# OpcAddReferencesRequest Members

> Reference: Represents the request of the AddReferences service of OPC UA, which adds references to the address space.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcAddReferencesRequest</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.services">Opc.UaFx.Services</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Inherits members from [OpcServiceRequest&lt;OpcAddReference, OpcAddReferenceCollection&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcservicerequest-2/members), [OpcServiceRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcservicerequest/members).

## Constructors

### OpcAddReferencesRequest

<span class="api-meta">4 overloads · since v2.7</span>

| Overload | Description |
|---|---|
| [OpcAddReferencesRequest(IEnumerable&lt;OpcAddReference&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/members#opcaddreferencesrequest-system-collections-generic-ienumerable-of-opc-uafx-opcaddreference)<span class="api-meta">since v2.7</span> | Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `commands` and a new header. |
| [OpcAddReferencesRequest(params OpcAddReference\[\])](#opcaddreferencesrequest-opc-uafx-opcaddreference-array)<span class="api-meta">since v2.7</span> | Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `commands` and a new header. |
| [OpcAddReferencesRequest(IOpcServiceRequestHeader, IEnumerable&lt;OpcAddReference&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/members#opcaddreferencesrequest-opc-uafx-services-iopcservicerequestheader-system-collections-generic-ienumerable-of-opc-uafx-opcaddreference)<span class="api-meta">since v2.7</span> | Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `header` and `commands`. |
| [OpcAddReferencesRequest(IOpcServiceRequestHeader, params OpcAddReference\[\])](#opcaddreferencesrequest-opc-uafx-services-iopcservicerequestheader-opc-uafx-opcaddreference-array)<span class="api-meta">since v2.7</span> | Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `header` and `commands`. |

#### OpcAddReferencesRequest(IEnumerable&lt;OpcAddReference&gt;)

<span class="api-meta">since v2.7</span>

Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `commands` and a new header.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcAddReferencesRequest(IEnumerable<OpcAddReference> commands)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(commands As IEnumerable(Of OpcAddReference))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `commands` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/)&gt; | The commands which specify the references to add. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `commands` is a null reference (Nothing in Visual Basic). |

#### OpcAddReferencesRequest(params OpcAddReference\[\])

<span class="api-meta">since v2.7</span>

Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `commands` and a new header.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcAddReferencesRequest(params OpcAddReference[] commands)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(ParamArray commands As OpcAddReference())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `commands` | params [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/)[] | The commands which specify the references to add. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `commands` is a null reference (Nothing in Visual Basic). |

#### OpcAddReferencesRequest(IOpcServiceRequestHeader, IEnumerable&lt;OpcAddReference&gt;)

<span class="api-meta">since v2.7</span>

Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `header` and `commands`.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcAddReferencesRequest(
    IOpcServiceRequestHeader header,
    IEnumerable<OpcAddReference> commands)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(
    header As IOpcServiceRequestHeader,
    commands As IEnumerable(Of OpcAddReference))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `header` | [IOpcServiceRequestHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservicerequestheader/) | The header of the request. |
| `commands` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/)&gt; | The commands which specify the references to add. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `header` or the `commands` is a null reference (Nothing in Visual Basic). |

#### OpcAddReferencesRequest(IOpcServiceRequestHeader, params OpcAddReference\[\])

<span class="api-meta">since v2.7</span>

Initializes a new instance of the [OpcAddReferencesRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcaddreferencesrequest/) class using the specified `header` and `commands`.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcAddReferencesRequest(
    IOpcServiceRequestHeader header,
    params OpcAddReference[] commands)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(
    header As IOpcServiceRequestHeader,
    ParamArray commands As OpcAddReference())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `header` | [IOpcServiceRequestHeader](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservicerequestheader/) | The header of the request. |
| `commands` | params [OpcAddReference](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddreference/)[] | The commands which specify the references to add. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `header` or the `commands` is a null reference (Nothing in Visual Basic). |

## Methods

### Validate

<span class="api-meta">protected · override · since v2.50</span>

Validates the request before a server processes it.

<div class="api-signature" data-lang="csharp">

```csharp
protected override void Validate()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Overrides Sub Validate()
```

</div>

**Overrides**

[Validate](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcservicerequest/members#validate)

**Remarks**

A server rejects the request with [BadNothingToDo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnothingtodo) if it contains no commands or if the source node identifier, the target node identifier or the reference type identifier of a command is a null identifier; then none of the commands is executed.
