CatalogManager3.ExportCSV Method (PIA)
Use this method to export catalog data to a comma-separated values (CSV) format file.
Definition
[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Sub ExportCSV(strCSVDestination As String,
strCatalogToExport As StringOptionalfRunSynchronously As Boolean,
Optional strLang As String)
[C#]
using Microsoft.CommerceServer.Interop.Catalog;
…
public void ExportCSV(stringstrCSVDestination,
stringstrCatalogToExportboolfRunSynchronously,
string strLang);
Parameters
[Visual Basic .NET]
- strCSVDestination
A String that contains the full path and file name of the export file to be created. - strCatalogToExport
A String that contains the name of the catalog to export. - fRunSynchronously
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
A String that contains the ISO 639+1 language identifier.
[C#]
- strCSVDestination
A string that contains the full path and file name of the export file to be created. - strCatalogToExport
A string that contains the name of the catalog to export. - fRunSynchronously
A 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. - strLang
A string that contains the ISO 639+1 language identifier.
Exceptions
This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.
The following table shows the custom COM errors that a COMException can wrap.
Name | Value | Description |
---|---|---|
E_CAT_CATMGR_NOT_INITIALIZED | [C#] 0x889800B [Visual Basic .NET] &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 .NET] &H8898003 |
The Catalog Name you specified is invalid. Catalog names cannot be blank |
E_CAT_INVALID_CATALOG_NAME_LENGTH | [C#] 0x8898004 [Visual Basic .NET] &H8898002 |
The Catalog name you specified exceeds the maximum limit of 85 characters. |
E_CAT_CHARACTER_NOT_ALLOWED | [C#] 0x8898003 [Visual Basic .NET] &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 .NET] &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 .NET] &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 .NET] &H8898005 |
This operation cannot be started because an import operation is currently in progress. |
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 output product data from only one catalog at a time.
The comma-separated values (CSV) file generated only contains products. The categories, relationships, and hierarchy are not written to the CSV file.
This method runs in a separate thread. Prior to spawning the thread, it checks that there is not an existing ExportCSV, ExportXML, ImportCSV or ImportXML method in progress. Once the new thread is spawned, this method returns immediately, if 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 aborted. Other methods should work after the interruption.
Caution
- 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.
[Visual Basic .NET]
Example
myCatalogManager.ExportCSV("c:\exports\ourcatalog.csv", "OurStore")
Requirements
Namespace: Microsoft.CommerceServer.Interop.Catalog
Platforms: Windows 2000, Windows Server 2003
Assembly: cataloglib (in cataloglib.dll)
See Also
CatalogManager3.ImportCSV
Copyright © 2005 Microsoft Corporation.
All rights reserved.