Assigning Delegation for Expired Delegatee
Tuesday, March 14, 2023 at 09:58amI have a situation where I set delegation to a sender using code that has worked in the past. The indication was that the delegation was successful BUT it didn't work. Looking in the UI I figured out that the users had used delegation before and it has expired. when I reassigned delegationI need to update the expiration date. What should I do to fix this Remove the delegation so when I assign the new one it won't have an expiration date OR assign the delegation with a new expiration date? (I'm not sure what will work and don't see how to update the expiration date)
I think the delegation was done using REST calls instead of of the .NET, which I could use if it makes for an easier solution.
Reply to: Assigning Delegation for Expired Delegatee
Tuesday, March 14, 2023 at 10:27amHi Richard,
To extend the delegate's expiry date, an update call works:
PUT /api/account/delegates/{delegatee's sender id}
[
{
"expiryDate": "2023-03-25T03:59:59.999Z",
"id": "{delegate's sender id}"
}
]
Before OSS introduced the delegation expiration date, I believe the payload only includes a list of delegate's id, e.g. ["delegateSenderId1","delegateSenderId2", "delegateSenderId3"]
.NET sdk should also support this model change (example code here), the code should look like below:
Sender retrievedSender10 = ossClient.AccountService.GetSender("delegate's sender id");
DelegationUser delegationUser10 = DelegationUserBuilder.NewDelegationUser(retrievedSender10).WithExpiryDate(DateTime.Now.AddHours(1)).Build();
List<DelegationUser> delegates = new List<DelegationUser>();
delegates.Add(delegationUser10);
ossClient.AccountService.updateDelegationWithDelegationUsers("delegatee's sender id", delegates);
Let me know how this works for you.
Duo