Jaa


GetInventoryCatalog Method

Returns an InventoryCatalog object containing information about the inventory catalog.

Namespace:  Microsoft.CommerceServer.Inventory
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public Function GetInventoryCatalog ( _
    catalogName As String _
) As InventoryCatalog
'Usage
Dim instance As InventoryContext
Dim catalogName As String
Dim returnValue As InventoryCatalog

returnValue = instance.GetInventoryCatalog(catalogName)
public InventoryCatalog GetInventoryCatalog(
    string catalogName
)
public:
InventoryCatalog^ GetInventoryCatalog(
    String^ catalogName
)
public function GetInventoryCatalog(
    catalogName : String
) : InventoryCatalog

Parameters

Return Value

Type: Microsoft.CommerceServer.Inventory..::.InventoryCatalog
An InventoryCatalog object containing information about the inventory catalog.

Remarks

If successful this method will return an instance of the InventoryCatalog object. You can the use the InventoryCatalog object to create, edit, retrieve and delete inventory information for the SKUs in the inventory catalog. The catalogName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 85 characters.

  • Not contain the .,"[]'()# characters.

Examples

This example demonstrates how to get an inventory catalog and access its properties.

public InventoryCatalog GetInventoryCatalog()
{
  InventoryCatalog inventoryCatalog = null;
  try
  {
    inventoryCatalog = inventoryContext.CreateInventoryCatalog("name of the inventory catalog");
    // Different ways of accessing the name and description of the inventoryCatalog
    Console.WriteLine(inventoryCatalog.Name);
    Console.WriteLine(inventoryCatalog.Description);
    Console.WriteLine(inventoryCatalog.LastModified);
    Console.WriteLine(inventoryCatalog[InventoryCatalogsDataSetSchema.InventoryCatalogName]);
    Console.WriteLine(inventoryCatalog[InventoryCatalogsDataSetSchema.InventoryCatalogDescription]);
    Console.WriteLine(inventoryCatalog.Information.InventoryCatalogs[0].InventoryCatalogName);
    Console.WriteLine(inventoryCatalog.Information.InventoryCatalogs[0].InventoryCatalogDescription);
    // To access custom properties on the inventory catalog use the
    // indexer. Assuming VendorId is a custom property added to the
    // inventory catalog, the value of the VendorId property can be
    // accessed as follows
    Console.WriteLine(inventoryCatalog["VendorId"]);
    Console.WriteLine(inventoryCatalog.Information.InventoryCatalogs[0]["VendorId"]);
    foreach( string productCatalog in inventoryCatalog.AssociatedProductCatalogs)
    {
      Console.WriteLine(productCatalog);
    }
  }
  catch (ValidationException ex)
  {
    Console.WriteLine(ex.Message);
  }
  catch (CatalogDatabaseException ex)
  {
    Console.WriteLine(ex.Message);
  }
  catch (EntityDoesNotExistException ex)
  {
    // ex.EntityId will contain the name of the inventory catalog
    Console.WriteLine(ex.Message);
  }
return inventoryCatalog;
}

Permissions

See Also

Reference

InventoryContext Class

InventoryContext Members

Microsoft.CommerceServer.Inventory Namespace