Skip to content

Commit fd11734

Browse files
committed
added delete folder method
1 parent 5b976e8 commit fd11734

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

launcher-csharp/eSignature/Controllers/DeleteRestoreEnvelope.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ namespace DocuSign.CodeExamples.ESignature.Controllers
1616
[Route("Eg045")]
1717
public class DeleteRestoreEnvelope : EgController
1818
{
19-
private const string DeleteFolderId = "recyclebin";
20-
2119
private const string SentItemsFolderName = "Sent Items";
2220

2321
public DeleteRestoreEnvelope(DsConfiguration config, LauncherTexts launcherTexts, IRequestItemsService requestItemsService)
@@ -52,12 +50,11 @@ public IActionResult DeleteEnvelopeAction(string envelopeId)
5250

5351
this.RequestItemsService.EnvelopeId = envelopeId;
5452

55-
global::ESignature.Examples.DeleteRestoreEnvelope.MoveEnvelopeToFolder(
53+
global::ESignature.Examples.DeleteRestoreEnvelope.DeleteEnvelope(
5654
accessToken,
5755
basePath,
5856
accountId,
59-
envelopeId,
60-
DeleteFolderId);
57+
envelopeId);
6158

6259
this.ViewBag.h1 = this.CodeExampleText.ExampleName;
6360
this.ViewBag.ConfirmAdditionalLink = nameof(this.GetRestoreEnvelope);

launcher-csharp/eSignature/Examples/DeleteRestoreEnvelope.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,35 @@ namespace ESignature.Examples
1111

1212
public class DeleteRestoreEnvelope
1313
{
14+
private const string DeleteFolderId = "recyclebin";
15+
16+
/// <summary>
17+
/// Delete envelope
18+
/// </summary>
19+
/// <param name="accessToken">Access Token for API call (OAuth)</param>
20+
/// <param name="basePath">BasePath for API calls (URI)</param>
21+
/// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
22+
/// <param name="envelopeId">Envelope ID</param>
23+
/// <returns>The folders response</returns>
24+
public static FoldersResponse DeleteEnvelope(
25+
string accessToken,
26+
string basePath,
27+
string accountId,
28+
string envelopeId)
29+
{
30+
var docusignClient = new DocuSignClient(basePath);
31+
docusignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
32+
33+
FoldersApi foldersApi = new FoldersApi(docusignClient);
34+
35+
var foldersRequest = new FoldersRequest
36+
{
37+
EnvelopeIds = new List<string> { envelopeId },
38+
};
39+
40+
return foldersApi.MoveEnvelopes(accountId, DeleteFolderId, foldersRequest);
41+
}
42+
1443
/// <summary>
1544
/// Moves envelope to a different folder
1645
/// </summary>

0 commit comments

Comments
 (0)