AdmListItems

The AdmListItems class provides methods to add items to a list and create item visual styles.

Inheritance: The AdmListItems class implements the IAdmListItems and IAdmListItemIterator interfaces.

Namespace: Softerra.Adaxes.Adsi.ListItems

Methods

Details

Add(IAdmSearchResult)

Adds a search result to the list.

IAdmListItem Add(IAdmSearchResult searchResult)

Add(IAdmSearchResult, Hashtable)

Adds a search result with the given column values to the list.

IAdmListItem Add(IAdmSearchResult searchResult, Hashtable columnValues)

Parameters

  • searchResult - Specifies the search result to be added.
  • columnValues - Specifies a hash table that maps column identifier to column value. To identify a column that represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.

Examples

The following code sample adds a search result with the given column values to a report.

# The $searchResult variable represents a search result

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add($searchResult, $columnValues)

Add(IAdmSearchResult, IAdmListItemStyle)

Adds a search result entry with the given style to the list.

IAdmListItem Add(IAdmSearchResult searchResult, IAdmListItemStyle itemStyle)

Parameters

  • searchResult - Specifies the search result to be added.
  • itemStyle - Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a search result with the given style to a report.

# The $searchResult variable represents a search result

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

$Context.Items.Add($searchResult, $itemStyle)

Add(IAdmSearchResult, Hashtable, IAdmListItemStyle)

Adds a search result with the given column values and style to the list.

IAdmListItem Add(IAdmSearchResult searchResult,
                 Hashtable columnValues,
                 IAdmListItemStyle itemStyle)

Parameters

  • searchResult- Specifies the search result to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a search result with the given column values and style to a report.

# The $searchResult variable represents a search result entry

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add($searchResult, $columnValues, $itemStyle)

Add(DirectorySearcher)

Adds search results to the list.

void Add(DirectorySearcher searcher)

Parameters

The searcherparameter specifies an instance of a directory searcher configured to search for items to be added.


Add(DirectorySearcher, IAdmListItemStyle)

Adds search results with the given style to the list.

void Add(DirectorySearcher searcher, IAdmListItemStyle itemStyle)

Parameters

  • searcher- Specifies an instance of a directory searcher configured to search for items to be added.
  • itemStyle- Specifies a visual style for the items to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds search results with the given style to a report.

# The $directorySearcher variable represents search results
                      
# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

$Context.Items.Add($directorySearcher, $itemStyle)

Add(IAdmTop)

Adds a directory object to the list.

IAdmListItem Add(IAdmTop obj)

Add(IAdmTop, Hashtable)

Adds a directory object with the given column values to the list.

IAdmListItem Add(IAdmTop obj, Hashtable columnValues)

Parameters

  • obj- Specifies the directory object to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.

Examples

The following code sample adds a user with the given column values to a report.

$johnDoe = $Context.BindToObjectByDN("CN=John Doe,CN=Users,DC=company,DC=com")

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add($johnDoe, $columnValues)

Add(IAdmTop, IAdmListItemStyle)

Adds a directory object with the given style to the list.

IAdmListItem Add(IAdmTop obj, IAdmListItemStyle itemStyle)

Parameters

  • obj- Specifies the directory object to be added.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a user with the given style to a report.

$johnDoe = $Context.BindToObjectByDN("CN=John Doe,CN=Users,DC=company,DC=com")

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

$Context.Items.Add($johnDoe, $itemStyle)

Add(IAdmTop, Hashtable, IAdmListItemStyle)

Adds a directory object with the given column values and style to the list.

IAdmListItem Add(IAdmTop obj, 
                 Hashtable columnValues, 
                 IAdmListItemStyle itemStyle)

Parameters

  • obj- Specifies the directory object to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a user with the given column values and style to a report.

$johnDoe = $Context.BindToObjectByDN("CN=John Doe,CN=Users,DC=company,DC=com")

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add($johnDoe, $columnValues, $itemStyle)

Add(IAdmLogRecord)

Adds a log record to the list.

IAdmListItem Add(IAdmLogRecord logRecord)

Add(IAdmLogRecord, Hashtable)

Adds a log record with the given column values to the list.

IAdmListItem Add(IAdmLogRecord logRecord, Hashtable columnValues)

Parameters

  • logRecord- Specifies the log record to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.

Examples

The following code sample adds a log record with the given column values to a report.

# The $logRecord variable represents a log record
                      
# Specify column values
$columnValues = @{ "description" = "My Description" }

$Context.Items.Add($logRecord, $columnValues)

Add(IAdmLogRecord, IAdmListItemStyle)

Adds a log record with the given style to the list.

IAdmListItem Add(IAdmLogRecord logRecord, IAdmListItemStyle itemStyle)

Parameters

  • logRecord- Specifies the log record to be added.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a log record with the given style to a report.

# The $logRecord variable represents a log record
                      
# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

$Context.Items.Add($logRecord, $itemStyle)

Add(IAdmLogRecord, Hashtable, IAdmListItemStyle)

Adds a log record with the given column values and style to the list.

IAdmListItem Add(IAdmLogRecord logRecord,
                 Hashtable columnValues,
                 IAdmListItemStyle itemStyle)

Parameters

  • logRecord- Specifies the log record to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a log record with the given column values and style to a report.

# The $logRecord variable represents a log record
                      
# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

# Specify column values
$columnValues = @{ "description" = "My Description" }

$Context.Items.Add($logRecord, $columnValues, $itemStyle)

Add(int, string, string)

Adds a custom object to the list.

IAdmListItem Add(int icon, 
                 string displayName, 
                 string displayType)

Parameters

  • icon- Specifies the icon index for the item to be added. For information on how to obtain a list of icons and corresponding indexes, see View List of Icons and Icon Indexes.
  • displayName- Specifies the object display name.
  • displayType- Specifies the object display type.

Add(int, string, string, Hashtable)

Adds a custom object with the given column values to the list.

IAdmListItem Add(int icon, 
                 string displayName, 
                 string displayType,
                 Hashtable columnValues)

Parameters

  • icon- Specifies the icon index for the item to be added. For information on how to obtain a list of icons and corresponding indexes, see View List of Icons and Icon Indexes.
  • displayName- Specifies the object display name.
  • displayType- Specifies the object display type.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.

Examples

The following code sample adds a custom item with the given icon and column values to a report.

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add(1, "My Item", "My Type", $columnValues)

Add(int, string, string, IAdmListItemStyle)

Adds a custom object with the given style to the list.

IAdmListItem Add(int icon, 
                 string displayName, 
                 string displayType,
                 IAdmListItemStyle itemStyle)

Parameters

  • icon- Specifies the icon index for the item to be added. For information on how to obtain a list of icons and corresponding indexes, see View List of Icons and Icon Indexes.
  • displayName- Specifies the object display name.
  • displayType- Specifies the object display type.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a custom item with the given icon and style to a report.

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

$Context.Items.Add(1, "My Item", "My Type", $itemStyle)

Add(int, string, string, Hashtable, IAdmListItemStyle)

Adds a custom object with the given column values and style to the list.

IAdmListItem Add(int icon, 
                 string displayName, 
                 string displayType,
                 Hashtable columnValues,
                 IAdmListItemStyle itemStyle)

Parameters

  • icon- Specifies the icon index for the item to be added. For information on how to obtain a list of icons and corresponding indexes, see View List of Icons and Icon Indexes.
  • displayName- Specifies the object display name.
  • displayType- Specifies the object display type.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds a custom object with the given column values and style to a report.

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add(1, "My Item", "My Type", $columnValues, $itemStyle)

Add(IAdmListItem, IAdmSearchResult)

Adds an item with the given search result to the list.

IAdmListItem Add(IAdmListItem item, IAdmSearchResult searchResult)

Parameters

  • item- Specifies the item to be added.
  • searchResult- Specifies the search result for the item to be added.

Add(IAdmListItem, IAdmSearchResult, Hashtable)

Adds an item with the given search result and column values to the list.

IAdmListItem Add(IAdmListItem item,
                 IAdmSearchResult searchResult,
                 Hashtable columnValues)

Parameters

  • item- Specifies the item to be added.
  • searchResult- Specifies the search result for the item to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.

Examples

The following code sample adds an item with the given search result and column values to a report.

# The $searchResult variable represents a search result entry

# Create list item
$listItem = New-Object "Softerra.Adaxes.Adsi.ListItems.AdmListItemADObject"

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add($listItem, $searchResult, $columnValues)

Add(IAdmListItem, IAdmSearchResult, IAdmListItemStyle)

Adds an item with the given search result and style to the list.

IAdmListItem Add(IAdmListItem item,
                 IAdmSearchResult searchResult,
                 IAdmListItemStyle itemStyle)

Parameters

  • item- Specifies the item to be added.
  • searchResult- Specifies the search result for the item to be added.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds an item with the given search result and style to a report.

# The $searchResult variable represents a search result entry

# Create list item
$listItem = New-Object "Softerra.Adaxes.Adsi.ListItems.AdmListItemADObject"

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

$Context.Items.Add($listItem, $searchResult, $itemStyle)

Add(IAdmListItem, IAdmSearchResult, Hashtable, IAdmListItemStyle)

Adds an item with the given search result, column values, and style to the list.

IAdmListItem Add(IAdmListItem item,
                 IAdmSearchResult searchResult,
                 Hashtable columnValues,
                 IAdmListItemStyle itemStyle)

Parameters

  • item- Specifies the item to be added.
  • searchResult- Specifies the search result for the item to be added.
  • columnValues- Specifies a hash table that maps column identifier to column value. To identify a column that represents represents a property, use the name of the property as it is specified in your directory schema. To identify a custom column, use the column ID.
  • itemStyle- Specifies a visual style for the item to be added. To create a visual style, use the CreateItemStyle method.

Examples

The following code sample adds an item with the given search result, column values, and style to a report.

# The $searchResult variable represents a search result entry

# Create list item
$listItem = New-Object "Softerra.Adaxes.Adsi.ListItems.AdmListItemADObject"

# Create item style
$itemStyle = $Context.Items.CreateItemStyle("red", "yellow", "ADM_LISTITEMFONTSTYLE_BOLD")

# Specify column values
$columnValues = @{ "company" = "Acme"; "description" = "Sales" }

$Context.Items.Add($listItem, $searchResult, $columnValues, $itemStyle)

CreateItemStyle()

Creates a visual style.

IAdmListItemStyle CreateItemStyle()

CreateItemStyle(Color, Color, ADM_LISTITEMFONTSTYLES_ENUM)

Creates a visual style with the given text color, background color and font style.

IAdmListItemStyle CreateItemStyle(Color textColor,
                                  Color backgroundColor,
                                  ADM_LISTITEMFONTSTYLES_ENUM fontStyle)

Parameters

  • textColor- Specifies the color of the list item text.
  • backgroundColor- Specifies a color of the list item background.
  • fontStyle- Specifies the font style of the list item text.

Examples

The following code sample adds users with different styles to a report.

# Add first user
$item = $Context.BindToObjectByDN("CN=James Cooper,CN=Users,DC=company,DC=com")

# Create item style
$textColor = [System.Drawing.Color]::Red
$backgroundColor = [System.Drawing.Color]::Green
$fontStyle = "ADM_LISTITEMFONTSTYLE_BOLD", 
             "ADM_LISTITEMFONTSTYLE_ITALIC"
$itemStyle = $Context.Items.CreateItemStyle($textColor, $backgroundColor, $fontStyle)

$Context.Items.Add($item, $itemStyle)

# Add second user
$item2 = $Context.BindToObjectByDN("CN=Michael Dean,CN=Users,DC=company,DC=com")

# Create item style
$textColor2 = [System.Drawing.Color]::FromArgb(255, 0, 0) # Red
$backgroundColor2 = [System.Drawing.Color]::FromKnownColor("Blue")
$fontStyle2 = "ADM_LISTITEMFONTSTYLE_ITALIC"
$itemStyle2 = $Context.Items.CreateItemStyle($textColor2, $backgroundColor2, $fontStyle2)

$Context.Items.Add($item2, $itemStyle2)

CreateItemStyle(string, string, ADM_LISTITEMFONTSTYLES_ENUM)

Creates a visual style with the given text color, background color and font style.

IAdmListItemStyle CreateItemStyle(string textColor,
                                  string backgroundColor,
                                  ADM_LISTITEMFONTSTYLES_ENUM fontStyle)

Parameters

  • textColor- Specifies a string indicating the list item text color.
  • backgroundColor- Specifies a string indicating the list item background color.
  • fontStyle- Specifies the font style of the list item text.

Examples

The following code sample adds users with different styles to a report.

# Add the first user
$item = $Context.BindToObjectByDN("CN=James Cooper,CN=Users,DC=company,DC=com")

# Create item style
$fontStyle = "ADM_LISTITEMFONTSTYLE_BOLD"
$itemStyle = $Context.Items.CreateItemStyle("red", "green", $fontStyle)

$Context.Items.Add($item, $itemStyle)

# Add the second user
$item2 = $Context.BindToObjectByDN("CN=Michael Dean,CN=Users,DC=company,DC=com")

# Create item style
$fontStyle2 = "ADM_LISTITEMFONTSTYLE_BOLD", 
              "ADM_LISTITEMFONTSTYLE_STRIKEDOUT", 
              "ADM_LISTITEMFONTSTYLE_ITALIC"
$itemStyle2 = $Context.Items.CreateItemStyle("#FFFFFF", "16776960", $fontStyle2)

$Context.Items.Add($item2, $itemStyle2)

Requirements

Minimum required version: 2018.1

See also