2017-11-14 1 views
1

DocuSign 데모 계정을 사용하여 C#을 사용하여 클라이언트에 서명하기위한 전자 메일로 문서를 보냅니다. 나는이 링크 (https://www.docusign.com/developer-center/api-overview#quickstart)의 코드를 사용하고있다. 하지만 코드를 실행하면 클라이언트에게 전자 메일이 전송되지 않고 오류도 표시되지 않습니다. 또한 HttpWebRequest 및 ajax 사용하여 봉투 함께 인증 후에 반환하는 baseurl 게시 시도했다. 그것은 역시 운동하지 않았다. 아무도 이것으로 나를 도울 수 있습니까?DocuSign (클라이언트에 전자 메일 보내기) ASP.NET MVC

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.IO;

Newtonsoft.Json;

DocuSign.eSign.Api를 사용합니다.

DocuSign.eSign.Model;

DocuSign.eSign.Client;

네임 스페이스 DocuSignTest {

class Program 
{ 

    static void Main(string[] args) 
    { 

     try 
     { 

      // Enter your DocuSign credentials 
      string Username = "[email protected]"; 
      string Password = "******"; 
      string IntegratorKey = "****************"; 

      // specify the document we want signed 
      string SignTest1File = @"C://SamplePdfSign.pdf"; 
      // Enter recipient (signer) name and email address 
      string recipientName = "PPradeep"; 
      string recipientEmail = "*****************"; 
      // instantiate api client with appropriate environment 
      string basePath = "https://demo.docusign.net/restapi"; 
      // instantiate a new api client 
      ApiClient apiClient = new ApiClient(basePath); 
      // set client in global config so we don't need to pass it to each API object 
      Configuration.Default.ApiClient = apiClient; 
      string authHeader = "{\"Username\":\"" + Username + "\", \"Password\":\"" + Password + "\", \"IntegratorKey\":\"" + IntegratorKey + "\"}"; 
      Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader); 
      // we will retrieve this from the login() results 
      string accountId = null; 
      AuthenticationApi authApi = new AuthenticationApi(); 
      LoginInformation loginInfo = authApi.Login(); 
      accountId = loginInfo.LoginAccounts[0].AccountId; 

      Console.WriteLine("LoginInformation: {0}", loginInfo.ToJson()); 
      // Read a file from disk to use as a document 
      byte[] fileBytes = File.ReadAllBytes(SignTest1File); 

      EnvelopeDefinition envDef = new EnvelopeDefinition(); 
      envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc"; 
      // Add a document to the envelope 
      Document doc = new Document(); 
      doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes); 
      doc.Name = "TestFile.pdf"; 
      doc.DocumentId = "1"; 

      envDef.Documents = new List<Document>(); 
      envDef.Documents.Add(doc); 

      // Add a recipient to sign the documeent 
      Signer signer = new Signer(); 
      signer.Name = recipientName; 
      signer.Email = recipientEmail; 
      signer.RecipientId = "1"; 

      // must set |clientUserId| to embed the recipient 
      signer.ClientUserId = "1234"; 
      // Create a |SignHere| tab somewhere on the document for the recipient to sign 
      signer.Tabs = new Tabs(); 
      signer.Tabs.SignHereTabs = new List<SignHere>(); 
      SignHere signHere = new SignHere(); 
      signHere.DocumentId = "1"; 
      signHere.PageNumber = "1"; 
      signHere.RecipientId = "1"; 
      signHere.XPosition = "100"; 
      signHere.YPosition = "150"; 
      signer.Tabs.SignHereTabs.Add(signHere); 

      envDef.Recipients = new Recipients(); 
      envDef.Recipients.Signers = new List<Signer>(); 
      envDef.Recipients.Signers.Add(signer); 

      // set envelope status to "sent" to immediately send the signature request 
      envDef.Status = "sent"; 

      // Use the EnvelopesApi to create and send the signature request 
      EnvelopesApi envelopesApi = new EnvelopesApi(); 
      EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef); 

      Console.WriteLine("EnvelopeSummary:\n{0}", JsonConvert.SerializeObject(envelopeSummary)); 



     } //try 
     catch(Exception ex) 
     { 
      Console.WriteLine(ex.Message); 
     } 
     Console.ReadKey(); 
    } 
} 

}

난 당신이-주석 (또는 모두 제거) 코드에서이 줄을하는 것이 좋을 것
+2

코드는 어떻게됩니까? 귀하의 코드가 문서와 일치한다는 것을 어떻게 알 수 있습니까? 질문에 관련 '코드'를 추가하십시오. – 12seconds

+0

생성 된 JSON 요청을 공유 할 수 있습니까? https://support.docusign.com/guides/ndse-user-guide-api-request-logging에 따라 DS에서 API 로깅을 캡처 할 수 있습니다. 내 이해는 당신이 원격 서명 대신 임베디드 서명을 사용하고있는 것일 수 있습니다. DocuSign은 임베디드 서명을위한 전자 메일을 생성하지 않습니다. 서명자에 대한 json 요청에 clientuserId를 추가 한 경우 임베디드 서명을 호출합니다. –

+0

게시 한 코드를 확인하십시오. 답장을 보내 주셔서 감사합니다. –

답변

0

:

signer.ClientUserId = "1234";

ClientUserId을 지정하면 DocuSign에 전자 메일을 보내지 말라고 명령합니다. o 서명자는 DocuSign이 임베디드 수신자로 언급 한 서명자이기 때문에 서명자입니다. ClientUserId을 제거하면 서명자가 원격 수 신자임을 DocuSign에 알리므로 DocuSign은 해당 수취인에게 서명 초대 이메일을 보냅니다.

+0

김 감사합니다. 그것의 작동! 임베디드 클라이언트를 사용하면 전자 메일을 보낼 수 없다는 것을 알지 못합니다. –

+0

기꺼이 도와 드리겠습니다! 이 답변을 "수락 됨"으로 표시하여 나중에 다른 사람들이이 정보로부터 더 많은 혜택을받을 수있게 해 주시겠습니까? 감사! –