Last active
October 9, 2020 19:16
-
-
Save mazzy-ax/4d4d06ec2fddd885b67527623467aee8 to your computer and use it in GitHub Desktop.
getTables. X++ for Microsoft Dynamics AX7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class getTables | |
{ | |
public static void Main(Args _args) | |
{ | |
str packageDir = 'C:\AOSService\PackagesLocalDirectory'; | |
//or | |
var environment = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment(); | |
packageDir = environment.get_Aos().get_PackageDirectory(); | |
// it's kind of magic | |
var runtimeProviderConfiguration = New Microsoft.Dynamics.AX.Metadata.Storage.Runtime.RuntimeProviderConfiguration(packageDir); | |
var metadataProviderFactory = New Microsoft.Dynamics.AX.Metadata.Storage.MetadataProviderFactory(); | |
Microsoft.Dynamics.AX.Metadata.Providers.IMetadataProvider provider = metadataProviderFactory.CreateRuntimeProvider(runtimeProviderConfiguration); | |
// object names | |
print provider.Tables.ListObjectsForModel('FleetManagement'); | |
print provider.Tables.ListObjectsForModel('FleetManagementExtension'); | |
print provider.TableExtensions.ListObjectsForModel('FleetManagement'); | |
print provider.TableExtensions.ListObjectsForModel('FleetManagementExtension'); | |
// single object by name | |
Microsoft.Dynamics.AX.Metadata.MetaModel.AxTable custTransMetaData = provider.Tables.Read('CustTrans'); | |
Microsoft.Dynamics.AX.Metadata.MetaModel.AxClass c = provider.Classes.Read('LedgerVoucher'); | |
} | |
} |
Hi @AdnanePow
Good question. I don't know. Sorry
Hi.
Thanks for the reply
Its ok i got the answer :)
…On Fri, 27 Dec 2019, 19:23 mazzy, ***@***.***> wrote:
Hi @AdnanePow <https://github.com/AdnanePow>
Good question. I don't know. Sorry
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/4d4d06ec2fddd885b67527623467aee8?email_source=notifications&email_token=AB4ZUQJ425QGHFTT5OLX7J3Q2ZB3DA5CNFSM4J72ICYKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF6RJI#gistcomment-3121812>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4ZUQPG53NOBNKBEC7NUEDQ2ZB3DANCNFSM4J72ICYA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @mazzy-ax , thanks for this very helpful post
in your example showed only 1 table passed as paramter ?
var = oneExtendedMenu = provider.MenuExtension.read("NameOfExtendedMenu");
What if i want to iterate all Menu extensions, and not only ?
var extendedMenus = provider.MenuExtensions;
how can i iterate the "ExtendedMenus" and get the current AxMenuExtension
Can you help on this please, thanks ?