OneDrive Business icon

OneDrive Business

Access OneDrive Business files and folders

File → Share

AI-generated

Summary

Create a sharing link for a file in OneDrive Business or SharePoint document library.

Inputs

  • fileId (required) — File item ID or path from drive root (e.g., '/Documents/file.pdf').
  • linkType — Type of link to create: view-only or edit. Default: view.
  • linkScope — Who can use the link: anonymous (anyone) or organization (only people in your tenant). Default: organization.
  • driveType — Whether to access a user's OneDrive or a SharePoint site's document library. Default: user.
  • userId (required) — User principal name or ID (e.g., user@contoso.com) when driveType is 'user'. Ignored otherwise.
  • siteId (required) — SharePoint site ID in the form 'contoso.sharepoint.com,site-id,web-id' when driveType is 'site'. Ignored otherwise.

Output shape

Array of objects, one per input item, each containing:

Each output item includes the Graph API response for the created link and a reference to the input item index.

Examples

Example 1: Share a file with view-only access for anyone in the organization.

driveType: user, userId: user@contoso.com, fileId: /Documents/report.pdf, linkType: view, linkScope: organization

Links

Discussion