public void ImportXML(CommerceServer.Core.Catalog.CatalogImportOptions options, System.IO.Stream xmlStream) { CatalogSiteAgent catalogSiteAgent = new CatalogSiteAgent(); catalogSiteAgent.SiteName = Configuration.CSSiteName; CatalogContext context = CatalogContext.Create(catalogSiteAgent); ImportProgress importProgress = context.ImportXml(options, xmlStream); try { while (importProgress.Status == CatalogOperationsStatus.InProgress) { System.Threading.Thread.Sleep(3000); importProgress.Refresh(); } } catch (Exception ex) { StringBuilder errors = new StringBuilder(); errors.AppendLine("CatalogInternalRepositoryImpl_ImportXML:"); if (importProgress != null && importProgress.Errors != null && importProgress.Errors.Count > 0) { foreach (CatalogError e in importProgress.Errors) { errors.AppendLine(String.Format("Line: {0} - Message: {1}", e.LineNumber, e.Message)); } } Exception newException = new Exception(errors.ToString(), ex); throw newException; } }