Attempting to preview a file in my React app using the endpoint: POST /drives/{driveId}/items/{itemId}/preview

Aakash 0 Reputation points
2023-05-31T09:40:08.8133333+00:00

I am trying to hit this endpoint->POST /drives/{driveId}/items/{itemId}/preview but getting the below error: User's image

I am attempting to preview the file within my React app. I consulted a Microsoft document for guidance, but it lacks clarification on the specific Office 365 Business license required. Currently, I have a subscription for 'Microsoft 365 Business Basic'. Any assistance or insights would be greatly appreciated. Thank you.

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,376 Reputation points
    2023-06-01T02:25:14.7566667+00:00

    Hi @Aakash

    Have you granted the appropriate graph API permissions to your application?

    User's image

    Do a quick test:

    Use your user to log in to Graph Explorer and consent to the permissions in "Modify permissions", then call the API.

    2

    Hope this helps.

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


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.