Powershell Query _ModerationStatus for Sharepoint List

New Contributor

Hello,  new to SP

 

Using powershell to pull list and would like to get moderation status from list of items, so I can do some work on that item if its in a non-approved state. Using SP Online

 

$orgName="myorganization"
$UserCredential = Get-Credential -Credential myname@myorganization.com

Connect-PnPOnline -url https://$orgName-admin.sharepoint.com -Credential $userCredential

$mysiteurl="https://myorganization.sharepoint.com/sites/targetSiteApproval"
$listname="TeamsApprovalsList"

 

get-pnplist -Identity $listname

Get-PnPField -list 'Target Approvals List'

Get-PnPListItem -list 1234-4567-8919-4567 # my guid for the site

 

I dont see where I can get to the moderation status, I just get ID, Title and GUID.

 

I would assume some sort of get-pnplistitem -list guide -item 30 -field "_ModerationStatus"

but I dont see it, what am I missing?

 

I am assuming when I get to moderationstatus it will be a numeric value 0-4, but I cant seem to pull it out of the list.

 

 

 

 

 

 

1 Reply

@justjeff 

 

For SharePoint Online, the field you are looking for is 'OData__ModerationStatus'.  I'm not sure why they changed the name, but they did.  Important Note: that is a "double underscore" between the words.  And yes, it returns a number, where 0 means 'Approved'.