Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 45 additions & 30 deletions docs/docs/cmd/spo/navigation/navigation-node-add.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ m365 spo navigation node add [options]
`--parentNodeId [parentNodeId]`
: ID of the node below which the node should be added. Specify either `location` or `parentNodeId` but not both.

`--isExternal`
: Set, if the navigation node points to an external URL.

`--audienceIds [audienceIds]`
: Comma-separated list of group IDs that will be used for audience targeting. The limit is 10 ids per navigation node.

Expand All @@ -57,7 +54,7 @@ m365 spo navigation node add --webUrl https://contoso.sharepoint.com/sites/team-
Add a navigation node pointing to an external page to the quick launch.

```sh
m365 spo navigation node add --webUrl https://contoso.sharepoint.com/sites/team-a --location QuickLaunch --title "About us" --url https://contoso.com/about-us --isExternal
m365 spo navigation node add --webUrl https://contoso.sharepoint.com/sites/team-a --location QuickLaunch --title "About us" --url https://contoso.com/about-us
```

Add a navigation node below an existing node and opens it in a new window.
Expand All @@ -72,6 +69,12 @@ Add a navigation node to the top navigation which is audience targetted and open
m365 spo navigation node add --webUrl https://contoso.sharepoint.com/sites/team-a --location TopNavigationBar --title About --url /sites/team-s/sitepages/about.aspx --audienceIds "7aa4a1ca-4035-4f2f-bac7-7beada59b5ba,4bbf236f-a131-4019-b4a2-315902fcfa3a" --openInNewWindow
```

Add a linkless label to the quick launch.

```sh
m365 spo navigation node add --webUrl https://contoso.sharepoint.com/sites/team-a --location QuickLaunch --title Resources
```

## Response

<Tabs>
Expand All @@ -83,59 +86,71 @@ m365 spo navigation node add --webUrl https://contoso.sharepoint.com/sites/team-
"7aa4a1ca-4035-4f2f-bac7-7beada59b5ba"
],
"CurrentLCID": 1033,
"Id": 2030,
"IsDocLib": true,
"IsExternal": true,
"IsVisible": true,
"ListTemplateType": 0,
"CustomProperties": [],
"FriendlyUrlSegment": "",
"IsDeleted": false,
"IsHidden": false,
"IsTitleForExistingLanguage": false,
"Key": "2030",
"Nodes": [],
"NodeType": 0,
"OpenInNewWindow": true,
"SimpleUrl": "https://contoso.sharepoint.com",
"Title": "Navigation Link",
"Url": "https://contoso.sharepoint.com"
"Translations": []
}
```

</TabItem>
<TabItem value="Text">

```text
AudienceIds : ["7aa4a1ca-4035-4f2f-bac7-7beada59b5ba"]
CurrentLCID : 1033
Id : 2031
IsDocLib : true
IsExternal : true
IsVisible : true
ListTemplateType: 0
Title : Navigation Link
Url : https://contoso.sharepoint.com
AudienceIds : ["7aa4a1ca-4035-4f2f-bac7-7beada59b5ba"]
CurrentLCID : 1033
CustomProperties : []
FriendlyUrlSegment :
IsDeleted : false
IsHidden : false
IsTitleForExistingLanguage: false
Key : 2030
NodeType : 0
Nodes : []
OpenInNewWindow : true
SimpleUrl : https://contoso.sharepoint.com
Title : Navigation Link
Translations : []
```

</TabItem>
<TabItem value="CSV">

```csv
AudienceIds,CurrentLCID,Id,IsDocLib,IsExternal,IsVisible,ListTemplateType,Title,Url
"[""7aa4a1ca-4035-4f2f-bac7-7beada59b5ba""]",1033,2032,1,1,1,0,Navigation Link,https://contoso.sharepoint.com
CurrentLCID,FriendlyUrlSegment,IsDeleted,IsHidden,IsTitleForExistingLanguage,Key,NodeType,OpenInNewWindow,SimpleUrl,Title
1033,,0,0,0,2030,0,1,https://contoso.sharepoint.com,Navigation Link
```

</TabItem>
<TabItem value="Markdown">

```md
# spo navigation node get --webUrl "https://contoso.sharepoint.com/sites/team-a" --location "TopNavigationBar" --title "Navigation Link" --url "https://contoso.sharepoint.com"
# spo navigation node add --webUrl "https://contoso.sharepoint.com/sites/team-a" --location "TopNavigationBar" --title "Navigation Link" --url "https://contoso.sharepoint.com" --openInNewWindow "true"

Date: 2/20/2023
Date: 10/7/2026

## Navigation Link (2030)
## Navigation Link

Property | Value
---------|-------
CurrentLCID | 1033
Id | 2030
IsDocLib | true
IsExternal | false
IsVisible | true
ListTemplateType | 0
FriendlyUrlSegment |
IsDeleted | false
IsHidden | false
IsTitleForExistingLanguage | false
Key | 2030
NodeType | 0
OpenInNewWindow | true
SimpleUrl | https://contoso.sharepoint.com
Title | Navigation Link
Url | https://contoso.sharepoint.com
```

</TabItem>
Expand Down
106 changes: 64 additions & 42 deletions docs/docs/cmd/spo/navigation/navigation-node-get.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ m365 spo navigation node get [options]
`-u, --webUrl <webUrl>`
: Absolute URL of the site.

`-l, --location <location>`
: Navigation type where the node is located. Available options: `QuickLaunch`, `TopNavigationBar`.

`--id <id>`
: Id of the navigation node.
```
Expand Down Expand Up @@ -45,10 +48,16 @@ m365 spo navigation node get [options]

## Examples

Retrieve information for a specific navigation node.
Retrieve information for a specific navigation node from the quick launch.

```sh
m365 spo navigation node get --webUrl https://contoso.sharepoint.com/sites/Marketing --id 2209
m365 spo navigation node get --webUrl https://contoso.sharepoint.com/sites/Marketing --location QuickLaunch --id 2209
```

Retrieve information for a specific navigation node from the top navigation.

```sh
m365 spo navigation node get --webUrl https://contoso.sharepoint.com/sites/Marketing --location TopNavigationBar --id 2209
```

## Response
Expand All @@ -58,78 +67,91 @@ m365 spo navigation node get --webUrl https://contoso.sharepoint.com/sites/Marke

```json
{
"Children": [
"AudienceIds": [
"0d718612-8407-4d6b-833c-6891a553354f"
],
"CurrentLCID": 1033,
"CustomProperties": [],
"FriendlyUrlSegment": "",
"IsDeleted": false,
"IsHidden": false,
"IsTitleForExistingLanguage": false,
"Key": "2209",
"Nodes": [
{
"AudienceIds": null,
"AudienceIds": [],
"CurrentLCID": 1033,
"Id": 2033,
"IsDocLib": true,
"IsExternal": true,
"IsVisible": true,
"ListTemplateType": 0,
"CustomProperties": [],
"FriendlyUrlSegment": "",
"IsDeleted": false,
"IsHidden": false,
"IsTitleForExistingLanguage": false,
"Key": "2210",
"Nodes": [],
"NodeType": 0,
"OpenInNewWindow": true,
"SimpleUrl": "https://microsoft365.com",
"Title": "Microsoft 365",
"Url": "https://microsoft365.com",
"Children": []
"Translations": []
}
],
"AudienceIds": [
"0d718612-8407-4d6b-833c-6891a553354f"
],
"CurrentLCID": 1033,
"Id": 2209,
"IsDocLib": true,
"IsExternal": false,
"IsVisible": true,
"ListTemplateType": 100,
"NodeType": 0,
"OpenInNewWindow": null,
"SimpleUrl": "/sites/Marketing/Lists/Work Status/AllItems.aspx",
"Title": "Work Status",
"Url": "/sites/Marketing/Lists/Work Status/AllItems.aspx"
"Translations": []
}
```

</TabItem>
<TabItem value="Text">

```text
Children : [{ AudienceIds: null, CurrentLCID: 1033, Id: 2033, IsDocLib: true, IsExternal: true, IsVisible: true, ListTemplateType: 0, Title: "Microsoft 365", Url: "https://microsoft365.com", Children: [] }]
AudienceIds : ["0d718612-8407-4d6b-833c-6891a553354f"]
CurrentLCID : 1033
Id : 2209
IsDocLib : true
IsExternal : false
IsVisible : true
ListTemplateType: 100
Title : Work Status
Url : /sites/Marketing/Lists/Work Status/AllItems.aspx
AudienceIds : ["0d718612-8407-4d6b-833c-6891a553354f"]
CurrentLCID : 1033
CustomProperties : []
FriendlyUrlSegment :
IsDeleted : false
IsHidden : false
IsTitleForExistingLanguage: false
Key : 2209
NodeType : 0
Nodes : [{"AudienceIds":[],"CurrentLCID":1033,"CustomProperties":[],"FriendlyUrlSegment":"","IsDeleted":false,"IsHidden":false,"IsTitleForExistingLanguage":false,"Key":"2210","Nodes":[],"NodeType":0,"OpenInNewWindow":true,"SimpleUrl":"https://microsoft365.com","Title":"Microsoft 365","Translations":[]}]
OpenInNewWindow : null
SimpleUrl : /sites/Marketing/Lists/Work Status/AllItems.aspx
Title : Work Status
Translations : []
```

</TabItem>
<TabItem value="CSV">

```csv
CurrentLCID,Id,IsDocLib,IsExternal,IsVisible,ListTemplateType,Title,Url
1033,2209,1,,1,100,Work Status,/sites/Marketing/Lists/Work Status/AllItems.aspx
CurrentLCID,FriendlyUrlSegment,IsDeleted,IsHidden,IsTitleForExistingLanguage,Key,NodeType,OpenInNewWindow,SimpleUrl,Title
1033,,0,0,0,2209,0,,/sites/Marketing/Lists/Work Status/AllItems.aspx,Work Status
```

</TabItem>
<TabItem value="Markdown">

```md
# spo navigation node get --webUrl "https://contoso.sharepoint.com/sites/Marketing" --id "2209"
# spo navigation node get --webUrl "https://contoso.sharepoint.com/sites/Marketing" --location "QuickLaunch" --id "2209"

Date: 1/29/2023
Date: 10/7/2026

## Work Status (2209)
## Work Status

Property | Value
---------|-------
CurrentLCID | 1033
Id | 2209
IsDocLib | true
IsExternal | false
IsVisible | true
ListTemplateType | 100
FriendlyUrlSegment |
IsDeleted | false
IsHidden | false
IsTitleForExistingLanguage | false
Key | 2209
NodeType | 0
SimpleUrl | /sites/Marketing/Lists/Work Status/AllItems.aspx
Title | Work Status
Url | /sites/Marketing/Lists/Work Status/AllItems.aspx
```

</TabItem>
Expand Down
18 changes: 10 additions & 8 deletions docs/docs/cmd/spo/navigation/navigation-node-set.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ m365 spo navigation node set [options]
`-u, --webUrl <webUrl>`
: Absolute URL of the site.

`-l, --location <location>`
: Navigation type where the node is located. Available options: `QuickLaunch`, `TopNavigationBar`.

`--id <id>`
: Id of the navigation node.

Expand All @@ -26,10 +29,7 @@ m365 spo navigation node set [options]
: New URL of the navigation node. Specify an empty string `""` to update the navigation label to a linkless label.

`--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`.
: Comma-separated list of group IDs that will be used for audience targeting. Specify an empty string `""` to clear this value. The limit is 10 ids per navigation node.

`--openInNewWindow [openInNewWindow]`
: Open the URL in a new window. Valid values: `true` or `false`.
Expand All @@ -41,30 +41,32 @@ m365 spo navigation node set [options]

To enable/disable audience targeting for the navigation bar, use the [`spo web set`](../web/web-set.mdx) command.

SharePoint doesn't allow changing the URL of a navigation node pointing to a page in the current site into an external URL. In that case, the URL isn't updated and no error is returned. To point such a node to an external URL, remove the node using [`spo navigation node remove`](./navigation-node-remove.mdx) and add it again using [`spo navigation node add`](./navigation-node-add.mdx).

## Examples

Updates the title of a navigation node

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

Updates the URL of a navigation node

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

Updates audience targeting of a navigation node with 3 groups

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

Updates the navigation node so that it opens in a new window

```sh
m365 spo navigation node set --webUrl https://contoso.sharepoint.com/sites/marketing --id 2209 --openInNewWindow true
m365 spo navigation node set --webUrl https://contoso.sharepoint.com/sites/marketing --location QuickLaunch --id 2209 --openInNewWindow true
```

## Response
Expand Down
14 changes: 1 addition & 13 deletions src/m365/spo/commands/navigation/NavigationNode.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
export interface NavigationNode {
Id: number;
IsDocLib: boolean;
IsExternal: boolean;
IsVisible: boolean;
ListTemplateType: number;
Title: string;
Url: string;
AudienceIds: string[];
Children?: NavigationNode[];
}

export interface MenuStateNode {
AudienceIds: string[];
CurrentLCID: number;
Expand All @@ -18,7 +6,7 @@ export interface MenuStateNode {
IsDeleted: boolean;
IsHidden: boolean;
IsTitleForExistingLanguage: boolean;
Key: string;
Key: string | null;
Nodes: MenuStateNode[];
NodeType: number;
OpenInNewWindow?: boolean | null;
Expand Down
Loading