Mar 042016
 
Share

I have been having problems sending a delete request via the lists.asmx web service in SharePoint.
My Delete XML packet looks like this:

<Batch OnError="Continue" PreCalc="TRUE" ListVersion="0">
<Method ID="1" Cmd="Delete">
<Field Name="ID"></Field>
</Method>
</Batch>

Using the steps found here (http://jaliyaudagedara.blogspot.com/2011/03/submitting-data-to-sharepoint-2010-list.html) I setup a Delete List Item data connection.

When trying to delete an item from a list (not document library) I was seeing the following error in the
ULS logs:

The form definition (.xsf) file has an invalid mapping from the document to the submit web service

After a little digging it appears the web service call wants the list item ID to be an integer.
After exporting my template files, I edited the schema definition file (.XSD) for the Delete function.
At the bottom of this file you will find:

	<xsd:attribute name="PreCalc" type="xsd:string"></xsd:attribute>
	<xsd:attribute name="Cmd" type="xsd:string"></xsd:attribute>
	<xsd:attribute name="ListVersion" type="xsd:string"></xsd:attribute>
	<xsd:attribute name="OnError" type="xsd:string"></xsd:attribute>
	<xsd:attribute name="ID" type="xsd:string"></xsd:attribute>
	<xsd:attribute name="Name" type="xsd:string"></xsd:attribute>

Simply change:

	<xsd:attribute name="ID" type="xsd:string"></xsd:attribute>

to

	<xsd:attribute name="ID" type="xsd:integer"></xsd:attribute>

and my delete function works!