> ## 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.ContactAgent

# \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent">\</a> Class ContactAgent

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

Contact (company) data services.

```csharp theme={null}
public class ContactAgent : AgentBase, IContactAgent, IAgentBase, IDisposable
```

#### Inheritance

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

#### Implements

[IContactAgent](SuperOffice.WebApi.Agents.IContactAgent.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 (ContactAgent agent = new ContactAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

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

Constructor: Contact (company) data services.

```csharp theme={null}
public ContactAgent(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\_ContactAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> ContactAgent(WebApiOptions, HttpClient)

Constructor: Contact (company) data services.

```csharp theme={null}
public ContactAgent(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\_ContactAgent\_AddPersonAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_PersonEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddPersonAsync(int, PersonEntity, RequestOptions)

Add a person to the given contact

```csharp theme={null}
public Task<PersonEntity> AddPersonAsync(int contactId, PersonEntity newPersonEntity, RequestOptions requestOptions = null)
```

#### Parameters

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

Contact to add person to

`newPersonEntity` [PersonEntity](SuperOffice.WebApi.Data.PersonEntity.md)

Person object to add

`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)\<[PersonEntity](SuperOffice.WebApi.Data.PersonEntity.md)\&gt;

Updated person object

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_ChangeCountryAsync\_SuperOffice\_WebApi\_Data\_ContactEntity\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ChangeCountryAsync(ContactEntity, int, RequestOptions)

Change country regenerates the default values and localized information such as phone number and address format

```csharp theme={null}
public Task<ContactEntity> ChangeCountryAsync(ContactEntity contactEntity, int toCountryId, RequestOptions requestOptions = null)
```

#### Parameters

`contactEntity` [ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)

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

The country to switch to

`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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_CopyAsync\_System\_Int32\_System\_String\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CopyAsync(int, string, string, bool, RequestOptions)

Copy a contact. Activities and related data will be ignored

```csharp theme={null}
public Task<int> CopyAsync(int sourceContactId, string destinationContactName, string destinationContactDepartment, bool copyPersons, RequestOptions requestOptions = null)
```

#### Parameters

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

The id of the contact to copy

`destinationContactName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the destination contact

`destinationContactDepartment` [string](https://learn.microsoft.com/dotnet/api/system.string)

The department of the destination contact

`copyPersons` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If true, persons will be copied from source contact

`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;

Id of copied contact

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_CreateDefaultContactEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultContactEntityAsync(RequestOptions)

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

```csharp theme={null}
public Task<ContactEntity> CreateDefaultContactEntityAsync(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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

A blank ContactEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_CreateDefaultPreviewContactAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultPreviewContactAsync(RequestOptions)

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

```csharp theme={null}
public Task<PreviewContact> CreateDefaultPreviewContactAsync(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)\<[PreviewContact](SuperOffice.WebApi.Data.PreviewContact.md)\&gt;

A blank PreviewContact

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_CreateNewEntryAsync\_SuperOffice\_WebApi\_Data\_DuplicateEntry\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateNewEntryAsync(DuplicateEntry, RequestOptions)

Creates a new contact based on external duplicate

```csharp theme={null}
public Task<int> CreateNewEntryAsync(DuplicateEntry duplicate, RequestOptions requestOptions = null)
```

#### Parameters

`duplicate` [DuplicateEntry](SuperOffice.WebApi.Data.DuplicateEntry.md)

The duplicate to create a new entry based upon

`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;

The database identity of the newly created entry

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_DeleteContactEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteContactEntityAsync(int, RequestOptions)

Deletes the ContactEntity

```csharp theme={null}
public Task DeleteContactEntityAsync(int contactEntityId, RequestOptions requestOptions = null)
```

#### Parameters

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

The identity of the ContactEntity

`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\_ContactAgent\_DeleteExpiredAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteExpiredAsync(RequestOptions)

Trigger deletion of contacts (companies) that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).

```csharp theme={null}
public Task DeleteExpiredAsync(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)

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_EnrichContactEntityAsync\_SuperOffice\_WebApi\_Data\_ContactEntity\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> EnrichContactEntityAsync(ContactEntity, string, RequestOptions)

Enrich a contact with data from the AI Enrichment service. This will update the contact with address, phone number, and email.

```csharp theme={null}
public Task<ContactEntity> EnrichContactEntityAsync(ContactEntity contactEntity, string enrichId, RequestOptions requestOptions = null)
```

#### Parameters

`contactEntity` [ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)

The contact entity to enrich.

`enrichId` [string](https://learn.microsoft.com/dotnet/api/system.string)

Id from the EnrichContact provider

`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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

Enriched contact entity with address, phone number, and email updated.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetAddressAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAddressAsync(int, RequestOptions)

Gets the contact's localized address.

```csharp theme={null}
public Task<Address> GetAddressAsync(int contactId, RequestOptions requestOptions = null)
```

#### Parameters

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

The contact 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)\<[Address](SuperOffice.WebApi.Data.Address.md)\&gt;

The address as LocalizedField\[]\[].

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetAddressByCountryAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAddressByCountryAsync(int, int, RequestOptions)

Gets the contact's localized address.

```csharp theme={null}
public Task<Address> GetAddressByCountryAsync(int contactId, int countryId, RequestOptions requestOptions = null)
```

#### Parameters

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

The contact id

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

`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)\<[Address](SuperOffice.WebApi.Data.Address.md)\&gt;

The address as LocalizedField\[]\[].

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetContactAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactAsync(int, RequestOptions)

Gets a specific Contact object.

```csharp theme={null}
public Task<Contact> GetContactAsync(int contactId, RequestOptions requestOptions = null)
```

#### Parameters

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

The identifier of the Contact 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)\<[Contact](SuperOffice.WebApi.Data.Contact.md)\&gt;

Contact

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetContactEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactEntityAsync(int, RequestOptions)

Gets a specific ContactEntity object.

```csharp theme={null}
public Task<ContactEntity> GetContactEntityAsync(int contactEntityId, RequestOptions requestOptions = null)
```

#### Parameters

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

The identifier of the ContactEntity 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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

ContactEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetContactListAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactListAsync(int\[], RequestOptions)

Gets an array of specific Contact objects.

```csharp theme={null}
public Task<Contact[]> GetContactListAsync(int[] contactIds, RequestOptions requestOptions = null)
```

#### Parameters

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

The identifiers of the Contact 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)\<[Contact](SuperOffice.WebApi.Data.Contact.md)\[]\&gt;

Array of Contact objects

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetContactSummaryAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactSummaryAsync(int, int, RequestOptions)

Get summary of contact and its recent activity.

```csharp theme={null}
public Task<ContactSummary> GetContactSummaryAsync(int contactId, int limit, RequestOptions requestOptions = null)
```

#### Parameters

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

The contact id to summarize.

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

Max number of items to include in summary lists.

`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)\<[ContactSummary](SuperOffice.WebApi.Data.ContactSummary.md)\&gt;

Summary of contact, with recent requests, sales, follow-ups, chats.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetContactWithPersonsAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactWithPersonsAsync(int, RequestOptions)

Returns the contact with all the contact persons belonging to the contact

```csharp theme={null}
public Task<ContactEntity> GetContactWithPersonsAsync(int contactId, RequestOptions requestOptions = null)
```

#### Parameters

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

The id of the contact.

`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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

ContactEntity with all data and persons.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetDomainDuplicatesAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDomainDuplicatesAsync(string, RequestOptions)

Get duplicates based on the domain

```csharp theme={null}
public Task<DuplicateEntry[]> GetDomainDuplicatesAsync(string domain, RequestOptions requestOptions = null)
```

#### Parameters

`domain` [string](https://learn.microsoft.com/dotnet/api/system.string)

Domain used for lookup

`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)\<[DuplicateEntry](SuperOffice.WebApi.Data.DuplicateEntry.md)\[]\&gt;

Any records matching the specified domain

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetDuplicateRulesAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDuplicateRulesAsync(RequestOptions)

Retrieve all available duplicate rules for contact

```csharp theme={null}
public Task<DuplicateRule[]> GetDuplicateRulesAsync(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)\<[DuplicateRule](SuperOffice.WebApi.Data.DuplicateRule.md)\[]\&gt;

All available duplicate rules

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetDuplicatesAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDuplicatesAsync(string, RequestOptions)

Get duplicates (exact or similar in the database) based on the name

```csharp theme={null}
public Task<DuplicateEntry[]> GetDuplicatesAsync(string name, RequestOptions requestOptions = null)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name used for lookup

`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)\<[DuplicateEntry](SuperOffice.WebApi.Data.DuplicateEntry.md)\[]\&gt;

Any records matching the specified name

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetMyActiveContactsAsync\_System\_DateTime\_System\_Int32\_\_\_SuperOffice\_WebApi\_Data\_ContactAction\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyActiveContactsAsync(DateTime, int\[], ContactAction, RequestOptions)

Returns the contacts where there has been activity since activityStartTime. If activityStartTime is larger than the current date, all contacts with activity since last log-out are returned. The result set can be filtered by category and action type.

```csharp theme={null}
public Task<ContactActivity[]> GetMyActiveContactsAsync(DateTime activityStartTime, int[] contactCategories, ContactAction actionType, RequestOptions requestOptions = null)
```

#### Parameters

`activityStartTime` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

The start time of the activities. If the start time is set to a future date; activites since the user last logged out are returned.

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

Integer array of categories to filter on. If the array is empty contacts from all categories will be selected.

`actionType` [ContactAction](SuperOffice.WebApi.Data.ContactAction.md)

The type of action that has occured. E.g. updates, deletes, new appointments, etc.

`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)\<[ContactActivity](SuperOffice.WebApi.Data.ContactActivity.md)\[]\&gt;

Array of contacts where there have been activity in the period.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetMyBizCardAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyBizCardAsync(RequestOptions)

Returns all data needed to display the logged on person's business card. That is company, person, and company interest data.

```csharp theme={null}
public Task<ContactEntity> GetMyBizCardAsync(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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

The contact object with persons and interests

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetMyContactAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyContactAsync(RequestOptions)

Gets the contact belonging to the currently logged on user.

```csharp theme={null}
public Task<ContactEntity> GetMyContactAsync(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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

The Contact

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetMyContactsAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyContactsAsync(RequestOptions)

Getting the contacts where the user currently logged in is set as contact owner.

```csharp theme={null}
public Task<Contact[]> GetMyContactsAsync(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)\<[Contact](SuperOffice.WebApi.Data.Contact.md)\[]\&gt;

Array of contacts

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetMyRecentContactsAsync\_SuperOffice\_WebApi\_Data\_ContactSourceType\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyRecentContactsAsync(ContactSourceType, RequestOptions)

Method that returns a set of initial contacts. This could be the contacts in a favorites selection, the history list, the diary, or from all sources. If retrieved from the diary it will get appointments for the current and the next day.

```csharp theme={null}
public Task<Contact[]> GetMyRecentContactsAsync(ContactSourceType sourceType, RequestOptions requestOptions = null)
```

#### Parameters

`sourceType` [ContactSourceType](SuperOffice.WebApi.Data.ContactSourceType.md)

The source where the contacts are retrieved from (Favorites, History, Diary)

`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)\<[Contact](SuperOffice.WebApi.Data.Contact.md)\[]\&gt;

Arrayof contacts

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetNameDepartmentDuplicatesAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetNameDepartmentDuplicatesAsync(string, string, RequestOptions)

Get duplicates based on the contact name and department

```csharp theme={null}
public Task<DuplicateEntry[]> GetNameDepartmentDuplicatesAsync(string name, string department, RequestOptions requestOptions = null)
```

#### Parameters

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name used for lookup

`department` [string](https://learn.microsoft.com/dotnet/api/system.string)

Department used for lookup (if any)

`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)\<[DuplicateEntry](SuperOffice.WebApi.Data.DuplicateEntry.md)\[]\&gt;

Any records matching the specified name and department

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetPersonsAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPersonsAsync(int, RequestOptions)

Returns an array of all the contact persons for the company card.

```csharp theme={null}
public Task<Person[]> GetPersonsAsync(int contactId, RequestOptions requestOptions = null)
```

#### Parameters

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

`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)\<[Person](SuperOffice.WebApi.Data.Person.md)\[]\&gt;

Array of Persons

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetPreviewContactAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPreviewContactAsync(int, RequestOptions)

Get a contact from its ID

```csharp theme={null}
public Task<PreviewContact> GetPreviewContactAsync(int contactId, RequestOptions requestOptions = null)
```

#### Parameters

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

Contact 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)\<[PreviewContact](SuperOffice.WebApi.Data.PreviewContact.md)\&gt;

Minimal contact suitable for preview

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetPreviewEnrichContactAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPreviewEnrichContactAsync(string, RequestOptions)

Get a contact from its ID

```csharp theme={null}
public Task<PreviewContact> GetPreviewEnrichContactAsync(string enrichId, RequestOptions requestOptions = null)
```

#### Parameters

`enrichId` [string](https://learn.microsoft.com/dotnet/api/system.string)

Enrich Contact ID from the EnrichContact MDO list provider

`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)\<[PreviewContact](SuperOffice.WebApi.Data.PreviewContact.md)\&gt;

Minimal contact suitable for preview

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_GetQuoteVersionAddressesAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetQuoteVersionAddressesAsync(int, RequestOptions)

Get the associated billing and invoice quote version addresses. These addresses might be address on the contact, or a custom address.

```csharp theme={null}
public Task<Address[]> GetQuoteVersionAddressesAsync(int quoteVersionId, RequestOptions requestOptions = null)
```

#### Parameters

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

The version to get the addresses for.

`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)\<[Address](SuperOffice.WebApi.Data.Address.md)\[]\&gt;

The quote version addresses. Invoice and billing address, in that order.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_IsNumberValidAsync\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> IsNumberValidAsync(int, string, RequestOptions)

Checks if the number is unique or required.  The setting is configured from admin under system options.

```csharp theme={null}
public Task<bool> IsNumberValidAsync(int contactId, string number, RequestOptions requestOptions = null)
```

#### Parameters

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

Primary key

`number` [string](https://learn.microsoft.com/dotnet/api/system.string)

Number field value to check.

`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)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

True if the number satisifies the configured rules for uniqueness.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_MergeAsync\_System\_Int32\_System\_Int32\_System\_Boolean\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> MergeAsync(int, int, bool, bool, RequestOptions)

Merge two contacts. The destination contact will remain.

```csharp theme={null}
public Task MergeAsync(int sourceContactId, int destinationContactId, bool mergeIdenticalPersons, bool replaceEmptyFieldsOnDestination, RequestOptions requestOptions = null)
```

#### Parameters

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

Source contact to merge from. This contact will disappear after the merge.

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

Destination contact to merge into

`mergeIdenticalPersons` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Persons with identical names will be merged

`replaceEmptyFieldsOnDestination` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If true, empty fields on destination will be replaced by values from source.

`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\_ContactAgent\_SaveContactEntityAsync\_SuperOffice\_WebApi\_Data\_ContactEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveContactEntityAsync(ContactEntity, RequestOptions)

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

```csharp theme={null}
public Task<ContactEntity> SaveContactEntityAsync(ContactEntity contactEntity, RequestOptions requestOptions = null)
```

#### Parameters

`contactEntity` [ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)

The ContactEntity 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)\<[ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)\&gt;

New or updated ContactEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_SaveQuoteVersionAddressAsync\_System\_Int32\_SuperOffice\_WebApi\_Data\_Address\_SuperOffice\_WebApi\_Data\_AddressType\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveQuoteVersionAddressAsync(int, Address, AddressType, int, RequestOptions)

Save a custom quote version address.

```csharp theme={null}
public Task<Address> SaveQuoteVersionAddressAsync(int quoteVersionId, Address address, AddressType addressType, int countryId, RequestOptions requestOptions = null)
```

#### Parameters

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

The version to save the address on.

`address` [Address](SuperOffice.WebApi.Data.Address.md)

The address to save on the quote version.

`addressType` [AddressType](SuperOffice.WebApi.Data.AddressType.md)

Should be either QuoteBillingAddress or QuoteShippingAddress

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

The country for the custom address

`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)\<[Address](SuperOffice.WebApi.Data.Address.md)\&gt;

The saved addresses.

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_SetDuplicateRulesStatusAsync\_SuperOffice\_WebApi\_Data\_DuplicateRule\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SetDuplicateRulesStatusAsync(DuplicateRule\[], RequestOptions)

Set which duplicate rules should be active or not

```csharp theme={null}
public Task SetDuplicateRulesStatusAsync(DuplicateRule[] rules, RequestOptions requestOptions = null)
```

#### Parameters

`rules` [DuplicateRule](SuperOffice.WebApi.Data.DuplicateRule.md)\[]

Duplicate rules to update active status for

`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\_ContactAgent\_UndeleteAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> UndeleteAsync(int, RequestOptions)

This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record

```csharp theme={null}
public Task UndeleteAsync(int id, RequestOptions requestOptions = null)
```

#### Parameters

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

The primary key of the entity to undelete

`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)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_UpdateInterestsAsync\_System\_Int32\_System\_Int32\_\_\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> UpdateInterestsAsync(int, int\[], int\[], RequestOptions)

Update interests on contact. Will throw exception if id is in both arrays

```csharp theme={null}
public Task UpdateInterestsAsync(int contactId, int[] enableInterestIds, int[] disableInterestIds, RequestOptions requestOptions = null)
```

#### Parameters

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

Contact id to update interests for

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

The interest ids to set on the contact. This will set these interests to true and not touch any other interests.

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

The interest ids to diable on the contact. This will set these interests to false and not touch any other interests.

`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)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_ContactAgent\_ValidateContactEntityAsync\_SuperOffice\_WebApi\_Data\_ContactEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ValidateContactEntityAsync(ContactEntity, RequestOptions)

Check that entity is ready for saving, return error messages by field.

```csharp theme={null}
public Task<StringDictionary> ValidateContactEntityAsync(ContactEntity contactEntity, RequestOptions requestOptions = null)
```

#### Parameters

`contactEntity` [ContactEntity](SuperOffice.WebApi.Data.ContactEntity.md)

Entity to be checked for errors.

`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)\<[StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)\&gt;

Error messages tagged by field.


## Related topics

- [SuperOffice.WebApi.Data.ContactEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.ContactEntity.md)
- [SuperOffice.WebApi.Data.Contact](/en/api/reference/webapi/SuperOffice.WebApi.Data.Contact.md)
- [SuperOffice.WebApi.Data.ContactSummary](/en/api/reference/webapi/SuperOffice.WebApi.Data.ContactSummary.md)
- [SuperOffice.WebApi.Data.ContactActivity](/en/api/reference/webapi/SuperOffice.WebApi.Data.ContactActivity.md)
- [SuperOffice.WebApi.Data.PreviewContact](/en/api/reference/webapi/SuperOffice.WebApi.Data.PreviewContact.md)
- [SOAP API](/en/api/web-services/endpoints/soap/index.md)
