문제

after check in a file using rest api , it having approval status as 'draft', do we have any rest api url (postman) to update approval status of a file in share point.

도움이 되었습니까?

해결책

HTTP POST:

https://<org>.sharepoint.com/sites/dev/_api/web/lists/getByTitle('list title')/items(<item id>)

Payload:

{
    "__metadata": {
        "type": "SP.Data.ClientsListItem" // your might be different
    },
    "OData__ModerationStatus": 0,
    "OData__ModerationComments": "Approved by <user name>"
}

To find out your list's type you can issue http get to https://<org>.sharepoint.com/sites/dev/_api/web/lists/getByTitle('<list title>')?$select=ListItemEntityTypeFullName. You should also provide x-requestdigest in http headers, since it's POST request.

or change moderation status with pnpjs library:

sp.web.lists.getByTitle('Clients').items.getById(1).update({
            'OData__ModerationStatus' : 0, // 1 - rejected
            'OData__ModerationComments': `Approved by <user name>`
}).then(data => {
    console.log(data);
});

다른 팁

As told by Sergei Sergeev. We can change approval status of a file using Rest.
1. post request header.
We need all these parameters in header. (if access token have fullControl as permission then we even don't need x-requestdigest in header)

Accept: application/json;odata=verbose
Authorization: Bearer <Your access token> 
Content-Type: application/json;odata=verbose
X-HTTP-Method: MERGE
If-Match: *

enter image description here


2. post request body enter image description here

As you can see i got response as 204 - that's success. so after post above post request check your share point site.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top