TrusteeSearcherFindTrustees Method (ConnectionId, SessionId, AccountType, 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,
	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 Sql statement and the search will be made both in the trustee's name and its login name.
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 a certain group by its name and get its id.
try
{
    TrusteeSearcher ts = new TrusteeSearcher();
    int max = 0;
    int GroupID = 0;
    using (StringReader SR = new StringReader(ts.FindTrustees(CS_ConnectionId, 
                                                              CS_UserSessionId, 
                                                              AccountType.Group, 
                                                              @"CS\Editors",
                                                              ref max)))
    {
       XmlReader XReader = XmlReader.Create(SR);
       if (XReader.ReadToFollowing("id"))
         GroupID = XReader.ReadElementContentAsInt();
    }
    if(GroupID > 0)
        Response.Write("GroupID is " + GroupID.ToString());
    else
        Response.Write("Not found");

}
catch (Exception ex)
{
  Response.Write("Error: " + ex.Message);
}
See Also

Reference