Update list properties using the call web service action


Badge +1

I am trying to update the properties using the UpdateList method of the lists.asmx webservice. As there are no  examples for the soap request on MSDN I like to know if anybody did this before and could provide an example. I know the guid of the list but I have no clue how the listProperties parameter should look like and which parametes are mandatory.

Any hints are appreciated.


15 replies

Userlevel 5
Badge +14

I played with it some time ago.

but I didn't bother with what's the exact definition of ListProperties attribute. I simply read in actual properties with GetList method, updated those properties that I needed and sent the full ListProperties set back to the list with UpdateList method.

Badge +1

I tried the same but received an error 500. Do you know if any of the other paramters like listVersion, deleteFields, updateFields and newFields are mandatory?

Userlevel 5
Badge +14

yes, you have provide at least empty XML node for each and every of the parameters, just like in the example on MSDN

Badge +1

Still no success. My soap request looks like this. Do you see any mistake? I tried it with and without method batch parts.



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <m:UpdateList>
      <m:listName>Projektideen</m:listName>
      <m:listProperties>
  <ListProperties
   DocTemplateUrl=""
   DefaultViewUrl="/test/poc/Lists/Projektideen/AllItems.aspx"
   MobileDefaultViewUrl="" ID="{CE9245B0-08BF-4F9A-A2E4-BD14A62594A4}"
   Title="Projektideen"
   Description=""
   ImageUrl="/_layouts/15/images/itgen.png?rev=23"
   Name="{CE9245B0-08BF-4F9A-A2E4-BD14A62594A4}"
   BaseType="0" FeatureId="00bfea71-de22-43b2-a848-c05709900100"
   ServerTemplate="100"
   Created="20180613 07:49:42"
   Modified="20180613 08:21:38"
   LastDeleted="20180613 07:49:42"
   Version="36"
   Direction="none"
   ThumbnailSize=""
   WebImageWidth=""
   WebImageHeight=""
   Flags="612372480"
   ItemCount="3"
   AnonymousPermMask="0"
   RootFolder="/test/poc/Lists/Projektideen"
   ReadSecurity="1"
   WriteSecurity="1"
   Author="1"
   EventSinkAssembly=""
   EventSinkClass=""
   EventSinkData=""
   EmailAlias=""
   WebFullUrl="/test/poc"
   WebId="eabf190b-7366-42a8-897d-64ad1e136702"
   SendToLocation=""
   ScopeId="e8fa6d7f-3a10-4d81-b726-bcdbaaa7d9db"
   MajorVersionLimit="0"
   MajorWithMinorVersionsLimit="0"
   WorkFlowId=""
   HasUniqueScopes="False"
   NoThrottleListOperations="False"
   HasRelatedLists=""
   Followable="False"
   AllowDeletion="True"
   AllowMultiResponses="False"
   EnableAttachments="True"
   EnableModeration="False"
   EnableVersioning="False"
   HasExternalDataSource="False"
   Hidden="False"
   MultipleDataList="False"
   Ordered="False"
   ShowUser="True"
   EnablePeopleSelector="False"
   EnableResourceSelector="False"
   EnableMinorVersion="False"
   RequireCheckout="False"
   ThrottleListOperations="False"
   ExcludeFromOfflineClient="False"
   CanOpenFileAsync="True"
   EnableFolderCreation="False"
   IrmEnabled="False"
   IsApplicationList="False"
   PreserveEmptyValues="False"
   StrictTypeCoercion="False"
   EnforceDataValidation="False"
   MaxItemsPerThrottledOperation="5000" />       
 </m:listProperties>
    <m:newFields>
  <NewFields>
   <Method ID="1">
    <ErrorCode>0x00000000</ErrorCode>
   </Method>
  </NewFields>
    </m:newFields>
        <m:updateFields>
   <UpdateFields>
    <Method ID="2">
     <ErrorCode>0x00000000</ErrorCode>
    </Method>
   </UpdateFields>
        </m:updateFields>
        <m:deleteFields>
   <DeleteFields>
    <Method ID="3">
     <ErrorCode>0x00000000</ErrorCode>
    </Method>
   </DeleteFields>
        </m:deleteFields>
        <m:listVersion>
   36
        </m:listVersion>
    </m:UpdateList>
</soap:Body>
</soap:Envelope>
 


                                
            
                        
Userlevel 5
Badge +14

why do you send some error codes in a request? 

as well some nodes doesn't meet specification.

you seem to mix request and response nodes together ....

try with following

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
     <soap:Header>
     </soap:Header>
     <soap:Body>
          <m:UpdateList>
               <m:listName>Projektideen</m:listName>
               <m:listProperties>
                    <List
                         DocTemplateUrl=""
                         DefaultViewUrl="/test/poc/Lists/Projektideen/AllItems.aspx"
                         MobileDefaultViewUrl="" ID="{CE9245B0-08BF-4F9A-A2E4-BD14A62594A4}"
                         Title="Projektideen"
                         Description=""
                         ImageUrl="/_layouts/15/images/itgen.png?rev=23"
                         Name="{CE9245B0-08BF-4F9A-A2E4-BD14A62594A4}"
                         BaseType="0" FeatureId="00bfea71-de22-43b2-a848-c05709900100"
                         ServerTemplate="100"
                         Created="20180613 07:49:42"
                         Modified="20180613 08:21:38"
                         LastDeleted="20180613 07:49:42"
                         Version="36"
                         Direction="none"
                         ThumbnailSize=""
                         WebImageWidth=""
                         WebImageHeight=""
                         Flags="612372480"
                         ItemCount="3"
                         AnonymousPermMask="0"
                         RootFolder="/test/poc/Lists/Projektideen"
                         ReadSecurity="1"
                         WriteSecurity="1"
                         Author="1"
                         EventSinkAssembly=""
                         EventSinkClass=""
                         EventSinkData=""
                         EmailAlias=""
                         WebFullUrl="/test/poc"
                         WebId="eabf190b-7366-42a8-897d-64ad1e136702"
                         SendToLocation=""
                         ScopeId="e8fa6d7f-3a10-4d81-b726-bcdbaaa7d9db"
                         MajorVersionLimit="0"
                         MajorWithMinorVersionsLimit="0"
                         WorkFlowId=""
                         HasUniqueScopes="False"
                         NoThrottleListOperations="False"
                         HasRelatedLists=""
                         Followable="False"
                         AllowDeletion="True"
                         AllowMultiResponses="False"
                         EnableAttachments="True"
                         EnableModeration="False"
                         EnableVersioning="False"
                         HasExternalDataSource="False"
                         Hidden="False"
                         MultipleDataList="False"
                         Ordered="False"
                         ShowUser="True"
                         EnablePeopleSelector="False"
                         EnableResourceSelector="False"
                         EnableMinorVersion="False"
                         RequireCheckout="False"
                         ThrottleListOperations="False"
                         ExcludeFromOfflineClient="False"
                         CanOpenFileAsync="True"
                         EnableFolderCreation="False"
                         IrmEnabled="False"
                         IsApplicationList="False"
                         PreserveEmptyValues="False"
                         StrictTypeCoercion="False"
                         EnforceDataValidation="False"
                    MaxItemsPerThrottledOperation="5000" />

               </m:listProperties>
               <m:Fields>
                    <Fields>
                    </Fields>
               </m:Fields>
               <m:listVersion>36</m:listVersion>
          </m:UpdateList>
     </soap:Body>
</soap:Envelope>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Badge +1

Thanks a lot. That helped. A bit tricky that you need to extract the version first after every update of the list. But easy to guess once you realize that it does not work a second time in the run now dialouge.

Userlevel 5
Badge +14

yeah, it's mentioned in documentation it's being checked to prevent conflicts.

Badge +1

Everything works like a charme if I update properties of a list which is created via Web GUI. But if I try to update a list which was created via workflow (either using the create list action or the addList method in a web service call) I was not able to update the properties.

I receive the following error message:

xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Specified method is not supported.</errorstring></detail></soap:Fault>  

I am using exactly the same procedure: get list properties, change properties, update list.

Any clue what could be the issue? 

Userlevel 5
Badge +14

I've no idea what could cause the difference.

could you post the requests that create list, query and update properties?

Badge

Hi, I am a colleague of Johannes. I realised the workflow works for lists (Server Template: 100), but not for libraries (Server Template: 101). All of our tests were done with libraries (e.g. the "AddList").

Somehow this fits the error we are getting. Can you confirm, the update list method actually does not work for libraries?

Aside from  the different Server Template I could not spot any obvious differences in the list properties and since we are pulling the actual properties and pushing the same properties with one little change in title, any differences in the properties should not be an issue. At least, that is what I assume.

Userlevel 5
Badge +14

hm, interesting.

I've never worked with libraries this way. But tried it now and can confirm I do get the same error. looks like UpdateList is not implemented/supported on doc libraries.

haven't you tried the same with REST API?

Lists and list items REST API reference 

Badge

I tried with REST API before and never got far. I just tried, with the code referenced by you. When I do I get an error message (the security Validation for this page is invalid...). I found a blog post regarding this error, but I don't know how to apply the SPUtility.ValidateFormDigest()-Call to the Nintex web request-function. Do you know how to handle this error?

I think I remember one version of the web request where I used some form of FormDigest oder RequestDigest. Is this the way to go?

What I did:

URL: Website-URL/_api/SP.APPContextSite(@target)/web/lists(guid'CF19CFC7-E7FF-4BD4-B137-A8F3F2EB2A73')?@target='Website-URL'

Userlevel 5
Badge +14

following worked for me

get request digest

217183_pastedImage_1.png

parse out digest out of response

217184_pastedImage_2.png

217185_pastedImage_3.png

update list

217186_pastedImage_4.png

‌ web service  

Badge

I got it working, after I added an xml Query-Action, to extract the Digest-Value from the RD Response XML.

Thanks a lot for your help :)

Userlevel 5
Badge +14

great!

please mark the correct answer.

Reply