Skip to main content

Class ProjectAgent

Namespace: SuperOffice.WebApi.Agents Assembly: SuperOffice.WebApi.dll Collection of all services that works with Project data.

Inheritance

object ← AgentBase ← ProjectAgent

Implements

IProjectAgent, IAgentBase, IDisposable

Inherited 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&gt;(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 (ProjectAgent agent = new ProjectAgent(mySession)) { // call methods on agent here… }</code></pre>

Constructors

ProjectAgent(HttpClient)

Constructor: Collection of all services that works with Project data.

Parameters

httpClient HttpClient Use this HTTP client instead of making own HttpClient instance.

ProjectAgent(WebApiOptions, HttpClient)

Constructor: Collection of all services that works with Project data.

Parameters

options WebApiOptions Base URL and authentication values. httpClient HttpClient Optional: Use this HTTP client instead of making a new one.

Methods

AddProjectMembersAsync(int, ProjectMember[], RequestOptions)

Add multiple project members to a project

Parameters

projectEntityId int Project to add members to projectMembers ProjectMember[] Project members to add requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

CheckProjectEntityCopyAsync(ProjectEntity, int, RequestOptions)

Check a project copy before saving it: which of the optional parts of SaveProjectEntityCopy can be copied, and errors in the fields the user can edit. Nothing is saved. Call it again when the owner (Associate) changes, as the right to add members follows the project owner. SaveProjectEntityCopy refuses an optional part that is reported as not available or not licensed.

Parameters

projectEntity ProjectEntity The prepared copy as the user has edited it. Only Name and Associate (the project owner) are used. Null checks the copy as CreateProjectEntityFromExisting prepares it. sourceProjectId int The project that the copy is prepared from requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectCopyCheck&gt; Whether each optional part can be copied, and errors in the fields the user can edit

CreateDefaultProjectEntityAsync(RequestOptions)

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

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEntity&gt; A blank ProjectEntity

CreateDefaultProjectEventEntityAsync(RequestOptions)

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

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEventEntity&gt; A blank ProjectEventEntity

CreateDefaultProjectMemberAsync(RequestOptions)

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

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectMember&gt; A blank ProjectMember

CreateNewEntryAsync(DuplicateEntry, RequestOptions)

Creates a new project based on external duplicate

Parameters

duplicate DuplicateEntry The duplicate to create a new entry based upon requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; The database identity of the newly created entry

CreateProjectEntityFromExistingAsync(int, RequestOptions)

Create an unsaved ProjectEntity copy of an existing project, with the copy rules already applied: the name gets a copy marker, the current user is the owner (Associate), status, dates and completion start over, and members, note, links, image, number, publishing and history are left out. The returned entity is not persisted - let the user change Name and Associate, then pass it to SaveProjectEntityCopy.

Parameters

projectId int The id of the source project requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEntity&gt; Unsaved copy of the source project, with ProjectId = 0

DeleteProjectEntityAsync(int, RequestOptions)

Deletes the ProjectEntity

Parameters

projectEntityId int The identity of the ProjectEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

DeleteProjectEventEntityAsync(int, RequestOptions)

Deletes the ProjectEventEntity

Parameters

projectEventEntityId int The identity of the ProjectEventEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

DeleteProjectEventEntityFromProjectIdAsync(int, RequestOptions)

Delete a project event based on a project id. Does not delete the project, but does delete the published and ExternalEvent and AudienceVisibility records.

Parameters

projectId int The project id of the external event to delete. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task Nothing

DeleteProjectMemberAsync(int, RequestOptions)

Deletes the ProjectMember

Parameters

projectMemberId int The identity of the ProjectMember requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

DeleteProjectMemberByIdsAsync(int[], RequestOptions)

Deletes projectmembers rows.

Parameters

projectMemberIds int[] An Array of projectmember ids. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

DeleteProjectMembersAsync(int, int[], RequestOptions)

Delete the given project members from a project

Parameters

projectEntityId int Project to remove members from memberIds int[] Project member ids requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

GetDuplicateRulesAsync(RequestOptions)

Retrieve all available duplicate rules for project

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DuplicateRule[]&gt; All available duplicate rules

GetDuplicatesAsync(string, RequestOptions)

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

Parameters

name string Name used for lookup requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DuplicateEntry[]&gt; Any records matching the specified name

GetMyMemberProjectsAsync(RequestOptions)

Returning the projects where an user is project member.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; The list of projects.

GetMyProjectEventsAsync(RequestOptions)

Gets all project events that belongs to the currently logged on user. The list of events are filtered by the Audience Visibility restrictions set when the project event is created.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEvent[]&gt; Array of project events

GetMyProjectsAsync(bool, RequestOptions)

Returning the projects belonging to an associate. If memberProjects is false only the projects where the associate is project responsible is returned, otherwise both the projects where the associate is project responsible and project member is returned.

Parameters

includeMemberProjects bool True to include projects where the user is project member. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; The list of projects

GetMyPublishedProjectsAsync(RequestOptions)

Get published projects from the logged in user.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; Projects

GetNextMilestoneAsync(int, RequestOptions)

Next upcoming milestone appointment

Parameters

projectId int Project id - primary key requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Appointment&gt; Upcoming milestone appointment

GetNextProjectStatusAsync(int, RequestOptions)

Parameters

projectId int requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt;

GetProjectAsync(int, RequestOptions)

Gets a specific Project object.

Parameters

projectId int The identifier of the Project object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project&gt; Project

GetProjectEntityAsync(int, RequestOptions)

Gets a specific ProjectEntity object.

Parameters

projectEntityId int The identifier of the ProjectEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEntity&gt; ProjectEntity

GetProjectEntityWithoutMembersAsync(int, RequestOptions)

Get a project entity with no project members. Project members property is always an empty array.

Parameters

projectId int The project id of the project. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEntity&gt; Project entity with the specified id. The project members property is always an empty array.

GetProjectEventAsync(int, RequestOptions)

Gets a specific ProjectEvent object.

Parameters

projectEventId int The identifier of the ProjectEvent object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEvent&gt; ProjectEvent

GetProjectEventEntityAsync(int, RequestOptions)

Gets a specific ProjectEventEntity object.

Parameters

projectEventEntityId int The identifier of the ProjectEventEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEventEntity&gt; ProjectEventEntity

GetProjectEventEntityFromProjectIdAsync(int, RequestOptions)

Get a ProjectEventEntity based on a projectId.

Parameters

projectId int The projectId to get a ProjectEventEntity for requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEventEntity&gt; ProjectEventEntity

GetProjectEventListAsync(int[], RequestOptions)

Gets an array of specific ProjectEvent objects.

Parameters

projectEventIds int[] The identifiers of the ProjectEvent object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEvent[]&gt; Array of ProjectEvent objects

GetProjectEventOnPersonAsync(int, int, RequestOptions)

Gets a ProjectEvent object from a project and a person.

Parameters

projectId int The project Id personId int Id of the person the project events belong to. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEvent&gt;

GetProjectEventsOnPersonAsync(int, RequestOptions)

Gets all project events that belongs to the person specified. The list of events are filtered by the Audience Visibility restrictions set when the project event is created.

Parameters

personId int Id of the person the project events belong to. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEvent[]&gt; Array of project events

GetProjectFencingInfoAsync(RequestOptions)

Get the current project fencing status for the tenant

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FencingInfo&gt; Current fencing status including count, maximum, and warning state

GetProjectImageAsync(int, string, RequestOptions)

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

Parameters

projectId int The project id of the project the image belongs to. returnContentType string Accept content-type. Default “application/octet-stream”. Could also be “application/pdf”, “text/plain”, “text/html”, or “multipart/related” requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<byte[]&gt; The project image.

GetProjectListAsync(int[], RequestOptions)

Gets an array of specific Project objects.

Parameters

projectIds int[] The identifiers of the Project object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; Array of Project objects

GetProjectMemberAsync(int, RequestOptions)

Gets a specific ProjectMember object.

Parameters

projectMemberId int The identifier of the ProjectMember object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectMember&gt; ProjectMember

GetProjectMembersAsync(int, RequestOptions)

Returns an array of project members

Parameters

projectId int The project id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectMember[]&gt; An array of project members

GetProjectMembersByIdAsync(int[], RequestOptions)

Returns an array of project members

Parameters

projectMemberIds int[] requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectMember[]&gt; An array of project members

GetProjectsFromContactAsync(int, RequestOptions)

Returns all projects where the given contact has projectmembers.

Parameters

contactId int The contact id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; ProjectListEntity

GetProjectsFromPersonAsync(int, RequestOptions)

Return all projects where the person is project member.

Parameters

personId int The person id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; ProjectListEntity

GetPublishedProjectAsync(int, RequestOptions)

Get published project by project id.

Parameters

projectId int The project id. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project&gt; Project

GetPublishedProjectsAsync(int[], RequestOptions)

Get published projects by project ids.

Parameters

projectIds int[] The array of project ids requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; Projects

GetPublishedProjectsOnPersonIdAsync(int, RequestOptions)

Get published projects where person is a member

Parameters

personId int The person id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Project[]&gt; Array of project

HasGuideActivitiesAsync(int, RequestOptions)

Parameters

projectId int requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt;

HasGuideAsync(int, RequestOptions)

Does this project have a guide associated with its project type?

Parameters

projectId int Project id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt; True if the project has a guide

IsNumberValidAsync(int, string, RequestOptions)

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

Parameters

contactId int The Project id number string The number to check for uniqueness and validity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt; True if the number is valid

MergeAsync(int, int, bool, RequestOptions)

Merge two projects into one, removing the source project in the process

Parameters

sourceProjectId int Id of source project for merge. This project is removed after the merge is completed. destinationProjectId int Id of destination project to merge to. This project is updated with info from the source. replaceEmptyFieldsOnDestination bool Fill in empty fields on destination from source? requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

OfferAutoNextStatusOnApppointmentCompletedAsync(int, RequestOptions)

Parameters

appointmentId int requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt;

SaveProjectEntityAsync(ProjectEntity, RequestOptions)

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

Parameters

projectEntity ProjectEntity The ProjectEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEntity&gt; New or updated ProjectEntity

SaveProjectEntityCopyAsync(ProjectEntity, int, ProjectCopyOptions, RequestOptions)

Save a project copy prepared by CreateProjectEntityFromExisting, optionally copying members, note, links and image of the source project along with it. The server rebuilds the copy from the source project and takes only Name and Associate (the project owner) from the passed entity; every other value on it is ignored. Members, note, links and image are read from the source project, not from the passed entity. Pass null options, or options with nothing set, to copy the project alone.

Parameters

projectEntity ProjectEntity The prepared copy. Only Name and Associate (the project owner) are used; every other value, including ProjectId, is ignored. sourceProjectId int The project that the copy was prepared from options ProjectCopyOptions Which optional parts to copy alongside the project. Null copies the project alone. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectCopyResult&gt; The new project id, and what became of each optional part

SaveProjectEntityWithoutMembersAsync(ProjectEntity, RequestOptions)

Save a project entity, the project members are ignored.

Parameters

projectEntity ProjectEntity The project entity to save. Any set project members are ignored. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEntity&gt; The saved project entity without any project members. The project members property is always an empty array.

SaveProjectEventEntityAsync(ProjectEventEntity, RequestOptions)

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

Parameters

projectEventEntity ProjectEventEntity The ProjectEventEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectEventEntity&gt; New or updated ProjectEventEntity

SaveProjectMemberAsync(ProjectMember, RequestOptions)

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

Parameters

projectMember ProjectMember The ProjectMember that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectMember&gt; New or updated ProjectMember

SaveProjectMembersFunctionAndCommentAsync(int[], int, string, RequestOptions)

Saves role and comment on an array of projectmembers represented by ids

Parameters

projectMemberIds int[] roleId int comment string requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

SetCompletedAsync(int, bool, RequestOptions)

Set the completed flag on the project

Parameters

projectId int isCompleted bool True if the project is completed, false if it is not requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

SetDuplicateRulesStatusAsync(DuplicateRule[], RequestOptions)

Set which duplicate rules should be active or not

Parameters

rules DuplicateRule[] Duplicate rules to update active status for requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

SetProjectImageAsync(int, byte[], RequestOptions)

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

Parameters

projectId int The project id of the project the image belongs to. image byte[] The project image. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

UpdateProjectMemberAsync(ProjectMember, RequestOptions)

Updates a ProjectMember row.

Parameters

projectMember ProjectMember ProjectMember to update requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ProjectMember&gt; The Updated ProjectMember

UpdateProjectMembersAsync(int, ProjectMember[], RequestOptions)

Update existing project members. Not creating new (only projectmember_id > 0 accepted)

Parameters

projectId int Project of which members will be updated projectMembers ProjectMember[] Project members to update requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

ValidateProjectEntityAsync(ProjectEntity, RequestOptions)

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

Parameters

projectEntity ProjectEntity Entity to be checked for errors. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<StringDictionary&gt; Error messages tagged by field.