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

# \<a id="SuperOffice\_WebApi\_Agents\_IForeignSystemAgent">\</a> Interface IForeignSystemAgent

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 interface IForeignSystemAgent : IAgentBase, IDisposable
```

#### Implements

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

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_DeleteForeignAppEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteForeignAppEntityAsync(int, RequestOptions)

Deletes the ForeignAppEntity

```csharp theme={null}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_GetAppByNameAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetAppByNameAsync(string, RequestOptions)

Gets the ForeignApp with the given name.

```csharp theme={null}
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\_IForeignSystemAgent\_GetApplicationDevicesAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetApplicationDevicesAsync(string, RequestOptions)

Gets all devices that belong to a foreign application.

```csharp theme={null}
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\_IForeignSystemAgent\_GetApplicationKeysAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetApplicationKeysAsync(string, RequestOptions)

Returns all ForeignKeys that belong to an application.

```csharp theme={null}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_GetDeviceKeysAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetDeviceKeysAsync(string, string, RequestOptions)

Returns all ForeignKeys that belong to a device.

```csharp theme={null}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_GetForeignAppEntityAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetForeignAppEntityAsync(int, RequestOptions)

Gets a specific ForeignAppEntity object.

```csharp theme={null}
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\_IForeignSystemAgent\_GetForeignDeviceAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetForeignDeviceAsync(int, RequestOptions)

Gets a specific ForeignDevice object.

```csharp theme={null}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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\_IForeignSystemAgent\_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}
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.Agents.ForeignSystemAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ForeignSystemAgent.md)
