示例#1
0
        public void Execute(ExportFileContext context, CancellationToken token)
        {
            var directoryInfo = new DirectoryInfo(context.DirectoryOut);

            if (!directoryInfo.Exists)
            {
                throw new DirectoryNotFoundException();
            }

            var exporter = ExportParserFactory.GetParser(context, logger);

            using (logger.NestLog(context.FileType))
            {
                var results = exporter.Export(token);

                if (token.IsCancellationRequested)
                {
                    token.ThrowIfCancellationRequested();
                }

                if (results == null || !results.Any())
                {
                    return;
                }

                logger.DebugFormat("Identified {0} \"{1}\" files(s) to export.", results.Length, context.FileType);
                var handler = ExportHandlerFactory.GetHandler(context, logger);

                HandleDuplicateLdcTradingPartners(results);
                foreach (var result in results)
                {
                    if (result.HeaderCount == 0)
                    {
                        continue;
                    }

                    if (token.IsCancellationRequested)
                    {
                        token.ThrowIfCancellationRequested();
                    }

                    ExportResult(context, result, handler);
                }
            }
        }
 public MailboxSearchTask(ITargetMailbox targetMailbox, ServerToServerCallingContextFactory callingContextFactory, string executingUserPrimarySmtpAddress, OrganizationId orgId, bool isDocIdHintFlightingEnabled) : this(targetMailbox, ExportHandlerFactory.CreateExportHandler(new MailboxSearchTask.MailboxSearchTracer(), targetMailbox, new ExchangeServiceClientFactory(callingContextFactory ?? new ServerToServerCallingContextFactory(null))), executingUserPrimarySmtpAddress, orgId, isDocIdHintFlightingEnabled)
 {
 }