12/01/2022
Hello!
I’m trying convert an absolute path to a node id instead of a relative path in .NET, but I can’t seem to figure out how to do that.
For example, the path for a node I’m trying to read is Root\Objects\EC\WT\13\WGRI1\Gri1\WMeas\mag
But when I try the below code, it doesn’t work, although the starting node is Objects folder.
var browsePathCollection = new BrowsePathCollection
{ new BrowsePath { RelativePath = RelativePath.Parse(@"EC\WT\13\WGRI1\Gri1\WMeas\mag", this._session.TypeTree), StartingNode = ObjectIds.ObjectsFolder } }; var paths = await this._session.TranslateBrowsePathsToNodeIdsAsync(null, browsePathCollection , new CancellationToken());
Can you someone guide me in the right direction please?
Thank you.
05/30/2017
The path you show is not complete. Each element in the path has a namespace that qualifies the name.
If you express the path using the NamespaceIndex (from the Server.NamespaceArray Property)
0:Root/0:Objects/1:EC/1:WT/1:13/1:WGRI1/2:Gri1/2:WMeas/2:mag
Then TranslateBrowsePathsToNodeIdsAsync should works as expected.
1 Guest(s)