Why does preview item API return 404?

captain_atharv 511 Reputation points
2023-02-16T08:27:52.9466667+00:00

Hi,

I'm using Graph Search API (https://learn.microsoft.com/en-us/graph/api/search-query?view=graph-rest-1.0) to search items in my sites. Then I'm using the id and siteId found in response of above API to preview the item using POST /sites/{siteId}/drive/items/{itemId}/preview API (https://learn.microsoft.com/en-us/graph/api/driveitem-preview?view=graph-rest-1.0)

This works for some items but for some items preview API returns 404 - itemNotFound.

I'm certain I'm copying the correct id and siteId from response of Search API, so why does the preview API return 404?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,646 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,682 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,675 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 37,216 Reputation points
    2023-02-17T08:56:53.61+00:00

    Hi @captain_atharv

    I can't reproduce your issue locally. Is there anything in common between the items where the error occurred? Or is the error just random?

    Since the issue is only specific to certain items, I recommend you raise a support case with Microsoft Graph, a Support Engineer will be able to assist you better. You can raise support ticket from:

    http://aad.portal.azure.com or https://admin.microsoft.com/#/support/requests.

    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.