SharePoint文档库版本控制并要求使用Web服务签出设置

时间:2009-10-12 09:31:16

标签: sharepoint versioning

我需要有关SharePoint文档库的信息。也就是说,我需要打开或关闭版本控制以及是否选择“要求检出”选项的信息。我必须使用SharePoint Web服务。

我查了一下Versions.asmx,Lists.asmx和SiteData.asmx,但没有找到适合我需要的方法或属性。

有人可以帮帮我吗?谢谢。

1 个答案:

答案 0 :(得分:1)

您需要使用lists.asmx GetList方法。它返回有关列表的所有元数据。

以下是我与Linq to XML结合使用的一些代码:

    Private _serviceRefrence As SharePointListsService.ListsSoapClient
    Dim endPoint As New ServiceModel.EndpointAddress(_serviceURL)
    Dim ListID as Guid = New Guid("<<Your List Guid>>") 

    _serviceRefrence = New SharePointListsService.ListsSoapClient("ListsSoap", endPoint)
    _serviceRefrence.ClientCredentials.Windows.ClientCredential = Credentials
    _serviceRefrence.ClientCredentials.Windows.AllowedImpersonationLevel = Security.Principal.TokenImpersonationLevel.Impersonation

    Dim results As XmlElement = _serviceRefrence.GetList(listID.ToString())
    Dim parserResults As XDocument = XDocument.Parse(results.OuterXml)

    Dim listinfo = (From list In parserResults.Descendants(XName.Get("List", "http://schemas.microsoft.com/sharepoint/soap/")) _
                    Select New With {.RequireCheckout = list.Attribute("RequireCheckout").Value, _
                                 .ModerationEnabled = list.Attribute("EnableModeration").Value, _
                                 .VersioningEnabled = list.Attribute("EnableVersioning")}).Single()

希望这有帮助!