public SPNavigationNodeInstance GetNodeById(int id) { var result = m_navigation.GetNodeById(id); return(result == null ? null : new SPNavigationNodeInstance(this.Engine.Object.InstancePrototype, result)); }
private IEnumerable <INavObject> GetMyWorkplaceLinks() { return((IEnumerable <INavObject>)CacheStore.Current.Get(_key, new CacheStoreCategory(Web).Navigation, () => { var links = new List <NavLink> { new NavLink { Title = "My Workplace", Url = "Header" } }; var wpLinks = new List <NavLink>(); using (var spSite = new SPSite(SiteId, GetUserToken())) { using (SPWeb spWeb = spSite.OpenWeb()) { try { bool isRootWeb = spWeb.ID == WebId; SPNavigation spNavigation = spWeb.Navigation; wpLinks.AddRange(from nodeId in GetNodes(spWeb) select spNavigation.GetNodeById(nodeId) into node where node != null select new NavLink { Title = node.Title, Url = CalculateUrl(node, isRootWeb) }); } catch { } } } if (wpLinks.Count > 0) { links.AddRange(wpLinks); } else { links.Add(new NavLink { Title = "No workplace", Url = "PlaceHolder" }); } return links; }).Value); }