'OPCUA: How to call nested method

I'm tryng to call "Select" method using OPCUA Foundation libraries.

enter image description here

and this is how I call it

 NodeId node = new NodeId("ns=2;s=/Methods/Filehandling");
 NodeId method = new NodeId("ns=2;s=/Methods/Filehandling/Select");
 object[] arguments = new object[2];

 arguments[0] = new NodeId($"ns=2;s={filePath}");
 arguments[1] = channel;

 var callResult = this.OpcUaBaseDriver.Session.Call(node, method, arguments);

The execution raise the exception

BadNodeIdUnknown

I'm able to call methods like "GiveUserAccess" or "GetUserAccessRights" that are not listed within "Filehandling" folder in this way

NodeId node = new NodeId("ns=2;s=/Methods");
NodeId method = new NodeId("ns=2;s=/Methods/GiveUserAccess");
object[] arguments = new object[2];

arguments[0] = userName;
arguments[1] = accessRight;

var callResult = this.OpcUaBaseDriver.Session.Call(node, method, arguments);

It looks like the problem is the nesting level of Select method within Methods folder. Ideas?



Solution 1:[1]

For this method, you should provide the Node ID of the program you want to select, not the Node ID of the Method's folder...

Try something like

NodeId node = new NodeId("ns=2;s=/FileSystem/Part Program/NC_PROG1.MPF");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Camille G.