File Sharing Problems

Set a OneDrive for Business Share Link Expiration Time

Jason MillerJason Miller Nov 13, 2026 869 views

Question details

The user wants to set an exact expiration time and time zone for a OneDrive for Business sharing link.

Set a OneDrive for Business Share Link Expiration Time
Product
Microsoft OneDrive for Business and Microsoft Graph
Device & OS
not provided
Scenario
Create a sharing link that expires at a specific time rather than selecting only an expiration date in OneDrive.
Observed behavior
The OneDrive interface may offer an expiration date without a precise time or time zone; Microsoft Graph can specify an expiration timestamp in UTC.
Before you start

Sign in to Microsoft Graph Explorer with an account that can share the target file, and confirm that your organization permits the intended link type. Choose a future expiration time in UTC and check any organizational expiration limits.

Solution 1Recommended

Create a sharing link with an exact UTC expiration using Microsoft Graph

Use Graph Explorer when you need to specify the expiration timestamp rather than just a date.

The example creates an anonymous edit link. Anonymous links and their maximum lifetimes are subject to your organization's sharing policies.

1
Sign in to Graph Explorer

Open https://developer.microsoft.com/en-us/graph/graph-explorer and select Sign in with Microsoft. Use the account that has access to the OneDrive for Business file.

2
Find the drive and item IDs

In Graph Explorer, send a GET request to /v1.0/me/drive/root:/path/to/your/file, replacing the path with the file's path. In the response, note the item id and parentReference.driveId.

3
Configure the request

Select POST and enter https://graph.microsoft.com/v1.0/drives/{driveId}/items/{itemId}/createLink, replacing the placeholders with the IDs. Under Request headers, set Content-Type to application/json.

4
Set the expiration timestamp

In Request body, enter {"type":"edit","expirationDateTime":"2030-07-07T02:40:10Z","scope":"anonymous"}. Replace the example timestamp with your desired future UTC time; the Z suffix denotes UTC.

5
Create and inspect the link

Select Run query and grant the requested Microsoft Graph permissions if prompted. Check the response for the link's webUrl and expirationDateTime before sharing the URL.

Create a sharing link with an exact UTC expiration using Microsoft Graph
Check the returned link: Microsoft Graph can return an existing link of the requested type instead of creating a new one. Verify its returned expiration rather than assuming the request changed it. If the request is blocked, check permissions and your organization's sharing policies.
Free Microsoft Office alternative

Work with shared Office files in WPS Office

WPS Office is a free, lightweight alternative for opening and editing Office files with a familiar interface, making it easy to move your document work between suites. It does not change OneDrive for Business link expiration settings.

Open and edit documents received through sharing links after downloading themCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXUse familiar document, spreadsheet, and presentation toolsMove existing Office files into a lightweight, easy-to-use suite
microsoft office alternative - wps office

Frequently Asked Questions

What time zone does the Graph expiration timestamp use?

Use a UTC timestamp ending in Z, such as 2030-07-07T02:40:10Z, in the createLink request's expirationDateTime field. Convert your local time to UTC before submitting the request.

Can I create a view-only link instead of an edit link?

Yes. In the createLink request body, change "type":"edit" to "type":"view". Keep the expirationDateTime and choose a scope allowed by your organization.

Why was my anonymous sharing link request rejected?

Your organization may disable anonymous sharing or limit link lifetimes. Check with your Microsoft 365 administrator and confirm that Graph Explorer has the permissions needed to access and share the file.

Will createLink always update an existing link's expiration?

No. The endpoint can return an existing link of the requested type. Inspect the response's expirationDateTime and webUrl to confirm which link was returned and when it expires.