添付ファイルを試した時の備忘メモ。
Document作成して、添付作成して、ダウンロードする。
var document = (await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId), testdoc)).Resource; var pdf = @"C:\temp\microsoft-documentdb-sql-query-cheat-sheet-v4.pdf"; using (var attachmentStream = File.OpenRead(pdf)) { var attachment = (await client.CreateAttachmentAsync(document.SelfLink, attachmentStream, new MediaOptions() { ContentType = "application/pdf", })).Resource; attachment = (await client.ReadAttachmentAsync(attachment.SelfLink)).Resource; var media = await client.ReadMediaAsync(attachment.MediaLink); using (var fileStream = File.OpenWrite(@"c:\temp\download.pdf")) { media.Media.CopyTo(fileStream); } }