Skip to content

New command: m365 spo folder sharinglink add #5963

@MathijsVerbeeck

Description

@MathijsVerbeeck

Usage

m365 spo folder sharinglink add [options]

Description

Creates a new sharing link to a folder

Options

Option Description
-u, --webUrl <webUrl> The URL of the site where the file is located
--folderUrl [folderUrl] The server- or site-relative decoded URL of the folder. Specify either folderUrl or folderId but not both
--folderId [folderId] The unique ID (GUID) of the folder. Specify either folderUrl or folderId but not both
--type <type> The type of sharing link to create. Either view or edit
--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, organization or users. If not specified, the default of the organization will be used
--retainInheritedPermissions [retainInheritiedPermissions] Optional. If true, any existing inherited permissions are retained on the shared item when sharing this item for the first time. If false, all existing permissions are removed when sharing for the first time.
--recipients [recipients] Comma separated list of users with whom we wish to share the item with. Required when using scope users

Examples

Creates a view-only anonymous sharing link of a folder by id

m365 spo folder sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --folderId daebb04b-a773-4baa-b1d1-3625418e3234 --type view --scope anonymous

Creates an edit organization sharing link of a folder by url with a specific expiration date.

m365 spo folder sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --shareId 123ABC --folderUrl /sites/demo/shared%20documents/Folder --type edit --scope organization --expirationDateTime '2022-11-30T00:00:00Z'

Creates a user sharing link of a folder by id

m365 spo folder sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --folderId daebb04b-a773-4baa-b1d1-3625418e3234 --type view --scope users --recipients [email protected],[email protected]

Default properties

No response

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions