我正在尝试使用DocuSign的Send On Behalf Of(SOBO)功能。我读到了它,我知道有两种方法可以做到这一点。使用OAuth获取access_token,然后使用X-DocuSign-Act-As-User或在X-DocuSign-Authentication中使用SendOnBehalfOf元素。
我也想使用DocuSign .NET客户端。从阅读代码我可以看到第一个选项不受支持(OAuth)。所以我选择了通过Account.SOBOUserId属性支持的X-DocuSign-Authentication。
RestSettings.Instance.IntegratorKey = "***";
RestSettings.Instance.DocuSignAddress = "http://demo.docusign.net";
RestSettings.Instance.WebServiceUrl = RestSettings.Instance.DocuSignAddress + "/restapi/v2";
RestSettings.Instance.RestTracing = true;
// credentials for sending account
Account account = new Account();
account.Email = "a@yopmail.com";
account.Password = "****";
account.SOBOUserId = "b@yopmail.com";
// make the Login API call
bool result = account.Login();
Envelope envelope = new Envelope();
envelope.Login = account; // assign account info from above
envelope.Recipients = new Recipients()
{
signers = new Signer[] { new Signer() {
email = "****@hotmail.com",
name = "Test",
routingOrder = "1",
recipientId = "1"
}}
};
// "sent" to send immediately, "created" to save envelope as draft
envelope.Status = "sent";
envelope.EmailSubject = "DocuSign Test document";
// create a new DocuSign envelope (i.e. server side)
result = envelope.Create(@"C:\temp\dummyPDF.pdf");
我在DocuSign UI中做了必要的设置,允许代表b@yopmail.com发送,如文档中所示。但是,当我运行此代码时,接收方收到来自a@yopmail.com的电子邮件,而不是b@yopmail.com。好像SOBO根本不起作用。
我的问题是我可以使用DocuSign .Net客户端使用SOBO功能吗?
感谢。
答案 0 :(得分:0)
似乎由于DocuSign .NET Client中的缺陷,这不起作用。如果您查看github.com/docusign/DocuSign-.NET-Client/blob/master/...方法SetLogonCredentials - 如果AuthorizationFormat是Xml,您将看到SendOnBehalfOf元素未添加到授权标头中。我做了一个改变,强制它到Json,它现在正在工作
答案 1 :(得分:0)
Envelope.Create(filepath)
方法未正确使用SOBOUserID字段。由于其他优先级,它只是尚未添加到代码中。我已经添加了一个拉取请求来解决这个问题,但同时你可以按照我的方式修复它,或者使用其他使用Envelope.Create()
数组而不是文件路径的byte
方法。
请在此处查看问题和解决方案: https://github.com/docusign/DocuSign-.NET-Client/issues/69