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

# \<a id="SuperOffice\_WebApi\_Agents\_IContactAgent">\</a> Interface IContactAgent

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

Contact (company) data services.

```csharp theme={null}
public interface IContactAgent : IAgentBase, IDisposable
```

#### Implements

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

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_CreateNewEntryAsync\_SuperOffice\_WebApi\_Data\_DuplicateEntry\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateNewEntryAsync(DuplicateEntry, RequestOptions)

Creates a new contact based on external duplicate

```csharp theme={null}
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\_IContactAgent\_DeleteContactEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteContactEntityAsync(int, RequestOptions)

Deletes the ContactEntity

```csharp theme={null}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_GetAddressAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAddressAsync(int, RequestOptions)

Gets the contact's localized address.

```csharp theme={null}
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\_IContactAgent\_GetAddressByCountryAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAddressByCountryAsync(int, int, RequestOptions)

Gets the contact's localized address.

```csharp theme={null}
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\_IContactAgent\_GetContactAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactAsync(int, RequestOptions)

Gets a specific Contact object.

```csharp theme={null}
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\_IContactAgent\_GetContactEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactEntityAsync(int, RequestOptions)

Gets a specific ContactEntity object.

```csharp theme={null}
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\_IContactAgent\_GetContactListAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactListAsync(int\[], RequestOptions)

Gets an array of specific Contact objects.

```csharp theme={null}
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\_IContactAgent\_GetContactSummaryAsync\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetContactSummaryAsync(int, int, RequestOptions)

Get summary of contact and its recent activity.

```csharp theme={null}
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\_IContactAgent\_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}
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\_IContactAgent\_GetDomainDuplicatesAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDomainDuplicatesAsync(string, RequestOptions)

Get duplicates based on the domain

```csharp theme={null}
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\_IContactAgent\_GetDuplicateRulesAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDuplicateRulesAsync(RequestOptions)

Retrieve all available duplicate rules for contact

```csharp theme={null}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_GetMyContactAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyContactAsync(RequestOptions)

Gets the contact belonging to the currently logged on user.

```csharp theme={null}
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\_IContactAgent\_GetMyContactsAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyContactsAsync(RequestOptions)

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

```csharp theme={null}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_GetPreviewContactAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPreviewContactAsync(int, RequestOptions)

Get a contact from its ID

```csharp theme={null}
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\_IContactAgent\_GetPreviewEnrichContactAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPreviewEnrichContactAsync(string, RequestOptions)

Get a contact from its ID

```csharp theme={null}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_SetDuplicateRulesStatusAsync\_SuperOffice\_WebApi\_Data\_DuplicateRule\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SetDuplicateRulesStatusAsync(DuplicateRule\[], RequestOptions)

Set which duplicate rules should be active or not

```csharp theme={null}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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\_IContactAgent\_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}
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.Agents.ContactAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ContactAgent.md)
- [SuperOffice.WebApi.Agents.IAIAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IAIAgent.md)
- [SuperOffice.WebApi.Agents.AIAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.AIAgent.md)
- [SuperOffice.WebApi.Agents.DocumentAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.DocumentAgent.md)
- [SuperOffice.WebApi.Agents.IDocumentAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IDocumentAgent.md)
