# OpcClient.AddNode Method

> Reference: Adds a new node into the address space hierarchy using the command specified.

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

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

Adds a new node into the address space hierarchy using the `command` specified.

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

```csharp
public OpcAddNodeResult AddNode(OpcAddNode command)
```

</div>

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

```vbnet
Public Function AddNode(command As OpcAddNode) As OpcAddNodeResult
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `command` | [OpcAddNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/) | The [OpcAddNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnode/) instance to process. |

**Returns**

[OpcAddNodeResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnoderesult/)

An instance of the [OpcAddNodeResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcaddnoderesult/) class which contains the node identifier used or created for the node added through the `command` specified; together with information about the outcome of the processed command.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `command` is a null reference (Nothing in Visual Basic). |
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | The add node service is currently not supported, especially using the `command` specified. |
| [ObjectDisposedException](https://learn.microsoft.com/dotnet/api/system.objectdisposedexception) | The object has been disposed of. |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The service execution failed upon different circumstances; for more details see exception details. The following issues can lead to that exception: [BadNothingToDo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnothingtodo) and [BadTooManyOperations](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtoomanyoperations). |

**Remarks**

Known results for the `command` specified are:

| Status | Description |
|---|---|
| [BadParentNodeIdInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badparentnodeidinvalid) | The parent node id does not refer to a valid node. |
| [BadReferenceTypeIdInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badreferencetypeidinvalid) | For more details see [BadReferenceTypeIdInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badreferencetypeidinvalid). |
| [BadReferenceNotAllowed](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badreferencenotallowed) | The reference could not be created because it violates constraints imposed by the data model. |
| [BadNodeIdRejected](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeidrejected) | The requested node id is already used by another node. |
| [BadNodeClassInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeclassinvalid) | For more details see [BadNodeClassInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeclassinvalid). |
| [BadBrowseNameInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badbrowsenameinvalid) | For more details see [BadBrowseNameInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badbrowsenameinvalid). |
| [BadBrowseNameDuplicated](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badbrowsenameduplicated) | The browse name is not unique among nodes that share the same relationship with the parent. |
| [BadNodeAttributesInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeattributesinvalid) | The node attributes are not valid for the node class. |
| [BadTypeDefinitionInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtypedefinitioninvalid) | For more details see [BadTypeDefinitionInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtypedefinitioninvalid). |
| [BadUserAccessDenied](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#baduseraccessdenied) | For more details see [BadUserAccessDenied](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#baduseraccessdenied). |
