2012-03-09 42 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

回答

相关问题