2009-10-12 93 views
0

我需要有關SharePoint文檔庫的信息。也就是說,我需要知道版本是打開還是關閉,以及是否選擇了「需要檢出」選項。我必須使用SharePoint Web服務。SharePoint文檔庫版本控制並需要使用Web服務檢出設置

我查了Versions.asmx,Lists.asmx和SiteData.asmx,但沒有找到適合我需求的方法或屬性。

任何人都可以幫助我嗎?謝謝。

回答

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() 

希望這有助於!

+0

克里斯,謝謝你的回覆。有什麼辦法將其轉換爲C#?我不明白VB的語法。感謝幫助。 – Boris 2009-10-15 09:39:09

+0

不幸的是,我沒有在C#中使用很多Linq XML,所以我需要一些時間來弄清楚如何轉換它。基本上,當你看到一個Dim時,將其轉換如下:ServiceModel.EndpointAddress endPoint = new ServiceModel.EnpointAddress(_serviceURL);順便說一句,我正在使用WCF與SharePoint交談。 – 2009-11-04 16:07:57

相關問題