SOLVED

Edit SharePoint Quicklaunch with /_api/navigation/SaveMenuState

%3CLINGO-SUB%20id%3D%22lingo-sub-1486862%22%20slang%3D%22en-US%22%3EEdit%20SharePoint%20Quicklaunch%20with%20%2F_api%2Fnavigation%2FSaveMenuState%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1486862%22%20slang%3D%22en-US%22%3EHey%20community%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20to%20change%20the%20quick%20launch%20node%20titles%20of%20several%20hundred%20site%20collections%20in%20depdency%20to%20the%20culture%20info%20of%20users%20browse%2C%20i.e.%20Contracts%20in%20English%20and%20Vertr%C3%A4ge%20in%20German.%3CBR%20%2F%3EI%20found%20the%20hint%20in%20internet%2C%20that%20this%20might%20be%20possible%20with%20%2F_api%2Fnavigation%2FSaveMenuState%3CBR%20%2F%3E%3CBR%20%2F%3EI%20would%20like%20to%20write%20a%20PowerShell%20function%20to%20change%20the%20quick%20launch.%3CBR%20%2F%3E%3CBR%20%2F%3EDoes%20anybody%20experience%20with%20this%20api%20or%20know%20where%20I%20can%20found%20a%20documentation%3F%3CBR%20%2F%3E%3CBR%20%2F%3EKind%20regards%3CBR%20%2F%3EChris%3CBR%20%2F%3E%3CBR%20%2F%3EI%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1486862%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1570359%22%20slang%3D%22en-US%22%3ERe%3A%20Edit%20SharePoint%20Quicklaunch%20with%20%2F_api%2Fnavigation%2FSaveMenuState%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570359%22%20slang%3D%22en-US%22%3E%3CP%3EAfter%20several%20days%20of%20R%26amp%3BD%20I%20found%20a%20way%20to%20manage%20the%20quicklaunch%20in%20a%20multi-language%20environment%20with%20PowerShell.%20You%20can%20find%20an%20example%20script%20attached.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20example%20script%20has%20this%20funcitonality%3C%2FP%3E%3CUL%3E%3CLI%3E%22get-QuickLaunch%22%3C%2FLI%3E%3CLI%3E%3CP%3EThe%20complete%20quicklaunch%20structure%20is%20requested%20for%20english%20and%20german%20language%20settings%20and%20returned%20as%20an%20array.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%26nbsp%3B%3C%2FLI%3E%3CLI%3E%22add-SingleNode%22%3C%2FLI%3E%3CLI%3E%3CP%3EA%20new%20main%20navigation%20element%20is%20set%20with%20language%20settings%20in%20german%20and%20english%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%26nbsp%3B%3C%2FLI%3E%3CLI%3E%22new-Quicklaunch%22%3C%2FLI%3E%3CLI%3E%3CP%3ECurrent%20quicklaunch%20is%20completly%20replaced%20in%20'two'%20steps%20with%20a%20new%20quicklaunch%20in%20german%20and%20english.%20The%20Nodes%20are%20the%20same%20as%20before%2C%20but%20titles%20are%20extended%20with%20current%20time.%26nbsp%3B%3CBR%20%2F%3EIt%20would%20be%20possible%20to%20add%20each%20node%20separatly%2C%20but%20in%20our%20use%20case%2C%20it%20wouldn't%20be%20nice%2C%20when%20the%20user%20sees%20the%20growing%20navigation%20tree.%20To%20avoid%20this%2C%20I%20have%20implemented%20a%20three%20step%20approach.%20First%20create%20the%20tree%20with%20all%20nodes%20and%20my%20node%20identifiers.%20Second%20and%20third%20step%20update%20the%20language%20versions.%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3EThe%20only%20preconditions%20to%20run%20the%20script%20is%20that%20you%20have%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EApp-Security%20authentification%20configured%3C%2FLI%3E%3CLI%3EApply%20your%20App-Security%20informations%20at%20the%20beginning%20of%20the%20Script%20(lines%203-6)%3C%2FLI%3E%3CLI%3ESet%20the%20Site%20URL%20in%20line%208%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLI%3E%3CLI%3EApp%20has%20SiteCollection%20admin%20rights%20to%20access%20the%20SharePoint%20site%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20would%20be%20nice%2C%20if%20you%20could%20send%20me%20feedback%20to%20my%20example.%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3EChristian%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor
Hey community,

I have to change the quick launch node titles of several hundred site collections in depdency to the culture info of users browse, i.e. Contracts in English and Verträge in German.
I found the hint in internet, that this might be possible with /_api/navigation/SaveMenuState

I would like to write a PowerShell function to change the quick launch.

Does anybody experience with this api or know where I can found a documentation?

Kind regards
Chris

I
1 Reply
Highlighted
Best Response confirmed by Chris10250 (Occasional Contributor)
Solution

After several days of R&D I found a way to manage the quicklaunch in a multi-language environment with PowerShell. You can find an example script attached. 

 

The example script has this funcitonality

  • "get-QuickLaunch"
  • The complete quicklaunch structure is requested for english and german language settings and returned as an array.

  •  
  • "add-SingleNode"
  • A new main navigation element is set with language settings in german and english

  •  
  • "new-Quicklaunch"
  • Current quicklaunch is completly replaced in 'two' steps with a new quicklaunch in german and english. The Nodes are the same as before, but titles are extended with current time. 
    It would be possible to add each node separatly, but in our use case, it wouldn't be nice, when the user sees the growing navigation tree. To avoid this, I have implemented a three step approach. First create the tree with all nodes and my node identifiers. Second and third step update the language versions. 

The only preconditions to run the script is that you have 

  • App-Security authentification configured
  • Apply your App-Security informations at the beginning of the Script (lines 3-6)
  • Set the Site URL in line 8

     

  • App has SiteCollection admin rights to access the SharePoint site

 

It would be nice, if you could send me feedback to my example.

Regards

Christian