Sharepoint 2010 - Object Model - Download DocumentSet Programmatically -
a code snippet of how can download documentset programmatically using sharepoint object model help.
what trying - given sharepoint site, log in user default credentials - document library files hosted - pull files down on local machine
what have done far,
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"); // document set cc.load(olist); cc.executequery(); // views var views = olist.views; cc.load(views); cc.executequery(); // 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 repository", docs.count));
foreach (var doc in docs) {
// download documents in document set - how?
console.writeline(string.format("{0} => {1} ", environment.newline, doc["title"])); } console.writeline(environment.newline);
you interested in microsoft.sharepoint.client.file.openbinarydirect
method. returns fileinformation
makes content accessible via stream
property. can have @ code examples in other thread here, on an msdn page or in a codeproject article.
and yes, there sharepoint developers on stackoverflow :-)
--- ferda
Comments
Post a Comment