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); } }
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)"); }
/// <inheritdoc /> public Task <Stream> OpenReadAsync(CancellationToken cancellationToken) { return(_sdk.OpenReadAsync(cancellationToken)); }
/// <inheritdoc /> public Task <Stream> OpenReadAsync(CancellationToken cancellationToken) { return(_sdk.OpenReadAsync(accessCondition: null, options: null, operationContext: null, cancellationToken: cancellationToken)); }
/// <summary> /// Returns the blob stream /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public Task <Stream> GetContentAsync(CancellationToken cancellationToken) { return(_appendBlob.OpenReadAsync()); }