Skip to main content

spo term set add

Adds taxonomy term set

Usage

m365 spo term set add [options]

Options

-n, --name <name>

Name of the term set to add.

-u, --webUrl [webUrl]

If specified, allows you to add a term set to the tenant term store as well as the sitecollection specific term store. Defaults to the tenant admin site.

--termGroupId [termGroupId]

ID of the term group in which to create the term set. Specify termGroupId or termGroupName but not both.

--termGroupName [termGroupName]

Name of the term group in which to create the term set. Specify termGroupId or termGroupName but not both.

-i, --id [id]

ID of the term set to add.

-d, --description [description]

Description of the term set to add.

--customProperties [customProperties]

JSON string with key-value pairs representing custom properties to set on the term set.

-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 is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

Escaping JSON in PowerShell

When using the --customProperties option it's possible to enter a JSON string. In PowerShell 5 to 7.2 specific escaping rules apply due to an issue. Remember that you can also use file tokens instead.

info

To use this command without the --webUrl option you have to have permissions to access the tenant admin site.

When using the --webUrl option you can connect to the term store with limited permissions, and do not need the SharePoint Administrator role. You need to be a site visitor or more. It allows you to add a term set to a term group in the tenant term store if you are listed as a term store administrator. It allows you to add a term set to a term group in the sitecollection term store if you are a site owner.

Examples

Add taxonomy term set to the term group specified by ID.

m365 spo term set add --name PnP-Organizations --termGroupId 0e8f395e-ff58-4d45-9ff7-e331ab728beb

Add taxonomy term set to the specified sitecollection's term group specified by ID.

m365 spo term set add --name PnP-Organizations --termGroupId 0e8f395e-ff58-4d45-9ff7-e331ab728beb --webUrl https://contoso.sharepoint.com/sites/project-x

Add taxonomy term set to the term group specified by name. Create the term set with the specified ID.

m365 spo term set add --name PnP-Organizations --termGroupName PnPTermSets --id aa70ede6-83d1-466d-8d95-30d29e9bbd7c

Add taxonomy term set and set its description.

m365 spo term set add --name PnP-Organizations --termGroupId 0e8f395e-ff58-4d45-9ff7-e331ab728beb --description 'Contains a list of organizations'

Add taxonomy term set and set its custom properties.

m365 spo term set add --name PnP-Organizations --termGroupId 0e8f395e-ff58-4d45-9ff7-e331ab728beb --customProperties '{"Property":"Value"}'

Response

Standard response

{
"CreatedDate": "2023-05-14T10:28:31.041Z",
"Id": "c28cfcd2-0705-4b7b-b8e6-ba2fb107e5ec",
"LastModifiedDate": "2023-05-14T10:28:31.041Z",
"Name": "PnP-Organizations",
"CustomProperties": {},
"CustomSortOrder": null,
"IsAvailableForTagging": true,
"Owner": "i:0#.f|membership|john.doe@contoso.com",
"Contact": "",
"Description": "",
"IsOpenForTermCreation": false,
"Names": {
"1033": "PnP-Organizations"
},
"Stakeholders": []
}
CTRL + M