我正在使用Sharepoint 2010的Web服務界面嘗試獲取給定列表的列。我沒有使用GetList()調用獲取所有列的問題,但問題是我只需要獲取用戶可以在Sharepoint UI的List Settings視圖中看到的列。如何僅獲取列表屬性中顯示的共享點列表列?
我目前使用的代碼如下:
rootNode = serviceReference.GetList(List_id.ToString());
Element element = XElement.Parse(rootNode.OuterXml);
var fields = from e in element.Descendants()
where e.Name.LocalName == "Field" && e.Attribute("ID") != null &&
!(e.Attribute("Name").Value.StartsWith("_") && e.Attribute("SourceID").Value == "http://schemas.microsoft.com/sharepoint/v3")
select e;
如果服務引用是SharePoint的一個實例,列出服務和LIST_ID是代表名單內到SharePoint中的GUID。
這可以過濾掉一些我不想要的列,但它並沒有擺脫所有的東西。
有沒有人知道我在尋找什麼樣的屬性來縮小它的範圍,直到用戶可以選擇添加到視圖中的屬性?或者我是否完全用錯誤的方式來解決這個問題?
非常感謝您的幫助。
您應該首先獲取列表的內容類型,然後獲取內容類型的列。 – user823959
非常感謝 - 我可以看到如何工作,但你能告訴我如何獲得列表的內容類型嗎? Lists.GetContentType需要一個內容類型ID,然後它會爲我返回任何東西。抱歉,我可以看到如何使用Google Searching的Sharepoint對象模型來做到這一點,但我無法看到它是如何使用Web服務界面完成的。 –
查看本網站:http://www.novolocus。com/2007/12/08/the-circular-logic-of-the-wss-lists-webservice-getlistcontenttypes-call/ 此外,如果您找到答案,請回答您的問題並提供完整答案。 – user823959