Exemplo n.º 1
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession recipientSession = (IRecipientSession)base.CreateSession();

            if (this.Disconnect.IsPresent || base.ForReconciliation.IsPresent)
            {
                recipientSession = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(recipientSession, null);
            }
            return(recipientSession);
        }
Exemplo n.º 2
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession recipientSession = (IRecipientSession)base.CreateSession();

            if (this.SoftDeletedMailUser.IsPresent)
            {
                recipientSession = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(recipientSession, null);
            }
            return(recipientSession);
        }
        protected override IEnumerable <ADRawEntry> GetPagedData()
        {
            if (this.Cookie == null)
            {
                DeletedRecipient item = new DeletedRecipient();
                return(new List <ADRawEntry>
                {
                    item
                });
            }
            PropertyDefinition[] properties = new PropertyDefinition[]
            {
                ADObjectSchema.Id,
                ADObjectSchema.Name,
                ADObjectSchema.DistinguishedName,
                ADObjectSchema.Guid,
                ADObjectSchema.OrganizationalUnitRoot,
                ADObjectSchema.ObjectClass,
                ADObjectSchema.WhenChanged,
                ADObjectSchema.WhenChangedUTC,
                ADObjectSchema.WhenCreated,
                ADObjectSchema.WhenCreatedUTC
            };
            if (this.requireTwoQueries)
            {
                IRecipientSession sessionForSoftDeletedObjects = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(base.CurrentOrganizationId, this.DomainController);
                ADObjectId        childId     = base.CurrentOrganizationId.OrganizationalUnit.GetChildId("OU", "Soft Deleted Objects");
                QueryFilter       queryFilter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.IsSoftDeletedByRemove, true);
                queryFilter = new AndFilter(new QueryFilter[]
                {
                    queryFilter,
                    SyncTaskHelper.GetDeltaFilter(this.inputCookie)
                });
                this.reader2        = sessionForSoftDeletedObjects.FindPagedADRawEntry(childId, QueryScope.OneLevel, queryFilter, null, this.PageSize, properties);
                this.reader2.Cookie = this.inputCookie.PageCookie2;
                base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(sessionForSoftDeletedObjects, typeof(ADRawEntry), queryFilter, null, false));
            }
            IRecipientSession recipientSession        = (IRecipientSession)base.DataSession;
            ADObjectId        deletedObjectsContainer = ADSession.GetDeletedObjectsContainer(recipientSession.GetDomainNamingContext());
            QueryFilter       internalFilter          = this.InternalFilter;

            recipientSession.SessionSettings.SkipCheckVirtualIndex = true;
            ADPagedReader <ADRawEntry> adpagedReader = recipientSession.FindPagedADRawEntry(deletedObjectsContainer, QueryScope.OneLevel, internalFilter, null, this.PageSize, properties);

            adpagedReader.IncludeDeletedObjects = true;
            adpagedReader.Cookie = this.inputCookie.PageCookie;
            base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(base.DataSession, typeof(ADRawEntry), this.InternalFilter, null, false));
            return(adpagedReader);
        }
Exemplo n.º 4
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession recipientSession = (IRecipientSession)base.CreateSession();
            ADObjectId        rootId           = recipientSession.SearchRoot;

            if (this.SoftDeletedMailUser.IsPresent && base.CurrentOrganizationId != null && base.CurrentOrganizationId.OrganizationalUnit != null)
            {
                rootId = new ADObjectId("OU=Soft Deleted Objects," + base.CurrentOrganizationId.OrganizationalUnit.DistinguishedName);
            }
            if (this.SoftDeletedMailUser.IsPresent)
            {
                recipientSession = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(recipientSession, rootId);
            }
            return(recipientSession);
        }
Exemplo n.º 5
0
        internal static ADUser GetSoftDeletedADUser(OrganizationId organizationId, RecipientIdParameter identity, Task.ErrorLoggerDelegate errorLogger)
        {
            IRecipientSession    sessionForSoftDeletedObjects = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(organizationId, null);
            IEnumerable <ADUser> enumerable = identity.GetObjects <ADUser>(organizationId.OrganizationalUnit, sessionForSoftDeletedObjects) ?? new List <ADUser>();
            ADUser result;

            using (IEnumerator <ADUser> enumerator = enumerable.GetEnumerator())
            {
                if (!enumerator.MoveNext())
                {
                    errorLogger(new RecipientTaskException(Strings.ErrorMailboxNotFound(identity.ToString())), ExchangeErrorCategory.Client, null);
                }
                result = enumerator.Current;
                if (enumerator.MoveNext())
                {
                    errorLogger(new RecipientTaskException(Strings.ErrorMailboxNotUnique(identity.ToString())), ExchangeErrorCategory.Client, null);
                }
            }
            return(result);
        }
Exemplo n.º 6
0
        protected override IConfigDataProvider CreateSession()
        {
            IRecipientSession recipientSession = (IRecipientSession)base.CreateSession();
            ADObjectId        rootId           = recipientSession.SearchRoot;

            if (this.SoftDeletedMailUser.IsPresent && base.CurrentOrganizationId != null && base.CurrentOrganizationId.OrganizationalUnit != null)
            {
                rootId = new ADObjectId("OU=Soft Deleted Objects," + base.CurrentOrganizationId.OrganizationalUnit.DistinguishedName);
            }
            if (this.SoftDeletedMailUser.IsPresent)
            {
                recipientSession = SoftDeletedTaskHelper.GetSessionForSoftDeletedObjects(recipientSession, rootId);
            }
            if (base.ParameterSetName == "CookieSet")
            {
                recipientSession.UseGlobalCatalog = true;
                this.inputCookie = SyncTaskHelper.ResolveSyncCookie(this.Cookie, recipientSession, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            return(recipientSession);
        }