using AMO to access meta data RRS feed

  • Question

  • I discovered the Analysis Management Objects (AMO) to produce a list of users and their permissions.

    Everything looks pretty easy, but my experimental code won't load the collection classes.

                using (Server server = new Server())

                    Database database = server.Databases.FindByName("myTabular");

                    this.Text = database.DatabasePermissions.Count.ToString();


    I confirmed, that the connection has been established. However, all collections I am trying to read in this very simple WinForm-TestApp will be empty (element count 0)

    Am I missing something?

    Monday, July 22, 2019 1:02 PM

All replies

  • database.DatabasePermissions.Count is a count of the number of roles you have for an Analysis Services database.

    I suspect you have no database roles defined. What exactly are you trying to achieve?

    Monday, July 22, 2019 2:13 PM
  • Try this (C#/.NET Framework) to get members from each role in selected Tabular database
    before going to a next step (filters/permissions on each model child object)
    and see if you can get any results displayed.
    using System;
    //using AMO=Microsoft.AnalysisServices;
    //using Microsoft.AnalysisServices.Core;
    using TOM=Microsoft.AnalysisServices.Tabular;
    class MyTab
    {static void Main(string[] args)
        {   TOM.Server sv=new TOM.Server();
            TOM.Database db=sv.Databases.FindByName("My_Tab_DB");
            TOM.Model m=db.Model;
            foreach(TOM.ModelRole r in m.Roles)
            {foreach(TOM.ModelRoleMember rm in r.Members)
             {Console.WriteLine(r.Name + " _ " + rm.Name);}}
    AMO works very well on a root level, as you go deeper into tabular
    object model - navigate referencing tabular assembly/namespace,
    although even here it really depends on compatibility level of your database
    (there are differences between versions)

    Monday, July 22, 2019 2:37 PM
  • Hi darkchanter99,

    I guess the problem is more likely related to the version of SSAS instance. For example, beginning in SQL Server 2016, AMO is refactored into multiple assemblies. Generic classes are in the Microsoft.AnalysisServices.Core Namespace. Multidimensional-specific APIs remain in Microsoft.AnalysisServices Namespace.

    If tabular models are at 1200 or higher compatibility level, use the Tabular Object Model. For more details, please refer:

    Analysis Management Objects (AMO)

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Tuesday, July 23, 2019 6:24 AM
  • Perhaps this will help you?

                using (Server server = new Server())
                    Database database = server.Databases.FindByName("XXX");
                    string text = database.DatabasePermissions.Count.ToString();
                    for (int a = 0; database.Roles.Count > a; a++)
                        Role role = database.Roles[a];
                        RoleMemberCollection roleMembers = role.Members;
                        foreach (RoleMember rm in roleMembers)
                            Console.WriteLine(rm.Name + " is a member of " + role.Name +" "+ );

    Tuesday, July 23, 2019 3:12 PM