ICatalogManager3::ExportCSV Method [C++]
Use this method to export catalog data to a comma-separated values (CSV) format file.
Definition
[C++]
HRESULT ICatalogManager3::ExportCSV(BSTRstrCSVDestination,
BSTRstrCatalogToExportVARIANT_BOOLfRunSynchronouslyBSTRstrLang,
);
[Visual Basic]
Sub ExportCSV(strCSVDestination As String,
strCatalogToExport As StringfRunSynchronously As BooleanOptional strLang As String,
)
Parameters
- strCSVDestination[C++]
[in] A BSTR that contains the full path and file name of the export file to be created. - strCSVDestination[Visual Basic]
A String that contains the full path and file name of the export file to be created. - strCatalogToExport[C++]
[in] A BSTR that contains the name of the catalog to export. - strCatalogToExport[Visual Basic]
A String that contains the name of the catalog to export. - fRunSynchronously [C++]
[in, defaultvalue (0)] A VARIANT_BOOL that specifies whether the method should be run synchronously. A value of True indicates that the method will not return until the export is completed. A value of False indicates that the method will return immediately after spawning the export thread. - fRunSynchronously [Visual Basic]
A Boolean that specifies whether the method should be run synchronously. A value of True indicates that the method will not return until the export is completed. A value of False indicates that the method will return immediately after spawning the export thread. The default value is False. - strLang[C++]
[in, optional, defaultvalue ("")] A BSTR that contains the culture name. The culture name follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>" where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. Some culture names have prefixes that specify the script; for example, "Cy" specifies the Cyrillic script, and "Lt" specifies the Latin script. For more information, see . Table of Language Culture Names, Culture Codes, and ISO Values. - strLang[Visual Basic]
A String that that contains the culture name. The culture name follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>" where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. Some culture names have prefixes that specify the script; for example, "Cy" specifies the Cyrillic script, and "Lt" specifies the Latin script. For more information, see . Table of Language Culture Names, Culture Codes, and ISO Values.
Return Values
[C++] This method returns an HRESULT indicating whether it completed successfully.
[Visual Basic] None.
Error Values
[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.
[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.
The following table shows the custom COM errors that this method can return.
Name | Value | Description |
---|---|---|
E_CAT_CATMGR_NOT_INITIALIZED | [C++] 0x889800B [Visual Basic] &H8898005 |
The CatalogManager object has not been initialized. The CatalogManager object should be initialized before calling this method. |
E_CAT_INVALID_CATALOGNAME | [C++] 0x8898006 [Visual Basic] &H8898003 |
The Catalog Name you specified is invalid. Catalog names cannot be blank |
E_CAT_INVALID_CATALOG_NAME_LENGTH | [C++] 0x8898004 [Visual Basic] &H8898002 |
The Catalog name you specified exceeds the maximum limit of 85 characters. |
E_CAT_CHARACTER_NOT_ALLOWED | [C++] 0x8898003 [Visual Basic] &H889800D |
The catalog name you specified has one of the nine reserved characters " [ ] , ' ( )#. which should not be used. |
E_CAT_INVALID_LANGUAGE | [C++] 0x8898009 [Visual Basic] &H889800E |
The value you specified for the Language parameter is either empty or exceeds the maximum length of 10 characters. |
E_CAT_FILE_CREATION_FAILED | [C++] 0x8898001 [Visual Basic] &H8898008 |
The Catalog Export operation was unable to create the file you specified. Check that the file name you specified is valid and the directory that you specified exists and is not read-only. |
E_CAT_IMPORT_IN_PROGRESS | [C++] 0x8898002 [Visual Basic] &H8898005 |
This operation cannot be started because an import operation is currently in progress. |
[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.
[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.
Remarks
The ExportCSV method can be used to output product data from the Product Catalog System in a format that can be used in other programs, such as Microsoft Excel.
This method can only output product data from one catalog at a time.
The CSV file generated only contains products and product families. The categories, relationships, and hierarchy are not written to the CSV file.
If the strLang parameter is not specified then the default system language of the Web server will be used for multilingual properties.
This method runs in a separate thread. Prior to spawning the thread, it checks that there is not an existing ImportCSV or ImportXML method in progress. After the new thread is spawned, this method returns immediately, if the parameter fRunSynchronously is False, with no errors. Any errors that occurred while importing the catalog are logged to the Windows NT Event Log. Use the Windows Event Viewer to view the Windows NT Event Log.
If there is a temporary loss of the SQL Server connection, longer than two minutes, an import or export will be stopped. Other methods should work after the interruption.
Caution
- If you call this method from Visual Basic Scripting Edition (VBScript) with the fRunSynchronously parameter set to False, VBScript will unload the object as soon as the script ends. If the script ends before the spawned thread finishes exporting the catalog, it will be terminated prematurely and the catalog will not be exported successfully.
- Changes made to the catalog while an export is in progress may or may not be reflected in the output file. Additions and deletions made during the export could result in a corrupt file. Changes should be avoided during an export.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.
[Visual Basic]
Example
myCatalogManager.ExportCSV "c:\exports\ourcatalog.csv", "OurStore"
See Also
[Visual Basic]CatalogManager Object
[C++]ICatalogManager3::ExportXML
[Visual Basic]CatalogManager.ExportXML
[C++]ICatalogManager3::ImportCSV
[Visual Basic]CatalogManager.ImportCSV
Copyright © 2005 Microsoft Corporation.
All rights reserved.