Web Service Update List List Fails with "Attempting to use an object that ceases to exist"

On the SharePoint 2010 lists of web service update lists, you cannot complete the "Attempt to use an object that ceases to exist" ... but it exists.

I would like to update the attribute for existing fields. For demonstration purposes, it should be easy to update the description. Using and extending haufe.sharepoint 0.1.9, I can request / update items and delete fields. I am sure that I am referring to the list correctly, observing the changes during the update and deletion. I believe that the field is also precisely addressed, because: a) it can be deleted and b) if I change the "Name" or "Identifier", the error will change to "A field with this name was not found."

By dropping a SOAP message from SUDS, I can show different messages and results. Below are three test cases. The first is failure. The second shows a name mismatch resulting in another error. The third shows how to delete a field by name.

Any ideas on where to go next? Could there be special permission to update the field, besides the ability to delete the same field? Although I own a subsite, I am not a SharePoint administrator or administrator. Thus, finding logs or installing custom code is difficult / absent. This is why I use the Python web service approach. I'm almost completely dumb.

Thanks Rob

Message This should work to update the Description field, but it is not. Besides using the field identifier, Ive tried the name, displayName and StaticName to no avail. MSFT Link: http://msdn.microsoft.com/en-us/library/lists.lists.updatelist%28v=office.12%29.aspx

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:updateFields> <Fields> <Method ID="1"> <Field ID="08d8fb05-0de8-4e19-988c-e204ade07f47" Description="new desc"/> </Method> </Fields> </ns1:updateFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

The error is :

 <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring> <detail> <errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))</errorstring> <errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x80030102</errorcode> </detail> </soap:Fault> 

Message Expect not to find a field and not be. Basically, this proves that the wrong name leads to another error.

 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:updateFields> <Fields> <Method ID="1"> <Field ID="q08d8fb05-0de8-4e19-988c-e204ade07f47" Description="new desc"/> </Method> </Fields> </ns1:updateFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

Message : the ability to delete a field like this. It just proves that the field can be successfully processed.

 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:deleteFields> <Fields> <Method ID="3"> <Field Name="myText"/> </Method> </Fields> </ns1:deleteFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 
+4
source share
1 answer

It works

Progress to update and add fields! "Fragile" comes to mind as a way to describe the Lists.asmx web service. It is noteworthy that the attributes of the field depend on the order; The type should be the first - suppose maybe there is a stupid "if-tree" in the Microsoft code. In addition, a DisplayName is required, followed by a name, if there can be ambiguity using only DisplayName.

The debug key models a software-added field after a similar field with a graphical interface. To find the correct options:

  • Create a similar field via the GUI
  • Set suds logging for debug level.
  • Open the list with haufe.sharepoint "service = Connector (url, username, password, list_id)" and view the returned SOAP message for the field parameters.
  • Use these attributes to control the experiment, bearing in mind that some fields are read-only or otherwise not intended for external use, as defined by Microsoft.

Below are four success examples for updating a text field, updating a calculated formula field, adding a text field, and adding a calculated field. I hope this is enough for me and for others. Note: haufe.sharepoint does not support these additional methods or returns results. So ... some kind of hack is required.

Refresh text box

Type must be the first attribute. Use DisplayName and then Name to avoid ambiguity with other fields.

 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:updateFields> <Fields> <Method ID="1"> <Field Type="Text" Name="myText" DisplayName="myText" Description="new desc"/> </Method> </Fields> </ns1:updateFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

Update calculated field

Type must be the first attribute. Use DisplayName first and then Name to avoid ambiguity with other fields.

 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:updateFields> <Fields> <Method ID="1"> <Field Type="Calculated" DisplayName="myCalcAdd" Name="myCalcAdd" ResultType="Number" ReadOnly="TRUE"> <Formula>=Jan*0.5</Formula> <FormulaDisplayNames>=Jan*0.5</FormulaDisplayNames> <FieldRefs> <FieldRef Name="Jan"/> </FieldRefs> </Field> </Method> </Fields> </ns1:updateFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

Add text box

Type must be first. DisplayName vs Name seems to be the more important of the two attributes.

 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:newFields> <Fields> <Method ID="1"> <Field Type="Text" Name="myTextAdd" DisplayName="myTextAdd" Description="My first added field"/> </Method> </Fields> </ns1:newFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 

Add calc field

Type must be first. DisplayName is required, but Name is not. ResultType is also required, at least in the case below.

 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns1:UpdateList> <ns1:listName>D538A29D-6DD4-423A-9E7D-2697917BDA78</ns1:listName> <ns1:newFields> <Fields> <Method ID="1" AddToView=""> <Field Type="Calculated" DisplayName="myCalcAdd" ResultType="Number"> <Formula>=Jan*0.5</Formula> <FormulaDisplayNames>=Jan*0.5</FormulaDisplayNames> <FieldRefs> <FieldRef Name="Jan"/> </FieldRefs> </Field> </Method> </Fields> </ns1:newFields> </ns1:UpdateList> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 
+2
source

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


All Articles