lundi 15 décembre 2014

How do I programmatically download all versions of a document from document library?



I want to download all versions of all documents from selected Document Libraries. How do I programmatically download all versions of a document from document library?


I found that I can download a File like this:



WebClient client1 = new WebClient();
client1.Credentials = System.Net.CredentialCache.DefaultCredentials;
FileStream outStream = new FileStream(localPath + "\\" + file.Name, FileMode.Create);
byte[] fileData = file.OpenBinary();
outStream.Write(fileData, 0, fileData.Count());
outStream.Close();


But once i try to download a / all versions in a loop, i get an error message that I can't access closed files.


Any tips?








0 commentaires:

Enregistrer un commentaire