Skip to main content

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent”></a> Interface IDocumentAgent

Namespace: SuperOffice.WebApi.Agents
Assembly: SuperOffice.WebApi.dll
Collection of all services that works with Document data. This is services for the document information, not the physical document themselves. These are handled by the BLOB service methods.

Implements

IAgentBase, IDisposable

Methods

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CheckinDocumentAsync_System_Int32_System_String___System_String_System_String___SuperOffice_WebApi_RequestOptions_”></a> CheckinDocumentAsync(int, string[], string, string[], RequestOptions)

Check in a currently checked-out document

Parameters

documentId int SuperOffice document Id allowedReturnTypes string[] List of return types that the client is prepared to handle, in case the document plugin needs to request additional processing.<br/>Standard allowed return types include ‘None’, ‘Message’, ‘SoProtocol’, ‘CustomGui’, ‘Other’.<br/>An empty array implies that the client places no restriction on possible return action requests. versionDescription string Optional textual description related to this version of the document; may be blank, and is discarded if the document/plugin do not support versioning. versionExtraFields string[] Optional extra metadata related to the new version (as opposed to metadata related to the document as a whole). Discarded if the document/plugin do not support versioning. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ReturnInfo&gt; Return information, including possible requests for further processing (“Return Action”). Return actions are constrained by the allowedReturnTypes parameter.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CheckoutDocumentAsync_System_Int32_System_String___SuperOffice_WebApi_RequestOptions_”></a> CheckoutDocumentAsync(int, string[], RequestOptions)

Check out a document for editing by the current user.

Parameters

documentId int SuperOffice document ID allowedReturnTypes string[] List of return types that the client is prepared to handle, in case the document plugin needs to request additional processing.<br/>Standard allowed return types include ‘None’, ‘Message’, ‘SoProtocol’, ‘CustomGui’, ‘Other’.<br/>An empty array implies that the client places no restriction on possible return action requests. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ReturnInfo&gt; Return information, including possible requests for further processing (“Return Action”). Return actions are constrained by the allowedReturnTypes parameter.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CopyDocumentToCsAttachmentAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CopyDocumentToCsAttachmentAsync(int, RequestOptions)

Copy a crm document to cs attachemnt. For use in mailings

Parameters

documentId int The primary key of the document to copy to the cs attachment requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; The primary key of the newly added attachment

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateDefaultDocumentEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultDocumentEntityAsync(RequestOptions)

Set default values into a new DocumentEntity. 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<DocumentEntity&gt; A blank DocumentEntity

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateDefaultDocumentEntityFromSuggestionAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultDocumentEntityFromSuggestionAsync(int, RequestOptions)

Parameters

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

Returns

Task<DocumentEntity&gt;

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateDefaultDocumentPreviewAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultDocumentPreviewAsync(RequestOptions)

Set default values into a new DocumentPreview. 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<DocumentPreview&gt; A blank DocumentPreview

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateDefaultSuggestedDocumentEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultSuggestedDocumentEntityAsync(RequestOptions)

Set default values into a new SuggestedDocumentEntity. 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<SuggestedDocumentEntity&gt; A blank SuggestedDocumentEntity

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateDefaultTemplateVariablesParametersAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTemplateVariablesParametersAsync(RequestOptions)

Set default values into a new TemplateVariablesParameters. 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<TemplateVariablesParameters&gt; A blank TemplateVariablesParameters

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateDocumentStreamAsync_SuperOffice_WebApi_Data_DocumentEntity_System_Boolean_System_String_SuperOffice_WebApi_RequestOptions_”></a> CreateDocumentStreamAsync(DocumentEntity, bool, string, RequestOptions)

Creates a new Stream that can be used to store the document in the file archive.

Parameters

documentEntity DocumentEntity The document the stream belongs to overwriteExistingData bool If true, the stream will overwrite existing data stored for this record in the document archive 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; A writeable stream. When written and closed, the stream will become the new document content, subject to locking and versioning constraints.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateNewPhysicalDocumentFromTemplateAsync_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> CreateNewPhysicalDocumentFromTemplateAsync(int, int, int, int, int, int, int, string, RequestOptions)

Create a new document content based on a document template and store it in the document archive. Tags are substituted according to the provided id’s. Use GetDocumentStream to obtain the created document. Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

Parameters

contactId int Identifier for a contact. Defaults to document’s contact if 0 personId int Identifier for a person. Defaults to document’s person if 0 appointmentId int identifier for an appointment. Defaults to document if 0 documentId int Identifier for a document. The document defines the template to use. saleId int Identifier for sale. Defaults to document’s sale if 0. selectionId int identifier for selection. projectId int identifier for project. Defaults to document’s project if 0 uiCulture string Language variation of template to use when creating document content. (ISO code “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; The updated document entity, after creating the document content from the template.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateNewPhysicalDocumentFromTemplateWithCustomTags2Async_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_SuperOffice_WebApi_Data_StringDictionary_System_String_SuperOffice_WebApi_RequestOptions_”></a> CreateNewPhysicalDocumentFromTemplateWithCustomTags2Async(int, int, int, int, int, int, int, StringDictionary, string, RequestOptions)

Create a new physical document based on a document template and store it in the document archive. Tags are substituted according to the provided id’s. Use GetDocumentStream to obtain the created document content. Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

Parameters

contactId int Identifier for a contact. Defaults to document’s contact if 0 personId int Identifier for a person. Defaults to document’s person if 0 appointmentId int identifier for an appointment. Defaults to document if 0 documentId int Identifier for the document saleId int Identifier for sale. Defaults to document’s sale if 0. selectionId int identifier for selection. projectId int identifier for project. Defaults to document’s project if 0 customTags StringDictionary Dictionary of custom tag names and values. Each name should have exactly four characters. There should be exactly one value for each tag. uiCulture string Language variation of template to use when creating document. (ISO code - “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; The document object with updated info after creating the document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateNewPhysicalDocumentFromTemplateWithCustomTagsAsync_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_String___System_String___System_String_SuperOffice_WebApi_RequestOptions_”></a> CreateNewPhysicalDocumentFromTemplateWithCustomTagsAsync(int, int, int, int, int, int, int, string[], string[], string, RequestOptions)

Create a new physical document based on a document template and store it in the document archive. Tags are substituted according to the provided id’s. Use GetDocumentStream to obtain the created document content. Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

Parameters

contactId int Identifier for a contact. Defaults to document’s contact if 0 personId int Identifier for a person. Defaults to document’s person if 0 appointmentId int identifier for an appointment. Defaults to document if 0 documentId int Identifier for the document saleId int Identifier for sale. Defaults to document’s sale if 0. selectionId int identifier for selection. projectId int identifier for project. Defaults to document’s project if 0 customTags string[] Array of custom tag names. Each name should have exactly four characters. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. customValues string[] Array of values for custom tags. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. uiCulture string Language variation of template to use when creating document. (ISO code - “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; The document object with updated info after creating the document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateNewPhysicalMailMergeDocumentFromTemplateAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> CreateNewPhysicalMailMergeDocumentFromTemplateAsync(int, string, RequestOptions)

Create a new physical document based on the documents template. Do not replace template tags, as the document is going to be used as a mail merge source. Use GetDocumentStream to obtain the created documents. Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

Parameters

documentId int Identifier for a document. The template to use is stored in the document entity. uiCulture string Language variation of template to use. (ISO code: “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; The document object with updated info after creating the document.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_CreateTempFileAsync_System_String_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> CreateTempFileAsync(string, byte[], RequestOptions)

Create a new temporary file based on the provided stream. Specified filename may be overridden, and actual name is returned.

Parameters

filename string Wanted name of file. dataStream byte[] Data to be added to the file. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Actual used filename.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_DeleteDocumentEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteDocumentEntityAsync(int, RequestOptions)

Deletes the DocumentEntity

Parameters

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

Returns

Task

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_DeletePhysicalDocumentAsync_System_Int32_System_String___SuperOffice_WebApi_RequestOptions_”></a> DeletePhysicalDocumentAsync(int, string[], RequestOptions)

Delete the document contents

Parameters

documentId int document primary key allowedReturnType string[] List of return types that the client is prepared to handle, in case the document plugin needs to request additional processing. Standard allowed return types include ‘None’, ‘Message’, ‘SoProtocol’, ‘CustomGui’, ‘Other’.<br/>An empty array implies that the client places no restriction on possible return action requests requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ReturnInfo&gt; Delete status - did removal succeed or not

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_DeleteTempFileAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> DeleteTempFileAsync(string, RequestOptions)

Delete a temporary file created with CreateTempFile.

Parameters

filename string Name of temporary file to delete. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_ExecuteDocumentCommandAsync_System_Int32_System_String_System_String___System_String_System_String___SuperOffice_WebApi_RequestOptions_”></a> ExecuteDocumentCommandAsync(int, string, string[], string, string[], RequestOptions)

Execute a custom command on a particular document, optionally a particular version

Parameters

documentId int SuperOffice document ID versionId string Version ID if applicable/desired; a blank value implies “latest” version and is always acceptable. allowedReturnTypes string[] List of return types that the client is prepared to handle, in case the document plugin needs to request additional processing.<br/>Standard allowed return types include ‘None’, ‘Message’, ‘SoProtocol’, ‘CustomGui’, ‘Other’.<br/>An empty array implies that the client places no restriction on possible return action requests. command string Command name, generally matching one of those returned from the GetDocumentCommands service. However, it is legal for document plugins to support commands that are not declared through GetDocumentCommands, for instance if a custom GUI needs to access plugin functionality. additionalData string[] Any additional data that the document command needs. This parameter can be used as a tunnel between a custom-programmed GUI and its plugin.<br/>It is suggested that the format is name=value, with one such pair per array item. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ReturnInfo&gt; Return information, including possible requests for further processing (“Return Action”). Return actions are constrained by the allowedReturnTypes parameter.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetAppointmentDocumentsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetAppointmentDocumentsAsync(int, RequestOptions)

Get all documents that are linked to the appointment. I.e. the documents that are listed in the appointment dialog.

Parameters

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

Returns

Task<Document[]&gt; Array of documents

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetCheckoutStateAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetCheckoutStateAsync(int, RequestOptions)

Get the current checkout state for a document, relative to the user perforing the call.

Parameters

documentId int SuperOffice document ID requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CheckoutInfo&gt; Current checkout state of the document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetContactDocumentsAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetContactDocumentsAsync(int, DateTime, DateTime, int, RequestOptions)

Method that returns a specified number of document appointments within a time range. The document appointments belong to the contact specified.

Parameters

contactId int The contact id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetContactDocumentsByTemplateHeadingAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetContactDocumentsByTemplateHeadingAsync(int, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by the document template heading. The document appointments belong to the contact specified. The heading represents a grouping or filtering of document templates.

Parameters

contactId int The contact id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. templateHeadingId int The document template heading id. The heading represents a grouping or filtering of document templates. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetContactDocumentsByTemplateTypeAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetContactDocumentsByTemplateTypeAsync(int, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template type. The document appointments belong to the contact specified.

Parameters

contactId int The contact id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateId int Id of the document template type to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetContactDocumentsByTemplateTypesAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetContactDocumentsByTemplateTypesAsync(int, DateTime, DateTime, int, int[], RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template types. The document appointments belong to the contact specified.

Parameters

contactId int The contact id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateIds int[] Ids of the document template types to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentAsync(int, RequestOptions)

Gets a specific Document object.

Parameters

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

Returns

Task<Document&gt; Document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentCommandsAsync_System_Int32_System_String___SuperOffice_WebApi_RequestOptions_”></a> GetDocumentCommandsAsync(int, string[], RequestOptions)

Get a list of custom commands valid for the specific document at this time. This information should not be cached by clients, as it may change between documents and over time.

Parameters

documentId int SuperOffice document ID allowedReturnTypes string[] List of return types that the client is prepared to handle, in case the document plugin needs to request additional processing.<br/>Standard allowed return types include ‘None’, ‘Message’, ‘SoProtocol’, ‘CustomGui’, ‘Other’.<br/>An empty array implies that the client places no restriction on possible return action requests.<br/>In this context the parameter is used to filter the returned command list, so that commands that require return actions not supported, will not be included by the document plugin. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CommandInfo[]&gt; Array of command information items. The command list is constrained by the allowedReturnTypes parameter.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentEntityAsync(int, RequestOptions)

Gets a specific DocumentEntity object.

Parameters

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

Returns

Task<DocumentEntity&gt; DocumentEntity

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentLengthAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentLengthAsync(int, string, RequestOptions)

Get length of the document content in bytes.

Parameters

documentId int SuperOffice document id versionId string Version ID if applicable; a blank value implies “latest” version and is always acceptable. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<long&gt; The length of the document content in bytes.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentListAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetDocumentListAsync(int[], RequestOptions)

Gets an array of specific Document objects.

Parameters

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

Returns

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

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentPropertiesAsync_System_Int32_System_String___SuperOffice_WebApi_RequestOptions_”></a> GetDocumentPropertiesAsync(int, string[], RequestOptions)

Get plugin-dependent properties for the document. A number of standard properties that should be supported by all plugins are defined in SuperOffice.CRM.Documents.Constants.Properties.

Parameters

documentId int SuperOffice document ID requestedProperties string[] Array of property names whose values are being requested. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<StringDictionary&gt; Dictionary of name=value pairs, corresponding to the requested properties.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentStreamAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentStreamAsync(int, string, RequestOptions)

Get the document content as a stream

Parameters

documentId int SuperOffice document id 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 document as a Stream. This stream can be read once and clients should not assume it remains valid after a ReadToEnd or Close.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentStreamFromEntityAsync_SuperOffice_WebApi_Data_DocumentEntity_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentStreamFromEntityAsync(DocumentEntity, string, RequestOptions)

Get the document as a stream

Parameters

documentEntity DocumentEntity The document entity object that refers to the binary data (document) 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 document as a Stream

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentUrlAsync_System_Int32_System_String_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentUrlAsync(int, string, bool, RequestOptions)

Get a URL referring to the given document content.<para/>This URL may be passed to the ultimate client (text editor of some kind?), which is then responsible for all further operations.<para/>The returned string is a fully qualified URL.<para/>Not all documents and document plugins support this feature.

Parameters

documentId int SuperOffice document primary key versionId string Version ID if applicable/desired; a blank value implies “latest” version and is always acceptable. writeableUrl bool If true, then a URL that supports saving is requested. Som edocument plugins may not support read-only URLs, so there is no guarantee that a False value will actually yield a read-only URL, and vice versa. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Fully resolved URL referring to the document. May be NULL or blank if plugin does not support URLs.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetDocumentsByTemplateHeadingAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetDocumentsByTemplateHeadingAsync(int, RequestOptions)

Method that returns document appointments, filtered by the document template heading. The heading represents a grouping or filtering of document templates.

Parameters

templateHeadingId int The document template heading id. The heading represents a grouping or filtering of document templates. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetMyPublishedDocumentsAsync_SuperOffice_WebApi_RequestOptions_”></a> GetMyPublishedDocumentsAsync(RequestOptions)

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of documents

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPersonDocumentsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPersonDocumentsAsync(int, RequestOptions)

Get all documents that are linked to the person. I.e. the documents that are listed in the person dialog.

Parameters

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

Returns

Task<Document[]&gt; Array of documents

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPersonDocumentsByDateAsync_System_Int32_System_Boolean_System_DateTime_System_DateTime_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPersonDocumentsByDateAsync(int, bool, DateTime, DateTime, int, RequestOptions)

Method that returns a specified number of document appointments within a time range. The document appointments belong to the person specified.

Parameters

personId int The person id of the SuperOffice user (associate). includeProjectDocuments bool If true, all appointments that belong to projects where the user is a project member are included as well as the appointments belonging to the person. startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPersonDocumentsByTemplateHeadingAsync_System_Int32_System_Boolean_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPersonDocumentsByTemplateHeadingAsync(int, bool, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template heading. The document appointments belong to the person specified. The heading represents a grouping or filtering of document templates.

Parameters

personId int The person id of the SuperOffice user (associate). includeProjectDocuments bool If true, all appointments that belong to projects where the user is a project member are included as well as the appointments belonging to the person. startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. templateHeadingId int The document template heading id. The heading represents a grouping or filtering of document templates. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPersonDocumentsByTemplateTypeAsync_System_Int32_System_Boolean_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPersonDocumentsByTemplateTypeAsync(int, bool, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template type. The document appointments belong to the person specified.

Parameters

personId int The person id of the SuperOffice user (associate). includeProjectDocuments bool If true, all appointments that belong to projects where the user is a project member are included as well as the appointments belonging to the person. startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateId int Id of the document template type to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPersonDocumentsByTemplateTypesAsync_System_Int32_System_Boolean_System_DateTime_System_DateTime_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetPersonDocumentsByTemplateTypesAsync(int, bool, DateTime, DateTime, int, int[], RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template types. The document appointments belong to the person specified.

Parameters

personId int The person id of the SuperOffice user (associate). includeProjectDocuments bool If true, all appointments that belong to projects where the user is a project member are included as well as the appointments belonging to the person. startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateIds int[] Ids of the document template types to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPluginCapabilitiesAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPluginCapabilitiesAsync(int, RequestOptions)

Get a list of plugin-dependent capabilities for a given document archive plugin.<br/>A standard set of properties is defined in SuperOffice.CRM.Documents.Constants.Capabilities.

Parameters

pluginId int Numeric document plugin id, corresponding to the document.archiveProvider id or doctmpl.autoeventid. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<StringDictionary&gt; Dictionary mapping capability names=values

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPluginListAsync_SuperOffice_WebApi_RequestOptions_”></a> GetPluginListAsync(RequestOptions)

Get a list of installed document plugins

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<StringDictionary&gt; Dictionary mapping plugin id=plugin name

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPreviewDocumentStreamAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPreviewDocumentStreamAsync(int, RequestOptions)

Get the preview version of the document content as a stream. Retrieves a sanitized version if possible

Parameters

documentId int SuperOffice document id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentPreview&gt; Preview version of the document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectDocumentsAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetProjectDocumentsAsync(int, DateTime, DateTime, int, RequestOptions)

Method that returns a specified number of document appointments within a time range. The document appointments belong to the project specified.

Parameters

projectId int The project id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectDocumentsByTemplateHeadingAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetProjectDocumentsByTemplateHeadingAsync(int, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template heading. The document appointments belong to the project specified. The heading represents a grouping or filtering of document templates.

Parameters

projectId int The project id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. templateHeadingId int The document template heading id. The heading represents a grouping or filtering of document templates. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectDocumentsByTemplateTypeAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetProjectDocumentsByTemplateTypeAsync(int, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template type. The document appointments belong to the project specified.

Parameters

projectId int The project id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateId int Id of the document template type to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectDocumentsByTemplateTypesAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetProjectDocumentsByTemplateTypesAsync(int, DateTime, DateTime, int, int[], RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template types. The document appointments belong to the project specified.

Parameters

projectId int The project id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateIds int[] Ids of the document template types to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectMemberDocumentsAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetProjectMemberDocumentsAsync(int, DateTime, DateTime, int, RequestOptions)

Method that returns a specified number of document appointments within a time range. The document appointments belong to the project member specified.

Parameters

personId int The project member’s person id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectMemberDocumentsByTemplateHeadingAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetProjectMemberDocumentsByTemplateHeadingAsync(int, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template heading. The document appointments belong to the project member specified. The heading represents a grouping or filtering of document templates.

Parameters

personId int The project member’s person id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. templateHeadingId int The document template heading id. The heading represents a grouping or filtering of document templates. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectMemberDocumentsByTemplateTypeAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetProjectMemberDocumentsByTemplateTypeAsync(int, DateTime, DateTime, int, int, RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template type. The document appointments belong to the project member specified.

Parameters

personId int The project member’s person id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateId int Id of the document template type to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetProjectMemberDocumentsByTemplateTypesAsync_System_Int32_System_DateTime_System_DateTime_System_Int32_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetProjectMemberDocumentsByTemplateTypesAsync(int, DateTime, DateTime, int, int[], RequestOptions)

Method that returns a specified number of document appointments within a time range, filtered by document template types. The document appointments belong to the project member specified.

Parameters

personId int The project member’s person id startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. documentTemplateIds int[] Ids of the document template types to filter on. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPublishedDocumentAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPublishedDocumentAsync(int, RequestOptions)

Get the document if it’s published

Parameters

documentId int The document id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document&gt; Document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPublishedDocumentsAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> GetPublishedDocumentsAsync(int[], RequestOptions)

Get the published documents from an array of doucment ids.

Parameters

documentIds int[] Array of document ids. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPublishedDocumentsByDateAsync_System_Int32_System_Boolean_System_DateTime_System_DateTime_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPublishedDocumentsByDateAsync(int, bool, DateTime, DateTime, int, RequestOptions)

Method that returns a specified number of published document appointments within a time range. The document appointments is visible to the person specified or the document is in a project the person belongs to.

Parameters

personId int The personId includeProjectDocuments bool Include projectDocuments to select documents in projects person is a member of. startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPublishedPersonDocumentsByDateAsync_System_Int32_System_Boolean_System_DateTime_System_DateTime_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPublishedPersonDocumentsByDateAsync(int, bool, DateTime, DateTime, int, RequestOptions)

Method that returns a specified number of published document appointments within a time range. The document appointments belong to the person specified or the document is in a project the person belongs to.

Parameters

personId int The person id of the SuperOffice user (associate). includeProjectDocuments bool If true, all appointments that belong to projects where the user is a project member are included as well as the appointments belonging to the person. startTime DateTime The start of the time interval we want appointments from. This will usually be the current time. endTime DateTime The end of the time interval. count int The maximum number of appointments that should be returned. -1 means no count restrictions. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of Appointments.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetPublishedProjectDocumentsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPublishedProjectDocumentsAsync(int, RequestOptions)

Get published appointment documents by project id.

Parameters

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

Returns

Task<Document[]&gt; Array of Appointment

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetSaleDocumentsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetSaleDocumentsAsync(int, RequestOptions)

Get all documents that are linked to the sale. I.e. the documents that are listed in the sale dialog.

Parameters

saleId int The sale id. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<Document[]&gt; Array of documents

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetSanitizedDocumentStreamAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetSanitizedDocumentStreamAsync(int, string, RequestOptions)

Get the document content as a stream. Retrieves a sanitized version if possible

Parameters

documentId int SuperOffice document id 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 document as a Stream. This stream can be read once and clients should not assume it remains valid after a ReadToEnd or Close.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetSanitizedTemplateStreamAsync_System_String_System_Boolean_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetSanitizedTemplateStreamAsync(string, bool, string, string, RequestOptions)

Retrieve a stream to a mail template based on its name. Sanitizes the contents if possible.

Parameters

templateName string Filename of mail template to retrieve allowPersonal bool If true, try looking up template in personal area before looking in shared document template area uiCulture string Language variation of template to use. (ISO code: “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. 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; Open stream to the mail template

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetSanitizedTemplateStreamFromIdAsync_System_Int32_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetSanitizedTemplateStreamFromIdAsync(int, string, string, RequestOptions)

Retrieve a stream to a document template based on its id. Sanitizes the contents if possible.

Parameters

templateId int Id of template to retrieve uiCulture string Language variation of template to use. (ISO code: “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. 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; Open stream to the template

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetSuggestedDocumentEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetSuggestedDocumentEntityAsync(int, RequestOptions)

Gets a specific SuggestedDocumentEntity object.

Parameters

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

Returns

Task<SuggestedDocumentEntity&gt; SuggestedDocumentEntity

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetTempFileAsync_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetTempFileAsync(string, string, RequestOptions)

Get data stream for temporary file created with CreateTempFile.

Parameters

filename string Name of temporary file to retrieve. 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 document as a Stream

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetTemplateStreamAsync_System_String_System_Boolean_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetTemplateStreamAsync(string, bool, string, string, RequestOptions)

Retrieve a stream to a mail template based on its name

Parameters

templateName string Filename of mail template to retrieve allowPersonal bool If true, try looking up template in personal area before looking in shared document template area uiCulture string Language variation of template to use. (ISO code: “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. 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; Open stream to the mail template

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetTemplateStreamFromIdAsync_System_Int32_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetTemplateStreamFromIdAsync(int, string, string, RequestOptions)

Retrieve a stream to a document template based on its id

Parameters

templateId int Id of template to retrieve uiCulture string Language variation of template to use. (ISO code: “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. 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; Open stream to the template

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetUnsanitizedPreviewDocumentStreamAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetUnsanitizedPreviewDocumentStreamAsync(int, RequestOptions)

Get the preview version of the document content as a stream. Retrieves an unsanitized version. This has less CPU impact but the caller must sanitize the content before presenting it to the user.

Parameters

documentId int SuperOffice document id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentPreview&gt; Unsanitized preview version of the document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_GetVersionListAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetVersionListAsync(int, RequestOptions)

Get a list of existing, committed versions for a given document

Parameters

documentId int SuperOffice document Id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<VersionInfo[]&gt; Array of objects describing the existing, committed versions for this document

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_RenameDocumentAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> RenameDocumentAsync(int, string, RequestOptions)

Rename the physical document, i.e., change the file name or equivalent concept in the document archive.

Parameters

documentId int SuperOffice document ID newFilename string Suggested new file name. The document archive may amend this to conform to uniqueness constraints, character range limitations etc. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; The actual, new “file” name. This will generally be derived from the suggested name, but may be amended.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SaveDocumentEntityAsync_SuperOffice_WebApi_Data_DocumentEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveDocumentEntityAsync(DocumentEntity, RequestOptions)

Updates the existing DocumentEntity or creates a new DocumentEntity if the id parameter is 0. Save the document entity. If the entity already exists and the file name of the incoming entity is different from the existing one, a corresponding renaming of the physical document will be attempted. This may cause an amended file name to be substituted into the document entity, since a document plugin may have aribitrary rules on file names and collisions. Clients should always inspect the return value from this call and not assume that what they sent for saving is the final truth.

Parameters

documentEntity DocumentEntity The DocumentEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; New or updated DocumentEntity

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SaveDocumentTemplateStreamAsync_System_Int32_System_Byte___System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> SaveDocumentTemplateStreamAsync(int, byte[], string, int, RequestOptions)

Saves content in stream to document template file

Parameters

documentTemplateId int Identifier for document template content byte[] Stream containing content to be saved to document template file languageCode string Language variation of template to update. (ISO code: “en-US” or “nb-NO” etc). Used to select a template of the appropriate language. Can be overridden in SO ARC by user preference “PreferDocLang”. pluginId int Plugin id. Use -1 to use the plugin specified in the template. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<TemplateInfo&gt; Template info

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SavePrivacyReportAsync_System_String_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> SavePrivacyReportAsync(string, string, int, RequestOptions)

Generates a Pdf from HTML and makes a document

Parameters

htmlReport string Html to convert title string Title of report personId int Person id associated with the report requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; Document id of saved report

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SavePrivacyReportPdfAsync_System_Byte___System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> SavePrivacyReportPdfAsync(byte[], string, int, RequestOptions)

Saves a pdf stream, assigns file name, connects to given contact etc.

Parameters

stream byte[] The pdf document as a stream. title string Title of report personId int Person id associated with the report requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; Document id of saved report

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SaveSuggestedDocumentEntityAsync_SuperOffice_WebApi_Data_SuggestedDocumentEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveSuggestedDocumentEntityAsync(SuggestedDocumentEntity, RequestOptions)

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

Parameters

suggestedDocumentEntity SuggestedDocumentEntity The SuggestedDocumentEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<SuggestedDocumentEntity&gt; New or updated SuggestedDocumentEntity

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SetDocumentStreamAsync_SuperOffice_WebApi_Data_DocumentEntity_System_Byte___System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> SetDocumentStreamAsync(DocumentEntity, byte[], bool, RequestOptions)

Store a document’s contents from its stream. Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

Parameters

documentEntity DocumentEntity The document entity object that the binary data (document) should be stored to. Its file name may be amended by this call, see the return value stream byte[] The document as a stream. overwriteExistingData bool If true, the stream will overwrite existing data stored for this record in the document archive; this works only for documents that already have a physical document in existence. If false, the call will only work for a document that has no physical document in the archive, and such a physical document will be created. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SetDocumentStreamFromIdAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetDocumentStreamFromIdAsync(int, byte[], RequestOptions)

Store document content from stream. Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

Parameters

documentId int The document entity object that the binary data (document) should be stored to. Its file name may be amended by this call, see the return value. stream byte[] The document content as a stream. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<DocumentEntity&gt; Since there is a potential for a name conflict (the file name stored by the document entity earlier may prove to be invalid), the (possibly amended) document entity is returned. The client should not assume that any earlier, cached entity information is valid.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SetTemplateStreamAsync_System_String_System_Boolean_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetTemplateStreamAsync(string, bool, byte[], RequestOptions)

Save a mail signature template to the document archive

Parameters

filename string Filename of template. personal bool If true, save the template in the user area, instead of in shared template area. stream byte[] The signature template content as a stream. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteMergeDocumentTemplateVariables2Async_System_Int32_System_Int32_SuperOffice_WebApi_Data_StringDictionary_System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteMergeDocumentTemplateVariables2Async(int, int, StringDictionary, string, RequestOptions)

Parse the source document, and replace any template variable tags with their values, based on the associate Id.<p/> The source document should be of type MergeDraft. This method also takes a pair of arrays specifying custom tags and their values; these tags will be available during substitution in addition to all the existing tags. Custom values will override values otherwise set.

Parameters

documentId int The document id that refers to the binary data (document) associateId int The associateId used to subsitute tags in the document. customTags StringDictionary Dictionary of custom tag names and values. Each name should have exactly four characters. There should be exactly one value for each tag. 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 document as a Stream

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteMergeDocumentTemplateVariablesAsync_System_Int32_System_Int32_System_String___System_String___System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteMergeDocumentTemplateVariablesAsync(int, int, string[], string[], string, RequestOptions)

Parse the source document, and replace any template variable tags with their values, based on the associate Id.<p/> The source document should be of type MergeDraft. This method also takes a pair of arrays specifying custom tags and their values; these tags will be available during substitution in addition to all the existing tags. Custom values will override values otherwise set.

Parameters

documentId int The document id that refers to the binary data (document) associateId int The associateId used to subsitute tags in the document. customTags string[] Array of custom tag names. Each name should have exactly four characters. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. customValues string[] Array of values for custom tags. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. 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 document as a Stream

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteMergeDocumentTemplateVariablesEx2Async_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_SuperOffice_WebApi_Data_StringDictionary_System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteMergeDocumentTemplateVariablesEx2Async(int, int, int, int, int, int, int, int, StringDictionary, string, RequestOptions)

Parse the source document, and replace any template variable tags with their values, based on the provided identifiers.<p/> The source document should be of type MergeDraft. This method also takes a pair of arrays specifying custom tags and their values; these tags will be available during substitution in addition to all the existing tags. Custom values will override values otherwise set.

Parameters

mergeDocumentId int The document id that refers to the binary data (document) contactId int The contact identifier to use for template substitution personId int The person identifier to use for template substitution projectId int The project identifier to use for template substitution selectionId int The selection identifier to use for template substitution appointmentId int The appointment identifier to use for template substitution documentId int The document identifier to use for template substitution saleId int The sale identifier to use for template substitution customTags StringDictionary Dictionary of custom tag names and values. Each name should have exactly four characters. There should be exactly one value for each tag 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 document as a Stream

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteMergeDocumentTemplateVariablesExAsync_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_String___System_String___System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteMergeDocumentTemplateVariablesExAsync(int, int, int, int, int, int, int, int, string[], string[], string, RequestOptions)

Parse the source document, and replace any template variable tags with their values, based on the provided identifiers.<p/> The source document should be of type MergeDraft. This method also takes a pair of arrays specifying custom tags and their values; these tags will be available during substitution in addition to all the existing tags. Custom values will override values otherwise set.

Parameters

mergeDocumentId int The document id that refers to the binary data (document) contactId int The contact identifier to use for template substitution personId int The person identifier to use for template substitution projectId int The project identifier to use for template substitution selectionId int The selection identifier to use for template substitution appointmentId int The appointment identifier to use for template substitution documentId int The document identifier to use for template substitution saleId int The sale identifier to use for template substitution customTags string[] Array of custom tag names. Each name should have exactly four characters. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. customValues string[] Array of values for custom tags. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. 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 document as a Stream

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteTemplateVariablesAsync_System_String_SuperOffice_WebApi_Data_GeneratorEncoding_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteTemplateVariablesAsync(string, GeneratorEncoding, int, int, int, int, int, int, int, string, RequestOptions)

Parse the source string, and replace any template variable tags with their values, based on the ID’s given in the other parameters.

Parameters

source string Source string to parse for template variables. Such variables must have delimiters corresponding to the standard for the given generator encoding.<p/>Non-text source data (such as the binary content of a .doc file) should be passed in as Base64. generatorEncoding GeneratorEncoding Encoding of source string. Non-text formats such as MsWord or Excel should be Base64 encoded in the source string. contactId int Identifier for a contact personId int Identifier for a person appointmentId int Identifier for an appointment documentId int Identifier for a document saleId int Identifier for a sale selectionId int Identifier for a selection projectId int Identifier for a project cultureName string Name of culture to be used for culture-sensitive data, such as dates or multi-language texts. Use a blank string to accept whatever current culture is set on the server (possibly not a good choice in multinational organizations with a single server). requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Source string with templates substituted, using the same encoding as for the source (binary data will be returned in Base64).

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteTemplateVariablesExAsync_SuperOffice_WebApi_Data_TemplateVariablesParameters_SuperOffice_WebApi_RequestOptions_”></a> SubstituteTemplateVariablesExAsync(TemplateVariablesParameters, RequestOptions)

Parse the source string, and replace any template variable tags with their values, based on the identities, custom values and entities specified in the other parameters.

Parameters

parameters TemplateVariablesParameters Name of culture to be used for culture-sensitive data, such as dates or multi-language texts. Use a blank string to accept whatever current culture is set on the server (possibly not a good choice in multinational organizations with a single server). requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Source string with templates substituted, using the same encoding as for the source (binary data will be returned in Base64).

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteTemplateVariablesWithCustomTags2Async_System_String_SuperOffice_WebApi_Data_GeneratorEncoding_SuperOffice_WebApi_Data_StringDictionary_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteTemplateVariablesWithCustomTags2Async(string, GeneratorEncoding, StringDictionary, int, int, int, int, int, int, int, string, RequestOptions)

Parse the source string, and replace any template variable tags with their values, based on the ID’s given in the other parameters.<p/>This method also takes a pair of arrays specifying custom tags and their values; these tags will be available during substitution in addition to all the existing tags. Custom values will override values otherwise set.

Parameters

source string Source string to parse for template variables. Such variables must have delimiters corresponding to the standard for the given generator encoding.<p/>Non-text source data (such as the binary content of a .doc file) should be passed in as Base64. generatorEncoding GeneratorEncoding Encoding of source string. Non-text formats such as MsWord or Excel should be Base64 encoded in the source string. customTags StringDictionary Dictionary of custom tag names and values. Each name should have exactly four characters. There should be exactly one value for each tag. contactId int Identifier for a contact personId int Identifier for a person appointmentId int Identifier for an appointment documentId int Identifier for a document saleId int Identifier for a sale selectionId int Identifier for a selection projectId int Identifier for a project cultureName string Name of culture to be used for culture-sensitive data, such as dates or multi-language texts. Use a blank string to accept whatever current culture is set on the server (possibly not a good choice in multinational organizations with a single server). requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Source string with templates substituted, using the same encoding as for the source (binary data will be returned in Base64).

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_SubstituteTemplateVariablesWithCustomTagsAsync_System_String_SuperOffice_WebApi_Data_GeneratorEncoding_System_String___System_String___System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> SubstituteTemplateVariablesWithCustomTagsAsync(string, GeneratorEncoding, string[], string[], int, int, int, int, int, int, int, string, RequestOptions)

Parse the source string, and replace any template variable tags with their values, based on the ID’s given in the other parameters.<p/>This method also takes a pair of arrays specifying custom tags and their values; these tags will be available during substitution in addition to all the existing tags. Custom values will override values otherwise set.

Parameters

source string Source string to parse for template variables. Such variables must have delimiters corresponding to the standard for the given generator encoding.<p/>Non-text source data (such as the binary content of a .doc file) should be passed in as Base64. generatorEncoding GeneratorEncoding Encoding of source string. Non-text formats such as MsWord or Excel should be Base64 encoded in the source string. customTags string[] Array of custom tag names. Each name should have exactly four characters. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. customValues string[] Array of values for custom tags. There should be exactly one value for each tag, i.e., the lengths of the customTags and customValues arrays should be the same. contactId int Identifier for a contact personId int Identifier for a person appointmentId int Identifier for an appointment documentId int Identifier for a document saleId int Identifier for a sale selectionId int Identifier for a selection projectId int Identifier for a project cultureName string Name of culture to be used for culture-sensitive data, such as dates or multi-language texts. Use a blank string to accept whatever current culture is set on the server (possibly not a good choice in multinational organizations with a single server). requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Source string with templates substituted, using the same encoding as for the source (binary data will be returned in Base64).

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_UndoCheckoutDocumentAsync_System_Int32_System_String___SuperOffice_WebApi_RequestOptions_”></a> UndoCheckoutDocumentAsync(int, string[], RequestOptions)

Undo (abandon) a checkout

Parameters

documentId int SuperOffice document ID allowedReturnTypes string[] List of return types that the client is prepared to handle, in case the document plugin needs to request additional processing.<br/>Standard allowed return types include ‘None’, ‘Message’, ‘SoProtocol’, ‘CustomGui’, ‘Other’.<br/>An empty array implies that the client places no restriction on possible return action requests. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ReturnInfo&gt; Return information, including possible requests for further processing (“Return Action”). Return actions are constrained by the allowedReturnTypes parameter.

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_ValidateDocumentEntityAsync_SuperOffice_WebApi_Data_DocumentEntity_SuperOffice_WebApi_RequestOptions_”></a> ValidateDocumentEntityAsync(DocumentEntity, RequestOptions)

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

Parameters

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

Returns

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

<a id=“SuperOffice_WebApi_Agents_IDocumentAgent_VerifyGetDocumentStreamAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> VerifyGetDocumentStreamAsync(int, RequestOptions)

Verify that the requested document stream exists, and that we can access it, without actually getting the stream.

Parameters

documentId int The document id that refers to the binary data (document) requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task