public async void SendSignatureRequestFromDocument() { var auth = new AuthenticationClient(_username, _password, _integratorKey); await auth.LoginInformationAsync(); var client = new DocuSignClient(auth); var documentName = "test.pdf"; var fileStream = File.OpenRead(documentName); var envelope = await client.SendDocumentSignatureRequestAsync(documentName, _recipientName, _recipientEmail, "application/pdf", fileStream); Assert.IsNotNull(envelope); Assert.IsNotNull(envelope.envelopeId); Assert.IsNotNull(envelope.status); Assert.IsNotNull(envelope.statusDateTime); Assert.IsNotNull(envelope.uri); }
public async Task <Envelope> PostFormData() { if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } await CheckAuthInfo(); var client = new DocuSignClient(BaseUrl, DocuSignCredentials); string root; if (IsLocal(Request)) { root = HttpContext.Current.Server.MapPath("~/App_Data"); } { root = @"D:\home\site\wwwroot"; } var streamProvider = new MultipartFormDataStreamProvider(root); await Request.Content.ReadAsMultipartAsync(streamProvider); var documentName = string.Empty; var recipientName = string.Empty; var recipientEmail = string.Empty; var contentType = string.Empty; foreach (var key in streamProvider.FormData.AllKeys) { var strings = streamProvider.FormData.GetValues(key); if (strings != null) { foreach (var val in strings) { if (key == "DocumentName") { documentName = val; } if (key == "RecipientName") { recipientName = val; } if (key == "RecipientEmail") { recipientEmail = val; } if (key == "ContentType") { contentType = val; } } } } var fileData = streamProvider.FileData[0]; var fileInfo = new FileInfo(fileData.LocalFileName); var fileStream = fileInfo.OpenRead(); var envelope = await client.SendDocumentSignatureRequestAsync(documentName, recipientName, recipientEmail, contentType, fileStream); return(envelope); }