docusignapi - Docusign .NET Sdk Create document and get recipient view (Embed signing) (ACCOUNT_NOT_AUTHORIZED_FOR_ENVELOPE) -
i'm trying create envelope , recipient url further processing. getting rest error "account_not_authorized_for_envelope".
string recipientemail = "123@123.com"; string recipientname = "123"; string accountemail = "myuser@mydomain.com"; string accountpassword = "mypassword"; string documentpath = @"c:\users\...."; ; var account = new account(); account.email = accountemail; account.password = accountpassword; var result = account.login(); if (!result) return; var envelope = new envelope(); envelope.login = account; envelope.recipients = new recipients() { signers = new [] { new signer() { email = recipientemail, name = recipientname, recipientid = "1", clientuserid = "777" } } }; rsult = envelope.create(documentpath); if(!result)return; result = envelope.getrecipientview("mydomain");
rest api
here code example :
github.com/kosmur/docusigntestwithproblems
you can not use free trial accounts (which created through www.docusign.com) api. need use free developer sandbox created through docusign developer center
https://www.docusign.com/devcenter
additionally, don't believe following correct pattern embedded signing flow. need create envelope first (i.e. docusign server side) before can request signing url. see in github code instantiating envelope object don't see call create one.
if @ examples.cs
in root level of docusign .net client , scroll down example #8 you'll see how references existing envelope, i.e.
//========================================================================================== // *** walkthrough #8 - embedded signing //========================================================================================== private void embeddedsigning() { //***************************************************************** // enter values following variables! //***************************************************************** string accountemail = "***"; string accountpassword = "***"; string envelopeid = "***"; string recipientemail = "***"; string recipientname = "***"; //***************************************************************** // user credentials account account = new account(); account.email = accountemail; account.password = accountpassword; // make login call (retrieves baseurl , accountid) bool result = account.login(); if (!result) { console.writeline("login api call failed user {0}.\nerror code: {1}\nmessage: {2}", account.email, account.resterror.errorcode, account.resterror.message); return; } // create envelope object , assign login info envelope envelope = new envelope(); envelope.login = account; // assign envelope id passed in envelope.envelopeid = envelopeid; // add 1 signer (single recipient embedded signing supported in docusign .net client) envelope.recipients = new recipients() { signers = new signer[] { new signer() { email = recipientemail, name = recipientname, recipientid = "1" } } }; // generate recipient view token result = envelope.getrecipientview("http://www.nuget.org/packages/docusign.integration.client.dll/"); if (!result) { if (envelope.resterror != null) { console.writeline("error code: {0}\nmessage: {1}", envelope.resterror.errorcode, envelope.resterror.message); return; } else { console.writeline("error encountered retrieving signing token, please review envelope , recipient data."); return; } } else { // open recipient view (senderviewurl field re-used recipient url) process.start(envelope.senderviewurl); } }
Comments
Post a Comment