--- title: "system.opc.browseServer" description: "When called from a Vision Client, Perspective Session, or the Designer, returns a list of OPCBrowseElement objects for the given server. Otherwise returns a list of PyOPCTagEx objects." --- # system.opc.browseServer > When called from a Vision Client, Perspective Session, or the Designer, returns a list of OPCBrowseElement objects for the given server. Otherwise returns a list of PyOPCTagEx objects. This function is used in **Python Scripting**. ## Description When called from a Vision Client, Perspective Session, or the Designer, returns a list of OPCBrowseElement objects for the given server. Otherwise, returns a list of PyOPCTagEx objects. As of 8.1.8, method nodes are now included in the browse results. Methods can be read and subscribed to, but not written to. ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.opc.browseServer(opcServer, nodeId)` ### Parameters Type | Parameter | Description ------- | ------- | ------ String| `opcServer` | The name of the OPC server connection. String| `nodeId` | The node ID to browse. ### Returns **List** - A list of [PyOPCTagEx](https://sdk.inductiveautomation.com/javadoc/ignition81/latest/com/inductiveautomation/ignition/common/script/builtin/AbstractOPCUtilities.PyOPCTag.html) objects. ### Scope Gateway ## Syntax - Vision Client Scope `system.opc.browseServer(opcServer, nodeId)` ### Parameters Type | Parameter | Description ------- | ------- | ------ String| `opcServer` | The name of the OPC server connection. String| `nodeId` | The node ID to browse. ### Returns **List** - A list of [OPCBrowseElement](https://sdk.inductiveautomation.com/javadoc/ignition81/8.1.53/com/inductiveautomation/ignition/common/opc/OPCBrowseElement.html) objects. ### Scope Vision Client, Perspective Session, Designer ## Object Summary The OPCBrowseElement object has the following methods: * getDisplayName() - Returns the display name of the object. * getElementType() - Returns the element type. Element types are server, device, view, folder, object, datavariable, property and method. * getNodeId() - Returns a string representing the server node ID. Functionally similar to [getServerNodeId()](https://sdk.inductiveautomation.com/javadoc/ignition81/8.1.53/com/inductiveautomation/ignition/common/opc/OPCBrowseElement.html), except it is available in all scopes, not just the Client/Designer. * getDatatype() - Returns data type information. The PyOPCTagEx object has the following methods to retrieve information: * getDisplayName() - Returns the display name of the object. * getElementType() - Returns the element type. Element types are server, device, view, folder, object, datavariable, property and method. * getServerName() - Returns the server name as a string. * getNodeId() - Returns a string representing the server node ID. * getDataType() - Returns data type information. ## Code Examples ```python title="Example #1" # Print the name of all devices on Ignition OPC UA opcServer="Ignition OPC UA Server" nodeId = "Devices" devices = system.opc.browseServer(opcServer, nodeId) for device in devices: print device.getDisplayName() ``` ```python title="Example #2" # Print the object's server node ID # This method call works in all scopes (Client, Gateway, and Perspective) opcServer = "Ignition OPC UA Server" nodeId = "Devices" results = system.opc.browseServer(opcServer, nodeId) for result in results: print "NodeID: ", result.getServerNodeId() ``` ```python title="Example #3 - Recursive Browse" # This example attempts to recursively browse OPC nodes. Be mindful of the maxDepth in larger systems. # The example uses system.util.getLogger asynchronously, so if you're calling this in the Script Console, # the output may appear in a different console (i.e., Designer console). from functools import partial maxDepth = 1 # Determines how deep the browse will go serverName = 'Ignition OPC UA Server' myLogger = system.util.getLogger('My Browse') # Creating a logger to print the results # Determines where the browse should start. An empty string will start at the root. # Alternatively, '[device name]' will start at a certain device. root = '' def browse(nodeId, depth = 0): children = system.opc.browseServer(serverName, nodeId) for child in children: elementType = str(child.getElementType()) childNodeId = child.getServerNodeId().getNodeId() msg = 'Depth - %s, Node - %s' % (depth, childNodeId) myLogger.info(msg) # If the element is an object, try to browse deeper. if (elementType == 'OBJECT' and depth < maxDepth): browse(childNodeId, depth + 1) system.util.invokeAsynchronous(partial(browse, root)) ```