I've decided to repost several of my older Commerce Server 2007 posts after spending some time reviewing questions on the Commerce Server forums. Please note: I've edited the code in this post to better explain exactly how to return a user's catalogs in the site.

Question: "How Do I Return the User's Catalogs in the Commerce Server 2007 Site Code?"

Tip #1 – Return a User's Catalogs

Commerce Server 2007 brings many changes and improvements, especially in the "Catalog" subsystem. First and foremost, the "Catalog" subsystem now returns strongly-typed objects in many cases which greatly simplifies your site code.

The following code returns a strongly-typed "CatalogsDataSet" using the new CatalogSetsContext.GetCatalogs(CatalogSetId) method.


This example could obviously be extended to fall back to one of the two default CatalogSets (DefaultUserCatalogSet or AnonymousUserCatalogSet) as well and the new strongly-typed DataSet can be directly bound to any number of ASP.NET 2.0 server controls or to (my personal favorite) the ObjectDataSource as it's "Select" method.