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
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
4,344 questions
Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,470 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,418 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 40,231 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.