0

我想从 Navigation sharepoint online 2013 中删除一个导航节点(不禁用 QuickLaunch)

ClientContext context = ClaimClientContext.GetAuthenticatedContext(targetURL, 600, 600);
                NavigationNodeCollection collNavNode = context.Web.Navigation.QuickLaunch;
                context.Load(collNavNode);
                foreach (SP.NavigationNode node in collNavNode)
                {
                    node.DeleteObject();
                }

                context.ExecuteQuery();

它不工作。

4

1 回答 1

1

如何使用 SharePoint CSOM 从 QuickLaunch 中删除所有节点:

public static void ClearQuickLaunch(string url, ICredentials credentials)
{
    using (var context = new ClientContext(url))
    {
        context.Credentials = credentials;

        NavigationNodeCollection qlNodes = context.Web.Navigation.QuickLaunch;
        context.Load(qlNodes);
        context.ExecuteQuery();

        qlNodes.ToList().ForEach(node => node.DeleteObject());
        context.ExecuteQuery();
    }
}
于 2014-01-26T10:27:43.643 回答