This example is very simple. It mainly demonstrates how to use the SDK to operate the navigation bar in Moss, that is, the link on the left of moss ,:
This example shows how to display the links in moss in winform and add some links.
Demo Effect
The main method is as follows:
- Get all navigation links under the sub-Website:
String _ mosssite = "http: // localhost: 999"; // URL of the website set
Spsite _ sitecollection = new spsite (_ mosssite );
// Get the navigation under the document library
Spweb site = _ sitecollection. allwebs ["Docs"];
// Place the navigation bar in ListBox for display
Spnavigationnodecollection nodes = site. Navigation. quicklaunch;
Listbox1.items. Clear ();
Foreach (spnavigationnode node in nodes)
{
Listbox1.items. Add (node. Title );
}
- Add your own navigation
Spweb site = _ sitecollection. allwebs ["Docs"];
Spnavigationnodecollection nodes = site. Navigation. quicklaunch;
Spnavigationnode navnode = new spnavigationnode (textbox1.text, textbox2.text, true );
Nodes. addasfirst (navnode );
Listbox1.items. Add (textbox1.text );
Demo download