2015-10-14 38 views
0

我已經從模板創建DocuSign信封。我已將信封ID存儲用於未來的操作。使用此信封ID我只能檢索我創建的信封,但我也需要模板ID。有沒有辦法從信封或FolderItems中檢索模板ID?請幫忙:(如何從docusign信封中檢索模板ID

回答

0

我不知道如果你從模板創建一個信封,如果templateId被保存爲信封中任何位置的元數據(我不相信它),因此你可以簡單地做到這一點自己 - 嘗試使用信封自定義字段templateId存儲在創建的時候,那templateId隨後將在該信封被存儲爲元數據在整個它的生命週期

不要在的DocuSign API文檔搜索找到。詳細瞭解「信封自定義字段」例如,here是如何創建它們的頁面

0

謝謝@Ergin。我試圖實現你的想法,它正在工作。但是我所做的還有其他一些問題。我正在分享我的代碼的一些部分。

//Getting available folder list of my DocuSign account. 
DocuSignServiceRef.AvailableFolders folders = DocuSignHelper.GetDocuSignServiceClient().GetFolderList(new DocuSignServiceRef.FoldersFilter { AccountId = DocuSignHelper.UserID }); 

//Creating a FolderFilter item to get folder items using this filter. 
DocuSignServiceRef.FolderFilter filter = new DocuSignServiceRef.FolderFilter(); 
filter.AccountId = DocuSignHelper.UserID; 
filter.FolderTypeInfo = new DocuSignServiceRef.FolderTypeInfo(); 
filter.FolderTypeInfo = folders.Folders[1].FolderTypeInfo; //Filter Send Items 

//Getting sent items 
DocuSignServiceRef.FolderResults results = DocuSignHelper.GetDocuSignServiceClient().GetFolderItems(filter); 

if (results != null && results.ResultSetSize > 0) 
{ 
    foreach (DocuSignServiceRef.FolderItem item in results.FolderItems) 
    { 
     foreach (DocuSignServiceRef.RecipientStatus recipient in item.RecipientStatuses) 
     { 
      //Filtering items by Recipient 
      if (recipient.Email.Equals(RecipientEmail)) 
      { 
       //Getting envelope of the folder item 
       DocuSignServiceRef.Envelope sentEnvelope = DocuSignHelper.GetDocuSignServiceClient().RequestEnvelope(item.EnvelopeId, false); 
       if (sentEnvelope.CustomFields != null) 
       { 
        //Checking envelope's custom fields for template id 
        foreach (DocuSignServiceRef.CustomField customField in sentEnvelope.CustomFields) 
        { 
         if (string.Equals(customField.Name, "TemplateID")) 
         { 
          if (customField.Value == "{CurrentTemplateID}") 
          { 
           HasAlreadySignedSameTemplate = true; 
           //I will not request the recipient for another signature on same template. 
          } 
         } 
        } 
       } 
      } 
     } 
    } 
} 

上述代碼適用於我。但是,加載所有已發送的項目需要花費太多時間。我看不到在FolderFilter中設置收件人信息的方法。如果我可以在收件人的電子郵件中首次設置收件人的電子郵件,那麼我將爲我保存時間。否則,該代碼將無法使用。

你對修改我的實現有任何想法嗎?

0

如果您正在使用REST呼叫創建信封,則可以通過呼叫檢索信息templatesv2/accounts/:accountId/envelopes/:envelopeId/templates 已經去除in the envelope tab。我注意到使用SOAP sdk創建的信封沒有填充此信息。

相關問題