public void ImportFile() { if (String.IsNullOrEmpty(Filename)) { Context.Output.WriteLine(T("Invalid file path")); return; } if (!File.Exists(Filename)) { Context.Output.WriteLine(T("File not found.")); return; } // Impersonate the Site owner. ImpersonateSuperUser(); // Read config file if specified. var configurationDocument = ReadImportConfigurationFile(ConfigFilename); // Configure any steps based on the configuration. _importExportService.ConfigureImportActions(new ConfigureImportActionsContext(configurationDocument)); // Import the file. _importExportService.Import(File.ReadAllText(Filename)); Context.Output.WriteLine(T("Import running...")); }