Rebuilding Catalogs

Commerce Server 2002

When a product is added to a catalog, you can write code to rebuild a specific virtual catalog or rebuild all of the virtual catalogs.

Warning  If you use the Business Desk Rebuild Catalog function to rebuild the catalogs in a single Commerce Server site, tables are re-created in SQL Server causing it to loose permissions that you need to make your site run (on the ASP.NET account).

The following code sample shows how to rebuild a specific virtual catalog.

Set oCatMan = CreateObject("Commerce.CatalogManager")
VirtualCatalogName = "Catalogname"
call oCatMan.Initialize("sitename", false)
Set oProdCatalog = oCatMan.GetCatalog(VirtualCatalogName)
oProdCatalog.RebuildVirtualCatalog true, true

The following code sample shows how to rebuild all the virtual catalogs.

Set oCatMan = CreateObject("Commerce.CatalogManager")
call oCatMan.Initialize("sitename", false)
oCatMan.RebuildAllVirtualCatalogs true, true

After the above is performed, you can then execute the ctlg_GrantPermissions_AllCatalogObjects procedure using ADO to grant the permissions on the tables and views.

Copyright © 2005 Microsoft Corporation.
All rights reserved.