 | PIServerConnect Method (NetworkCredential, PIAuthenticationMode) |
Open a connection to the PI Data Archive using the specified credentials
to allow sending and retrieving data.
Namespace:
OSIsoft.AF.PI
Assembly:
OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntaxpublic void Connect(
NetworkCredential credential,
PIAuthenticationMode authenticationMode
)
Public Sub Connect (
credential As NetworkCredential,
authenticationMode As PIAuthenticationMode
)
Dim instance As PIServer
Dim credential As NetworkCredential
Dim authenticationMode As PIAuthenticationMode
instance.Connect(credential, authenticationMode)
public:
void Connect(
NetworkCredential^ credential,
PIAuthenticationMode authenticationMode
)
member Connect :
credential : NetworkCredential *
authenticationMode : PIAuthenticationMode -> unit
Parameters
- credential
- Type: System.NetNetworkCredential
The NetworkCredential to use when connecting to the server.
- authenticationMode
- Type: OSIsoft.AF.PIPIAuthenticationMode
Specifies the type of authentication to be used when making the connection.
The specified credential must match the type of authentication.
Exceptions
Remarks
If an application accesses a property or invokes a method that requires server
access, an implicit connection is performed. When a connection is no longer needed,
it can be closed using the
Disconnect method.
Examples
PIServer myPIServer = new PIServers().DefaultPIServer;
myPIServer.Connect();
myPIServer.Disconnect();
myPIServer.Connect(true, null);
myPIServer.Disconnect();
try
{
NetworkCredential credential = new NetworkCredential("guest", String.Empty);
myPIServer.Connect(credential);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Dim myPIServer As PIServer = New PIServers().DefaultPIServer
myPIServer.Connect()
myPIServer.Disconnect()
myPIServer.Connect(True, Nothing)
myPIServer.Disconnect()
Try
Dim credential As NetworkCredential = New NetworkCredential("guest", String.Empty)
myPIServer.Connect(credential)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Version InformationAFSDK
Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6
See Also