如何按顺序将docusign草稿信封发送给收件人? 更重要的是:

问题描述

这是我用来将草稿信封发送给签名处理程序的完整流程,以便签名处理程序可以在发送给其他签名人收件人之前进行修改

//获取访问令牌:

private void GetAccesstoken()
 {
    var apiclient = new apiclient();
    string ik = integrationKey;
    string userId = userId;
    string authServer = authServer;
    string fileContents = await FileHelper.ReadFileContentAsstring(RSAKeyPemFile);

    //Request for access token
    OAuth.OAuthToken authToken = apiclient.RequestJWTUserToken(ik,userId,authServer,Encoding.UTF8.GetBytes(fileContents),1);


    //Get userinfo for AccountId and BaseURI
    string accesstoken = authToken.access_token;
    apiclient.SetoAuthBasePath(authServer);
    OAuth.UserInfo userInfo = apiclient.GetUserInfo(authToken.access_token);
    Account acct = null;

    var accounts = userInfo.Accounts;
    {
        acct = accounts.FirstOrDefault(a => a.IsDefault == "true");
    }
    string accountId = acct.AccountId;
    string baseUri = acct.BaseUri + "/restapi";

    //Set details to configuration object which would be used for sending envelope request
    this.accesstoken = accesstoken;
    this.accountId = accountId;
    this.baseUri = baseUri;
}

//创建信封

private EnvelopeDeFinition MakeEnvelope()
{

    // create the envelope deFinition
    EnvelopeDeFinition env = new EnvelopeDeFinition();
    env.EmailSubject = "Please sign this document";

    //Get document extension
    Document documentToSign = new Document
    {
        DocumentBase64 = Convert.ToBase64String(documentBytes),Name = documentName,FileExtension = documentExtension,DocumentId = documentId
    };

    // The order in the docs array determines the order in the envelope
    env.Documents = new List<Document> { documentToSign };

    var routingOrder = 1;
    var signatureHandler = new Editor
    {
        Email = signatureHandler.mail,Name = signatureHandler.displayName,RecipientId = routingOrder.ToString(),RoutingOrder = routingOrder.ToString()
    };

    routingOrder++;

    List<Signer> signers = new List<Signer>();
    foreach (var signer in signerList)
    {
        signers.Add(new Signer { Name = signerList.displayName,Email = signerList.mail,RoleName = signerList.jobTitle,RoutingOrder = routingOrder.ToString() });
        routingOrder++;
    }

    // Add the recipients to the envelope object
    Recipients recipients = new Recipients
    {
        Editors = new List<Editor> { signatureHandler },Signers = signers
    };

    //Attache all recipients to envelope
    env.Recipients = recipients;

    env.EventNotification = eventNotification;

    env.Status = "created";

    return env;
}

//发送信封草稿

public void SendEnvelope()
{
    EnvelopeDeFinition env = MakeEnvelope();
    var config = new Configuration(baseUri);

    var apiclient = new apiclient(baseUri);
    apiclient.Configuration = config;
            
    EnvelopesApi envelopesApi = new EnvelopesApi(apiclient);
    EnvelopeSummary result = await envelopesApi.CreateEnvelopeAsync(accountId,env);
}

但是,每当草稿信封进入admin帐户草稿下,而不是签署处理程序(在本例中为编辑器)。我做错了什么?

解决方法

您希望editor收件人管理一些以后的收件人。很好。

但是editor不会收到信封,直到它处于sent状态。您当前正在将信封保持为created状态(草稿状态)。

尝试更改

env.Status = "created";

env.Status = "sent";

已添加

关于

,但是编辑器仍然无法更改信封请求。它说没有足够的权限进行更改,即使他具有DS Admin个人资料权限也是如此。我想做的是,信封应该转到编辑草稿(应该可以进行修改),并且应该可以进行修改。

很遗憾,我对editor收件人类型没有任何经验。 (而且我不清楚您“修改”信封是什么意思-更改文档?更改其他收件人?还有其他内容吗?

检查编辑器使用的名称和电子邮件地址与登录DocuSign时使用的名称和电子邮件地址完全相同。

更重要的是:

仅使用DocuSign网络应用程序(不使用API​​)试用您的工作流程。发送信封后,请检查编辑器是否可以执行您想要的操作。

然后使用API​​日志记录来准确查看DocuSign Web应用如何设置编辑者收件人的属性。然后,您可以在API应用程序中重复该操作。