TrusteeSearcherLookupAccountSID Method Content Studio 5.7 SDK
Content Studio Web Content Management System

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

Searches a registered group or user account in Content Studio given its security identifier.

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

public int LookupAccountSID(
	ConnectionId connectionId,
	SessionId sessionId,
	string sid,
	out AccountType type
)

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).
sid
Type: SystemString
A security identifier in its SSDL form of an account.
type
Type: ContentStudio.SecurityAccountType
On return this parameter is filled with the type of account found

Return Value

Type: Int32
The id of the account found. Zero if no account could be found
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
Content Studio permissions

Any authenticated user can execute this function.
Examples

This little sample shows how to find out if a trustee is registered in Content Studio and whether it is a regular user or a group. The code starts with the trustee's name in the DOMAIN\NAME - format (the UPN-format ex.user@domain.com is also supported), gets its SecurityIdentifier by translating its NTAccount form eventually passing the found sid in its string format to Content Studio.
try
{
  NTAccount acc = new NTAccount("CS\\Editors");
  SecurityIdentifier sid = (SecurityIdentifier)acc.Translate(typeof(SecurityIdentifier));
  AccountType act;
  TrusteeSearcher ts = new TrusteeSearcher();
  int TrusteeID = ts.LookupAccountSID(CS_ConnectionId, CS_UserSessionId, sid.Value, out act);
  if(TrusteeID > 0)
     Response.Write ("ID is: " + TrusteeID.ToString() + "; Type: " + act.ToString());
  else
     Response.Write ("Not found");
}
catch(Exception ex)
{
  Response.Write("Error: " + ex.Message);
}
See Also

Reference