다음을 통해 공유


ImportOptions 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 MustInherit Class ImportOptions
'Usage
Dim instance As ImportOptions
[SerializableAttribute]
public abstract class ImportOptions
[SerializableAttribute]
public ref class ImportOptions abstract
public abstract class ImportOptions

Remarks

Provides properties for retrieving and setting options for performing an inventory import operation. An abstract class. The following classes derive from this class:

Examples

internal void ImportXml(string fileName)
{
  // 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
    Microsoft.CommerceServer.Catalog..::.XmlImportOptions
    Microsoft.CommerceServer.Inventory..::.InventoryImportOptions

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

ImportOptions 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