Udostępnij za pośrednictwem


CatalogImportOptions Class

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Specifies the set of options to use for a catalog import operation.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class CatalogImportOptions _
    Inherits ImportOptions
'Usage
Dim instance As CatalogImportOptions
[SerializableAttribute]
public class CatalogImportOptions : ImportOptions
[SerializableAttribute]
public ref class CatalogImportOptions : public ImportOptions
public class CatalogImportOptions extends ImportOptions

Remarks

Import a catalog using the specified options. The imported data is about the products in your Commerce Server catalog database, including dimensional information such as product name, description, color, and size.

During the import process, the Catalog Manager is performing an asynchronous import of the catalog, validating the XML file, and creating the catalog, or updating the existing data if the catalog is currently in your system. If you refresh the catalog before it is fully imported, you may see an incorrect structure in the Catalogs tree pane. The catalog structure will display correctly after the import is complete.

Examples

// Create a CatalogImportOptions object and set properties on it
CatalogImportOptions catalogImportOptions = new CatalogImportOptions();
catalogImportOptions.Operation = ImportOperation.ValidateAndImport;
/*  Setting additional import options
 * Set the CSV list of catalogs to import
 catalogImportOptions.CatalogsToImport = "Catalgo1,Catalog2";
 catalogImportOptions.PropertiesToImport = "ListPrice";
*/
// The ImportXml returns an  ImportProgress object
// Use the Status property to determine the current status
ImportProgress importProgress = this.catalogContext.ImportXml(catalogImportOptions, fileName);
while (importProgress.Status == CatalogOperationsStatus.InProgress)
{
  System.Threading.Thread.Sleep(3000);
  // Call the refresh method to refresh the current status
  importProgress.Refresh();
}
Console.WriteLine(importProgress.EndDate);
// If the import operation failed
if (importProgress.Status == CatalogOperationsStatus.Failed ||
  importProgress.Status == CatalogOperationsStatus.CompletedWithErrors)
{
  // Use the Errors property to get the errors that occurred during import
  foreach (CatalogError error in importProgress.Errors)
  {
    Console.WriteLine(error.LineNumber);
    Console.WriteLine(error.Message);
  }
}

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer.Catalog..::.ImportOptions
    Microsoft.CommerceServer.Catalog..::.CatalogImportOptions

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

CatalogImportOptions Members

Microsoft.CommerceServer.Catalog Namespace

Other Resources

Importing Catalog Data by Using the Catalog API

Import Options

How to Import From an XML File

How to Import Selected Fields

Exporting Catalog Data by Using the Catalog API

Export Options

How to Export to an XML File

How to Export Selected Fields