> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.ResourceAgent

# \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent">\</a> Class ResourceAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

String resource substitution management.

```csharp theme={null}
public class ResourceAgent : AgentBase, IResourceAgent, IAgentBase, IDisposable
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AgentBase](SuperOffice.WebApi.Agents.AgentBase.md) ←
[ResourceAgent](SuperOffice.WebApi.Agents.ResourceAgent.md)

#### Implements

[IResourceAgent](SuperOffice.WebApi.Agents.IResourceAgent.md),
[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

#### Inherited Members

[AgentBase.\_json](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__json),
[AgentBase.\_binary](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__binary),
[AgentBase.\_config](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__config),
[AgentBase.\_client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__client),
[AgentBase.\_disposeClient](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__disposeClient),
[AgentBase.Merge(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_),
[AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.ParseAuthorization(IAuthorization)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_),
[AgentBase.CancelRequest()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_CancelRequest),
[AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequest(HttpRequestMessage, RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_),
[AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_),
[AgentBase.ParseResponse\<T\&gt;(HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_),
[AgentBase.Finally(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_),
[AgentBase.Dispose()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Dispose),
[AgentBase.Configuration](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Configuration),
[AgentBase.Client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Client),
[AgentBase.HasRunningRequest](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest),
[AgentBase.ClientCancellationTokenSource](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource),
[AgentBase.ProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ProgressListener),
[AgentBase.UploadProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener),
[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

\<pre>\<code class="lang-csharp">using SuperOffice.WebApi;
using SuperOffice.WebApi.Agents;

var mySession = new WebApiOptions("[http://example.com/super/api](http://example.com/super/api)");
mySession.Authorization = new AuthorizationUsernamePassword("user", "pass");
using (ResourceAgent agent = new ResourceAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_\_ctor\_System\_Net\_Http\_HttpClient\_">\</a> ResourceAgent(HttpClient)

Constructor: String resource substitution management.

```csharp theme={null}
public ResourceAgent(HttpClient httpClient)
```

#### Parameters

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Use this HTTP client instead of making own HttpClient instance.

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> ResourceAgent(WebApiOptions, HttpClient)

Constructor: String resource substitution management.

```csharp theme={null}
public ResourceAgent(WebApiOptions options, HttpClient httpClient = null)
```

#### Parameters

`options` [WebApiOptions](SuperOffice.WebApi.WebApiOptions.md)

Base URL and authentication values.

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Optional: Use this HTTP client instead of making a new one.

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_ActivateResourceSubstitutionAsync\_System\_String\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ActivateResourceSubstitutionAsync(string, string, bool, RequestOptions)

Activate or deactive a resource substitution for one or more cultures

```csharp theme={null}
public Task ActivateResourceSubstitutionAsync(string resourceName, string culture, bool isActive, RequestOptions requestOptions = null)
```

#### Parameters

`resourceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the resource, without any brackets; if blank then this is the MASTER SWITCH for the override system

`culture` [string](https://learn.microsoft.com/dotnet/api/system.string)

The .NET culture string; if blank, then ALL substitutions for this resource will be affected

`isActive` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

New status of override

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_DeleteResourceSubstitutionAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteResourceSubstitutionAsync(string, string, RequestOptions)

Permanentely delete a resource substitution for one or more cultures

```csharp theme={null}
public Task DeleteResourceSubstitutionAsync(string resourceName, string culture, RequestOptions requestOptions = null)
```

#### Parameters

`resourceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the resource, without any brackets

`culture` [string](https://learn.microsoft.com/dotnet/api/system.string)

The .NET culture string; if blank, then ALL substitutions for this resource will be dropped

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_GetResourceSubstitutionsAsync\_System\_String\_\_\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetResourceSubstitutionsAsync(string\[], string, bool, RequestOptions)

Get substitutions for some or all resources for one culture

```csharp theme={null}
public Task<ResourceOverride[]> GetResourceSubstitutionsAsync(string[] resourceNames, string culture, bool activeOnly, RequestOptions requestOptions = null)
```

#### Parameters

`resourceNames` [string](https://learn.microsoft.com/dotnet/api/system.string)\[]

Array of names of resources for which overrides are sought; if empty, then get all

`culture` [string](https://learn.microsoft.com/dotnet/api/system.string)

.NET culture string; if empty, then get all

`activeOnly` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

If true, then only resources with active substitutions will be returned; if false then ALL existing overrides will be returned

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ResourceOverride](SuperOffice.WebApi.Data.ResourceOverride.md)\[]\&gt;

Array of override objects, empty if there are none

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_IsResourceSubstitutionActiveAsync\_System\_String\_\_\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> IsResourceSubstitutionActiveAsync(string\[], string, RequestOptions)

Determine if resource substitution/override is active, globally or for a subset of resources/cultures

```csharp theme={null}
public Task<ResourceOverride[]> IsResourceSubstitutionActiveAsync(string[] resourceNames, string culture, RequestOptions requestOptions = null)
```

#### Parameters

`resourceNames` [string](https://learn.microsoft.com/dotnet/api/system.string)\[]

Array of names of resources for which overrides are sought; if empty, then get the MASTER on/off

`culture` [string](https://learn.microsoft.com/dotnet/api/system.string)

.NET culture string; if empty, then get for all cultures (unless resourceName

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[ResourceOverride](SuperOffice.WebApi.Data.ResourceOverride.md)\[]\&gt;

Array of override objects, empty if there are none; the ResourceValue member is not set by this call

### \<a id="SuperOffice\_WebApi\_Agents\_ResourceAgent\_SetResourceSubstitutionAsync\_System\_String\_System\_String\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SetResourceSubstitutionAsync(string, string, string, bool, RequestOptions)

Create or update a resource substitution

```csharp theme={null}
public Task SetResourceSubstitutionAsync(string resourceName, string resourceValues, string culture, bool isActive, RequestOptions requestOptions = null)
```

#### Parameters

`resourceName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the resource, without any brackets

`resourceValues` [string](https://learn.microsoft.com/dotnet/api/system.string)

The new value of the resource

`culture` [string](https://learn.microsoft.com/dotnet/api/system.string)

The .NET culture string

`isActive` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Is the subsitution now active

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value


## Related topics

- [SuperOffice.WebApi.Data.ResourceOverride](/en/api/reference/webapi/SuperOffice.WebApi.Data.ResourceOverride.md)
- [SuperOffice.WebApi.Agents.AgentBase](/en/api/reference/webapi/SuperOffice.WebApi.Agents.AgentBase.md)
- [SuperOffice.WebApi.Agents.IResourceAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IResourceAgent.md)
- [SuperOffice.WebApi.Agents.IListAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IListAgent.md)
- [SuperOffice.WebApi.Agents.ListAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ListAgent.md)
- [SuperOffice.WebApi.Data.ResourceEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.ResourceEntity.md)
