In this article you will learn how to add multiple top navigation links with Remote PowerShell.
Recently, I published two articles related to how to work with SharePoint remotely with help of PowerShell. Their is Client Side SharePoint PowerShell libraries available to use which help you to get start. In my article Getting SharePoint Context with Client Side SharePoint PowerShell, I explained how to use this Client Side SharePoint PowerShell and created re-usable PowerShell (attached to that article) which helps you to create SharePoint Client Context. This PowerShell will help you build your own PowerShell libraries which could be reused and save lot of time. Another article Adding Bulk Attachments to SharePoint List Item With PowerShell Remotely use those libraries to add bulk attachments to particular list item. In this article, I will help you to learn how this remote SharePoint PowerShell is used to add multiple top navigation links to particular SharePoint Site (SPWeb) with input of CSV file. Again I am using existing Get-SharePointContext.ps1 file and building on top of that. Purpose: Adding multiple top navigation links to SharePoint site (SPWeb). Pre-requisite
Add-SPTopNavLinks.ps1 contains generic PowerShell function which takes input as Microsoft.SharePoint.Client.ClientContext and Microsoft.SharePoint.Client.Web objects.
It is not necessary that you should use above headers. You can use your own header names provided you update Add-SPTopNavLinks function accordingly before using it. The function imports the CSV file in a PowerShell object. Before importing filters the CSV file to include only records whose LinkTitle column is not blank or empty and then finally sort the list based on LinkOrder column. Note that LinkOrder column type is changed to [int] before sorting happens on the values of LinkOrder.
JavaScript Object Model (ECMA) Programming In SharePoint 2016 And Office 365