TrusteeSearcherFindTrustees Method (ConnectionId, SessionId, AccountType, String, String, Int32) Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Finds trustes (groups or users) in CS that matches a certain criteria.

Namespace: ContentStudio.Security
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public string FindTrustees(
	ConnectionId connectionId,
	SessionId sessionId,
	AccountType type,
	string criteria,
	string scope,
	ref int returnMax
)

Parameters

connectionId
Type: ContentStudioConnectionId
A value that identifies the web site
sessionId
Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
type
Type: ContentStudio.SecurityAccountType
The type of account to find. To find all types of account pass AccountType.Unknown
criteria
Type: SystemString
The search argument. This parameter must match the LIKE statement in Microsoft Sql Server and the search will be made both in the trustee's name and its login name.
The following are examples of valid criterias:
CriteriaComment
CS\EditorsFinds the trustee with login name Editors in the domain CS
EditorsFinds any trustee named Editors or having the the login name Editors in any domain
CS\Editors%Finds any trustee or group whose name starts with Editors with in the CS domain
%suzy%Finds all trustees whose name of login name contains suzu
CS\Editors[_]%Finds all trustees in the CS domain whose login name starts with Editors_ e.g. Editors_1 or Editors_Admin1.
scope
Type: SystemString
For the accountType AccountType.User this can be the name of a security group where the user must be a member. Pass null or an empty string to allow selection from any group.
returnMax
Type: SystemInt32
Indicates the maximum allowed row that can be returned. If this value is exceeded a CSException is thrown. Pass zero to use the default value. After the call this parameter contains the actual records found.

Return Value

Type: String
Xml, with the following sample syntax
<root>
    <status>0</status>
    <statustext>Success</statustext>
    <pageno>1</pageno>
    <pagesize>1</pagesize>
    <pagecount>1</pagecount>
    <recordcount>1</recordcount>
    <trustes>
        <truste>
            <id>4</id>
            <name>Alva Larsson (CS\alva)</name>
            <fullname>Alva Larsson</fullname>
            <type>U</type>
            <sid>S-1-5-21-2060480078-1251939555-6206559-1104</sid>
            <isgroup>0</isgroup>
            <islocalgroup>0</islocalgroup>
            <email>alva.larsson@cs.com</email>
            <trusteekey>AAAAZ3</trusteekey>
            <isunknown>0</isunknown>
        </truste>
    </trustes>
</root>
Exceptions

ExceptionCondition
CSExceptionA business rule was violated in the underlying Content Studio database
SqlExceptionAn error occurred when executing the command against the Content Studio database
CSInvalidParameterExceptionAn invalid parameter value was passed in or Criteria was null
ArgumentOutOfRangeExceptionThe Criteria (max 1000) or the Scope(max 50) argument is too long.
Content Studio permissions

All authenticated users can call this function.
Examples

The following code shows how you can find the user "Anna Doe" that is a member by the Editors group by and get the user's id.
try
{
    TrusteeSearcher ts = new TrusteeSearcher();
    int max = 1;
    int UserID = 0;
    using (StringReader SR = new StringReader(ts.FindTrustees(CS_ConnectionId, 
                                                              CS_UserSessionId, 
                                                              AccountType.User, 
                                                              "Anna Doe",
                                                              @"CS\Editors",
                                                              ref max)))
    {
       XmlReader XReader = XmlReader.Create(SR);
       if (XReader.ReadToFollowing("id"))
         GroupID = XReader.ReadElementContentAsInt();
    }
    if(GroupID > 0)
        Response.Write("UserID is " + GroupID.ToString());
    else
        Response.Write("Not found");
}
catch (Exception ex)
{
  Response.Write("Error: " + ex.Message);
}
See Also

Reference