Ejemplo n.º 1
0
        public static void InitializeTests(TestContext d)
        {
            context       = new TestExportContext();
            teamsToDelete = new List <string>();

            teamExportProvider = new TeamExportProvider();
            teamExportProvider.Initialize(context);
        }
 public void Initialize(IExportContext context)
 {
     this.context    = context;
     this.token      = context.Token;
     this.betaClient = ((GraphConnectionContext)context.ConnectionContext).BetaClient;
     this.client     = ((GraphConnectionContext)context.ConnectionContext).Client;
     this.userFilter = ((GraphConnectionContext)context.ConnectionContext).UserFilter;
 }
Ejemplo n.º 3
0
 private void Initialize(string primarySmtpAddress, string legacyDN, IExportContext exportContext)
 {
     this.PrimarySmtpAddress      = primarySmtpAddress;
     this.LegacyDistinguishedName = legacyDN;
     this.ExportContext           = exportContext;
     if (this.ExportContext != null)
     {
         if (!this.ExportContext.IsResume)
         {
             this.DeleteWorkingFolders();
         }
         this.CreateWorkingFolderIfNotExist();
     }
     this.StatusMailRecipients = new string[0];
 }
Ejemplo n.º 4
0
 public MailboxWriter(IExportContext exportContext, ITargetMailbox targetMailbox, IProgressController progressController, TargetFolderProvider <string, BaseFolderType, ITargetMailbox> targetFolderProvider)
 {
     Util.ThrowIfNull(exportContext, "exportContext");
     Util.ThrowIfNull(targetMailbox, "targetMailbox");
     Util.ThrowIfNull(progressController, "progressController");
     this.includeDuplicates  = exportContext.ExportMetadata.IncludeDuplicates;
     this.targetMailbox      = targetMailbox;
     this.progressController = progressController;
     this.timer = new Stopwatch();
     this.targetFolderProvider = targetFolderProvider;
     if (this.targetFolderProvider == null)
     {
         this.targetFolderProvider = new MailboxTargetFolderProvider(exportContext, this.targetMailbox);
     }
 }
        public ExportResultInfo ExportToExcel(ICellInfo targetCell, IExportContext context)
        {
            var value = targetCell.Value as string;

            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }
            var byteArray         = Convert.FromBase64String(value.Substring(context.ExportImageContext.BASE64STRINGHEAD.Length));
            var bitmapImageSource = context.GetPictureByByteArray(byteArray, context.PictureSize.Width, context.PictureSize.Height);

            return(new ExportResultInfo()
            {
                ExportValue = null,
                ExportPicture = bitmapImageSource
            });
        }
Ejemplo n.º 6
0
 internal static bool IncludeUnsearchableItems(IExportContext exportContext)
 {
     if (exportContext == null || exportContext.ExportMetadata == null)
     {
         throw new ArgumentException("exportContext.ExportMetadata should not be null.");
     }
     if (exportContext.ExportMetadata.IncludeUnsearchableItems)
     {
         if (exportContext.Sources == null || exportContext.Sources.Count == 0)
         {
             return(exportContext.ExportMetadata.IncludeUnsearchableItems);
         }
         string pattern      = string.Format("(^$|^{0}$|^received[><]=\\\".+\\\"$|^\\(received>=\\\".+\\\" AND received<=\\\".+\\\"\\)$)", Util.EmptyQueryReplacement);
         Regex  regex        = new Regex(pattern);
         string sourceFilter = exportContext.Sources[0].SourceFilter;
         if (regex.IsMatch(sourceFilter))
         {
             return(false);
         }
     }
     return(exportContext.ExportMetadata.IncludeUnsearchableItems);
 }
Ejemplo n.º 7
0
        internal static ITargetMailbox CreateTargetMailbox(IRecipientSession recipientSession, MailboxDiscoverySearch searchObject, IExportContext exportContext)
        {
            Util.ThrowIfNull(recipientSession, "recipientSession");
            Util.ThrowIfNull(searchObject, "searchObject");
            Util.ThrowIfNull(exportContext, "exportContext");
            ADSessionSettings sessionSettings = recipientSession.SessionSettings;
            string            target          = searchObject.Target;

            Util.ThrowIfNull(sessionSettings, "adSessionSettings");
            Util.ThrowIfNullOrEmpty(target, "targetLegacyDn");
            ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromLegacyDN(sessionSettings, target, RemotingOptions.AllowCrossSite);

            if (exchangePrincipal == null || string.IsNullOrEmpty(exchangePrincipal.MailboxInfo.Location.ServerFqdn))
            {
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFoundId(target));
            }
            return(new TargetMailbox(exchangePrincipal.MailboxInfo.OrganizationId, exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString(), target, BackEndLocator.GetBackEndWebServicesUrl(exchangePrincipal.MailboxInfo), exportContext)
            {
                StatusMailRecipients = Util.GetStatusMailRecipients(searchObject, recipientSession)
            });
        }
Ejemplo n.º 8
0
 public MailboxSearchTask(IEwsClient ewsClient, string keywordStatisticsQuery, MultiValuedProperty <string> userKeywords, IRecipientSession recipientSession, IExportContext exportContext, string executingUserPrimarySmtpAddress, int previewMaxMailboxes, OrganizationId orgId) : this(ewsClient, keywordStatisticsQuery, userKeywords, recipientSession, exportContext, executingUserPrimarySmtpAddress, previewMaxMailboxes, false, null, orgId)
 {
 }
Ejemplo n.º 9
0
 public TargetMailbox(OrganizationId orgId, string primarySmtpAddress, string legacyDN, IEwsClient ewsClient, IExportContext exportContext)
 {
     Util.ThrowIfNullOrEmpty(primarySmtpAddress, "primarySmtpAddress");
     Util.ThrowIfNullOrEmpty(legacyDN, "legacyDN");
     Util.ThrowIfNull(ewsClient, "ewsClient");
     Util.ThrowIfNull(exportContext, "exportContext");
     this.organizationId = orgId;
     this.ewsClient      = ewsClient;
     this.targetLocation = exportContext.TargetLocation;
     this.Initialize(primarySmtpAddress, legacyDN, exportContext);
 }
Ejemplo n.º 10
0
 internal ExportContextWrapper(IExportContext exportContext)
 {
     this.ExportMetadataInternal = new ProgressController.ExportMetadataWrapper(exportContext.ExportMetadata);
     this.ExportContextInternal  = exportContext;
 }
Ejemplo n.º 11
0
 public PstTarget(IExportContext exportContext)
 {
     this.ExportContext = exportContext;
 }
Ejemplo n.º 12
0
 public TargetMailbox(OrganizationId orgId, string primarySmtpAddress, string legacyDN, Uri serviceEndpoint, IExportContext exportContext) : this(orgId, primarySmtpAddress, legacyDN, new EwsClient(serviceEndpoint, new ServerToServerEwsCallingContext(null)), exportContext)
 {
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 使用指定的导出上下文初始化控件
 /// </summary>
 /// <param name="context"></param>
 public virtual void Initialize(IExportContext context)
 {
     this.ExportContext = context;
 }
Ejemplo n.º 14
0
 public MailboxSearchTask(IEwsClient ewsClient, string keywordStatisticsQuery, MultiValuedProperty <string> userKeywords, IRecipientSession recipientSession, IExportContext exportContext, string executingUserPrimarySmtpAddress, int previewMaxMailboxes, bool isPFSearchFlightingEnabled, MailboxDiscoverySearch searchObject, OrganizationId orgId)
 {
     Util.ThrowIfNull(ewsClient, "ewsClient");
     Util.ThrowIfNull(exportContext, "exportContext");
     this.isStatisticsOnlySearch = true;
     this.keywordStatisticsQuery = keywordStatisticsQuery;
     this.CurrentState           = SearchState.NotStarted;
     this.Errors = new List <string>(1);
     this.executingUserPrimarySmtpAddress = executingUserPrimarySmtpAddress;
     this.ewsClient           = ewsClient;
     this.ExportContext       = exportContext;
     this.previewMaxMailboxes = previewMaxMailboxes;
     this.InitializeUserKeywordsMapping(keywordStatisticsQuery, userKeywords, recipientSession);
     this.isPFSearchFlightingEnabled = isPFSearchFlightingEnabled;
     this.searchObject = searchObject;
     this.orgId        = orgId;
 }
Ejemplo n.º 15
0
 public MailboxWriter(IExportContext exportContext, ITargetMailbox targetMailbox, IProgressController progressController) : this(exportContext, targetMailbox, progressController, null)
 {
 }
Ejemplo n.º 16
0
 public static IExportHandler CreateExportHandler(IExportContext exportContext, ITracer tracer)
 {
     return(ExportHandlerFactory.CreateExportHandler(exportContext, tracer, new ExchangeServiceClientFactory(new UserServiceCallingContextFactory(null))));
 }
Ejemplo n.º 17
0
        internal static IExportHandler CreateExportHandler(IExportContext exportContext, ITracer tracer, IServiceClientFactory serviceClientFactory)
        {
            if (exportContext == null)
            {
                throw new ArgumentNullException("exportContext");
            }
            if (exportContext.Sources == null || exportContext.Sources.Count == 0)
            {
                throw new ArgumentNullException("exportContext.Sources");
            }
            for (int i = 0; i < exportContext.Sources.Count; i++)
            {
                ISource source = exportContext.Sources[i];
                if (source == null)
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}]", new object[]
                    {
                        i
                    }));
                }
                if (string.IsNullOrEmpty(source.Name))
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}].Name", new object[]
                    {
                        i
                    }));
                }
                if (string.IsNullOrEmpty(source.Id))
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}].Id", new object[]
                    {
                        i
                    }));
                }
                if (string.IsNullOrEmpty(source.SourceFilter))
                {
                    throw new ArgumentNullException(string.Format(CultureInfo.CurrentCulture, "exportContext.Source[{0}].SourceFilter", new object[]
                    {
                        i
                    }));
                }
            }
            if (exportContext.ExportMetadata == null)
            {
                throw new ArgumentNullException("exportContext.ExportMetadata");
            }
            if (string.IsNullOrEmpty(exportContext.ExportMetadata.ExportName))
            {
                throw new ArgumentNullException("exportContext.ExportMetadata.ExportName");
            }
            if (exportContext.ExportMetadata.ExportStartTime == default(DateTime))
            {
                throw new ArgumentNullException("exportContext.ExportMetadata.ExportStartTime");
            }
            if (exportContext.TargetLocation == null)
            {
                throw new ArgumentNullException("exportContext.TargetLocation");
            }
            PstTarget pstTarget = new PstTarget(exportContext);

            pstTarget.CheckLocation();
            return(ExportHandlerFactory.CreateExportHandler(tracer, pstTarget, serviceClientFactory));
        }