GetInventoryCatalogs Method (String)
Returns an InventoryCatalogCollection object containing the list of all the inventory catalogs in the inventory system that match the specified search clause.
Namespace: Microsoft.CommerceServer.Inventory
Assembly: Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)
Syntax
'Declaration
Public Function GetInventoryCatalogs ( _
searchClause As String _
) As InventoryCatalogCollection
'Usage
Dim instance As InventoryContext
Dim searchClause As String
Dim returnValue As InventoryCatalogCollection
returnValue = instance.GetInventoryCatalogs(searchClause)
public InventoryCatalogCollection GetInventoryCatalogs(
string searchClause
)
public:
InventoryCatalogCollection^ GetInventoryCatalogs(
String^ searchClause
)
public function GetInventoryCatalogs(
searchClause : String
) : InventoryCatalogCollection
Parameters
- searchClause
Type: System..::.String
The criteria, the search clause to filter the inventory catalogs.
Return Value
Type: Microsoft.CommerceServer.Inventory..::.InventoryCatalogCollection
An InventoryCatalogCollection object containing the list of all the inventory catalogs in the inventory system.
Remarks
You can iterate through the InventoryCatalogCollection and access the properties of the individual inventory catalogs using the InventoryCatalog object. You can set the searchClause to a valid T-SQL where clause which can be used to perform searches on the inventory catalogs. All the properties in the searchClause should be enclosed in []. Any string values in the searchClause should be prefixed with N to allow searching for unicode content. You can use valid T-SQL operators like AND, OR, NOT, LIKE etc in the search condition. For example string searchClause = @"(\[InventoryCatalogName\] like N'IC00%' OR \[InventoryCatalogDescription\] like N'IC00%') AND \[LastModified\]\> '1/1/2000' "; You cannot have the following in the searchClause :
The ( and ) should be symmetric. For eg string searchClause = @"([InventoryCatalogName] like N'IC00%' is invalid since the ( is not closed.
It should not contain sql comment characters /* and -- unless these characters are enclosed by [].
Examples
This example demonstrates how to get the inventory catalogs and access the properties of the individual inventory catalogs.
public void GetInventoryCatalogs()
{
try
{
string searchClause = @"([InventoryCatalogName] like N'IC000%' OR [InventoryCatalogDescription] like N'IC000%') AND [LastModified] > '1/1/2000'";
InventoryCatalogCollection inventoryCatalogs = inventoryContext.GetInventoryCatalogs(searchClause);
int numInventoryCatalogs = inventoryCatalogs.Count;
foreach(InventoryCatalog inventoryCatalog in inventoryCatalogs)
{
Console.WriteLine(inventoryCatalog.Name);
Console.WriteLine(inventoryCatalog.Description);
// Accessing associated product catalogs foreach(string productCatalog in inventoryCatalog.AssociatedProductCatalogs)
{
Console.WriteLine(productCatalog);
}
}
// Accessing the InventoryCatalogs dataset
foreach(InventoryCatalogsDataSet.InventoryCatalog inventoryCatalog in inventoryCatalogs.DataSet.InventoryCatalogs)
{
Console.WriteLine(inventoryCatalog.InventoryCatalogName);
Console.WriteLine(inventoryCatalog.InventoryCatalogDescription); InventoryCatalog inventoryCatalogObject = inventoryContext.GetInventoryCatalog(inventoryCatalog.InventoryCatalogName);
// Accessing associated product catalogs
foreach (string productCatalog in inventoryCatalogObject.AssociatedProductCatalogs)
{
Console.WriteLine(productCatalog);
}
}
}
catch (ValidationException ex)
{
Console.WriteLine(ex.Message);
}
catch (CatalogDatabaseException ex)
{
Console.WriteLine(ex.Message);
}
}
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.