Monday, November 2, 2009

Commerce Server 2007 - Fetch Product Catalog

Hi Fellows,

Been quiet a while since I blogged last. These days am understanding nuts and bolts of another Microsoft Product i.e. Microsoft Commerce Server 2007/2009 and how they sync with Microsoft SharePoint Server 2009. Watch out for my up-coming blogs on Commerce Server.

Just to give you guys a Sneak Peak of what I have done so far, take a look at the code below which gets you Product Catalog Object by using Catalog System API's:

[CODE]
internal static ProductCatalog GetCSCatalog(String SiteName, String AuthorizationPolicyPath, String CatalogName)
{

try
{
//Accessing the site agent of a hypotheticla site BuyOnline
CatalogSiteAgent catalogSiteAgent = new CatalogSiteAgent();
catalogSiteAgent.SiteName = SiteName;

//Here its assumed that the context under which the method runs
// is already added in the AZMAN for the catalog web service
catalogSiteAgent.AuthorizationMode = AuthorizationMode.ThreadContext;
catalogSiteAgent.AuthorizationPolicyPath = AuthorizationPolicyPath;

//Inventory subsytem being ignored
catalogSiteAgent.IgnoreInventorySystem = true;

//configure the caching parameters
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.CacheEnabled = true;

//Get the catalog context for the current site
CatalogContext catalogContext =
CatalogContext.Create(catalogSiteAgent, cacheConfiguration);

ProductCatalog cd = catalogContext.GetCatalog(CatalogName);

return cd;
}
catch (Exception ex)
{
throw (ex);
}
}
[/CODE]

3 comments:

Richard said...

Thanks, was trying to do just that. :) Is this the common way to retrieve the local Commerce Server product catalog from a console app?

SharePoint Consulting said...

I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.

Salvage Cars said...

This is really a great post, I haven't visited your website yet before but today I got it from search engine. Hope you hold good technical knowledge. Thanks for share.