sharepoint - Deleting all nodes from QuickLaunch -


This is my code to remove QuickLaunch navigation nodes I'm using SharePoint 2013

 < Code> Public Zero 2013NodeOrders (String SITEURL, String Quicklaunch) {SPSecurity.RunWithElevatedPrivileges ((=). {Using (localWeb = new SPSite (SITEURL). OpenWeb {var QL = localWeb.N Navigation.QuickLaunch () } {Try; integer count = 0; while (count ++'s & lt; 10) {{CleanUpAutoCreatedNodes (QL, nodeNames.ToArray (try); break;} hold (Exception pre) {}}} localWeb.Update () ;} Hold (Exception Pre) {Console.WriteLine ("Error occurred", prior); Throw Pu W;}}}); } Private Static Zero CleanUpAutoCreatedNodes (SPNavigationNodeCollection QL, string [] nodenames) {foreach (in SPNavigationNode globalNode QL) {if (Array.IndexOf (nodenames, globalNode.Title) == -1) {if (globalNode.Children.Count & gt ; 0) {foreach (SPNavigationNode childNode in globalNode.Children) childNode.Delete (); } (GlobalNode.Title.Equals ("Site Content")); GlobalNode.Delete (); I got the following COM exception error from lines  foreach (SPNavigationNode globalNode in QL)  and  foreach (childNode in SPNavigationNode globalNode.Children)   

/ Strong>

Error message: This action can not be completed. Please try again. 0x80004005

  Stacktrace error on Microsoft. SharePoint Library. SPRECETE Client. Gate NavigationNode Child (String Beastroute, Int 32LapentID, Int 32Lindex, Intrase and LandodeIID, String and Pibstreit NodeRR, String and PBTTrank, String and PbstrNameResource, on Microsoft and String and PBIRTEdit Mododed, Inter 32 and PBIVisible, Intros and PBI Xantial, int 32 and plim childon, guind and pgस्कोpid, int 32 and ppt Object type) string Bistiuarel, IT 32 Elpiaiaraidi, Int 32 Lindeks, Int 32 and Lanodaidi, String & amp; PbstrNodeUrl, string & amp; PbstrName, string & amp; PbstrNameResource, string & amp; PbstrDateModified, Int32 & amp; PbIsVisible, Int32 & amp; PbIsExternal, Int32 and PLNumChildren, Guid & amp; PgScopeId, Int32 and plParentObjectType)    p> 

You know that you delete navigation nodes from SharePoint Designer Are you?

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -