How to set/open document into readOlny/Protected view from graph API.(One drive)

prithavi 21 Reputation points
2022-09-27T07:33:20.837+00:00

I am working on Word , Excel and PowerPoint add-ins . I want to upload document from graphs API .Below are API PUT https://graph.microsoft.com/v1.0/users/**myuser[@](/users/na/?userId=19d591f5-0000-0003-0000-000000000000).subdomain.com**/drive/items/root:/filename.docx:/content and it is working fine from Postman .

But I want to open this document as protected view or read only view . Any graph API available for change document as protected view ?.

Microsoft 365 and Office | Development | Other
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Shivam Dhiman 6,081 Reputation points
    2022-09-28T21:39:14.627+00:00

    Hi @prithavi

    If you are only looking to open the documents in read only mode you can use Preview Graph API . This POST /users/{userId}/drive/items/{itemId}/preview Graph API which returns "getUrl" in response that you can use to Preview(read) that file.

    To Protect an excel file(making it read only) using Graph API, you can use WorksheetProtection Graph API.

    As per my knowledge this Protect feature is not yet available for other files using Graph API. Since this feature/functionality is presently not available, you can submit a feature request idea using this support link, which will be monitored by Microsoft team and make the enhancements to Microsoft Graph APIs. I will also upvote for you.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.