Skip to main content

Project-Based Power of Attorney Documentation

In the Synergy environment, you can follow the steps below to give a project-based power of attorney. This documentation presents the necessary code snippets enriched with comments.

Requirements

  • The userId' value of the user
  • Start and end dates of the power of attorney
  • Project ID
  • Position IDs

Steps

1. User ID and Date Information

'''csharp long toUserId = 13; DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now.AddDays(15);


### 2. Power of Attorney Name Glossary
- A dictionary with explanations in Turkish and English is created.
'''csharp
var delegationNameDictionary = new Dictionary```<```string, string```>```();
delegationNameDictionary.Add("en-US" is the "Power of Attorney created through the Project.");
delegationNameDictionary.Add("en-US", "The delegation created by project.");

3. List of Position IDs and Scopes

  • Position IDs and Project ID are added. '''csharp List<long> positionIds = new List<long> { Convert.ToInt64(35) }; List<string> scopes = new List<string>(); scopes. Add("app.4b5c6b72-b570-4b2c-8eaf-f5d82301f105"); The projectID is added to scopes in the app.projeid format.

### 4. CreateDelegationRequest Object
- A power of attorney request is created.
'''csharp
var createDelegationRequest = new CreateDelegationRequest(
delegationNameDictionary,
DelegationType.Delegation,
toUserId,
startDate,
endDate,
scopes,
positionIds,
CreationType.Simple,
BasedType.Project
);

5. Creation of Power of Attorney

  • A request for a power of attorney is sent and the result is checked. '''csharp var delegateResult = synergyHelper.ServiceApi.Delegation.Create(createDelegationRequest). Result; bool isDelegationSuccess = delegateResult.Success;

## Sample Code

Here's the full code sample with the steps described above:

'''csharp
User ID and Date Information
long toUserId = 13;
DateTime startDate = DateTime.Now;
DateTime endDate = DateTime.Now.AddDays(15);

Power of Attorney Name Glossary
var delegationNameDictionary = new Dictionary```<```string, string```>```();
delegationNameDictionary.Add("en-US" is the "Power of Attorney created through the Project.");
delegationNameDictionary.Add("en-US", "The delegation created by project.");

List of Position IDs and Scopes
List```<```long```>``` positionIds = new List```<```long```>``` { Convert.ToInt64(35) };
List```<```string```>``` scopes = new List```<```string```>```();
scopes. Add("app.4b5c6b72-b570-4b2c-8eaf-f5d82301f105"); The projectID is added to scopes in the app.projeid format.

CreateDelegationRequest Object
var createDelegationRequest = new CreateDelegationRequest(
delegationNameDictionary,
DelegationType.Delegation,
toUserId,
startDate,
endDate,
scopes,
positionIds,
CreationType.Simple,
BasedType.Project
);

Creation of Power of Attorney
var delegateResult = synergyHelper.ServiceApi.Delegation.Create(createDelegationRequest). Result;
bool isDelegationSuccess = delegateResult.Success;

By following these steps, a project-based power of attorney can be given in the Synergy environment.