Connect to server by session key.
long OpenSession( [in] BSTR Session, [in] BSTR Server, [in, optional, defaultvalue("127.0.0.1")] BSTR RequestAddr, [in, optional, defaultvalue(0)] long Remove )
Parameters
Session
Session key to logon.
Server
Server name or IP address.
RequestAddr
IP address of current logon machine. OpenSession method must use the same value as what Connect method used; otherwise OpenSession method will fail.
Remove
If this value is zero, OpenSession logon server by the specified session key. If this value is 1, OpenSession removes the specified session from server.
Return Value
Return value is zero if this method succeeds; otherwise return value is non-zero.
Usage Example
Const SESSION_REQUIRED = 1 Dim server, user, password, sessionkey, requestAddr server = "localhost" user = "myuser@adminsystem.com" password = "mypassword" requestAddr = "192.168.0.1" Set oSvr = CreateObject("EmailArchitectObjects.ServerRoot") 'Connect with session required r = oSvr.Connect( server, user, password, SESSION_REQUIRED, requestAddr ) If r <> 0 Then WScript.Echo( "connect server failed!" ) WScript.Quit End If 'get session key generated by server. sessionkey = oSvr.SessionKey oSvr.Close 'now connect server with session key, once this method succeeded, current object has the same user security context r = oSvr.OpenSession( sessionkey, server, requestAddr ) If r <> 0 Then WScript.Echo( "open session failed!" ) WScript.Quit End If 'remove session from server. oSvr.OpenSession( sessionkey, server, requestAddr, 1 )
See Also
Using EmailArchitectObjects
EmailArchitectObjects Remote Access
Connect