Coping files in sharepoint lists


Badge +2

Hello everyone, I'm new here and I need help from k2 blackpoint users. I just wanted to know two things:

1. In sharepoint I've got 'Document Library' list and there I've got some files. I wanted to find file by name so I used Sharepoint Search from Event Wizard but it didn't work (my sharepoint is configured I guess).

2. The second thing that I want to do is copy file from one list to another. I tried Sharepoint Documents but I didn't work either.

 

I would be very greatfull if someone could help me with this two problems. It's probably easy to do but I'm just starting with blackpoint.

 Thanks alot!


13 replies

Badge +11

Could you be more specific?  What didn't work?  Did you get an error message?


You are on the right track.  You would use these two events to select one or more files and then copy them someplace else.  It may just be a configuration issue.  With more details we could help point you in the right direction.

Badge +2

On start I set "When item is created" first. I have sharepoint list which holds *.docx files. List has column called 'Title'. So from Event Wizard I drag Sharepoint Search and point it to that list. I set up sharepoint site, sharepoint list and in value I wrote the name of file. After Sharepoint Search I drag and drop Mail Event so I could check if workflow is complete. I deployed my workflow to list. Next I go to the sharepoint and create new file, workflow started (status is in progress after that it change to complete) but mail wasn't send I got no errors. I tried make file with normal user or administrator in both cases mail wasn't send.

 

With second issue I've two list called SourceList and DestinationList so I drag and drop Sharepoint Documents, set up Source List to my list in sharepoint, write the file name and in next step I set up copy to DestinationList. I set the mail event also to check the result, deployed and... unfotunelly like in previous, it doesn't work. Workflow is in SourceList, when I add new item it says that workflow is in progress, it completes but I don't have mail and file isn't copied to destination list.

 

Thanks for help.

Badge +11
Make sure the user adding documents to the list has start rights on the process.
Badge +2

Yes, user has rights to start the process. But still it doesn't find or copy the file.


I'll post the screen shot how I'm doing it.

 

Ok I copied file from one list to another but I still can't find file on list. I also have another problem. I want to rename file on my list (it's test.xml file) but I don't know how to do it. I've read somewhere that I should use smartobjects but I don't know how. I would be very gratefull if anyone could help me.

 Thanks.

 

edit:

I've found on forum that I can't rename file, I've to download it and upload again. However I want to change other properties in my file. My problem is:

I'm creating one word file in list. Then workflow starts and it copys infopath file from one list to another and now my problem starts. I want to get name of word file and some other properties. Should I use smart objects? I don't know how to get it. That would solve my problem :) Sorry for changing my mind I'm used to making workflows in visual studio and it's quite different ;)

Thanks.

Badge +2

Hello, that's me again. I managed how to download and upload new file, however I download it on my hard disc which isnt good solution. My question is: Can I download file ( word document document.xml) to K2 field (to K2 field)?

 sorry for double posting but if I didn't do this post wouldn't be visible as new post.

Badge +2
I did it. If someone has a problem with it I can write how to do it.
Badge +2

The Standard SharePoint workflow would allow you to do it ..


 


Try using SharePoint designer to do the file rename . 


 


Good Luck,


-George Gergues


-SharePoint Architect

Badge +3

Hi Yeti, 


I am having a similar problem with K2 where I am trying to change the file name of several files in a folder.  Actually all I want to do is append a unique number to the end of the file name but can't seem to find the metadata field for the file name.  Any help on this would be great.


 


Thanks,


Mark

Badge +8

I too am looking for instructions on how to rename a document in a document library. Anyone?

Badge +10

I just tried to do this on my VM and could not do it either. It does not appear that there is a way to change the actual file name through the wizards.  Has anyone else out there done this through something custom or creative?


 


 

Badge +10

I'm not aware of a way of doing it either using OOTB features.  I ended up doing it using a CAML query which I packaged in a Service Object available at:  http://www.k2underground.com/groups/caprivi_caml_service_object/default.aspx


For blackpoint users though since I don't believe the licensing allows you to add a custom Service Objects I think you'd need to create a web service with custom code (can use the code from the project if you like) and call that using the Code Reference Event within the process.


Here is some sample code of how the CAML Query to rename a file is done.


        private void RenameFile(string SharePointSiteURL, string listName, string DocID,string NewFileName)
        {
            wsSharePoint.Lists listsWS = new wsSharePoint.Lists();
            //Reference the Lists asmx for that SharePoint Site
            listsWS.Url = SharePointSiteURL + "/_vti_bin/lists.asmx";
            //Use the credentials of the user context initiating the application.
            listsWS.UseDefaultCredentials = true;




            string xmlCommand = "<Method ID='1' Cmd='Update'>" +
              "<Field Name='ID'>" + DocID + "</Field><Field Name='FileRef'></Field>" +
       "<Field Name='BaseName'>" + NewFileName + "</Field></Method>";
           
            XmlDocument doc = new XmlDocument();
            System.Xml.XmlElement batchNode = doc.CreateElement("Batch");


            batchNode.InnerXml = xmlCommand;
            XmlNode resultNode = listsWS.UpdateListItems(listName, batchNode);


        }



Badge +8

Tim,


I downloaded your Service Object and compiled and uploaded to my dev server. Can you give me a little guidance on what settings are needed for a service instance and then how to give it the above CAML?


Thanks,


Doug

Badge +10

Hi Doug


I've been meaning to put something together for awhile now.  I whipped up a brief document that should allow you to get the service instance configured and points to some third party tools that help in actually designing CAML queries that you can then use with this service object.  Note for the File Rename you don't have to know any special CAML queries but just need to specify the ID of the file and the new file name.


http://www.k2underground.com/groups/caprivi_caml_service_object/media/p/43037.aspx


I hope this helps.


Tim

Reply