Skip to main content
Nintex Community Menu Bar

How to access roles through API

  • February 16, 2008
  • 2 replies
  • 15 views

Forum|alt.badge.img+8

Hey Everyone,


                      Can anyone tell me how to access black pearl "roles" through code. ?. I need to create a function which accepts role name and then gives back collection of username?


 


Thanks in advance


 

2 replies

Forum|alt.badge.img+6
  • February 16, 2008
Try SourceCode.Workflow.Management API..?

Forum|alt.badge.img+5
  • February 18, 2008

Hi,


I would recommend you to do this through a SmartObject using the URM(UserRoleManager) ServiceObject, but you could also do this through the URM API as described below.


You need to reference the following assemblies :



  • SourceCode.Security.UserRoleManager.Client
  • SourceCode.HostServerInterfaces which contains the IUsers collection and IUser
  • SourceCode.HostClientAPI

The following is a very simple example on how to use the API:


            UserRoleManagerServer urm = new UserRoleManagerServer();
            urm.Connection = urm.CreateConnection();
            //To build up the connection string.
            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder csb = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            csb.Host = "blackpearl";
            csb.Integrated = true;
            csb.IsPrimaryLogin = true;
            csb.Port = 5555;
           
//Open the connection using the constr built
            urm.Connection.Open(csb.ToString());
           
//Get a collection of users belonging to a Role
            SourceCode.Hosting.Server.Interfaces.IUserCollection users = urm.ResolveQueue("MyRole");
            //...Rest of code here


Hope this helps.


Gert