如何将文档草稿信封按顺序发送给收件人



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

//获取访问令牌:

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);
}

但每次草稿信封都在管理员帐户草稿下,而不是签名处理程序(在本例中是编辑器(。我做错了什么?

您想要一个editor收件人来管理一些稍后的收件人。没关系。

但是editor在处于sent状态之前不会接收到信封。您目前持有created状态的信封,该信封为草稿。

尝试更改

env.Status = "created";

env.Status = "sent";

已添加

关于

但编辑器仍然无法更改信封请求。它说,即使他拥有DS管理员配置文件权限,也没有足够的权限进行更改。我想做的是,信封应该放在编辑的草稿里(应该能做修改(,并且应该能做更改。

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

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

更重要的是:

只需使用DocuSign web应用程序(无API(即可尝试您的工作流程。检查一下信封寄出后,编辑可以做你想做的事。

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

最新更新