Show / Hide Table of Contents

Class PersonAgent

Proxy class for the Person Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Inheritance
object
PersonAgent
Implements
IPersonAgent
IAgent
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class PersonAgent : IPersonAgent, IAgent

Constructors

PersonAgent(IConsentPersonImplementation, IPersonImplementation, IPersonEntityImplementation, IPersonImageImplementation, IPersonListImplementation, ISoRequestItemsAccessor)

Proxy class for the Person Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Declaration
public PersonAgent(IConsentPersonImplementation consentPersonImplementation, IPersonImplementation personImplementation, IPersonEntityImplementation personEntityImplementation, IPersonImageImplementation personImageImplementation, IPersonListImplementation personListImplementation, ISoRequestItemsAccessor accessor)
Parameters
Type Name Description
IConsentPersonImplementation consentPersonImplementation
IPersonImplementation personImplementation
IPersonEntityImplementation personEntityImplementation
IPersonImageImplementation personImageImplementation
IPersonListImplementation personListImplementation
ISoRequestItemsAccessor accessor

PersonAgent(IConsentPersonImplementation, IPersonImplementation, IPersonEntityImplementation, IPersonImageImplementation, IPersonListImplementation, ISoRequestItemsAccessor, IDebugUser, IServiceCallsRepository)

Proxy class for the Person Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Declaration
public PersonAgent(IConsentPersonImplementation consentPersonImplementation, IPersonImplementation personImplementation, IPersonEntityImplementation personEntityImplementation, IPersonImageImplementation personImageImplementation, IPersonListImplementation personListImplementation, ISoRequestItemsAccessor accessor, IDebugUser debugUser, IServiceCallsRepository serviceCallsRepository)
Parameters
Type Name Description
IConsentPersonImplementation consentPersonImplementation
IPersonImplementation personImplementation
IPersonEntityImplementation personEntityImplementation
IPersonImageImplementation personImageImplementation
IPersonListImplementation personListImplementation
ISoRequestItemsAccessor accessor
IDebugUser debugUser
IServiceCallsRepository serviceCallsRepository

Methods

AddBounceAsync(string, CancellationToken)

Add a bounce count on the email address if it exists

Declaration
public Task AddBounceAsync(string emailAddress, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

The email address which we want to add a bounce count to

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

AddBounceWithCountAsync(string, int, CancellationToken)

Add a number of bounce counts on the email address if it exists

Declaration
public Task AddBounceWithCountAsync(string emailAddress, int counts, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

The email address which we want to add bounce counts to

int counts

The number of bounce counts to add

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

AddBounceWithDetailsAsync(string, int, int, string, CancellationToken)

Add a number of bounce counts on the email address if it exists, and with possible bounce code and reason

Declaration
public Task AddBounceWithDetailsAsync(string emailAddress, int counts, int code, string reason, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

The email address which we want to add bounce counts to

int counts

The number of bounce counts to add

int code

A numeric code representing the bounce reason

string reason

A textual tag representing the bounce reason

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

AddEmailAddressToPersonAsync(int, string, bool, CancellationToken)

Sets the primary email address on person, possibly re-ranking email addresses accordingly.

Declaration
public Task AddEmailAddressToPersonAsync(int personId, string emailAddress, bool setAsPrimaryEmail, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Person id of the person

string emailAddress

The email address to set as primary email address

bool setAsPrimaryEmail

True if the address shall be primary email address (have rank == 1)

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

ChangeCountryAsync(PersonEntity, int, CancellationToken)

Change country regenerates the default values and localized information such as phone number and address format for this entity.

Declaration
public Task<PersonEntity> ChangeCountryAsync(PersonEntity personEntity, int toCountryId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
PersonEntity personEntity

The PersonEntity to change country on

int toCountryId

The country to switch to

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonEntity>

The PersonEntity

ChangePersonRankAsync(int, bool, CancellationToken)

Move one person up or down in the ranking in the Person Archive, if possible.<para/>The person record that has rank = 1 is the primary contact for a company, and is the one used in situations where no person has been explicitly chosen (such as in selections).<para/>This method corresponds to the move up/move down functions in the person archive in the contact panel.<para/>This method always affects two records.

Declaration
public Task<int> ChangePersonRankAsync(int personId, bool moveUp, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Primary key of person record to move up or down. You must have write access both to this record AND to whatever record is adjacent in the direction you want to move.

bool moveUp

If true, the given person is moved to an earlier rank (lower numeric rank value, down to a limit of 1; up in the GUI if sorted by ascending rank). If false, movement is to later priority (higher numeric rank value).

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<int>

If movement occurred, the return value will be the ID of the OTHER person that got moved. A GUI should switch the positions of the original person ID and this return value.<para/>If no movement occurred, for any reason, 0 is returned.

CheckTemporaryKeyAsync(string, CancellationToken)

Check a temporary key for validity, and in case it is valid, return its domain, targetId and personId

Declaration
public Task<TemporaryKeyInfo> CheckTemporaryKeyAsync(string temporaryKey, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string temporaryKey

The base64 encoded key value, as returned by CreateTemporaryKey

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<TemporaryKeyInfo>

The info about the temporary key. Domain will be Unknown if key is not valid.

CreateDefaultByContactIdAsync(int, CancellationToken)

Creates a PersonEntity with default values based on the contactId.

Declaration
public Task<PersonEntity> CreateDefaultByContactIdAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

Contact id of the person

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonEntity>

CreateDefaultConsentPersonAsync(CancellationToken)

Loading default values into a new ConsentPerson. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<ConsentPerson> CreateDefaultConsentPersonAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ConsentPerson>

New ConsentPerson with default values

CreateDefaultFromCredentialAsync(int, string, string, string, CancellationToken)

Creates a PersonEntity with default values based on the contactId and credentials.

Declaration
public Task<PersonEntity> CreateDefaultFromCredentialAsync(int contactId, string credentialType, string credentialValue, string credentialDisplayValue, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

Contact id of the person

string credentialType

Type of credentials, corresponding to name of plugin and type in the credentials table.

string credentialValue

This is the actuall value of the credentials. This will typically be the password or teh users SID in active directory

string credentialDisplayValue

The value displayed to the user. this will typically be the users login name in active directory.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonEntity>

CreateDefaultPersonEntityAsync(CancellationToken)

Loading default values into a new PersonEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<PersonEntity> CreateDefaultPersonEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<PersonEntity>

New PersonEntity with default values

CreateDefaultPersonImageAsync(CancellationToken)

Loading default values into a new PersonImage. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<PersonImage> CreateDefaultPersonImageAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<PersonImage>

New PersonImage with default values

CreateOrUpdateUserCandidateAsync(int, string, bool, CancellationToken)

Creates a Customer Centre User (UserCandidate) for a given Contact (personId) with the supplied parameters. If the Customer Centre User already exists for a given Contact, the user is updated with the supplied parameters.

Declaration
public Task<UserCandidate> CreateOrUpdateUserCandidateAsync(int personId, string username, bool accessAllRequests, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Person to create UserCandidate for.

string username

Desired username. Username must be unique. If the username is not unique, method will throw an error.

bool accessAllRequests

Determines if Custom Center User has access to all requests created for all Contacts in the company.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<UserCandidate>

UserCandidate created or updated.

CreateTemporaryKeyAsync(TemporaryKeyDomain, int, int, DateTime, CancellationToken)

Create a temporary key in the database from the given parameters and return the key string. Used for temporary keys for accessing customer centric functionality, such as UpdateSubscriptions.

Declaration
public Task<string> CreateTemporaryKeyAsync(TemporaryKeyDomain domain, int targetId, int personId, DateTime expires, CancellationToken cancellationToken = default)
Parameters
Type Name Description
TemporaryKeyDomain domain

The domain this key is for

int targetId

The primary key of the entity this is for. Depends on domain.

int personId

The person this key is for. May be null.

DateTime expires

When the key will expire (servers local time)

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<string>

The key as base64, ready to be used e.g. in a URL

CreateTemporaryKeyWithPayloadAsync(TemporaryKeyDomain, int, int, DateTime, string, CancellationToken)

Create a temporary key in the database from the given parameters and return the key string. Used for temporary keys for accessing customer centric functionality, such as UpdateSubscriptions.

Declaration
public Task<string> CreateTemporaryKeyWithPayloadAsync(TemporaryKeyDomain domain, int targetId, int personId, DateTime expires, string payload, CancellationToken cancellationToken = default)
Parameters
Type Name Description
TemporaryKeyDomain domain

The domain this key is for

int targetId

The primary key of the entity this is for. Depends on domain.

int personId

The person this key is for. May be null.

DateTime expires

When the key will expire (servers local time)

string payload

The payload for the temporary key

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<string>

The key as base64, ready to be used e.g. in a URL

DeleteConsentPersonAsync(int, CancellationToken)

Deletes the ConsentPerson

Declaration
public Task DeleteConsentPersonAsync(int consentPersonId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int consentPersonId

The identity of the ConsentPerson

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteExpiredAsync(CancellationToken)

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

Declaration
public Task DeleteExpiredAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

DeletePersonEntityAsync(int, CancellationToken)

Deletes the PersonEntity

Declaration
public Task DeletePersonEntityAsync(int personEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personEntityId

The identity of the PersonEntity

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteTemporaryKeysOfDomainAsync(TemporaryKeyDomain, int, CancellationToken)

Delete all temporary keys for a given domain and person

Declaration
public Task DeleteTemporaryKeysOfDomainAsync(TemporaryKeyDomain domain, int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
TemporaryKeyDomain domain

The domain type to delete

int personId

The person for which to delete the keys

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

GetAddressAsync(int, CancellationToken)

Gets the person's localized address.

Declaration
public Task<Address> GetAddressAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Address>

The address as LocalizedField[][].

GetAddressByCountryAsync(int, int, CancellationToken)

Gets the person's localized address.

Declaration
public Task<Address> GetAddressByCountryAsync(int personId, int countryId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

int countryId
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Address>

The address as LocalizedField[][].

GetBestSoLanguageForTemplateAsync(int, int, CancellationToken)

Get the best language for this person on this template

Declaration
public Task<string> GetBestSoLanguageForTemplateAsync(int personId, int templateId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The id of the person

int templateId

The id of the template to find languages on

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<string>

The solang code for best language, empty string if no best language found

GetColleaguesAsync(CancellationToken)

Gets the persons working in the same company as the logged on user.

Declaration
public Task<Person[]> GetColleaguesAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person[]>

Colleagues.

GetColleaguesByDepartmentAsync(int, CancellationToken)

Gets the persons working in a specific department in the same company as the logged on user. Departments can be retrieved with the PhoneList.DepartmentList service.

Declaration
public Task<Person[]> GetColleaguesByDepartmentAsync(int departmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int departmentId

The department id.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person[]>

PersonList with colleagues.

GetColleaguesBySourceAsync(AssociateSourceType, int, CancellationToken)

Gets the persons working in the same company as the logged on user. The list of person could be retrieved from the history list, the diary view list, or from all sources.

Declaration
public Task<Person[]> GetColleaguesBySourceAsync(AssociateSourceType sourceType, int count, CancellationToken cancellationToken = default)
Parameters
Type Name Description
AssociateSourceType sourceType

The “source” the colleagues should be retrieved from. <see cref="AssociateSourceType"/> for more information.

int count
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person[]>

Colleagues.

GetConsentInfosAsync(int, CancellationToken)

Get all consent information for a given person. May include withdrawn consents (check

Declaration
public Task<ConsentInfo[]> GetConsentInfosAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id to get consents for

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ConsentInfo[]>

List of consents recorded on this person

GetConsentPersonAsync(int, CancellationToken)

Gets a ConsentPerson object.

Declaration
public Task<ConsentPerson> GetConsentPersonAsync(int consentPersonId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int consentPersonId

The identifier of the ConsentPerson object

CancellationToken cancellationToken
Returns
Type Description
Task<ConsentPerson>

ConsentPerson

GetCustomerCentrePasswordReplyTemplateAsync(int, CancellationToken)

Gets a parsed Customer Centre password reply template for a particular customer

Declaration
public Task<ReplyTemplateParsed> GetCustomerCentrePasswordReplyTemplateAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Person/customer id to get the template for.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ReplyTemplateParsed>

A parsed Customer Centre password reply template.

GetMyOwnerAsync(CancellationToken)

Get the owner of the logged in person.

Declaration
public Task<Person> GetMyOwnerAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person>

Person

GetMyPersonAsync(CancellationToken)

Gets the person info belonging to the currently logged on user.

Declaration
public Task<PersonEntity> GetMyPersonAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonEntity>

The PersonEntity

GetOwnerOnPersonIdAsync(int, CancellationToken)

Get the owner of the person by id.

Declaration
public Task<Person> GetOwnerOnPersonIdAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person>

Person

GetPersonAsync(int, CancellationToken)

Gets a Person object.

Declaration
public Task<Person> GetPersonAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The identifier of the Person object

CancellationToken cancellationToken
Returns
Type Description
Task<Person>

Person

GetPersonEntityAsync(int, CancellationToken)

Gets a PersonEntity object.

Declaration
public Task<PersonEntity> GetPersonEntityAsync(int personEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personEntityId

The identifier of the PersonEntity object

CancellationToken cancellationToken
Returns
Type Description
Task<PersonEntity>

PersonEntity

GetPersonImageAsync(int, CancellationToken)

Returns the person image that is displayed in the CRM application.

Declaration
public Task<Image> GetPersonImageAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id of the person the image belongs to.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Image>

The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.)

GetPersonImagesAsync(int[], int, int, CancellationToken)

Get the image for a set of persons scaled to a specific size. Returned images are in PNG format.

Declaration
public Task<PersonImage[]> GetPersonImagesAsync(int[] personIds, int scaledWidth, int scaledHeight, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] personIds

List of persons to get images for.

int scaledWidth

Returned images are scaled to this width

int scaledHeight

Returned images are scaled to this height

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonImage[]>

List of person images. Persons without an image are not present in this list.

GetPersonListAsync(int[], CancellationToken)

Gets an array of Person objects.

Declaration
public Task<Person[]> GetPersonListAsync(int[] personIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] personIds

The identifiers of the Person object

CancellationToken cancellationToken
Returns
Type Description
Task<Person[]>

Array of Person objects

GetPersonSummaryAsync(int, int, CancellationToken)

Get summary of person and recent activity.

Declaration
public Task<PersonSummary> GetPersonSummaryAsync(int personId, int limit, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id to summarize.

int limit

Max number of items to include in summary lists.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonSummary>

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

GetPersonsFromContactAsync(int, CancellationToken)

Returns all the persons belonging to a contact.

Declaration
public Task<Person[]> GetPersonsFromContactAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

The project id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person[]>

The persons belonging to a contact.

GetPersonsFromProjectAsync(int, CancellationToken)

Returns all the persons belonging to a project.

Declaration
public Task<Person[]> GetPersonsFromProjectAsync(int projectId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int projectId

The project id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Person[]>

The persons belonging to a project.

GetPhonesAsync(int, CancellationToken)

Returning all phones that belong to a person, ordered by the phone type.

Declaration
public Task<EntityElement[]> GetPhonesAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<EntityElement[]>

An array of Phones

GetSalesRepAsync(string, string, string, string, string, CancellationToken)

Returns the sales representative for an external user. If this method is accessed with anonymous authentication the external user is recognized by contact and name, or by email, or phone number. If the external user is recognized as an CRM5 user (internal or external) the input fields can be left blank.

Declaration
public Task<PersonEntity> GetSalesRepAsync(string contactName, string personFirstname, string personLastname, string emailAddress, string phoneNumber, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string contactName

The company name of the person requesting his sales representative. May be empty if email or phone is provided.

string personFirstname

The firstname of the person requesting his sales representative. May be empty if email or phone is provided.

string personLastname

The lastname of the person requesting his sales representative. May be empty if email or phone is provided.

string emailAddress

The email address of the person requesting his sales representative. May be empty if phone, or contact and person name is provided.

string phoneNumber

The phone number of the person requesting his sales representative. May be empty if email, or contact and person name is provided.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<PersonEntity>

The PersonEntity of the sales rep.

GetUserCandidateByPersonAsync(int, CancellationToken)

Gets user candidate linked to a person.

Declaration
public Task<UserCandidate> GetUserCandidateByPersonAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Person related to requested UserCandidate.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<UserCandidate>

UserCandidate linked to a person.

HasConsentAsync(int, string, CancellationToken)

Check if consent has been given by a specified person, for a specific purpose. Withdraw consents return FALSE.

Declaration
public Task<bool> HasConsentAsync(int personId, string purpose, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

string purpose

The key of the purpose to check. (e.g. 'STORE' or 'EMARKETING')

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<bool>

True if the person has consented to the given purpose.

IsNumberValidAsync(int, string, CancellationToken)

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

Declaration
public Task<bool> IsNumberValidAsync(int contactId, string number, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId
string number

Number to check.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<bool>

True if number is ok (passes uniqueness/required checks)

MergeAsync(int, int, DateTime, bool, bool, CancellationToken)

Merge two persons. The destination person will remain. You must specify the date after which activities will be moved along with the person.

Declaration
public Task MergeAsync(int sourcePersonId, int destinationPersonId, DateTime moveAfterDate, bool deleteSource, bool replaceEmptyFieldsOnDestination, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int sourcePersonId

The identifier for the person which will be merged into the destination person. The source person is deleted/marked retired after the merge.

int destinationPersonId

The identifier for the person which will remain after the merge. The target person is updated.

DateTime moveAfterDate

Merge activites after this date. Activities before this date are left alone.

bool deleteSource

If true, the source person will be deleted after the merge. If false, it will have its retired flag set

bool replaceEmptyFieldsOnDestination

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

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

MoveAsync(int, int, DateTime, CancellationToken)

Move a person to a specified contact. You must specify the date after which activities will be moved along with the person.

Declaration
public Task MoveAsync(int personId, int destinationContactId, DateTime moveAfterDate, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The identifier for the person

int destinationContactId

The identifier for the contact which the person will be moved to

DateTime moveAfterDate

Move activites after this date. Activities before this date are left alone.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

NormalizeRanksAsync(int, CancellationToken)

Nomralize the ranks for all persons that belong to a contact. This means that the persons will be sorted according to their current rank values, and the ranks will be made monotonically increasing from 1.

Declaration
public Task<bool> NormalizeRanksAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

Id of contact whose persons are to be rank normalized

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<bool>

The reutrn value is true if the operation suceeded, either because all persons were already normalized, or because normalization was done. It is false if Sentry blocks any required changes.

RemoveConsentAsync(int, string, CancellationToken)

Turn off consent for a specified person and purpose.

Declaration
public Task RemoveConsentAsync(int personId, string purpose, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

string purpose

The key of the purpose to remove. (e.g. 'STORE' or 'EMARKETING')

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

ResolvePersonFromInfoAsync(int, string, string[], string[], CancellationToken)

Get a person from the provided information. If the person does not exist, it will be created on demand.

Declaration
public Task<ResolvedPerson> ResolvePersonFromInfoAsync(int contactId, string personName, string[] phoneNumbers, string[] emails, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

The contact Id of the contact which the person belongs to. Cannot be 0.

string personName

The full name of the person to be resolved. Optional.

string[] phoneNumbers

Phone numbers registered on the person. Optional.

string[] emails

Email-addresses registered on the person. Optional.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<ResolvedPerson>

The results of the resolve-operation.

SaveConsentPersonAsync(ConsentPerson, CancellationToken)

Updates the existing ConsentPerson or creates a new ConsentPerson if the id parameter is empty

Declaration
public Task<ConsentPerson> SaveConsentPersonAsync(ConsentPerson consentPerson, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ConsentPerson consentPerson

The ConsentPerson that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<ConsentPerson>

New or updated ConsentPerson

SavePersonEntityAsync(PersonEntity, CancellationToken)

Updates the existing PersonEntity or creates a new PersonEntity if the id parameter is empty

Declaration
public Task<PersonEntity> SavePersonEntityAsync(PersonEntity personEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
PersonEntity personEntity

The PersonEntity that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<PersonEntity>

New or updated PersonEntity

SendConsentConfirmationEmailAsync(int, string, int, int, string, CancellationToken)

Send confirmation email to the provided person, email address (id), using the document template

Declaration
public Task SendConsentConfirmationEmailAsync(int personId, string emailAddress, int emailTemplateId, int cultureLcidId, string subject, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

string emailAddress

The email address to send to.

int emailTemplateId

The id of the email template (doctmpl_id)

int cultureLcidId

The id of the culture (LCID)

string subject

Optional email subject

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

SendCustomerCentrePasswordEmailAsync(int, string, string, string, CancellationToken)

Sends a Customer Centre password email based on the reply template.

Declaration
public Task SendCustomerCentrePasswordEmailAsync(int personId, string from, string to, string subject, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Person id associated to email's reply template.

string from

Sender's email address.

string to

Recipient's email address.

string subject

Email's subject.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

SendEmailAsync(string, string, string, string, string, int[], CancellationToken)

Inserts into outbox an email with specified details.

Declaration
public Task SendEmailAsync(string from, string to, string subject, string plainBody, string htmlBody, int[] attachmentIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string from

Sender's email address.

string to

Recipient's email address.

string subject

Email's subject.

string plainBody

Email's plain body.

string htmlBody

Email's html body.

int[] attachmentIds

Ids of email's attachments.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

SendEmailWithEventNameAsync(string, string, string, string, string, int[], string, CancellationToken)

Inserts into outbox an email with specified details and event name.

Declaration
public Task SendEmailWithEventNameAsync(string from, string to, string subject, string plainBody, string htmlBody, int[] attachmentIds, string eventName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string from

Sender's email address.

string to

Recipient's email address.

string subject

Email's subject.

string plainBody

Email's plain body.

string htmlBody

Email's html body.

int[] attachmentIds

Ids of email's attachments.

string eventName

Event name passed to outbound email trigger

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

SetConsentAsync(int, string, string, string, string, CancellationToken)

Set a specified type of consent on the person.

Declaration
public Task SetConsentAsync(int personId, string purpose, string source, string legalBase, string comment, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id

string purpose

The Key of the purpose this affects. e.g. 'STORE' or 'EMARKETING'.

string source

The Key of the source of this consent. e.g. 'USER', 'WEBFORM' or 'API'.

string legalBase

The Key of the legal base for this consent. e.g. '61A', '61B', '61F'

string comment

A comment regarding this consent. May be null or empty.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

SetPersonImageAsync(int, Image, CancellationToken)

Stores the person image that is displayed in the CRM application.

Declaration
public Task SetPersonImageAsync(int personId, Image image, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The person id of the person the image belongs to.

Image image

The image that is stored on the person (System.Drawing.Image)

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

SetPersonRankAsync(int, short, CancellationToken)

Directly set the rank field of a person record, adjusting all other person records under the same contact as needed.<para/>This call may affect multiple records, potentially all person records belonging to one contact.<para/>You must have write access for to affected records for this method to succeed.

Declaration
public Task<bool> SetPersonRankAsync(int personId, short desiredRank, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

Id of person to change

short desiredRank

Desired rank to set, legal values are from 1 to the number of person records on this contact. Out of range values will be moved to the closest valid value and processed.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<bool>

If movement occurred, or the person already had exactly the desired rank value, then the return value will be true. If movement did not occur, for any other reason, the return value is false.

TryAddPersonsToEmailFlowAsync(int, int[], CancellationToken)

Try to add a participant to the EmailFlow, Same function available in WorkflowAgent

Declaration
public Task<bool[]> TryAddPersonsToEmailFlowAsync(int emailFlowId, int[] personIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int emailFlowId

Primary key of EmailFlow

int[] personIds

Array of Person Ids

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<bool[]>

True if the corresponding participant was successfully added, false if it could not be added because of filter criteria or other reason

UndeleteAsync(int, CancellationToken)

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

Declaration
public Task UndeleteAsync(int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int id

The primary key of the entity to undelete

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

ValidatePersonEntityAsync(PersonEntity, CancellationToken)

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

Declaration
public Task<StringDictionary> ValidatePersonEntityAsync(PersonEntity personEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
PersonEntity personEntity

Entity to be checked for errors.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<StringDictionary>

Error messages tagged by field.

Implements

IPersonAgent
IAgent
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top