Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The SharePoint Object Model provides a property of an SPListItem called SPListItem.ModerationInformation.Status to allow you to determine the current content approval / moderation status if a document library has content approval enabled. The property ModerationInformation is an instance of the class SPModerationInformation and Status is an instance of the enum SPModerationStatusType.

How can I work with these objects / properties from the Client Side Object Model? The client side ListItem does not contain the ModerationInformation property like its server-side counter part.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Even though the CSOM ListItem class does not have a ModerationInformation property, I was able to access this value through the field's internal name:

ListItem item = file.Item;
clientContext.Load(item);
clientContext.ExecuteQuery();

int status = Convert.ToInt32(item["_ModerationStatus"]);

And the enum is defined as:

public enum SPModerationStatusType
{
    Approved, //0
    Denied,   //1
    Pending,  //2
    Draft,    //3
    Scheduled //4
 }

This got me where I needed to be.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.