SharePoint 2010 C# Client Object Model ListItem Status

I have a routine which update ListItems in using the Client Object Model which works fine and dandy.  However, the update causes the listitem's status to change to Pending which is no good for my purposes.

I have found a line that would work on server side code:

 oListItem.ModerationInformation.Status =

However,  there is no such access to this in CSOM.  Please advise.

Howard BashSenior Software EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
you would have to update the internal status field:
oListItem["_ModerationStatus"] = 0;

Open in new window

Howard BashSenior Software EngineerAuthor Commented:
I tried that. That fails for CSOM.
Rainer JeschorCommented:
you will have first to update all other properties, then execute the query, get the item and update the moderation status.

The following simple sample code works on my dev environment with Content Approval activated:
            ClientContext clientContext =
            new ClientContext("http://dev.rainerj.local/sites/ee");
            Web site = clientContext.Web;

            List list = site.Lists.GetByTitle("EESPCOMTest");
            ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
            ListItem listItem = list.AddItem(itemCreateInfo);
            listItem["Title"] = "First Test";
            listItem["JustANumber"] = 234;

            ListItem item2Update = list.GetItemById(1);
            item2Update["_ModerationStatus"] = 0;


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.