Downloading documents

All documents, photos, videos and other files stored in WorkZone are accessible via Media Link Entries in the Documents feed.

The example below streams all documents of a specific File (case) to your local machine.

 

Example: Download all documents from a case to your local machine


string fileID = "2805305";
 
var query = from d in context.Documents
            where d.Record.File.ID == fileID
            select d;
 
// loop through the documents on the case.
foreach (Document doc in query)
{
    // get document stream and download to file system.
    using (var fs = System.IO.File.Create(System.IO.Path.Combine(@"C:\Temp\Documents\", doc.SuggestedFileName)))
    {
        context.GetReadStream(doc).Stream.CopyTo(fs);
    }
}
				

Kopibilledet mangler

Note: In this example, only the first 50 documents are retrieved (the default page size).