royjs

Hi,

I'm adding some items to a list using the updatelistitems method of the Lists webservice. It works fine except that the new items approval status is 'Pending'. How can add the items with an 'Approved' status Simply setting the _ModerationStatus field to 0 doesn't seem to work...

Thanks,



Re: SharePoint - Development and Programming Approve from web service

Curtis Ruppe (MicroStaff IT)

The following link shows something similar that worked in the previous version, but should still be relatively the same in the current version:

http://www.dotnetjunkies.com/WebLog/wicwil/archive/2005/08/04/131732.aspx





Re: SharePoint - Development and Programming Approve from web service

royjs

I already found a few examples like that, but none worked.

Maybe it doesn't work in MOSS 2007, or maybe it's because I'm not translating correctly from the processbatchdata syntax to the updatelistitems syntax as they are slightly different.

Here is the batch command I have :

< xml version="1.0" encoding="UTF-8" >

<Batch OnError="Continue">

<Method ID="1" Cmd="Update">

<Field Name="ID">3634</Field>

<Field Name="FileRef">3634;#Lists/Fichesroyjs/3634_.000</Field>

<Field Name="_ModerationStatus">0</Field>

</Method>

</Batch>

I also tried creating a new item instead of of updating it and I tried without the FileRef since I'm not in a document library but in a list but nothing worked... Any other ideas





Re: SharePoint - Development and Programming Approve from web service

Curtis Ruppe (MicroStaff IT)

Maybe use _ModerationStatus with 0;#Approved instead of just 0 What is the XML result



Re: SharePoint - Development and Programming Approve from web service

royjs

Thanks for the prompt answer.

If I use 0;#Approved, the XML result returns an error : <ErrorCode>0x80020005</ErrorCode>

When I use 0, the errorcode is 0 but I still have ows__ModerationStatus="2" in the z:row element of the XML results.

If I update some other fields(e.g _ModerationComments), they are updated in the XML result and in the list.





Re: SharePoint - Development and Programming Approve from web service

Curtis Ruppe (MicroStaff IT)

Your web service call is using credentials that have the authority to approve items, right



Re: SharePoint - Development and Programming Approve from web service

royjs

Yeah, I also tried with a NetworkCredential and I had the same results.

And if I use the credentials of a user who doesn't have enough authority, the xml results returns an error.





Re: SharePoint - Development and Programming Approve from web service

Curtis Ruppe (MicroStaff IT)

Try updating your CAML Web service call to use Type="ModStat" for your _ModerationStatus field.



Re: SharePoint - Development and Programming Approve from web service

royjs

Unfortunatly it still doesn't work. The XML result doesn't show any error but the ModerationStatus won't change...



Re: SharePoint - Development and Programming Approve from web service

Curtis Ruppe (MicroStaff IT)

Try that with the 0;#Approved input.



Re: SharePoint - Development and Programming Approve from web service

royjs

Oh, sorry my last post wasn't very informative.

I tried with <Field Name="_ModerationStatus" Type="ModStat">0;#Approved</Field> and I still received <ErrorCode>0x80020005</ErrorCode>.

I also tried 0;#Approuve since my sharepoint installation is in french but nothing works...





Re: SharePoint - Development and Programming Approve from web service

Galois E

I've got the same problem, did you solve the problem





Re: SharePoint - Development and Programming Approve from web service

Adam Andersson

Hi!

Don't know if this may help you but when adding/modifying an list item programmatically and setting the _ModerationStatus to 0 the status is then set to "Approved" insted of "Pending".

// adam






Re: SharePoint - Development and Programming Approve from web service

Galois E

It seems that setting list item property _ModerationStatus works in SharePoint 2003, but not in SharePoint 2007





Re: SharePoint - Development and Programming Approve from web service

Seb0482

Hi,

Have you solved your problem now I have the same problem since a few days and can't find a solution...

Thanks