AFConnections.IsValidConnection Method (Boolean, Boolean, AFPort, AFPort, String)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
This method checks if a valid connection can be created between the
specified source and destination ports of an AFBaseElement.
Namespace: OSIsoft.AF.Modeling
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public bool IsValidConnection( bool checkSourceMaxConnections, bool checkDestinationMaxConnections, AFPort sourcePort, AFPort destinationPort, out string errMsg )
Public Function IsValidConnection ( checkSourceMaxConnections As Boolean, checkDestinationMaxConnections As Boolean, sourcePort As AFPort, destinationPort As AFPort, <OutAttribute> ByRef errMsg As String ) As Boolean Dim instance As AFConnections Dim checkSourceMaxConnections As Boolean Dim checkDestinationMaxConnections As Boolean Dim sourcePort As AFPort Dim destinationPort As AFPort Dim errMsg As String Dim returnValue As Boolean returnValue = instance.IsValidConnection(checkSourceMaxConnections, checkDestinationMaxConnections, sourcePort, destinationPort, errMsg)
public: bool IsValidConnection( bool checkSourceMaxConnections, bool checkDestinationMaxConnections, AFPort^ sourcePort, AFPort^ destinationPort, [OutAttribute] String^% errMsg )
member IsValidConnection : checkSourceMaxConnections : bool * checkDestinationMaxConnections : bool * sourcePort : AFPort * destinationPort : AFPort * errMsg : string byref -> bool
Parameters
- checkSourceMaxConnections
- Type: SystemBoolean
If , check the source port to determine if the maximum number of connections will be exceeded. If , this check will not be performed. You would not want to perform this check if you are attempting to check if the destination could be changed to a different port before removing the current connection. Normally this parameter should be set to . - checkDestinationMaxConnections
- Type: SystemBoolean
If , check the destination port to determine if the maximum number of connections will be exceeded. If , this check will not be performed. You would not want to perform this check if you are attempting to check if the source could be changed to a different port before removing the current connection. Normally this parameter should be set to . - sourcePort
- Type: OSIsoft.AF.ModelingAFPort
The source AFPort object of the connection. The port type must be either Output or Undirected. The port must be from an AFBaseElement, it cannot be from an AFElementTemplate. - destinationPort
- Type: OSIsoft.AF.ModelingAFPort
The destination AFPort object of the connection. The port type must be either Input or Undirected. The port must be from an AFBaseElement, it cannot be from an AFElementTemplate. - errMsg
- Type: SystemString
The returned error message if the connection is invalid.
Return Value
Type: BooleanReturns if the connection is valid. If the connection is invalid, returns and the errMsg parameter specifies the error message.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | This exception is thrown when the sourcePort parameter or the destinationPort parameter is . |