コード例 #1
0
 public async Task SendSingleTemplateEmailMultipleRcptsAttachment(string from, List <EmailAddress> tos, string templateID, object templateData, CloudAppendBlob fileReference, string fileName)
 {
     Require.That(templateID != null, new ErrorCode("Sendgrid Error", 403, "Required Sengrid template ID not configured in settings"));
     {
         var fromEmail = new EmailAddress(from);
         var msg       = MailHelper.CreateSingleTemplateEmailToMultipleRecipients(fromEmail, tos, templateID, templateData);
         using (var stream = await fileReference.OpenReadAsync())
         {
             await msg.AddAttachmentAsync(fileName, stream);
         }
         await _client.SendEmailAsync(msg);
     }
 }
コード例 #2
0
        private async Task CopyBlobAsync(CloudAppendBlob source, CloudBlockBlob target)
        {
            Console.WriteLine($"Copying {source.Container.Name}/{source.Name} to {target.Container.Name}/{target.Name}");
            var sw = new Stopwatch();

            sw.Start();
            using (var sourceStream = await source.OpenReadAsync())
            {
                await target.UploadFromStreamAsync(sourceStream);
            }

            sw.Stop();
            Console.WriteLine($"Copy operation finished in {sw.Elapsed.TotalSeconds} second(s)");
        }
コード例 #3
0
ファイル: StorageAppendBlob.cs プロジェクト: sravan251/Azure
 /// <inheritdoc />
 public Task <Stream> OpenReadAsync(CancellationToken cancellationToken)
 {
     return(_sdk.OpenReadAsync(cancellationToken));
 }
コード例 #4
0
 /// <inheritdoc />
 public Task <Stream> OpenReadAsync(CancellationToken cancellationToken)
 {
     return(_sdk.OpenReadAsync(accessCondition: null, options: null, operationContext: null, cancellationToken: cancellationToken));
 }
コード例 #5
0
 /// <summary>
 /// Returns the blob stream
 /// </summary>
 /// <param name="cancellationToken"></param>
 /// <returns></returns>
 public Task <Stream> GetContentAsync(CancellationToken cancellationToken)
 {
     return(_appendBlob.OpenReadAsync());
 }