简体   繁体   中英

SharePoint document library versioning and require check out settings using web services

I need the information about the SharePoint document library. Namely, I need the info whether the versioning is turned on or off and if the "require check out" option is selected. I have to use SharePoint web services.

I have looked up in Versions.asmx, Lists.asmx and SiteData.asmx, but found no method or properties that suit my needs.

Could anyone help me out please? Thanks.

You will need to make use of the lists.asmx GetList method. It returns all of the metadata about a list.

Here's some code I've been using in combination with 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()

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM