Dynamics AX Client Type Library Reference

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2

The Dynamics AX Client Type Library is a binary file that stores information about the Dynamics AX COM object. The COM object is a runtime object that provides programmatic access to the Microsoft Dynamics AX client. You can use the methods and enumerations in the type library to open a Microsoft Dynamics AX client form. The type library is created when you install the Microsoft Dynamics AX client application. For more information, see Using COM to Open a Form from an Application.

The following interfaces in the Dynamics AX Client Type Library enable you to use the Dynamics AX COM object:

Interface

Information

DynamicsAx.Application

You use a method from this interface to open a form.

DynamicsAx.GeneralLedger

The interface is used internally. You should not use this interface or the methods that it provides.

DynamicsAx.Application Interface

The Dynamics AX Client Type Library interface enables you to programmatically open a form.

JJ677289.collapse_all(en-us,AX.60).gifOpenMenuItem Method

You use the OpenMenuItemmethod to open a specified form. The following code example shows the signature of the method.

HRESULT OpenMenuItem ([in] BSTR bstrCompany, [in] BSTR bstrMenuName, [in] AXMENUTYPE axMenuTypeMenuType)

The following sections describe the parameters, syntax, and return value for the OpenMenuItem method.

JJ677289.collapse_all(en-us,AX.60).gifParameters

To specify the form you want to open, use the following parameters.

Name

Type

Description

bstrCompany

[in] BSTR

A string that specifies a company. You use the company to specify the scope for the form.

bstrMenuName

[in] BSTR

A string that specifies the name of a menu item.

axMenuTypeMenuType

[in] AXMENUTYPE

An enumeration value that specifies the type of the menu item specified by bstrMenuName parameter.

You use a member of the AxMenuType enumeration to specify the type of the menu item.

JJ677289.collapse_all(en-us,AX.60).gifSyntax

The following code example shows how to call the OpenMenuItem method from a C# application.

void OpenMenuItem(string company, string menuitem, AxClientLib.AxMenuType menuitemType);

The following code example shows how to use the OpenMenuItem method from Microsoft Visual Basic Scripting Edition.

    Dim instance
    Dim company, menuitem, menuitemType
     
    Set instance = CreateObject("DynamicsAx.Application")
    instance.OpenMenuItem company, menuitem, menuitemType

JJ677289.collapse_all(en-us,AX.60).gifReturn Value

The OpenMenuItem method returns a value of type HRESULT. The method returns one of the following values:

HRESULT

Description

S_OK

The method succeeded.

E_INVALIDARG

An invalid parameter value was supplied to the method.

E_ACCESSDENIED

The user does not have permission to open the form. The menu item might not be associated with a security key.

E_UNEXPECTED

An unexpected error occurred when you open the specified form.

When you use the Dynamics Ax Client Type Library with a .NET application, you use an interop assembly to access the DynamicsAxApplication interface. If the OpenMenuItem method returns any value but S_OK, the interop converts the HRESULT to an exception.

JJ677289.collapse_all(en-us,AX.60).gifRemarks

For information about how to use the OpenMenuItem with .NET or VBScript, see How to: Use COM to Open a Form.

AxMenuType

Use the AxMenuType enumeration to specify the type of a menu item. The enumeration includes the following values:

Constant

Value

Description

ActionMenu

2

Specifies that the menu item is an Action type.

DisplayMenu

0

Specifies that the menu item is a Display type.

OutputMenu

1

Specifies that the menu item is an Output type.

The following .NET code example uses AxMenuType for the third parameter of the OpenMenuItem method. Notice how the enumeration identifies that the CustTableListPage menu item is a Display type.

OpenMenuItem("DAT", "CustTableListPage", AxClientLib.AxMenuType.DisplayMenu);

See also

How to: Specify the Partition for the Form

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.