0

I'm trying to update the moderation status of a sharepoint file through rest API. The rest API will be called from java code.I'm trying to update it using a HTTP patch request for graph api.I'm using the below API

https://graph.microsoft.com/v1.0/sites/{site}/drives/{driveId}/items/{itenId}/listitem

and my payload is

{  
    "_ModerationStatus" : 0  
}

The status is getting updated but it reverts back to pending as a new version is created.

I have versioning turned on my document library. Is there any way to update the moderation status without it rolling back to pending.

**Note:**I need versioning on my library. So, the versioning setting cannot be turned off.

6
  • 1
    If an item is modified after it has been approved it's moderation status Should revert back, as it is no longer the version that was approved.
    – willman
    Feb 16, 2020 at 23:58
  • Is there any way to approve the file using the Graph API? Since we are only updating the moderation status, the revert back beats the purpose.
    – Hari
    Mar 26, 2020 at 5:45
  • The Graph API does not directly support Approving items yet, but your can try an old SP-server technique of sending OData__ModerationStatus instead of _ModerationStatus.
    – willman
    Mar 26, 2020 at 16:44
  • I tried sending OData__ModerationStatus : 0 in body, but that didn't work.It still gets reverted back to Pending. Am I doing something wrong here.
    – Hari
    Mar 27, 2020 at 15:14
  • Are you saving the item more than once? As previously mentioned, if you modify an item after it is approved, it should change back to pending.
    – willman
    Mar 27, 2020 at 15:30

1 Answer 1

0

The Graph API doesn't have an exact equivalent, but the SharePoint REST API specifically has an Approve method on the File object: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn450841(v%3doffice.15)#approve

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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