spo folder sharinglink add
Creates a new sharing link to a folder
Usage
m365 spo folder sharinglink add [options]
Options
-u, --webUrl <webUrl>
The URL of the site where the folder is located.
--folderUrl [folderUrl]
The server- or site-relative decoded URL of the folder. Specify either
folderUrl
orfolderId
but not both.--folderId [folderId]
The UniqueId (GUID) of the folder. Specify either
folderUrl
orfolderId
but not both.--type <type>
The type of sharing link to create. Either
view
oredit
.--expirationDateTime [expirationDateTime]
The date and time to set the expiration. This should be defined as a valid ISO 8601 string.
--scope [scope]
The scope of link to create. Either
anonymous
,organization
orusers
. If not specified, the default of the organization will be used.--retainInheritedPermissions [retainInheritedPermissions]
If
true
, any existing inherited permissions are retained on the shared item when sharing this item for the first time. Iffalse
, 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
.
-h, --help [help]
Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options
,examples
,remarks
,response
,full
. Default isoptions
.--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]
Output type.
json
,text
,csv
,md
,none
. Defaultjson
.--verbose
Runs command with verbose logging.
--debug
Runs command with debug logging.
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 --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 john@contoso.com,doe@contoso.com
Response
- JSON
- Text
- CSV
- Markdown
{
"id": "4fe11ccb-6c83-4927-8072-95642422b8ae",
"roles": [
"read"
],
"shareId": "u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE",
"hasPassword": false,
"link": {
"scope": "anonymous",
"type": "view",
"webUrl": "https://contoso.sharepoint.com/:f:/g/EvAQivzKWfhOvI8rb6mTTHcB3GZDQ6UaCup4HVxZbGnfFA",
"preventsDownload": false
}
}
hasPassword: false
id : 4fe11ccb-6c83-4927-8072-95642422b8ae
link : {"scope":"anonymous","type":"view","webUrl":"https://contoso.sharepoint.com/:f:/g/EvAQivzKWfhOvI8rb6mTTHcB3GZDQ6UaCup4HVxZbGnfFA","preventsDownload":false}
roles : ["read"]
shareId : u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE
id,shareId,hasPassword
4fe11ccb-6c83-4927-8072-95642422b8ae,u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE,
# spo folder sharinglink add --webUrl "https://contoso.sharepoint.com" --folderUrl "/shared documents/folder1" --type "view" --scope "anonymous"
Date: 29/04/2024
## 4fe11ccb-6c83-4927-8072-95642422b8ae
Property | Value
---------|-------
id | 4fe11ccb-6c83-4927-8072-95642422b8ae
shareId | u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE
hasPassword | false