Developer forum

Forum » Development » Smart Searches List

Smart Searches List

Rui Silva
Reply

Does anyone know how I can list the users from a smart search in backend code?

I’ve the Guid and name of the smart search but have no way to get the users list from the API (Dynamicweb.Modules.Searching.SmartSearch).

Thanks,

Rui Silva

 


Replies

 
Steffen Kruse Hansen
Reply

If you create an instance of a "Dynamicweb.Modules.Searching.SmartSearch", you can call the method "Load" on that with the Guid of smart search you want to use. If that succeeds you should be able to call "GetResult" and you will get the list of users.

Example:

var smartSearch = new SmartSearch();

if(smartSearch.Load(*GUID*))

{

var users = smartSearch.GetResult<User>();

}

Hope it helps,

Best regards,

Steffen

 

 
Rui Silva
Reply

Hi Steffen,

I could do what you suggest, but the class Dynamicweb.Modules.Searching.SmartSearch with declared as Friend (VB.net) so it's only accessible from DW objects.

Can this class become public?

Best,

Rui Silva

 

 
Rui Silva
Reply

bump

 
Nicolai Pedersen
Reply

This is TFS#29244 marked for 8.9.2 coming up after 9.2 release

 

You must be logged in to post in the forum