How to delete column from SP List

May 31, 2011 at 9:31 AM

Just wondering how i can delete a column from the SP List using SP Services.basically to make use of the updatelist webservice

 <deleteFields>
        <xsd:schema>schema</xsd:schema>xml</deleteFields>

May 31, 2011 at 9:45 AM

Keeping in mind the permissions needed to delete a column you have to use the Method and batch options to do this. There is a good example of the syntax here.

May 31, 2011 at 9:53 AM

Thanks for this, how can i make use of this web service using spservices?

May 31, 2011 at 10:02 AM

$().SPServices({$()

$().SPServices({
operation: "UpdateList",
		listName: listname,
		listProperties: properties,
		newFields: fieldsToAdd,
		updateFields: fieldsToUpdate,
		deleteFields: fieldsToDelete,
		async: false,
		completefunc: function(xData, Status){
			//Your stuff here
		}
});

just put your detele XML in the deleteFields, , not forgetting the <Fields></Fields> around the code.

You might want to put "" in the unused properties or not putting them.

I usually put them anyway so I remember what is possible to do later, but it's up to you.

 

Hope it helped

 

 

May 31, 2011 at 10:09 AM
var dfields="<Fields><Method ID='1'><Field Name='deletefield' /></Method></Fields>";

$().SPServices({
     operation: "UpdateList",
     listName: listtoupdate,
     deleteFields: dfields,
     completefunc: function(xData, Status) {
          alert(xData.responseText);
     }
});

This should get you going I hope!

May 31, 2011 at 11:17 AM

Get got it Thanks  a lot to both of you. :)