Guid guid = Marshal.GenerateGuidForType(typeof(IServerEnvironment));

UID uid = new UIDClass();

uid.Value = guid.ToString("B");

IEnvironmentManager environmentManager = new EnvironmentManager() as IEnvironmentManager;

IServerEnvironment2 serverEnvironment = environmentManager.GetEnvironment(uid) as IServerEnvironment2;

userName = serverEnvironment.UserInfo.Name;

roles = serverEnvironment.UserInfo.Roles;

string role = roles.Next();


  role = roles.Next(); 

while (role != null);


Leading Cloud Surveillance service

Leading Enterprise Cloud IT Service Since 2003

Powered by, a division of DriveHQ, the leading Cloud IT and Cloud Surveillance Service provider since 2003.