使用 C# 的 Docusign Move Envelope - 如何将 XML/JSON 请求和 "PUT" 方法转换为工作 C# 代码?
Docusign Move Envelope using C# - How can I turn XML/JSON requests and "PUT" methods into working C# code?
首先,我的代码:
string accountID = loginInfo.LoginAccounts[0].AccountId;
Console.WriteLine("Account ID:" + accountID);
FoldersApi foldApi = new FoldersApi();
var folders = foldApi.List(accountID);
//this is pointing to my "Sent" folder
string folderID = folders.Folders[1].FolderId;
var envID = foldApi.ListItems(accountID, folderID);
foreach (FolderItem fi in envID.FolderItems)
{
EnvelopesApi envApi = new EnvelopesApi();
EnvelopeDocumentsResult docsList = envApi.ListDocuments(accountID, fi.EnvelopeId);
Recipients listRecip = envApi.ListRecipients(accountID, fi.EnvelopeId);
string listOfInfo = "";
Envelope myEnv = envApi.GetEnvelope(accountID, fi.EnvelopeId);
if (myEnv.Status == "completed")
{
foreach (var signer in listRecip.Signers)
{
var listTabs = envApi.ListTabs(accountID, fi.EnvelopeId, signer.RecipientId);
foreach (var tab in listTabs.TextTabs)
{
//listOfInfo is for each specific document, just to view results
listOfInfo += tab.TabLabel + " - " + tab.Value + " \n ";
//bigString is an aggregation of all documents tab values
bigString += tab.TabLabel + " - " + tab.Value + " \n ";
}
Console.WriteLine("Stop here");//breakpoint
}
//Move code should go here.
}
}
目前我的代码进入我的帐户,获取所有文件夹的列表,然后我指向我的 "Sent" 文件夹。之后,我查看已发送文件夹中的所有文档,检查它们的状态是否为 "completed",如果是,则转到 "into" 该文档并删除文本选项卡中的所有信息我已经放在文件上了。
回答我的问题!
评论“//移动代码应该放在这里。”在我删除了我需要的信息后,我想从我的 "Sent" 文件夹(文件夹[1])中移动一个信封并将其放入我的 "Loaded" 文件夹(文件夹[3])中。
我已评论:https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Move%20Envelope.htm
但我无法理解如何将 XML/JSON 请求和 "PUT" 方法转换为工作 C# 代码。
如有任何帮助,我们将不胜感激。
谢谢,
-凯尔。
更新代码。
Console.WriteLine("Account ID:" + accountID);
FoldersApi foldApi = new FoldersApi();
//create fr object
FoldersRequest fr = new FoldersRequest();
//instantiate EnvelopeIds string list, to a new string list..
fr.EnvelopeIds = new List<string>();
//get folders
var folders = foldApi.List(accountID);
string sentFolderID = "";
string loadedFolderID = "";
foreach (var fold in folders.Folders)
{//get sent/loaded folder IDs
if (fold.Name == "Sent Items") { sentFolderID = fold.FolderId; }
else if(fold.Name == "Loaded") { loadedFolderID = fold.FolderId; }
}
//list the items in the folder
var envID = foldApi.ListItems(accountID, sentFolderID);
//for each item in the folder...
foreach (FolderItem fi in envID.FolderItems)
{
EnvelopesApi envApi = new EnvelopesApi();
//get a list of documents in the envelope
EnvelopeDocumentsResult docsList = envApi.ListDocuments(accountID, fi.EnvelopeId);
//list recipients
Recipients listRecip = envApi.ListRecipients(accountID, fi.EnvelopeId);
string listOfInfo = "";
Envelope myEnv = envApi.GetEnvelope(accountID, fi.EnvelopeId);
if (myEnv.Status == "completed")
{
foreach (var signer in listRecip.Signers)
{
var listTabs = envApi.ListTabs(accountID, fi.EnvelopeId, signer.RecipientId);
foreach (var tab in listTabs.TextTabs)
{
//get info out of document
listOfInfo += tab.TabLabel + " - " + tab.Value + " \n ";
bigString += tab.TabLabel + " - " + tab.Value + " \n ";
}
Console.WriteLine("Stop here");//breakpoint
}
//add this envelope ID to the list of envelopes to be moved
fr.EnvelopeIds.Add(myEnv.EnvelopeId);
}
}
//move all the envelopes in the list
if (fr.EnvelopeIds.Count >= 1) { foldApi.MoveEnvelopes(accountID, loadedFolderID, fr); }
我找到了解决方案。
首先,我的代码:
string accountID = loginInfo.LoginAccounts[0].AccountId;
Console.WriteLine("Account ID:" + accountID);
FoldersApi foldApi = new FoldersApi();
var folders = foldApi.List(accountID);
//this is pointing to my "Sent" folder
string folderID = folders.Folders[1].FolderId;
var envID = foldApi.ListItems(accountID, folderID);
foreach (FolderItem fi in envID.FolderItems)
{
EnvelopesApi envApi = new EnvelopesApi();
EnvelopeDocumentsResult docsList = envApi.ListDocuments(accountID, fi.EnvelopeId);
Recipients listRecip = envApi.ListRecipients(accountID, fi.EnvelopeId);
string listOfInfo = "";
Envelope myEnv = envApi.GetEnvelope(accountID, fi.EnvelopeId);
if (myEnv.Status == "completed")
{
foreach (var signer in listRecip.Signers)
{
var listTabs = envApi.ListTabs(accountID, fi.EnvelopeId, signer.RecipientId);
foreach (var tab in listTabs.TextTabs)
{
//listOfInfo is for each specific document, just to view results
listOfInfo += tab.TabLabel + " - " + tab.Value + " \n ";
//bigString is an aggregation of all documents tab values
bigString += tab.TabLabel + " - " + tab.Value + " \n ";
}
Console.WriteLine("Stop here");//breakpoint
}
//Move code should go here.
}
}
目前我的代码进入我的帐户,获取所有文件夹的列表,然后我指向我的 "Sent" 文件夹。之后,我查看已发送文件夹中的所有文档,检查它们的状态是否为 "completed",如果是,则转到 "into" 该文档并删除文本选项卡中的所有信息我已经放在文件上了。
回答我的问题! 评论“//移动代码应该放在这里。”在我删除了我需要的信息后,我想从我的 "Sent" 文件夹(文件夹[1])中移动一个信封并将其放入我的 "Loaded" 文件夹(文件夹[3])中。
我已评论:https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Move%20Envelope.htm
但我无法理解如何将 XML/JSON 请求和 "PUT" 方法转换为工作 C# 代码。
如有任何帮助,我们将不胜感激。 谢谢,
-凯尔。
更新代码。
Console.WriteLine("Account ID:" + accountID);
FoldersApi foldApi = new FoldersApi();
//create fr object
FoldersRequest fr = new FoldersRequest();
//instantiate EnvelopeIds string list, to a new string list..
fr.EnvelopeIds = new List<string>();
//get folders
var folders = foldApi.List(accountID);
string sentFolderID = "";
string loadedFolderID = "";
foreach (var fold in folders.Folders)
{//get sent/loaded folder IDs
if (fold.Name == "Sent Items") { sentFolderID = fold.FolderId; }
else if(fold.Name == "Loaded") { loadedFolderID = fold.FolderId; }
}
//list the items in the folder
var envID = foldApi.ListItems(accountID, sentFolderID);
//for each item in the folder...
foreach (FolderItem fi in envID.FolderItems)
{
EnvelopesApi envApi = new EnvelopesApi();
//get a list of documents in the envelope
EnvelopeDocumentsResult docsList = envApi.ListDocuments(accountID, fi.EnvelopeId);
//list recipients
Recipients listRecip = envApi.ListRecipients(accountID, fi.EnvelopeId);
string listOfInfo = "";
Envelope myEnv = envApi.GetEnvelope(accountID, fi.EnvelopeId);
if (myEnv.Status == "completed")
{
foreach (var signer in listRecip.Signers)
{
var listTabs = envApi.ListTabs(accountID, fi.EnvelopeId, signer.RecipientId);
foreach (var tab in listTabs.TextTabs)
{
//get info out of document
listOfInfo += tab.TabLabel + " - " + tab.Value + " \n ";
bigString += tab.TabLabel + " - " + tab.Value + " \n ";
}
Console.WriteLine("Stop here");//breakpoint
}
//add this envelope ID to the list of envelopes to be moved
fr.EnvelopeIds.Add(myEnv.EnvelopeId);
}
}
//move all the envelopes in the list
if (fr.EnvelopeIds.Count >= 1) { foldApi.MoveEnvelopes(accountID, loadedFolderID, fr); }
我找到了解决方案。