ImportOperation Enumeration
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
Specifies the catalog import validation mode.
Namespace: Microsoft.CommerceServer.Catalog
Assembly: Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)
Syntax
'Declaration
Public Enumeration ImportOperation
'Usage
Dim instance As ImportOperation
public enum ImportOperation
public enum class ImportOperation
public enum ImportOperation
Members
Member name | Description | |
---|---|---|
Import | Validate data as the file is imported. | |
Validate | Validate the XML file but do not import data. | |
ValidateAndImport | Validate the XML file and import data only if the file is valid. |
Remarks
If you select ValidateAndImport, the file is first validated, any errors are recorded, and the file is imported. The import operation does not start if the errors reach the error threshold.
The type of validation mode for the import operation.
Enumeration values are:
Import - Validate data as the file is imported.
Validate - Validate the XML file but do not import data.
ValidateAndImport - Validate the XML file and import data only if the file is valid.
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);
}
}
}