[英]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.
}
}
當前,我的代碼進入我的帳戶,獲取所有文件夾的列表,然后指向“已發送”文件夾。 之后,我查看已發送文件夾中的所有文檔,檢查它們的狀態是否為“完成”,然后查看狀態,進入該文檔並刪除我放置的文本選項卡中的所有信息。在文檔上。
我的問題! 注釋“ //將代碼移到此處”的位置。 刪除所需信息后,我想從“已發送”文件夾(文件夾[1])中移動信封並將其放入“已加載”文件夾(文件夾[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); }
我找到了解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.