> ## 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.ForeignSystemAgent

# \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent">\</a> Class ForeignSystemAgent

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

Collection of all services that works with Foreign key data (Key/Value pairs)

```csharp theme={null}
public class ForeignSystemAgent : AgentBase, IForeignSystemAgent, IAgentBase, IDisposable
```

#### Inheritance

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

#### Implements

[IForeignSystemAgent](SuperOffice.WebApi.Agents.IForeignSystemAgent.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 (ForeignSystemAgent agent = new ForeignSystemAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

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

Constructor: Collection of all services that works with Foreign key data (Key/Value pairs)

```csharp theme={null}
public ForeignSystemAgent(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\_ForeignSystemAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> ForeignSystemAgent(WebApiOptions, HttpClient)

Constructor: Collection of all services that works with Foreign key data (Key/Value pairs)

```csharp theme={null}
public ForeignSystemAgent(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\_ForeignSystemAgent\_AddDeviceByIdentifierAsync\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddDeviceByIdentifierAsync(string, string, string, RequestOptions)

Adds a new ForeignDevice with deviceName that belongs to the application with applicationName, with an optional device-specific identifier.

```csharp theme={null}
public Task<ForeignDevice> AddDeviceByIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Unique id of device (Palm pilot device ID, version number, etc)

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\&gt;

The ForeignDevice.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_AddForeignKeyAsync\_SuperOffice\_WebApi\_Data\_ForeignKey\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddForeignKeyAsync(ForeignKey, string, string, string, RequestOptions)

Add a new key belonging to the ForeignApp and ForeignDevice specified.

```csharp theme={null}
public Task<ForeignKey> AddForeignKeyAsync(ForeignKey foreignKey, string applicationName, string deviceName, string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

`foreignKey` [ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)

Foreign key to save

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier. Optional if device identifier is not used.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\&gt;

The new or updated ForeignKey

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_CreateDefaultForeignAppEntityAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultForeignAppEntityAsync(RequestOptions)

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

```csharp theme={null}
public Task<ForeignAppEntity> CreateDefaultForeignAppEntityAsync(RequestOptions requestOptions = null)
```

#### Parameters

`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)\<[ForeignAppEntity](SuperOffice.WebApi.Data.ForeignAppEntity.md)\&gt;

A blank ForeignAppEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_DeleteDeviceByIdentifierAsync\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteDeviceByIdentifierAsync(string, string, string, RequestOptions)

Delete a ForeignDevice with deviceName and deviceIdentifier that belongs to the application with applicationName.

```csharp theme={null}
public Task DeleteDeviceByIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Unique id of device (Palm pilot device ID, version number, etc)

`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\_ForeignSystemAgent\_DeleteForeignAppEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteForeignAppEntityAsync(int, RequestOptions)

Deletes the ForeignAppEntity

```csharp theme={null}
public Task DeleteForeignAppEntityAsync(int foreignAppEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`foreignAppEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identity of the ForeignAppEntity

`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)

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_DeleteForeignDeviceAsync\_SuperOffice\_WebApi\_Data\_ForeignDevice\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteForeignDeviceAsync(ForeignDevice, string, RequestOptions)

Deletes a foreign device from an application

```csharp theme={null}
public Task DeleteForeignDeviceAsync(ForeignDevice foreignDevice, string applicationName, RequestOptions requestOptions = null)
```

#### Parameters

`foreignDevice` [ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)

foreign device to delete

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

Name of application to delete from

`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)

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_DeleteForeignKeyAsync\_SuperOffice\_WebApi\_Data\_ForeignKey\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteForeignKeyAsync(ForeignKey, string, string, string, string, int, RequestOptions)

Deletes all specified occurrences of a key, belonging to the ForeignApp and ForeignDevice, table and record specified. Specifying a blank table name will delete ALL keys of the given name; specifying a recordId of 0 will delete ALL keys of the given name for the given table.

```csharp theme={null}
public Task DeleteForeignKeyAsync(ForeignKey foreignKey, string applicationName, string deviceName, string deviceIdentifier, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

`foreignKey` [ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)

Key name to delete.

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier. Optional if device identifier is not used.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to delete ALL keys that otherwise match; this may be dangerous and can take a long time if there are many items to delete.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.\<p/>Specifying a zero recordId will remove the recordId restriction and delete all keys that otherwise match.

`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\_ForeignSystemAgent\_DeleteForeignKeyOnNameAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteForeignKeyOnNameAsync(string, string, string, string, string, int, RequestOptions)

Deletes all specified occurrences of a key, belonging to the ForeignApp and ForeignDevice, table and record specified. Specifying a blank table name will delete ALL keys of the given name; specifying a recordId of 0 will delete ALL keys of the given name for the given table.

```csharp theme={null}
public Task DeleteForeignKeyOnNameAsync(string applicationName, string deviceName, string deviceIdentifier, string keyName, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier. Optional if device identifier is not used.

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

The name of the foreign key to delete.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to delete ALL keys that otherwise match; this may be dangerous and can take a long time if there are many items to delete.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.\<p/>Specifying a zero recordId will remove the recordId restriction and delete all keys that otherwise match.

`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\_ForeignSystemAgent\_GetAllForeignKeysOnEntityAsync\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAllForeignKeysOnEntityAsync(string, int, RequestOptions)

Get a list of foreignkeys ('app.device.key') and their values ('123') that belong to the specified entity.

```csharp theme={null}
public Task<StringDictionary> GetAllForeignKeysOnEntityAsync(string entityType, int entityId, RequestOptions requestOptions = null)
```

#### Parameters

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

Entity type (table name): 'contact', 'project' etc.

`entityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Primary key of Entity

`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)\<[StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)\&gt;

Dictionary of 'appname.deviceid.keyname' = '123' key values

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetAppByNameAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAppByNameAsync(string, RequestOptions)

Gets the ForeignApp with the given name.

```csharp theme={null}
public Task<ForeignAppEntity> GetAppByNameAsync(string applicationName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

`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)\<[ForeignAppEntity](SuperOffice.WebApi.Data.ForeignAppEntity.md)\&gt;

The ForeignApp that matches the name.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetApplicationDevicesAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetApplicationDevicesAsync(string, RequestOptions)

Gets all devices that belong to a foreign application.

```csharp theme={null}
public Task<ForeignDevice[]> GetApplicationDevicesAsync(string applicationName, RequestOptions requestOptions = null)
```

#### Parameters

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

The foreign application name

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\[]\&gt;

Array of ForeignDevices

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetApplicationKeysAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetApplicationKeysAsync(string, RequestOptions)

Returns all ForeignKeys that belong to an application.

```csharp theme={null}
public Task<ForeignKey[]> GetApplicationKeysAsync(string applicationName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\[]\&gt;

Array of all ForeignKeys in the ForeignApp.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetDeviceByIdentifierAsync\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceByIdentifierAsync(string, string, string, RequestOptions)

Gets a ForeignDevice with deviceName and deviceIdentifier that belongs to the application with applicationName.

```csharp theme={null}
public Task<ForeignDevice> GetDeviceByIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Optional unique id of device (Palm pilot device ID, version number, etc)

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\&gt;

The ForeignDevice.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetDeviceByNameAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceByNameAsync(string, string, RequestOptions)

Gets a ForeignDevice with deviceName that belongs to the application with applicationName.

```csharp theme={null}
public Task<ForeignDevice> GetDeviceByNameAsync(string applicationName, string deviceName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\&gt;

The ForeignDevice.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetDeviceKeysAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceKeysAsync(string, string, RequestOptions)

Returns all ForeignKeys that belong to a device.

```csharp theme={null}
public Task<ForeignKey[]> GetDeviceKeysAsync(string applicationName, string deviceName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\[]\&gt;

Array of all ForeignKeys in the ForeignDevice.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetDeviceKeysOnDeviceIdentifierAsync\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceKeysOnDeviceIdentifierAsync(string, string, string, RequestOptions)

Returns all ForeignKeys that belong to a device with a given deviceIdentifier.

```csharp theme={null}
public Task<ForeignKey[]> GetDeviceKeysOnDeviceIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Identifier for a unique grouping of keys within a device.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\[]\&gt;

Array of all ForeignKeys in the ForeignDevice that belong to the DeviceIdentifier.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetDeviceKeysOnDeviceIdentifierTableAsync\_System\_String\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceKeysOnDeviceIdentifierTableAsync(string, string, string, string, RequestOptions)

Returns all ForeignKeys that belong to a device with a given deviceIdentifier and table name.

```csharp theme={null}
public Task<ForeignKey[]> GetDeviceKeysOnDeviceIdentifierTableAsync(string applicationName, string deviceName, string deviceIdentifier, string tableName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Identifier for a unique grouping of keys within a device.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\[]\&gt;

Array of all ForeignKeys in the ForeignDevice that belong to the DeviceIdentifier.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetDeviceKeysOnDeviceIdentifierTableRecordIdAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceKeysOnDeviceIdentifierTableRecordIdAsync(string, string, string, string, int, RequestOptions)

Returns all ForeignKeys that belong to a device with a given deviceIdentifier and table name, as well as record id.

```csharp theme={null}
public Task<ForeignKey[]> GetDeviceKeysOnDeviceIdentifierTableRecordIdAsync(string applicationName, string deviceName, string deviceIdentifier, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Identifier for a unique grouping of keys within a device.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\[]\&gt;

Array of all ForeignKeys in the ForeignDevice that match the criteria

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetForeignAppEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetForeignAppEntityAsync(int, RequestOptions)

Gets a specific ForeignAppEntity object.

```csharp theme={null}
public Task<ForeignAppEntity> GetForeignAppEntityAsync(int foreignAppEntityId, RequestOptions requestOptions = null)
```

#### Parameters

`foreignAppEntityId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the ForeignAppEntity object

`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)\<[ForeignAppEntity](SuperOffice.WebApi.Data.ForeignAppEntity.md)\&gt;

ForeignAppEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetForeignDeviceAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetForeignDeviceAsync(int, RequestOptions)

Gets a specific ForeignDevice object.

```csharp theme={null}
public Task<ForeignDevice> GetForeignDeviceAsync(int foreignDeviceId, RequestOptions requestOptions = null)
```

#### Parameters

`foreignDeviceId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The identifier of the ForeignDevice object

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\&gt;

ForeignDevice

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetKeyAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetKeyAsync(string, string, string, string, int, RequestOptions)

Returning a foreign key by its key name, that belongs to the specified device and application. A table name and record ID can also be specified.

```csharp theme={null}
public Task<ForeignKey> GetKeyAsync(string applicationName, string deviceName, string keyName, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The name of the foreign key.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\&gt;

The ForeignKey.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetKeyByValueAndIdentifierAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetKeyByValueAndIdentifierAsync(string, string, string, string, string, string, RequestOptions)

Get a foreignkey based on its name and value, that belongs to the specified deviceId, device, and application.

```csharp theme={null}
public Task<ForeignKey> GetKeyByValueAndIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, string keyName, string keyValue, string tableName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier. Optional if device identifier is not used.

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

The name of the foreign key.

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

Foreignkey value

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\&gt;

The ForeignKey.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetKeyByValueAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetKeyByValueAsync(string, string, string, string, string, RequestOptions)

Get a foreignkey based on its name and value, that belongs to the specified device and application.

```csharp theme={null}
public Task<ForeignKey> GetKeyByValueAsync(string applicationName, string deviceName, string keyName, string keyValue, string tableName, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The name of the foreign key.

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

Foreignkey value

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\&gt;

The ForeignKey.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetKeyOnDeviceIdentifierAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetKeyOnDeviceIdentifierAsync(string, string, string, string, string, int, RequestOptions)

Returning a foreign key by its key name and device identifier, that belongs to the specified device and application. A table name and record ID can also be specified.

```csharp theme={null}
public Task<ForeignKey> GetKeyOnDeviceIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, string keyName, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier.

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

The name of the foreign key.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\&gt;

The ForeignKey.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetKeyValueAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetKeyValueAsync(string, string, string, string, int, RequestOptions)

Gets the string value of a ForeignKey, that belongs to the specified device and application. The table name and record ID must also be specified.

```csharp theme={null}
public Task<string> GetKeyValueAsync(string applicationName, string deviceName, string keyName, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The name of the foreign key.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.

`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)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

The ForeignKey value as string.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_GetKeyValueOnDeviceIdentifierAsync\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetKeyValueOnDeviceIdentifierAsync(string, string, string, string, string, int, RequestOptions)

Returning a foreign key string value by its key name and device identifier, that belongs to the specified device and application. A table name and record ID can also be specified.

```csharp theme={null}
public Task<string> GetKeyValueOnDeviceIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, string keyName, string tableName, int recordId, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier.

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

The name of the foreign key.

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

Table name, transformed to and from numeric table id by the service layer.\<p/>Use an empty string to indicate that your key is not bound to any specific table.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of record that this key refers to. If the table name was blank, then this parameter must be 0. It can also be 0 to mean that the foreign key record was not bound to any particular record of the target table.

`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)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

The ForeignKey's string value.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_SaveDeviceByIdentifierAsync\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_Data\_ForeignDevice\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveDeviceByIdentifierAsync(string, string, string, ForeignDevice, RequestOptions)

Updates a ForeignDevice with deviceName that belongs to the application with applicationName.

```csharp theme={null}
public Task<ForeignDevice> SaveDeviceByIdentifierAsync(string applicationName, string deviceName, string deviceIdentifier, ForeignDevice foreignDevice, RequestOptions requestOptions = null)
```

#### Parameters

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

The name of the foreign application.

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

The name of the foreign device.

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

Unique id of device (Palm pilot device ID, version number, etc)

`foreignDevice` [ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)

Foreign device to save. Can be null if adding new device.

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\&gt;

The ForeignDevice.

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_SaveForeignAppEntityAsync\_SuperOffice\_WebApi\_Data\_ForeignAppEntity\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveForeignAppEntityAsync(ForeignAppEntity, RequestOptions)

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

```csharp theme={null}
public Task<ForeignAppEntity> SaveForeignAppEntityAsync(ForeignAppEntity foreignAppEntity, RequestOptions requestOptions = null)
```

#### Parameters

`foreignAppEntity` [ForeignAppEntity](SuperOffice.WebApi.Data.ForeignAppEntity.md)

The ForeignAppEntity that is saved.

`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)\<[ForeignAppEntity](SuperOffice.WebApi.Data.ForeignAppEntity.md)\&gt;

New or updated ForeignAppEntity

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_SaveForeignDeviceAsync\_SuperOffice\_WebApi\_Data\_ForeignDevice\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveForeignDeviceAsync(ForeignDevice, string, RequestOptions)

Saves a foreign device for an foreign application

```csharp theme={null}
public Task<ForeignDevice> SaveForeignDeviceAsync(ForeignDevice foreignDevice, string applicationName, RequestOptions requestOptions = null)
```

#### Parameters

`foreignDevice` [ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)

Foreign device to save

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

The name of the foreign application.

`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)\<[ForeignDevice](SuperOffice.WebApi.Data.ForeignDevice.md)\&gt;

Returns the saved foreign device

### \<a id="SuperOffice\_WebApi\_Agents\_ForeignSystemAgent\_SaveForeignKeyAsync\_SuperOffice\_WebApi\_Data\_ForeignKey\_System\_String\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveForeignKeyAsync(ForeignKey, string, string, string, RequestOptions)

Saves a key belonging to the ForeignApp and ForeignDevice specified.

```csharp theme={null}
public Task<ForeignKey> SaveForeignKeyAsync(ForeignKey foreignKey, string applicationName, string deviceName, string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

`foreignKey` [ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)

Foreign key to save

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

The name of the foreign application.

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

The name of the foreign device.

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

The device identifier. Optional if device identifier is not used.

`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)\<[ForeignKey](SuperOffice.WebApi.Data.ForeignKey.md)\&gt;

The new or updated ForeignKey


## Related topics

- [SuperOffice.WebApi.Data.ForeignAppEntity](/en/api/reference/webapi/SuperOffice.WebApi.Data.ForeignAppEntity.md)
- [SuperOffice.WebApi.Data.ForeignDevice](/en/api/reference/webapi/SuperOffice.WebApi.Data.ForeignDevice.md)
- [SuperOffice.WebApi.Data.ForeignKey](/en/api/reference/webapi/SuperOffice.WebApi.Data.ForeignKey.md)
- [Delete Foreign Device](/en/api/reference/restful/agent/foreignsystem_agent/delete-foreign-device.md)
- [Delete Foreign Key](/en/api/reference/restful/agent/foreignsystem_agent/delete-foreign-key.md)
- [Delete Foreign App Entity](/en/api/reference/restful/agent/foreignsystem_agent/delete-foreign-app-entity.md)
