-
Notifications
You must be signed in to change notification settings - Fork 0
/
AllowRecipientDelegation.cs
73 lines (63 loc) · 1.89 KB
/
AllowRecipientDelegation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.IO;
using Bulksign.Api;
namespace Bulksign.ApiSamples
{
public class AllowRecipientDelegation
{
public void RunSample()
{
AuthenticationApiModel token = new Authentication().GetAuthenticationModel();
if (string.IsNullOrEmpty(token.Key))
{
Console.WriteLine("Please edit Authentication.cs and set your own API key there");
return;
}
BulksignApiClient client = new BulksignApiClient();
EnvelopeApiModel envelope = new EnvelopeApiModel();
envelope.EnvelopeType = EnvelopeTypeApi.Serial;
envelope.DaysUntilExpire = 10;
envelope.Name = "Test envelope";
//setting this to true will allow the recipient to delegate signing to another person
envelope.AllowRecipientDelegation = true;
envelope.Recipients = new[]
{
new RecipientApiModel(){
Name = "Bulksign Test",
Email = "contact@bulksign.com",
Index = 1,
RecipientType = RecipientTypeApi.Signer
}
};
envelope.Documents = new[]
{
new DocumentApiModel(){
Index = 1,
FileName = "test.pdf",
FileContentByteArray = new FileContentByteArray()
{
ContentBytes = File.ReadAllBytes(Environment.CurrentDirectory + @"\Files\bulksign_test_Sample.pdf")
}
}
};
try
{
BulksignResult<SendEnvelopeResultApiModel> result = client.SendEnvelope(token, envelope);
if (result.IsSuccessful)
{
Console.WriteLine("Access code for recipient " + result.Result.RecipientAccess[0].RecipientEmail + " is " + result.Result.RecipientAccess[0].AccessCode);
Console.WriteLine("Envelope id is : " + result.Result.EnvelopeId);
}
else
{
Console.WriteLine($"Request failed : ErrorCode '{result.ErrorCode}' , Message {result.ErrorMessage}");
}
}
catch (BulksignException bex)
{
//handle failed request here
Console.WriteLine($"Exception {bex.Message}, response is {bex.Response}");
}
}
}
}