public void RemoveNavigationLink(string data) { try { if (string.IsNullOrEmpty(data)) { return; } var provider = new GenericLinkProvider(_spWeb.Site.ID, _spWeb.ID, _spWeb.CurrentUser.LoginName); provider.Remove(new Guid(data)); } catch (Exception exception) { throw new APIException(20004, "[NavigationService:RemoveNavigationLink] " + exception.Message); } }
public void ReorderLinks(string data) { try { if (string.IsNullOrEmpty(data)) { return; } var orders = new Dictionary <Guid, int>(); foreach ( var parts in data.Split(',') .Where(link => !string.IsNullOrEmpty(link)) .Select(link => link.Split(':')) .Where(parts => parts.Count() == 2)) { Guid id; if (!Guid.TryParse(parts[0], out id) || orders.ContainsKey(id)) { continue; } int order; if (int.TryParse(parts[1], out order)) { orders.Add(id, order); } } if (!orders.Any()) { return; } var provider = new GenericLinkProvider(_spWeb.Site.ID, _spWeb.ID, _spWeb.CurrentUser.LoginName); provider.Reorder(orders); } catch (Exception exception) { throw new APIException(20002, "[NavigationService:ReorderLinks] " + exception.Message); } }