【问题标题】:How to remove a NavigationNode in sharepoint online 2013 with CSOM如何使用 CSOM 在 sharepoint online 2013 中删除 NavigationNode
【发布时间】:2013-11-06 03:42:49
【问题描述】:

我想从 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();

它不工作。

【问题讨论】:

    标签: sharepoint-2013 sharepoint-clientobject


    【解决方案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();
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-06-22
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 2013-06-26
      • 2017-04-04
      • 2019-04-12
      • 1970-01-01
      相关资源
      最近更新 更多