Partager via


How to Get a Catalog

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

To browse a catalog you must first get the catalog. To do this, use one of the GetCatalog methods on the CatalogContext object. You can specify the language in which the data is returned by using the language parameter. Alternatively, you can get the catalog and then use the ActiveLanguage property to specify the language.

To get a catalog

  1. Use the GetCatalog method on the CatalogContext object to get the specified catalog.

  2. Use the ActiveLanguage property to specify the language for the catalog.

  3. Alternatively, use the GetCatalog method on the CatalogContext object to get the specified catalog in the language specified by the language parameter.

Example

This example gets the catalog specified by the parameter catalogName. The data in the catalog is returned in English, as specified by the language parameter.

private static void GetCatalog(CatalogContext context, string catalogName)
{
    // Get the catalog with the name specified in catalogName. 
    // Return the catalog data in English, as specified by "en-US");
    ProductCatalog productCatalog = (ProductCatalog)context.GetCatalog(catalogName, "en-US");
    Console.WriteLine(productCatalog.Name); 
}

See Also

Other Resources

Managing Products and Categories by Using the Catalog API