IMessenger::AutoSignin

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Signs in the local client automatically using the last sign-in name and saved password information. Scriptable.

Syntax

HRESULT AutoSignin(VOID);

Parameters

This method takes no parameters.

Return Value

Returns one of the following values. For managed code applications, these return values are received in the form of a COMException.

  • S_OK
    Success. See Remarks.
  • MSGR_E_LOGON_UI_ACTIVE
    The Sign In dialog box is enabled and visible when this method is called.
  • S_FALSE
    The client is already signed in (scripting).
  • MSGR_E_ALREADY_LOGGED_ON
    The client is already signed in.
  • E_FAIL
    Returned for one of the following reasons:

    • First-time user.
    • No available credentials.
    • Cannot determine local state.
    • Lost connection.
    • Password encoding failed.
    • Unspecified internal error. Cannot access object.

For a table of MSGR_E_* constants, see Error Codes.

Remarks

This method is used for initial sign-in if necessary, but requires that the sign-in credentials are previously stored by the client user.

To sign in with a name and password other than the defaults, use the IMessenger::Signin method. This method always displays the Sign In dialog box, even with cached credentials. If saving the password locally is not enabled by a specific user option, this method fails.

If this method fails, implementers can display the Sign In dialog box by calling the IMessenger::Signin method with null strings for the sign-in name and password.

Because sign-in relies on server authentication, several possible error conditions are not checked for by the HRESULT of IMessenger::AutoSignin method; instead, they are returned in the IMessenger::Signin method. These error conditions include, but are not limited to, bad credentials stored from the last sign-in attempt, a blank sign-in name or password, and connection problems, each of which is differentiated by the hr parameter of the event. To determine whether the sign-in sequence succeeded, clients should always check both the HRESULT of IMessenger::AutoSignin method and the hr parameter of the IMessenger::Signin event.

Example

The following example creates an intparentHandle and sets it to a zero value. The Signin method of the IMessenger interface requires a null or zero value in the first parameter position with an account name and password in the second and third parameter positions. In this example, the account might not have been supplied by the user so the code tests the string for length to determine which IMessenger interface method to call.

int parentHandle = 0;
if (account == null)
   communicator.AutoSignin();
else
   try
   {
      communicator.Signin(parentHandle, account, passwd);
      connected = true;
   }
   catch (ArgumentException AE)
   {
     MessageBox.Show(AE.Message.ToString());
     connected = false;
   }
   catch (COMException CE)
   {
      connected = false;
   }

Requirements

  • Client
    Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .
  • Server
    Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.
  • Product
    Microsoft Office Communicator 2007 Automation API
  • IDL file
    Msgrua.idl

See Also

Reference

Office Communicator Automation API Reference