Approving/Rejecting list items using SPServices

Sep 15, 2011 at 12:44 PM
Edited Sep 15, 2011 at 12:48 PM

Hi, 

I would like to approve single, multiple list items using SPServices.

I tried to use:

$().SPServices({       

operation: "UpdateListItems",   

async: false,

batchCmd: "Update",       

listName: "Project Resources",     

valuepairs: [["_ModerationStatus", "Approved"], ["Editor", ph.thisGetFullUserName()]],     

 ID: id,

but the item is not approved, it comes back as: ows__ModerationStatus="2" 

I tried different variations eg: [["_ModerationStatus", "0"] or without providing Editor but no luck.

Is it possible to do this at all?

Appreciate any suggestion

Regards

Michal

Sep 15, 2011 at 12:56 PM
Edited Sep 15, 2011 at 12:58 PM

Looks like the answer is to use 

 Cmd='Moderate' and ["_ModerationStatus", "0"] to approve

In case someone needs it

Cheers

Sep 1, 2012 at 4:43 AM
Edited Sep 3, 2012 at 1:31 AM

Thanks golka! I needed this tonight and you saved me some time...

For posterity, here's what the batch looks like:

 

		var updateModStatus = 	"<Batch OnError='Continue'>" + 
						"<Method ID='1' Cmd='Moderate'>" +
							"<Field Name='ID'>" + projectID + "</Field>" + 
						       	"<Field Name='_ModerationStatus'>0</Field>" +
						 "</Method>" +
					"</Batch>";

Cheers,
Matt