Share via


GetAssociatedInventoryCatalog Method

Returns an instance of the InventoryCatalog object for the specified product catalog.

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

Syntax

'Declaration
Public Function GetAssociatedInventoryCatalog ( _
    productCatalogName As String _
) As InventoryCatalog
'Usage
Dim instance As InventoryContext
Dim productCatalogName As String
Dim returnValue As InventoryCatalog

returnValue = instance.GetAssociatedInventoryCatalog(productCatalogName)
public InventoryCatalog GetAssociatedInventoryCatalog(
    string productCatalogName
)
public:
InventoryCatalog^ GetAssociatedInventoryCatalog(
    String^ productCatalogName
)
public function GetAssociatedInventoryCatalog(
    productCatalogName : String
) : InventoryCatalog

Parameters

Return Value

Type: Microsoft.CommerceServer.Inventory..::.InventoryCatalog
Returns an instance of the InventoryCatalog object for the specified product catalog.

Remarks

You can use this method to return the InventoryCatalog object for the product catalog in the catalog system. An EntityDoesNotExistException will be thrown if the product catalog does not exist in the catalog system or the product catalog is not mapped.

The productCatalogName 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 associated with a product catalog and access its properties.

public void GetAssociatedInventoryCatalog()
{
  try
  {
    InventoryCatalog inventoryCatalog = inventoryContext.GetAssociatedInventoryCatalog("product catalog name");
    Console.WriteLine(inventoryCatalog.Name);
    Console.WriteLine(inventoryCatalog.Description);
    // Accessing associated product catalogs
    foreach (string productCatalog in inventoryCatalog.AssociatedProductCatalogs)
    {
      Console.WriteLine(productCatalog);
    }
  }
  catch (ValidationException ex)
  {
    Console.WriteLine(ex.Message);
  }
  catch (EntityDoesNotExistException ex)
  {
    Console.WriteLine(ex.Message);
  }
  catch (CatalogDatabaseException ex)
  {
    Console.WriteLine(ex.Message);
  }
} 

Permissions

See Also

Reference

InventoryContext Class

InventoryContext Members

Microsoft.CommerceServer.Inventory Namespace