0

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

//获取访问令牌:

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, RecipientId = routingOrder.ToString(), 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);
}

但是每次在管理员帐户草稿下的草稿信封而不是签名处理程序(在这种情况下是编辑器)。我做错了什么?

4

1 回答 1

1

您希望editor收件人管理一些后来的收件人。没关系。

但是直到它处于状态editor时才会收到信封。sent您目前持有的信封created状态为草稿。

尝试改变

env.Status = "created";

env.Status = "sent";

添加

关于

但是编辑器仍然无法对信封请求进行更改。它说即使他拥有 DS Admin profile 权限,也没有足够的权限进行更改。我想做的是,信封应该去编辑草稿(应该可以修改)并且应该可以修改。

editor不幸的是,我对收件人类型没有任何经验。(我不清楚你所说的“修改”信封是什么意思——改变文件?改变其他收件人?还有别的吗?

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

更重要的是:

仅使用 DocuSign 网络应用程序(无 API)尝试您的工作流程。检查信封发送后,编辑可以为所欲为。

然后使用 API 日志记录准确查看 DocuSign Web 应用程序如何设置编辑器收件人的属性。然后,您可以在您的 API 应用程序中复制它。

于 2020-09-07T19:31:05.607 回答