Skip to main content

Searching users can be achieved by using one of the Search methods.

Search users specifying options.

Syntax

C#
public PagedList<User> Search(SecuritySearchOptions securitySearchOptions)
{    
}

Parameters

securitySearchOptions

Type: SecuritySearchOptions
The search options, query, ordering and paging, etc

Examples

C#
using Zengenti.Contensis.Management;
using Zengenti.Data;

// Create a client
var client = ManagementClient.Create();

SecuritySearchOptions securitySearchOptions = new SecuritySearchOptions 
{
    PageIndex = 0,
    PageSize = 10,
    OrderBy = new List<string>{"username"},
    Where = new IExpression[]
    {
        new OrExpression(
            new Contains("email", "zengenti"),
            new EqualTo<string>("username", "zengenti")
         )
     }
};

// Search the users
PagedList<User> users = client.Security.Users.Search(securitySearchOptions);

Search users asynchronously specifying options.

Syntax

C#
public Task<PagedList<User>> SearchAsync(SecuritySearchOptions securitySearchOptions)
{    
}

Parameters

securitySearchOptions

Type: SecuritySearchOptions

The search options, query, ordering and paging, etc

Examples

C#
using Zengenti.Contensis.Management;
using Zengenti.Data;

// Create a client
var client = ManagementClient.Create();

SecuritySearchOptions securitySearchOptions = new SecuritySearchOptions 
{
    PageIndex = 0,
    PageSize = 10,
    OrderBy = new List<string>{"username"},
    Where = new IExpression[]
    {
        new OrExpression(
            new Contains("email", "zengenti"),
            new EqualTo<string>("username", "zengenti")
         )
     }
};

// Search the users
PagedList<User> users = await client.Security.Users.SearchAsync(securitySearchOptions);

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request