SmartObject to get users list from AD

  • 1 April 2009
  • 6 replies
  • 4 views

Badge +6

Greetings,

We have this system to be developed in ASP.NET C# no sharepoint integration.

How can I get the list of users from AD using SmartObjects? Where can I find the list of services SmartObject provides and how to make use of them in code? 

I am new to this concept SmartObjects. Is SharePoint required to create SmartObjuects?

If anyone provide where I should start with that will be of great help.

 

Thanks,

Aman Kazi


6 replies

Badge +6

Hi,


maybe this post can help you: http://www.k2underground.com/blogs/rambleon/archive/2008/05/13/using-smartobject-api-and-the-ad-service-object.aspx


HTH

Badge +10

Hi


 


Using K2 blackpearl SharePoint is not required for workflows or for SmartObjects.  Since BlackPearl 807 the AD Service Object was updated which is probably good news for what you want to do since most of the time you can get the information you want without having to write any code.


 


To get more familiar with SmartObjects the tool that will become your new best friend is the SmartObjects Services Tester which ships with 807 and is hidden (no start menu links) under C:Program FilesK2 blackpearlServiceBroker SmartObject Service Tester.exe


 


Using this tool you can create a SmartObject for the AD Service 2AD User node and can test calling the SmartObject you created from the service object to make sure it returns the information you want.  The tool also shows you the properties the AD Service 2 exposes for users, groups and AD Organizational units.  Once the SmartObject is created you can use it within your workflow and within your forms.


 


I hope this helps.  Tim


 


__________________________


Principal - Technologist

Caprivi Solutions Inc.
Toronto, Ontario 
Badge +6

Thanks Tim,

I got the .exe. But how do I use it? Can I find help regarding the tool?

Do I need to register the ServiceInstance /ServiceType. Can I get the information how to register and use it in the form code?

Thanks in advance

Badge +11
I can appreciate the struggles of a new person starting their first project and feeling a little overwhelmed.  Where to begin?  May I suggest attending a K2 101 course available from K2 or one of our training partners?
Badge +6

Thanks David,

 Where can I find this training details?

Thanks,

Aman

Badge +6

Hurry!,

 Following code will give you the list of users in active directory,

            Connection K2con = new Connection();
            K2con.Open("sys.K2.com");

            SmartObjectClientServer sOServer = new SmartObjectClientServer();
            sOServer.CreateConnection();
            sOServer.Connection.Open("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host=sys;Port=5555");

            #region Getting the users

            SmartObject smUsers = sOServer.GetSmartObject("UMUser");
            smUsers.MethodToExecute = "Get_Users";
            smUsers.ListMethods["Get_Users"].InputProperties["Label_Name"].Value = "K2";
            SmartObjectList smUsersList = sOServer.ExecuteList(smUsers);

            foreach (SmartObject data in smUsersList.SmartObjectsList)
                    lstUser.Items.Add(data.Properties["Name"].Value);


 

Cheers!

Reply