How to move a document to another folder in a SharePoint library using web services

I am desperately trying to move a document in a document library from one folder to another (yes, in the same library). All this needs to be done through web services.

I use the UpdateListItems method with batch XML as follows:

<Batch>
 <Method ID="1" Cmd="Update">
    <Field Name="ID">14</Field>
    <Field Name="ServerUrl">personal/blabla/Documents/CT-5/image.jpg</Field>
 </Method>
</Batch>

I tried updating various fields instead of ServerUrl above - no one was lucky ...

Thanks for any tips ...

+3
source share
3 answers

, , WebDAV. , - -, , ASP.NET. () :

WebRequest lRequest = WebRequest.Create(sourceUrl);
lRequest.Credentials = CredentialCache.DefaultCredentials;
lRequest.Method = "MOVE";

lRequest.Headers.Add("Destination", targetUrl);
var lResponse = lRequest.GetResponse();
+1

, -. - sharepoint.

2 -: copy - - . , "", .

+1

, -, . - OOB. , , . Copy WS .

If this is a show stopper, you can take a look at CopyMove for SharePoint . It also comes with a web service that allows you to copy or move documents, items and folders without losing any metadata.

+1
source

Source: https://habr.com/ru/post/1715599/


All Articles