Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

spweb.processbatchdata fails to update list items that are in pending status.

$
0
0

I am trying to use spweb.processbatchdata to update items in list on which versioning is enabled. Below is the string I have that I am passing to processbatchdata method:

<?xml version="1.0" encoding="UTF-8"?>
<ows:Batch OnError="Return">
            <Method ID="A2">
            <SetList Scope="Request">3ed85666-0369-4f69-af68-2a4b95776e2b</SetList>
            <SetVar Name="Cmd">Moderate</SetVar>
            <SetVar Name="ID">14</SetVar>
            <SetVar Name="urn:schemas-microsoft-com:office:office#My_Field_Name">MyFieldValue</SetVar>
            <SetVar Name="urn:schemas-microsoft-com:office:office#_ModerationStatus">0</SetVar>
            </Method>
</ows:Batch>

If I use this piece of code against an item that is in approved status, the target field's value in that item is updated and item is then approved. If I use it against an item that is in pending status, I get the below error:

<Results><Result ID="A2" Code="-2147467259">
<ErrorText>Cannot complete this action.

Please try again.</ErrorText></Result>
</Results>

Its the same error even if simply use Save instead of Moderate and get rid of <setvar> line with _ModerationStatus, meaning I am just trying to update an already pending item. Any suggestions?


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>