SharePoint document library versioning and require check out settings using web services
I need the information about the Shar开发者_高级运维ePoint 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!
精彩评论