<a id=“SuperOffice_WebApi_Agents_BLOBAgent”></a> Class BLOBAgent
Namespace: SuperOffice.WebApi.AgentsAssembly: SuperOffice.WebApi.dll Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
Inheritance
object ← AgentBase ← BLOBAgentImplements
IBLOBAgent, IAgentBase, IDisposableInherited Members
AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T>(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()Examples
<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“http://example.com/super/api”); mySession.Authorization = new AuthorizationUsernamePassword(“user”, “pass”); using (BLOBAgent agent = new BLOBAgent(mySession)) { // call methods on agent here… }</code></pre>Constructors
<a id=“SuperOffice_WebApi_Agents_BLOBAgent__ctor_System_Net_Http_HttpClient_”></a> BLOBAgent(HttpClient)
Constructor: Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.Parameters
httpClient HttpClient
Use this HTTP client instead of making own HttpClient instance.
<a id=“SuperOffice_WebApi_Agents_BLOBAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> BLOBAgent(WebApiOptions, HttpClient)
Constructor: Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.Parameters
options WebApiOptions
Base URL and authentication values.
httpClient HttpClient
Optional: Use this HTTP client instead of making a new one.
Methods
<a id=“SuperOffice_WebApi_Agents_BLOBAgent_ChangeContactImageAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ChangeContactImageAsync(int, int, RequestOptions)
Changes the contact image link. If the Binary object id is 0, any image link is removed from the contact.Parameters
contactId int
The Contact the image is linked to
blobId int
The Binary object id. If the Binary object id is 0, any image link is removed from the Contact.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_ChangePersonImageAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ChangePersonImageAsync(int, int, RequestOptions)
Parameters
personId int
The person the image is linked to
blobId int
The Binary object id. If the Binary object id is 0, any image link is removed from the person.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_ChangeProductImageAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ChangeProductImageAsync(int, int, RequestOptions)
Parameters
productId int
The product the image is linked to
blobId int
The Binary object id. If the Binary object id is 0, any image link is removed from the product.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_ChangeProjectImageAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ChangeProjectImageAsync(int, int, RequestOptions)
Changes the project image link. If the Binary object id is 0, any image link is removed from the project.Parameters
projectId int
The project the image is linked to
blobId int
The Binary object id. If the Binary object id is 0, any image link is removed from the project.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_CleanupBatchTaskAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CleanupBatchTaskAsync(int, RequestOptions)
Removes the binary objects linked to the batch task, the links themselves and the batch task.Parameters
batchTaskId int
The ID of the batchtask that created the output data
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_CreateDefaultBlobEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultBlobEntityAsync(RequestOptions)
Set default values into a new BlobEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> A blank BlobEntity<a id=“SuperOffice_WebApi_Agents_BLOBAgent_DeleteBlobEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteBlobEntityAsync(int, RequestOptions)
Deletes the BlobEntityParameters
blobEntityId int
The identity of the BlobEntity
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBlobEntityAsync(int, RequestOptions)
Gets a specific BlobEntity object.Parameters
blobEntityId int
The identifier of the BlobEntity object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> BlobEntity<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobEntityOnContactAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBlobEntityOnContactAsync(int, RequestOptions)
Gets the blob entity that represents the contact image binary object.Parameters
contactId int
The Contact id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> BlobEntity object<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobEntityOnCountryAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBlobEntityOnCountryAsync(int, RequestOptions)
Gets the blob entity that represents the country flag binary object.Parameters
countryId int
The country id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> BlobEntity object<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobEntityOnPersonAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBlobEntityOnPersonAsync(int, RequestOptions)
Gets the blob entity that represents the person image binary object.Parameters
personId int
The person id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> BlobEntity object<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobEntityOnProductAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBlobEntityOnProductAsync(int, RequestOptions)
Gets the blob entity that represents the product image binary object.Parameters
productId int
The product id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> BlobEntity object<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobEntityOnProjectAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetBlobEntityOnProjectAsync(int, RequestOptions)
Gets the blob entity that represents the project image binary object.Parameters
projectId int
The project id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> BlobEntity object<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetBlobStreamAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetBlobStreamAsync(int, string, RequestOptions)
Get the binary object as a streamParameters
blobEntityId int
The ID of the BLOB entity object that refers to the binary data
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[]> The binary object as a Stream<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetChatImageWithSizeAsync_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetChatImageWithSizeAsync(int, int, int, string, RequestOptions)
Returns the chat image that is displayed in chat with a specified maximum size.Parameters
chatTopicId int
The project id of the project the image belongs to.
width int
The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
height int
The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
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[]> The chat image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetContactImageAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetContactImageAsync(int, string, RequestOptions)
Returns the contact image that is displayed in the CRM application.Parameters
contactId int
The contact id of the contact 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[]> The contact image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetContactImageWithSizeAsync_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetContactImageWithSizeAsync(int, int, int, string, RequestOptions)
Returns the contact image that is displayed in the CRM application with a specified maximum size.Parameters
contactId int
The contact id of the Contact the image belongs to.
width int
The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
height int
The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
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[]> The contact image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetOutputFromBatchAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetOutputFromBatchAsync(int, string, RequestOptions)
Get the output of a batchtask as a streamParameters
batchTaskId int
The ID of the batchtask that created the output data
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[]> The binary object as a Stream.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetPersonImageAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetPersonImageAsync(int, string, RequestOptions)
Returns the person image that is displayed in the CRM application.Parameters
personId int
The person id of the person 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[]> The person image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetPersonImageWithSizeAsync_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetPersonImageWithSizeAsync(int, int, int, string, RequestOptions)
Returns the person image that is displayed in the CRM application with a specified maximum size.Parameters
personId int
The person id of the person the image belongs to.
width int
The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
height int
The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
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[]> The person image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetProductImageAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetProductImageAsync(int, string, RequestOptions)
Returns the product image (rank=1) that is displayed in the CRM application.Parameters
productId int
The product id of the product 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[]> The product image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetProductThumbnailAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetProductThumbnailAsync(int, string, RequestOptions)
Returns the product thumbnail that is displayed in the CRM application.Parameters
productId int
The product id of the product the thumbnail 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[]> The product thumbnail.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetProjectImageAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> 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[]> The project image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetProjectImageWithSizeAsync_System_Int32_System_Int32_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetProjectImageWithSizeAsync(int, int, int, string, RequestOptions)
Returns the project image that is displayed in the CRM application with a specified maximum size.Parameters
projectId int
The project id of the project the image belongs to.
width int
The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
height int
The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image.
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[]> The project image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_GetQuoteLineImageAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetQuoteLineImageAsync(int, string, RequestOptions)
Returns the quoteline image (rank=1) that is displayed in the CRM application.Parameters
quoteLineId int
The product id of the quoteline 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[]> The quote line image.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SaveBlobEntityAsync_SuperOffice_WebApi_Data_BlobEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveBlobEntityAsync(BlobEntity, RequestOptions)
Updates the existing BlobEntity or creates a new BlobEntity if the id parameter is 0.Parameters
blobEntity BlobEntity
The BlobEntity that is saved.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<BlobEntity> New or updated BlobEntity<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SaveImageStreamAsync_SuperOffice_WebApi_Data_BlobLinkType_System_Byte___System_String_SuperOffice_WebApi_RequestOptions_”></a> SaveImageStreamAsync(BlobLinkType, byte[], string, RequestOptions)
Stores an image in the database without linking it to a project or a person. It is possible to ChangePersonImage or ChangeProjectImage to attach image later.Parameters
type BlobLinkType
The type of the image.
image byte[]
Image to store.
description string
Image description.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int> The blob id.<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SaveProjectImageAsync_System_String_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SaveProjectImageAsync(string, byte[], RequestOptions)
Saves a project image that is displayed in the CRM application’s project image selection dialog to the database.Parameters
description string
Image description. Should be image name (e.g. winter.jpg) for project images.
image byte[]
The project image.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SetBlobStreamAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetBlobStreamAsync(int, byte[], RequestOptions)
Store a binary object from it’s streamParameters
blobEntityId int
Id of the BLOB entity object that the binary data should be stored to.
stream byte[]
The binary object as a Stream
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SetContactImageAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetContactImageAsync(int, byte[], RequestOptions)
Stores the contact image that is displayed in the CRM application.Parameters
contactId int
The contact id of the contact the image belongs to.
image byte[]
The contact image.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SetPersonImageAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetPersonImageAsync(int, byte[], RequestOptions)
Stores the person image that is displayed in the CRM application.Parameters
personId int
The person id of the person the image belongs to.
image byte[]
The person image.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SetProductImageAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetProductImageAsync(int, byte[], RequestOptions)
Stores the product image that is displayed in the CRM application. The image is scaled down to max 1000x1000. This method operates only the main (rank=1) image; future extensions may support multiple images. A thumbnail of size 75x75 is also automatically set.Parameters
productId int
The product id of the product the image belongs to.
image byte[]
The product image, scaled down to no more than 1000x1000.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SetProductThumbnailAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> SetProductThumbnailAsync(int, byte[], RequestOptions)
Stores the product thumbnail that is displayed in the CRM application. The image is scaled down to max 200x200 pixels.Parameters
productId int
The product id of the product the image belongs to.
image byte[]
The product thumbnail, scaled down to no more than 200x200.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_BLOBAgent_SetProjectImageAsync_System_Int32_System_Byte___SuperOffice_WebApi_RequestOptions_”></a> 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.