2010-01-21 61 views

回答

1

您可以使用Web服務調用嗎?這個線程介紹了從Web服務讀多選擇的選擇:http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/04a00936-7102-4ddc-aa7d-0be7e14e7692 這隨訪後可能是有用的,太:http://mysharepointwork.blogspot.com/2009/10/sharepoint-web-services-get-choice.html

+0

Web服務的價值的另一種方式是我可以想到的唯一方法來在不使用對象模型的情況下獲得選擇。 – 2010-01-21 17:00:59

+0

是的,我可以使用Web服務調用。謝謝你的提示。奇蹟般有效 :) – shaibee 2010-01-22 11:27:21

1

實際上有讓使用Xelements

  using (var service = new SharePoint.Services.ListsSoapClient()) 
      { 
       service.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; 

       var listName = "MyList"; 

       var xelement = service.GetList(listName); 
       var fieldName = "Category"; //My Field name 
       XNamespace ns = "http://schemas.microsoft.com/sharepoint/soap/"; 

       var selectedField = xelement.Descendants(ns + "Fields").Elements().Where(x => x.Attribute("Name").Value == fieldName).FirstOrDefault(); 
       if (selectedField != null) 
       { 
        var choices = selectedField.Elements(ns + "CHOICES").Elements().Where(x => x.Name == ns + "CHOICE").Select(x => x.Value).ToList(); 
        //Do something with choices 
       } 
      } 
相關問題