Skip to content

New command: m365 spo file sharinglink set #4026

@MathijsVerbeeck

Description

@MathijsVerbeeck

Usage

m365 spo file sharinglink set

Description

Updates a specific sharing link to a file

Options

Option Description
-u, --webUrl <webUrl> The URL of the site where the file is located.
--fileUrl [fileUrl] The server-relative URL of the file. Specify either fileUrl or fileId but not both.
--fileId [fileId] The UniqueId (GUID) of the file. Specify either fileUrl or fileId but not both.
--id <id> The ID of the sharing link.
--role [role] Role to set. Possible options are: read or write.
--expirationDateTime [expirationDateTime] The date and time to set the expiration. This should be defined as a valid ISO 8601 string.

Examples

Updates the expiration datetime of an anonymous sharing link with a specific id.

m365 spo file sharinglink set --webUrl https://contoso.sharepoint.com/sites/demo --fileId daebb04b-a773-4baa-b1d1-3625418e3234 --id 1 --expirationDateTime '2022-11-30T00:00:00Z'

Updates the roles of a sharing link.

m365 spo file sharinglink set --webUrl https://contoso.sharepoint.com/sites/demo --fileUrl /sites/demo/shared%20documents/document.docx --id 1 --role read

Additional Info

The API call to set a sharing link can be found on the following documentation: https://learn.microsoft.com/en-us/graph/api/permission-update?view=graph-rest-beta&tabs=http

Currently, using the Graph 1.0 API, it is not possible to modify sharing links of type 'Organizational'.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions