我必须将配置对象传递给EnvelopesApi构造函数。这就成功了。
string authHeader = "{\"Username\":\"" + DocuSignCredentials.Username + "\", \"Password\":\"" + DocuSignCredentials.Password + "\", \"IntegratorKey\":\"" + DocuSignCredentials.IntegratorKey + "\"}";
Configuration configuration = new Configuration(new ApiClient("https://demo.docusign.net/restapi"));
if (configuration.DefaultHeader.ContainsKey("X-DocuSign-Authentication"))
{
configuration.DefaultHeader.Remove("X-DocuSign-Authentication");
}
configuration.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
var envelopesApi = new EnvelopesApi(configuration);