Skip to content

New command: spo navigation node set #4416

@milanholemans

Description

@milanholemans

Usage

m365 spo navigation node set [options]

Description

Updates a SharePoint navigation node

Options

Option Description
-u, --webUrl <webUrl> Absolute URL of the site.
--id <id> Id of the navigation node.
--title [title] New title of the navigation node.
--url [url] New URL of the navigation node.
--audienceIds [audienceIds] Comma separated list of group IDs that will be used for audience targeting. Speficy an empty string "" to clear this value. The limit is 10 ids per navigation node.
--isExternal [isExternal] Whether the navigation node points to an external URL. Valid values: true or false.

Examples

Updates the title of a navigation node

m365 spo navigation node set --webUrl https://contoso.sharepoint.com/sites/marketing --id 2209 --title "Pictures"

Updates the URL of a navigation node

m365 spo navigation node set --webUrl https://contoso.sharepoint.com/sites/marketing --id 2209 --url "https://microsoft.com" --isExternal true

Updates audience targeting of a navigation node with 3 groups

m365 spo navigation node set --webUrl https://contoso.sharepoint.com/sites/marketing --id 2209 --audienceIds "61f78c73-f71a-471e-a3b9-15daa936e200,9524e6b4-e663-44fe-b179-210c963e37e7,c42b8756-494d-4141-a575-45f01320e26a"

Default properties

No response

Additional Info

Docs

Let's add to remarks a reference to spo web set to enable audience targeting for navigation.

API Request

PATCH https://contoso.sharepoint.com/sites/sitename/_api/web/navigation/GetNodeById(2209)

{
    "Title": "Home site",
    "Url": "https://contoso.sharepoint.com",
    "AudienceIds": ["4a7a1426-4d90-421a-8050-265d8eca2495"]
}

Note! To clear the audience targeting, we have to specify an empty array.

Validation

  • audienceIds are all GUIDs
  • audienceIds cannot have more than 10 IDs

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions