Login() Method

You use the Login() method of a DefaultSoapClient object to make the client application sign in to MYOB Advanced.

Note: Instead of directly signing in to MYOB Advanced, your application can use the OAuth 2.0 authorization. For details about OAuth 2.0, see Authorizing Client Applications to Work with MYOB Advanced.

Syntax

public void Login(string name, string password, string tenant, string branch, string locale)

Parameters

  • name: The username that the application should use to sign in to MYOB Advanced, such as "admin".
  • password: The password for the username, such as "123".
  • tenant: The name of the tenant to which the application should sign in, such as "MyStore". You can view the name that should be used for the tenant in the Login Name box of the Tenants (SM203520) form.
  • branch: The ID of the branch to which the application should sign in. You can view the ID of the branch in the Branch ID box of the Branches (CS102000) form.
  • locale: The locale that should be used in MYOB Advanced. You should specify the locale in the System.Globalization.CultureInfo format converted to string, as with "EN-US".
    Note: This parameter has been developed for future use. You do not need to set its value.

Example

The following code causes the client to sign in to MYOB Advanced by using the parameters that are specified in the application settings.
using (var soapClient = new DefaultSoapClient())
{
  //Log in to MYOB Advanced
  soapClient.Login
  (
    Properties.Settings.Default.UserName,
    Properties.Settings.Default.Password,
    Properties.Settings.Default.TenantName,
    Properties.Settings.Default.BranchName,
    null
  );
}

Usage Notes

For each call of the Login() method, you must call the Logout() method after you finish your work with MYOB Advanced to close the session.

You should take into account MYOB Advanced license API limits when using the Login() method. For details, see License Restrictions for API Users.