Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rename a file using the SharePoint web services?

I have a custom definition for a document library and I am trying to rename documents within the library using only the out of the box web services. Having defined a view with the "Name" field supplied and trying the "LinkFilename", my calls to rename a file are respectively returning a failure or ignoring the new value.

How do I rename a file using the SharePoint web services?

like image 619
Nat Avatar asked Dec 23 '22 10:12

Nat


1 Answers

Use the Lists.UpdateListItems web method. The XML request should look like:

<Batch OnError="Continue" PreCalc="TRUE" ListVersion="0">
   <Method ID="1" Cmd="Update">

      <!-- List item ID of document -->
      <Field Name="ID">2</Field>

      <!-- Full URL to document -->
      <Field Name="FileRef">http://Server/FullUrl/File.doc</Field>

      <!-- New filename -->
      <Field Name="BaseName">NewName</Field>

   </Method>
</Batch>
like image 130
Alex Angas Avatar answered Jan 13 '23 07:01

Alex Angas