【问题标题】:Add SharePoint Document List to Quick Launch through Web Services通过 Web 服务将 SharePoint 文档列表添加到快速启动
【发布时间】:2009-03-16 06:54:01
【问题描述】:

我正在通过 C#.Net 应用程序使用 Webservice Lists.AddList 方法在 SharePoint 中创建文档库。 (见下文)

listsService.AddList(listTitle, listDescription, 101);

我希望它们显示在创建它们的站点下的“快速启动”菜单中,而不仅仅是“所有站点内容”菜单。

我查看了 Lists.UpdateList() 方法,但运气不佳。

有谁知道如何通过 Web 服务做到这一点? (无法手动完成,因为要更改的列表太多了)。

我正在使用最新版本的 SharePoint Server 和 Web 服务。

谢谢你:)

【问题讨论】:

    标签: web-services sharepoint


    【解决方案1】:

    我相信你是正确的,设置OnQuickLaunch 不能通过网络服务使用。在listProperties 中为UpdateList 设置OnQuickLaunch 是我会尝试的,但听起来这不起作用。

    如果您的列表尚不存在,我建议使用OnQuickLaunch="true" 的列表模板创建一个功能,并通过AddListFromFeature 添加列表。您的另一个选择似乎是编写自己的服务来通过对象模型设置属性。

    【讨论】:

    • 我实际上并没有尝试过 OnQuickLaunch,因为我一直在阅读的文档中没有提到它,并且看它与 list.UpdateList 方法一起使用。谢谢!
    【解决方案2】:
    XmlDocument xmlDoc = new System.Xml.XmlDocument();
    
    XmlNode ndProperties = xmlDoc.CreateNode(XmlNodeType.Element, "List", "");
    
    XmlAttribute ndQuickLaunchAttrib = (XmlAttribute)xmlDoc.CreateNode(XmlNodeType.Attribute, "OnQuickLaunch", "");
    
    ndQuickLaunchAttrib.Value = "True";
    
    ndProperties.Attributes.Append(ndQuickLaunchAttrib);
    
    XmlNode ndReturn = proxy.UpdateList("12345", ndProperties, null, null, null, null);
    

    【讨论】:

      【解决方案3】:

      最好先创建一个 SPList 对象,然后执行 OnQuickLaunch="true"。不要忘记更新命令!

      Example:
      Guid listID = Guid.Empty;
      listID = siteObject.Lists.Add("Title","Description",listTemplateObject);
      //This will work:
      SPList thisList = siteObject.Lists[ListID];
      thisList.OnQuickLaunch = true;
      thisList.Update();
      

      【讨论】:

        猜你喜欢
        • 2011-02-14
        • 2023-03-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多