Skip to main content

spo term add

Adds taxonomy term

Usage

m365 spo term add [options]

Options

-n, --name <name>

Name of the term to add

-u, --webUrl [webUrl]

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

--termSetId [termSetId]

ID of the term set in which to create the term. Specify termSetId or termSetName but not both

--termSetName [termSetName]

Name of the term set in which to create the term. Specify termSetId or termSetName but not both

--termGroupId [termGroupId]

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

--termGroupName [termGroupName]

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

-i, --id [id]

ID of the term to add

-d, --description [description]

Description of the term to add

--parentTermId [parentTermId]

ID of the term below which the term should be added

--customProperties [customProperties]

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

--localCustomProperties [localCustomProperties]

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

-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 and/or --localCustomProperties options 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. It allows you to add a term to a term set in the tenant term store if you are listed as a term store administrator. It allows you to add terms to a term set in the sitecollection term store if you are a site owner.

Examples

Add taxonomy term with the specified name to the term group and term set specified by their names.

m365 spo term add --name IT --termSetName Department --termGroupName People

Add taxonomy term with the specified name to the term group and term set specified by their IDs.

m365 spo term add --name IT --termSetId 8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f --termGroupId 5c928151-c140-4d48-aab9-54da901c7fef

Add taxonomy term with the specified name and ID.

m365 spo term add --name IT --id 5c928151-c140-4d48-aab9-54da901c7fef --termSetName Department --termGroupName People

Add taxonomy term to the specified sitecollection with the specified name and ID.

m365 spo term add --name IT --id 5c928151-c140-4d48-aab9-54da901c7fef --termSetName Department --termGroupName People --webUrl https://contoso.sharepoint.com/sites/project-x

Add taxonomy term with custom properties.

m365 spo term add --name IT --termSetName Department --termGroupName People --customProperties '{"Property": "Value"}'

Add taxonomy term below the specified term.

m365 spo term add --name IT --parentTermId 5c928151-c140-4d48-aab9-54da901c7fef --termGroupName People

Response

{
"CreatedDate": "2023-05-10T06:21:33.873Z",
"Id": "346f49b0-3d1c-4ed3-b590-df303294cc16",
"LastModifiedDate": "2023-05-10T06:21:33.873Z",
"Name": "IT",
"CustomProperties": {},
"CustomSortOrder": null,
"IsAvailableForTagging": true,
"Owner": "i:0#.f|membership|john.doe@contoso.onmicrosoft.com",
"Description": "",
"IsDeprecated": false,
"IsKeyword": false,
"IsPinned": false,
"IsPinnedRoot": false,
"IsReused": false,
"IsRoot": true,
"IsSourceTerm": true,
"LocalCustomProperties": {},
"MergedTermIds": [],
"PathOfTerm": "IT",
"TermsCount": 0
}
CTRL + M