> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.TargetsAgent

# \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent">\</a> Class TargetsAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Agent lets you configure targets, and retrieve targets

```csharp theme={null}
public class TargetsAgent : AgentBase, ITargetsAgent, IAgentBase, IDisposable
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AgentBase](SuperOffice.WebApi.Agents.AgentBase.md) ←
[TargetsAgent](SuperOffice.WebApi.Agents.TargetsAgent.md)

#### Implements

[ITargetsAgent](SuperOffice.WebApi.Agents.ITargetsAgent.md),
[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

#### Inherited Members

[AgentBase.\_json](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__json),
[AgentBase.\_binary](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__binary),
[AgentBase.\_config](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__config),
[AgentBase.\_client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__client),
[AgentBase.\_disposeClient](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__disposeClient),
[AgentBase.Merge(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_),
[AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.ParseAuthorization(IAuthorization)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_),
[AgentBase.CancelRequest()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_CancelRequest),
[AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequest(HttpRequestMessage, RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_),
[AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_),
[AgentBase.ParseResponse\<T\&gt;(HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_),
[AgentBase.Finally(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_),
[AgentBase.Dispose()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Dispose),
[AgentBase.Configuration](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Configuration),
[AgentBase.Client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Client),
[AgentBase.HasRunningRequest](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest),
[AgentBase.ClientCancellationTokenSource](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource),
[AgentBase.ProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ProgressListener),
[AgentBase.UploadProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener),
[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

\<pre>\<code class="lang-csharp">using SuperOffice.WebApi;
using SuperOffice.WebApi.Agents;

var mySession = new WebApiOptions("[http://example.com/super/api](http://example.com/super/api)");
mySession.Authorization = new AuthorizationUsernamePassword("user", "pass");
using (TargetsAgent agent = new TargetsAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_\_ctor\_System\_Net\_Http\_HttpClient\_">\</a> TargetsAgent(HttpClient)

Constructor: Agent lets you configure targets, and retrieve targets

```csharp theme={null}
public TargetsAgent(HttpClient httpClient)
```

#### Parameters

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Use this HTTP client instead of making own HttpClient instance.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> TargetsAgent(WebApiOptions, HttpClient)

Constructor: Agent lets you configure targets, and retrieve targets

```csharp theme={null}
public TargetsAgent(WebApiOptions options, HttpClient httpClient = null)
```

#### Parameters

`options` [WebApiOptions](SuperOffice.WebApi.WebApiOptions.md)

Base URL and authentication values.

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Optional: Use this HTTP client instead of making a new one.

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentAsync(RequestOptions)

Set default values into a new TargetAssignment.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<TargetAssignment> CreateDefaultTargetAssignmentAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\&gt;

A blank TargetAssignment

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentForCompanyAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentForCompanyAsync(RequestOptions)

Returns a default target assignment for the owner company.

```csharp theme={null}
public Task<TargetAssignment> CreateDefaultTargetAssignmentForCompanyAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\&gt;

Default target assignment for the owner company.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentForCompanyWithDimensionAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentForCompanyWithDimensionAsync(int, RequestOptions)

Returns a default target assignment for the owner company, for the specified dimension.

```csharp theme={null}
public Task<TargetAssignment[]> CreateDefaultTargetAssignmentForCompanyWithDimensionAsync(int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The dimension id to use.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\[]\&gt;

Default target assignments for the owner company.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentForCompanyWithYearAndDimensionAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentForCompanyWithYearAndDimensionAsync(int, int, RequestOptions)

Returns a default target assignment for the owner company, for the specified year and dimension.

```csharp theme={null}
public Task<TargetAssignment[]> CreateDefaultTargetAssignmentForCompanyWithYearAndDimensionAsync(int year, int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`year` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The year from which to retrieve dimension data.

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The dimension id to use.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\[]\&gt;

Default target assignments for the owner company.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentForUserGroupAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentForUserGroupAsync(int, RequestOptions)

Returns a default target assignment for the specified usergroup.

```csharp theme={null}
public Task<TargetAssignment[]> CreateDefaultTargetAssignmentForUserGroupAsync(int userGroupId, RequestOptions requestOptions = null)
```

#### Parameters

`userGroupId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the UserGroup

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\[]\&gt;

Default target assignment for the specified usergroup.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentForUserGroupWithDimensionAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentForUserGroupWithDimensionAsync(int, int, RequestOptions)

Returns a default target assignment for the specified usergroup, for the specified dimension.

```csharp theme={null}
public Task<TargetAssignment[]> CreateDefaultTargetAssignmentForUserGroupWithDimensionAsync(int userGroupId, int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`userGroupId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the UserGroup

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The dimension id to use.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\[]\&gt;

Default target assignment for the specified usergroup.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetAssignmentForUserGroupWithYearAndDimensionAsync\_System\_Int32\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetAssignmentForUserGroupWithYearAndDimensionAsync(int, int, int, RequestOptions)

Returns a default target assignment for the specified usergroup, for the specified year and dimension.

```csharp theme={null}
public Task<TargetAssignment[]> CreateDefaultTargetAssignmentForUserGroupWithYearAndDimensionAsync(int userGroupId, int year, int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`userGroupId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the UserGroup

`year` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The year from which to retrieve dimension data.

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The dimension id to use.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\[]\&gt;

Default target assignment for the specified usergroup.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetDimensionAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetDimensionAsync(RequestOptions)

Set default values into a new TargetDimension.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<TargetDimension> CreateDefaultTargetDimensionAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetDimension](SuperOffice.WebApi.Data.TargetDimension.md)\&gt;

A blank TargetDimension

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetGroupAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetGroupAsync(RequestOptions)

Set default values into a new TargetGroup.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<TargetGroup> CreateDefaultTargetGroupAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetGroup](SuperOffice.WebApi.Data.TargetGroup.md)\&gt;

A blank TargetGroup

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetRevisionAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetRevisionAsync(RequestOptions)

Set default values into a new TargetRevision.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<TargetRevision> CreateDefaultTargetRevisionAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetRevision](SuperOffice.WebApi.Data.TargetRevision.md)\&gt;

A blank TargetRevision

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_CreateDefaultTargetRevisionHistoryAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultTargetRevisionHistoryAsync(RequestOptions)

Set default values into a new TargetRevisionHistory.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
public Task<TargetRevisionHistory> CreateDefaultTargetRevisionHistoryAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetRevisionHistory](SuperOffice.WebApi.Data.TargetRevisionHistory.md)\&gt;

A blank TargetRevisionHistory

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_DeleteTargetDimensionAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteTargetDimensionAsync(int, RequestOptions)

Deletes the TargetDimension

```csharp theme={null}
public Task DeleteTargetDimensionAsync(int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the TargetDimension

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_DeleteTargetGroupAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteTargetGroupAsync(int, RequestOptions)

Deletes the TargetGroup

```csharp theme={null}
public Task DeleteTargetGroupAsync(int targetGroupId, RequestOptions requestOptions = null)
```

#### Parameters

`targetGroupId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the TargetGroup

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_ExportTargetGroupToExcelAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ExportTargetGroupToExcelAsync(int, RequestOptions)

Renders the given targetgroup to excel, and returns the path to the temporary file.

```csharp theme={null}
public Task<ExportArchiveResult> ExportTargetGroupToExcelAsync(int targetGroupId, RequestOptions requestOptions = null)
```

#### Parameters

`targetGroupId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The id of the targetgroup to be rendered to excel.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ExportArchiveResult](SuperOffice.WebApi.Data.ExportArchiveResult.md)\&gt;

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetAssignmentForYearAndDimensionAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_TargetEntityType\_SuperOffice\_WebApi\_Data\_TargetLevel\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetAssignmentForYearAndDimensionAsync(int, TargetEntityType, TargetLevel, int, int, RequestOptions)

Returns the target assignment for the specified year, entity type and dimension.

```csharp theme={null}
public Task<TargetAssignment> GetTargetAssignmentForYearAndDimensionAsync(int targetYear, TargetEntityType entityType, TargetLevel targetLevel, int id, int dimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`targetYear` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Targeted year

`entityType` [TargetEntityType](SuperOffice.WebApi.Data.TargetEntityType.md)

Targeted entity type

`targetLevel` [TargetLevel](SuperOffice.WebApi.Data.TargetLevel.md)

The level of target the id is referring to.

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Contact, UserGroup or Associate id.

`dimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of dimension.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\&gt;

Target assignment for a specified entity for year and entity type. Null if not found.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetAssignmentForYearAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_TargetEntityType\_SuperOffice\_WebApi\_Data\_TargetLevel\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetAssignmentForYearAsync(int, TargetEntityType, TargetLevel, int, RequestOptions)

Returns the target assignment for the specified year and entity type.

```csharp theme={null}
public Task<TargetAssignment> GetTargetAssignmentForYearAsync(int targetYear, TargetEntityType entityType, TargetLevel targetLevel, int id, RequestOptions requestOptions = null)
```

#### Parameters

`targetYear` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Targeted year

`entityType` [TargetEntityType](SuperOffice.WebApi.Data.TargetEntityType.md)

Targeted entity type

`targetLevel` [TargetLevel](SuperOffice.WebApi.Data.TargetLevel.md)

The level of target the id is referring to.

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Contact, UserGroup or Associate id.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetAssignment](SuperOffice.WebApi.Data.TargetAssignment.md)\&gt;

Target assignment for a specified entity for year and entity type. Null if not found.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetDimensionAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetDimensionAsync(int, RequestOptions)

Gets a specific TargetDimension object.

```csharp theme={null}
public Task<TargetDimension> GetTargetDimensionAsync(int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the TargetDimension object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetDimension](SuperOffice.WebApi.Data.TargetDimension.md)\&gt;

TargetDimension

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetDimensionsForEntityTypeAsync\_SuperOffice\_WebApi\_Data\_TargetEntityType\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetDimensionsForEntityTypeAsync(TargetEntityType, RequestOptions)

Returns the target dimensions for the given entity type.

```csharp theme={null}
public Task<TargetDimension[]> GetTargetDimensionsForEntityTypeAsync(TargetEntityType entityType, RequestOptions requestOptions = null)
```

#### Parameters

`entityType` [TargetEntityType](SuperOffice.WebApi.Data.TargetEntityType.md)

Targeted entity type

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetDimension](SuperOffice.WebApi.Data.TargetDimension.md)\[]\&gt;

Target dimensions for year and entity type.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetGroupAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetGroupAsync(int, RequestOptions)

Gets a specific TargetGroup object.

```csharp theme={null}
public Task<TargetGroup> GetTargetGroupAsync(int targetGroupId, RequestOptions requestOptions = null)
```

#### Parameters

`targetGroupId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the TargetGroup object

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetGroup](SuperOffice.WebApi.Data.TargetGroup.md)\&gt;

TargetGroup

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetGroupForYearAndDimensionAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetGroupForYearAndDimensionAsync(int, int, RequestOptions)

Returns the target group for the specified year and dimension.

```csharp theme={null}
public Task<TargetGroup> GetTargetGroupForYearAndDimensionAsync(int targetYear, int dimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`targetYear` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Targeted year

`dimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Targeted dimension Id

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetGroup](SuperOffice.WebApi.Data.TargetGroup.md)\&gt;

Target Group for year and dimension.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetGroupForYearAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_TargetEntityType\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetGroupForYearAsync(int, TargetEntityType, RequestOptions)

Returns the target group for the specified year and entity type.

```csharp theme={null}
public Task<TargetGroup> GetTargetGroupForYearAsync(int targetYear, TargetEntityType entityType, RequestOptions requestOptions = null)
```

#### Parameters

`targetYear` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Targeted year

`entityType` [TargetEntityType](SuperOffice.WebApi.Data.TargetEntityType.md)

Targeted entity type

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetGroup](SuperOffice.WebApi.Data.TargetGroup.md)\&gt;

Target Group for year and entity type.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetGroupIdsAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetGroupIdsAsync(int, RequestOptions)

Returns ids of the target groups that use this dimension.

```csharp theme={null}
public Task<int[]> GetTargetGroupIdsAsync(int targetDimensionId, RequestOptions requestOptions = null)
```

#### Parameters

`targetDimensionId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The target dimension id

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[int](https://learn.microsoft.com/dotnet/api/system.int32)\[]\&gt;

Target group ids.

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_GetTargetRevisionHistoryAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetTargetRevisionHistoryAsync(int, RequestOptions)

Returns the revision history for a given TargetAssignmentInfo in chronological order.

```csharp theme={null}
public Task<TargetRevisionHistory> GetTargetRevisionHistoryAsync(int targetAssignmentInfoId, RequestOptions requestOptions = null)
```

#### Parameters

`targetAssignmentInfoId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Target assignment info id

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetRevisionHistory](SuperOffice.WebApi.Data.TargetRevisionHistory.md)\&gt;

Target revision history for the given TargetAssignmentInfo

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_SaveTargetDimensionAsync\_SuperOffice\_WebApi\_Data\_TargetDimension\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveTargetDimensionAsync(TargetDimension, RequestOptions)

Updates the existing TargetDimension or creates a new TargetDimension if the id parameter is 0.

```csharp theme={null}
public Task<TargetDimension> SaveTargetDimensionAsync(TargetDimension targetDimension, RequestOptions requestOptions = null)
```

#### Parameters

`targetDimension` [TargetDimension](SuperOffice.WebApi.Data.TargetDimension.md)

The TargetDimension that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetDimension](SuperOffice.WebApi.Data.TargetDimension.md)\&gt;

New or updated TargetDimension

### \<a id="SuperOffice\_WebApi\_Agents\_TargetsAgent\_SaveTargetGroupAsync\_SuperOffice\_WebApi\_Data\_TargetGroup\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveTargetGroupAsync(TargetGroup, RequestOptions)

Updates the existing TargetGroup or creates a new TargetGroup if the id parameter is 0.

```csharp theme={null}
public Task<TargetGroup> SaveTargetGroupAsync(TargetGroup targetGroup, RequestOptions requestOptions = null)
```

#### Parameters

`targetGroup` [TargetGroup](SuperOffice.WebApi.Data.TargetGroup.md)

The TargetGroup that is saved.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[TargetGroup](SuperOffice.WebApi.Data.TargetGroup.md)\&gt;

New or updated TargetGroup


## Related topics

- [SuperOffice.WebApi.Data.TargetAssignment](/en/api/reference/webapi/SuperOffice.WebApi.Data.TargetAssignment.md)
- [SuperOffice.WebApi.Data.TargetChange](/en/api/reference/webapi/SuperOffice.WebApi.Data.TargetChange.md)
- [SuperOffice.WebApi.Data.TargetDimension](/en/api/reference/webapi/SuperOffice.WebApi.Data.TargetDimension.md)
- [SuperOffice.WebApi.Data.TargetGroup](/en/api/reference/webapi/SuperOffice.WebApi.Data.TargetGroup.md)
- [SuperOffice.WebApi.Data.TargetRevision](/en/api/reference/webapi/SuperOffice.WebApi.Data.TargetRevision.md)
- [SuperOffice.WebApi.Data.TargetRevisionHistory](/en/api/reference/webapi/SuperOffice.WebApi.Data.TargetRevisionHistory.md)
