<a id=“SuperOffice_WebApi_Agents_ContactAgent”></a> Class ContactAgent
Namespace: SuperOffice.WebApi.AgentsAssembly: SuperOffice.WebApi.dll Contact (company) data services.
Inheritance
object ← AgentBase ← ContactAgentImplements
IContactAgent, IAgentBase, IDisposableInherited Members
AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T>(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()Examples
<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“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.Parameters
httpClient 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.Parameters
options WebApiOptions
Base URL and authentication values.
httpClient 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 contactParameters
contactId int
Contact to add person to
newPersonEntity PersonEntity
Person object to add
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<PersonEntity> 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 formatParameters
contactEntity ContactEntity
toCountryId int
The country to switch to
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity><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 ignoredParameters
sourceContactId int
The id of the contact to copy
destinationContactName string
The name of the destination contact
destinationContactDepartment string
The department of the destination contact
copyPersons bool
If true, persons will be copied from source contact
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int> 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 instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> 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 instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<PreviewContact> 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 duplicateParameters
duplicate DuplicateEntry
The duplicate to create a new entry based upon
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int> 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 ContactEntityParameters
contactEntityId int
The identity of the ContactEntity
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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).Parameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
contactEntity ContactEntity
The contact entity to enrich.
enrichId string
Id from the EnrichContact provider
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> 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.Parameters
contactId int
The contact id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Address> 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.Parameters
contactId int
The contact id
countryId int
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Address> 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.Parameters
contactId int
The identifier of the Contact object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Contact> Contact<a id=“SuperOffice_WebApi_Agents_ContactAgent_GetContactEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetContactEntityAsync(int, RequestOptions)
Gets a specific ContactEntity object.Parameters
contactEntityId int
The identifier of the ContactEntity object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> ContactEntity<a id=“SuperOffice_WebApi_Agents_ContactAgent_GetContactListAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetContactListAsync(int[], RequestOptions)
Gets an array of specific Contact objects.Parameters
contactIds int[]
The identifiers of the Contact object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Contact[]> 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.Parameters
contactId int
The contact id to summarize.
limit int
Max number of items to include in summary lists.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactSummary> 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 contactParameters
contactId int
The id of the contact.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> 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 domainParameters
domain string
Domain used for lookup
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<DuplicateEntry[]> 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 contactParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<DuplicateRule[]> 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 nameParameters
name string
Name used for lookup
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<DuplicateEntry[]> 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.Parameters
activityStartTime 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[]
Integer array of categories to filter on. If the array is empty contacts from all categories will be selected.
actionType ContactAction
The type of action that has occured. E.g. updates, deletes, new appointments, etc.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactActivity[]> 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.Parameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> 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.Parameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> 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.Parameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Contact[]> 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.Parameters
sourceType ContactSourceType
The source where the contacts are retrieved from (Favorites, History, Diary)
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Contact[]> 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 departmentParameters
name string
Name used for lookup
department string
Department used for lookup (if any)
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<DuplicateEntry[]> 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.Parameters
contactId int
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Person[]> Array of Persons<a id=“SuperOffice_WebApi_Agents_ContactAgent_GetPreviewContactAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPreviewContactAsync(int, RequestOptions)
Get a contact from its IDParameters
contactId int
Contact ID
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<PreviewContact> 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 IDParameters
enrichId string
Enrich Contact ID from the EnrichContact MDO list provider
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<PreviewContact> 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.Parameters
quoteVersionId int
The version to get the addresses for.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Address[]> 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.Parameters
contactId int
Primary key
number string
Number field value to check.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<bool> 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.Parameters
sourceContactId int
Source contact to merge from. This contact will disappear after the merge.
destinationContactId int
Destination contact to merge into
mergeIdenticalPersons bool
Persons with identical names will be merged
replaceEmptyFieldsOnDestination bool
If true, empty fields on destination will be replaced by values from source.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
contactEntity ContactEntity
The ContactEntity that is saved.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ContactEntity> 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.Parameters
quoteVersionId int
The version to save the address on.
address Address
The address to save on the quote version.
addressType AddressType
Should be either QuoteBillingAddress or QuoteShippingAddress
countryId int
The country for the custom address
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<Address> 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 notParameters
rules DuplicateRule[]
Duplicate rules to update active status for
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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 recordParameters
id int
The primary key of the entity to undelete
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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 arraysParameters
contactId int
Contact id to update interests for
enableInterestIds int[]
The interest ids to set on the contact. This will set these interests to true and not touch any other interests.
disableInterestIds int[]
The interest ids to diable on the contact. This will set these interests to false and not touch any other interests.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
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.Parameters
contactEntity ContactEntity
Entity to be checked for errors.
requestOptions RequestOptions
Override language/culture codes on this request.