0

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?

M.Ob
  • 1,785
  • 14
  • 27

2 Answers2

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: https://msdn.microsoft.com/en-us/library/jj675013(v=office.12).aspx Also look at these links depending upon your need: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spaccessrequests.changerequeststatus.aspx https://msdn.microsoft.com/en-us/library/jj674880(v=office.12).aspx

Davemundo
  • 849
  • 9
  • 14
0

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);
}

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.
Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193