2012-03-09 41 views
0

我可以通過使用Sharepoint對象模型以編程方式下載documentSet的代碼片段確實有幫助。Sharepoint 2010 - 對象模型 - 以編程方式下載DocumentSet

我所試圖做的是 - 考慮到SharePoint網站,與用戶的默認憑據登錄 - 查找文檔庫中的文件被主辦 - 拉文件下到本地機器

我迄今所做的,

using Microsoft.SharePoint.Client; 

ClientContext cc = new ClientContext(ConfigurationManager.AppSettings["site"]); 
      cc.Credentials = new NetworkCredential(username, pwd, domain); 
      Web site = cc.Web; 
      ListCollection collList = site.Lists; 

      var oList = collList.GetByTitle("Document Set test"); 

      // Get the document set 
      cc.Load(oList); 
      cc.ExecuteQuery(); 

      // Get All views 
      var views = oList.Views; 
      cc.Load(views); 
      cc.ExecuteQuery(); 

      // Get All documents 
      CamlQuery camlQuery = new CamlQuery(); 
      camlQuery.ViewXml = @"<Query> 
            <ViewFields> 
             <FieldRef Name='Title'/> 
             <FieldRef Name='Display Name'/> 
            </ViewFields> 
            <Where> 
             <Gt> 
             <FieldRef Name='Created' /> 
             <Value IncludeTimeValue='TRUE' Type='DateTime'>1900-05-08T14:25:50Z</Value> 
             </Gt> 
            </Where> 
            <OrderBy> 
             <FieldRef Name='Title' Ascending='True' /> 
            </OrderBy>          
           </Query>"; 

      var docs = oList.GetItems(camlQuery); 
      cc.Load(docs); 
      cc.ExecuteQuery(); 

      Console.WriteLine(string.Format("{0} Models in the repository", docs.Count)); 

的foreach(在文檔VAR DOC) {

//下載中的文檔文件集 - 但如何?

   Console.WriteLine(string.Format("{0} => {1} ", Environment.NewLine, doc["Title"])); 
      } 
      Console.WriteLine(Environment.NewLine); 
+0

我會問sharepoint.stackexchange.com,你可能會發現更多的大師有 – AnarchistGeek 2012-03-09 13:21:38

+0

完成,HTTP:// sharepoint.stackexchange.com/questions/31218/sharepoint-2010-client-object-model-download-documentset-programmatically其他建議? – 2012-03-09 13:38:10

+0

msdn論壇也不錯,如果你還沒有發佈的話。 – AnarchistGeek 2012-03-09 13:41:33

回答

相關問題