How do I get a driveItemId from a sharepoint link?

Jake Ditslear 20 Reputation points
2023-10-26T14:40:11.93+00:00

I have a sharepoint link to an excel file and I would like to obtain the driveItemId or shareItem id to be used to Get a driveItem resource without granting a read all permission like "Sites.Read.All" or "Files.Read.All".

Example link: "https://goelate-my.sharepoint.com/:x:/r/personal/EMAIL_ADDRESS/_layouts/15/doc2.aspx?sourcedoc=%7SOURCE_DOC_ID%7D&file=FILENAME.xlsx&action=default&mobileredirect=true&DefaultItemOpen=1&ct=1698330559922&wdOrigin=OFFICECOM-WEB.START.EDGEWORTH&cid=e90b56ea-0e93-46f2-8e53-0236a8c736ec&wdPreviousSessionSrc=HarmonyWeb&wdPreviousSession=f8c76342-68d1-4efc-88e9-e51d3e1d6632"

How do you obtain the proper id to be used with the get driveItem resource without requiring excessive permissions?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,527 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,952 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.
3,123 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 36,651 Reputation points Microsoft Vendor
    2023-10-30T06:20:59.95+00:00

    Hi @Jake Ditslear,

    Per my research, the share link doesn't contain id of the driveitem. We are unable to get the item id only through the link. And I feel regretful to inform you that it turns out to be a by-design one.

    It is highly recommended that you can vote this ticket. Many features of our current products are designed and upgraded based on customers’ feedback. With requirements like this increase, the problem may well be released in the future. Thanks for your understanding.


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.