Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.             SPSecurity.RunWithElevatedPrivileges(delegate ()
  2.             {
  3.                 using (SPWeb web = (SPWeb)properties.Feature.Parent)
  4.                 {
  5.                     Boolean found = false;
  6.                     SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
  7.                     foreach (SPNavigationNode node in nodes)
  8.                     {
  9.                         if (node.Url.ToString() == "_layouts/15/ContractManager/ContractManager.aspx")
  10.                         {
  11.                             found = true;
  12.                         }
  13.                     }
  14.  
  15.                     SPNavigationNode navNode = new SPNavigationNode("Contract Manager", "_layouts/15/ContractManager/ContractManager.aspx", true);
  16.                     if (found == false)
  17.                     {
  18.                         web.AllowUnsafeUpdates = true;
  19.                         nodes.AddAsLast(navNode);
  20.                         navNode.Update();
  21.                     }
  22.                 }
  23.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement