1

I am using CSOM to retrieve items from the "Access Requests" list.

(https://sharepointSite.sharepoint.com/sites/siteName/Access%20Requests/pendingreq.aspx)

I am trying to figure out all the possible values of the "Status" field.

I have found the following values (just from looking at the access requests page and comparing to the data retrieved from my code)

  • 0 = Pending
  • 2 = Accepted
  • 5 = Withdrawn

I have been unable to find any reference to these codes online. Can anyone point me to a reference for these values or let me know what you figured our on your own?

EDIT: This is for the status of invitations (in the access request list) - not the moderation status of people requesting access. When I "share" the site, the invitation ends up in the access requests list with the IsInvitation bit set to true. Please see image below where I point out the IsInvitation and Status fields. I am looking for the possible values/meanings for Status (not moderation status).

This image shows a status of 5 for an invite that has been withdrawn.

enter image description here

1

Statuses are stored in Approval Status field (Internal Name: _ModerationStatus) for the specified Access Requests list

How to retrieve values of _ModerationStatus field via CSOM

var listTitle = "Access Requests";
var fieldName = "_ModerationStatus";
var list = ctx.Web.Lists.GetByTitle(listTitle);
var field = list.Fields.GetByInternalNameOrTitle(fieldName);
ctx.Load(field);
ctx.ExecuteQuery();
var fieldChoice = ctx.CastTo<FieldChoice>(field);
var values = fieldChoice.Choices;
foreach (var value in values)
{
     Console.WriteLine(value);
}

Result

0;#Approved
1;#Rejected
2;#Pending
3;#Draft
4;#Scheduled

About Moderation Status field

According to 2.2.1.2.13 Moderation Status the following are all possible valid values for Moderation Status:

  • 0 - The list item is approved.
  • 1 - The list item has been denied approval.
  • 2 - The list item is pending approval.
  • 3 - The list item is in the draft or checked out state.
  • 4 - The list item is scheduled for automatic approval at a future date.
  • Thank you for the info. Please see my edits above, as I am looking for info on "status", not "moderation status". Thank you! – M.Ob May 4 '15 at 11:57
1

OK whilst "_ModerationStatus" values are 0..4 (where 0=Approved), this is not the same as the "Status" field of an Access Request, which has values I have obtained from the Microsoft.SharePoint.SPAccessRequestsUtility (public enum StatusToInt), as well as accessrequestsviewtemplate.debug.js file (located in 15 hive, Layouts folder):

  • 0=Pending (which could also trigger expired is an invitation)
  • 1=Approved
  • 2=Accepted
  • 3=Denied
  • 4=Expired
  • 5=Revoked

I obtained this from powershell hitting the field and obtaining the SchemaXml property, reverse-engineering code as well as this MS link

Also look at these links depending upon your need:

  1. article 1
  2. article 2

Copied here for someone also looking for this.

Reference for answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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