如何按顺序将文档草稿信封发送给收件人?
How to send docusign draft envelope to recipient in sequence?
这是我用来将草稿信封发送给签名处理程序的完整流程,以便签名处理程序可以在发送给其他签名者收件人之前进行修改:
//获取访问令牌:
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";
已添加
关于
but still editor is not able to do changes to envelope request. It says not have sufficient permission to do changes even though he has DS Admin profile permission. What I am trying to do is, envelope should go to editor's draft (should able to do modification) and should be able to do modification.
很遗憾,我对 editor
收件人类型没有任何经验。 (我不清楚你所说的“修改”信封是什么意思——更改文件?更改其他收件人?其他?
检查编辑者使用的姓名和电子邮件地址是否与他们用于登录 DocuSign 的姓名和电子邮件地址完全相同。
更重要的是:
仅使用 DocuSign 网络应用程序尝试您的工作流程(没有 API)。查看信封发出后,小编可以为所欲为
然后使用 API 日志记录来准确查看 DocuSign 网络应用程序如何设置编辑器收件人的属性。然后,您可以在 API 应用程序中复制它。
这是我用来将草稿信封发送给签名处理程序的完整流程,以便签名处理程序可以在发送给其他签名者收件人之前进行修改:
//获取访问令牌:
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";
已添加
关于
but still editor is not able to do changes to envelope request. It says not have sufficient permission to do changes even though he has DS Admin profile permission. What I am trying to do is, envelope should go to editor's draft (should able to do modification) and should be able to do modification.
很遗憾,我对 editor
收件人类型没有任何经验。 (我不清楚你所说的“修改”信封是什么意思——更改文件?更改其他收件人?其他?
检查编辑者使用的姓名和电子邮件地址是否与他们用于登录 DocuSign 的姓名和电子邮件地址完全相同。
更重要的是:
仅使用 DocuSign 网络应用程序尝试您的工作流程(没有 API)。查看信封发出后,小编可以为所欲为
然后使用 API 日志记录来准确查看 DocuSign 网络应用程序如何设置编辑器收件人的属性。然后,您可以在 API 应用程序中复制它。