AnsweredAssumed Answered

User Groups

Question asked by Matthew aDAMS on Apr 15, 2016
Latest reply on May 3, 2016 by Matthew aDAMS

I am trying to return a string of all of the groups that a user belongs to.  I am doing this to limited functions in the add-in that I am writing.  I am able to get the logged in user using IEdmUser5, but when I try to GetGroupMembeship with IEdmUser8 I get a conversion error.  I can't seam to figure out what the issue is so any help would be great.

 

Below is the C# code that I am using.  Note that I am am still learning C# so if there is a better way to go about this please let me know.  This is not the full code but what is critical this this.

 

     // Get the current vault

               EdmVault5 cEdmVault = (EdmVault5)poCmd.mpoVault;

              IEdmVault12 cEdmVault2 = (IEdmVault12)cEdmVault;

 

       // get user name

            IEdmUserMgr7 userMgr = default(IEdmUserMgr7);

            userMgr = (IEdmUserMgr7)cEdmVault2;

            IEdmUser5 user = default(IEdmUser5);

            user = userMgr.GetLoggedInUser();

            string userName = user.Name;

            MessageBox.Show("Logged In User: " + user.Name);

 

            IEdmUser8 user2 = default(IEdmUser8);

            user2 = userMgr.GetUser(user.Name);

            Array groups = null;

            user2.GetGroupMemberships(out groups);   

            string UserGroup = string.Join(",", groups);

 

            MessageBox.Show("Member of groups: " + UserGroup);

 

          

Outcomes