Microsoft KB Archive/296210

From BetaArchive Wiki

Article ID: 296210

Article Last Modified on 10/26/2007



APPLIES TO

  • Microsoft Commerce Server 2000 Standard Edition



This article was previously published under Q296210

SUMMARY

Commerce Server 2000 Service Pack 1 (SP1) introduces several Catalog Component Object Model (COM) method modifications. This article provides supplemental reference documentation about programming with the Microsoft Catalog COM objects, its methods, and some sample codes.

This article is divided into the following sections:

For additional information about how to obtain the latest Commerce Server 2000 service pack, click the article number below to view the article in the Microsoft Knowledge Base:

297216 How to Obtain the Latest Commerce Server 2000 Service Pack


MORE INFORMATION

The CatalogManager.DeltaExportXML and ProductCatalog.Purge methods are new to Commerce Server 2000 SP1. The CatalogManager.ExportXML and CatalogManager.ImportXML methods have been modified to accommodate the new Extensible Markup Language (XML) file formats.

CatalogManager.DeltaExportXML

Use this method to export catalog data to an XML file from the timestamp that is specified. This new method is introduced in Commerce 2000 SP1.

Definition

DeltaExportXML([in] VARIANT vrXML, 
               [in] VARIANT vrTimeStamp, 
               [in, optional] VARIANT strCatalogsToExport,
               [in, defaultvalue(0)] VARIANT_BOOL fRunSynchronously,
               [in, defaultvalue(cscFmtElementCentric)] CatalogXMLFmtEnum eXMLFmt);
                

Parameters

  • vrXML: A Variant string that contains the path and file name of the XML file to be created.
  • vrTimeStamp: A Variant datetime that specifies that any changes to the catalog since this date/time should be written to the XML file. This can also be a string. An error is returned, and the export fails if conversion to Date Format is not possible.
  • strCatalogsToExport: An optional Variant string that contains the catalogs to export. See the "Remarks" section for more information.
  • fRunSynchronously: An optional Variant Boolean that specifies whether the method should be run synchronously.
    • A value of True indicates that the method does not return until the export is completed.
    • A value of False indicates that the method returns immediately after spawning the export thread. The default value is False.
  • eXMLFmt: An optional value from the CatalogXMLFmtEnum enumeration that specifies the output format.

    Legal values are as follows:

    • cscFmtElementCentric = 0
    • cscFmtAttributeCentric = 1
    • cscFmtXDR = 2


    The default value is cscFmtElementCentric. See the "Remarks" section for more information.

Remarks

If the strCatalogsToExport parameter is not specified, export only those catalogs that have changed since the timestamp. The strCatalogsToExport parameter is a comma-separated list of catalog names to be exported.

The following list includes the legal values for the eXMLFmt parameter and describes their effect:

  • cscFmtElementCentric = 0 Outputs version 1.0 of the Commerce Server Catalog XML Format. This is the default value and the version that is produced by Commerce Server 2000.


  • cscFmtAttributeCentric = 1 Outputs version 1.5 of the Commerce Server Catalog XML Format. This is produced by Commerce Server 2000 Service Pack 1.


  • cscFmtXDR = 2 Outputs the version 1.5 XML Data Reduced (XDR) specification for the current catalog schema. This XDR file can be used with BizTalk Mapper to create new maps.


If the fRunSynchronously parameter is set to False, and no other import or export operations are in progress (ExportCSV, ExportXML, ImportCSV, or ImportXML), this method begins the export operation asynchronously in a separate thread and returns successfully.

Any errors that occurred while exporting the catalog are logged to the Windows NT Event log. To view the Windows NT Event Log, on the Windows Start menu, point to Programs, point to Administrative Tools, and then click Event Viewer.

ProductCatalog.Purge

When a product, category, or variant is deleted, it is moved to a shadow table. The ProductCatalog.Purge method cleans up the entries in this shadow table. This new method is introduced in Commerce Server 2000 SP1.

Definition

Purge();
                

CatalogManager.ExportXML

Use this method to export catalog data to an XML file. This is similar to the above-mentioned DeltaExportXML method, except there is no TimeStamp parameter. This method has been modified to accommodate different XML formats.

Definition

ExportXML([in] VARIANT vrXML, 
          [in, optional] VARIANT strCatalogsToExport,
          [in, defaultvalue(0)] VARIANT_BOOL fRunSynchronously,
          [in, defaultvalue(cscFmtElementCentric)] CatalogXMLFmtEnum eXMLFmt);
                

Parameters

  • vrXML: A Variant string that contains the path and file name of the XML file to be created.
  • strCatalogsToExport: An optional Variant string that contains the catalogs to export. The default behavior is to export all catalogs. See the "Remarks" section for more information.
  • fRunSynchronously: An optional Variant Boolean that specifies whether the method should be run synchronously.
    • A value of True indicates that the method does not return until the export is completed.
    • A value of False indicates that the method returns immediately after spawning the export thread. The default value is False.
  • eXMLFmt: An optional value from the CatalogXMLFmtEnum enumeration that specifies the output format.

    Legal values are as follows:

    • cscFmtElementCentric = 0
    • cscFmtAttributeCentric = 1
    • cscFmtXDR = 2


    The default value is cscFmtElementCentric. See the "Remarks" section for more information.

Remarks

If the strCatalogsToExport parameter is missing or contains an empty string, all catalogs are exported. Otherwise, the strCatalogsToExport parameter is a comma-separated list of catalog names to be exported.

The following list includes the legal values for the eXMLFmt parameter and describes their effect:

  • cscFmtElementCentric = 0 Outputs version 1.0 of the Commerce Server Catalog XML Format. This is the default value and the version that is produced by Commerce Server 2000.


  • cscFmtAttributeCentric = 1 Outputs version 1.5 of the Commerce Server Catalog XML Format. This is produced by Commerce Server 2000 Service Pack 1.


  • cscFmtXDR = 2 Outputs the version 1.5 XML Data Reduced (XDR) specification for the current catalog schema. This XDR file can be used with BizTalk Mapper to create new maps.


If the fRunSynchronously parameter is set to False, and no other import or export operations are in progress (ExportCSV, ExportXML, ImportCSV, or ImportXML), this method begins the export operation asynchronously in a separate thread and returns successfully.

Any errors that occurred while exporting the catalog are logged to the Windows NT Event log. To view the Windows NT Event log, use the Windows Event Viewer.

CatalogManager.ImportXML

Although the CatalogManager.ImportXML method has not changed, it can now recognize Element Centric and Attribute Centric.

Definition

ImportXML([in] VARIANT vrXML,
          [in, defaultvalue(0)] VARIANT_BOOL fUpdateOnly,
          [in, defaultvalue(0)] VARIANT_BOOL fRunSynchronously);
                

Parameters

  • vrXML: A Variant string that contains the path and file name of the XML file to be created.
  • fUpdateOnly: A Boolean that specifies whether to update an existing catalog or create a new one.
    • A value of True indicates that if the system contains a catalog whose name is the same as the one that is specified in the strCatalogName parameter, the catalog is updated with the imported data.
    • A value of False indicates that the system deletes the catalog if it already exists and creates a new one with the imported data.
  • fRunSynchronously: An optional Variant Boolean that specifies whether the method should be run synchronously.
    • A value of True indicates that the method does not return until the export is completed.
    • A value of False indicates that the method returns immediately after spawning the export thread. The default value is False.

New Support of Catalog XML Schema

New XML Formats

Catalog can now recognize Element Centric, Attribute Centric, and XML Data Reduced Format (XDR) formats.

Importing Deleted Product

You can export a catalog including deleted products. If you import this XML into an existing catalog, that item is deleted from the catalog on import.

For more information about the new XML schema that is introduced in Commerce Server 2000 SP1, refer to the new CatalogXMLSchema.XML in the Commerce folder.

Sample Code

cscFmtElementCentric = 0
cscFmtAttributeCentric = 1
cscFmtXDR = 2
fRunSynchronously = True
TimeStamp = "1/1/1975"

Set oCatMan = CreateObject("Commerce.CatalogManager")

call oCatMan.Initialize("Provider=SQLOLEDB;User ID=sa;Initial 
Catalog=Ret_Commerce;Data Source=ari5", true)

call oCatMan.DeltaExportXML("DeltaExportElementCentric.xml", TimeStamp ,, 
fRunSynchronously , cscFmtElementCentric)

call oCatMan.DeltaExportXML("DeltaExportAttributeCentric.xml", TimeStamp ,, 
fRunSynchronously , cscFmtAttributeCentric)

call oCatMan.DeltaExportXML("DeltaExportXDRFormat.xml", TimeStamp ,, 
fRunSynchronously , cscFmtXDR)

Set oCatMan = Nothing
                

Keywords: kbproductlink kbhowto KB296210