Usage
m365 spo file sharinglink add
Description
Creates a new 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 |
--type <type> |
The type of sharing link to create. Either view, edit, or embed |
--expirationDateTime [expirationDateTime] |
The date and time to set the expiration. This should be defined as a valid ISO 8601 string |
--scope [scope] |
Optional. The scope of link to create. Either anonymous or organization. If not specified, the default of the organization will be used |
I'm not sure if we should use the option 'Password' using the Graph 1.0 API, as this doesn't really add value here. Same goes with the type 'Embed', as this also only works for OneDrive personal files
Examples
Creates a view-only anonymous sharing link of a file by id
m365 spo file sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --fileId daebb04b-a773-4baa-b1d1-3625418e3234 --type view --scope anonymous
Creates an edit organization sharing link of a file by url with a specific expiration date.
m365 spo file sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --shareId 123ABC --fileUrl /sites/demo/shared%20documents/document.docx --type edit --scope organization --expirationDateTime '2022-11-30T00:00:00Z'
Additional Info
The API call to create a sharing link can be found on the following documentation: https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0
Usage
m365 spo file sharinglink add
Description
Creates a new sharing link to a file
Options
-u, --webUrl <webUrl>--fileUrl [fileUrl]--fileId [fileId]--type <type>--expirationDateTime [expirationDateTime]--scope [scope]I'm not sure if we should use the option 'Password' using the Graph 1.0 API, as this doesn't really add value here. Same goes with the type 'Embed', as this also only works for OneDrive personal files
Examples
Creates a view-only anonymous sharing link of a file by id
Creates an edit organization sharing link of a file by url with a specific expiration date.
m365 spo file sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --shareId 123ABC --fileUrl /sites/demo/shared%20documents/document.docx --type edit --scope organization --expirationDateTime '2022-11-30T00:00:00Z'Additional Info
The API call to create a sharing link can be found on the following documentation: https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0