0

We have an outside document app (PCM) that has a nightly sync to our SharePoint server. All contracts in PCM are synced into SP then we change the PCM document to a link to SP. Recently, we have a need to copy certain files from our SP library to another library on the same site, then update the URL in PCM to point to the new location.

I am brand new to SP. I am writing this in C# using CSOM and CAML Query. My questions are:

  1. IF I have the URL of the document I want, how do I get a ListItem from SP using that URL?
  2. How do I deep copy that ListItem to a new library?

I've gone through several questions here that are "close" to what I am trying to do but this ListItem object is throwing me for a loop. I can't inspect it nor can I confirm that I have all the fields for the content type included.

Any (a lot?) of help is appreciated!

1 Answer 1

1

To get the listitem from URL:

 ListItem  item =  web.GetFileByServerRelativeUrl(fileRelativeUrl).ListItemAllFields;

And to copy item to another library follow:

http://sacarter.wordpress.com/2011/12/08/sync-files-sharepoint-files-across-web-applications-using-the-client-object-model/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.