예제 #1
0
        ADRawEntry IDirectorySession.ReadADRawEntry(ADObjectId entryId, IEnumerable <PropertyDefinition> properties)
        {
            ADRawEntry adrawEntry = new ADRawEntry();

            adrawEntry.SetId(entryId);
            return(adrawEntry);
        }
예제 #2
0
        protected DatabaseCopy SaveDBCopy()
        {
            TaskLogger.LogEnter();
            DatabaseCopy databaseCopy = null;

            if (this.preExistingDatabase != null)
            {
                foreach (DatabaseCopy databaseCopy2 in this.preExistingDatabase.InvalidDatabaseCopies)
                {
                    if (databaseCopy2.Name.Equals(this.OwnerServer.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        databaseCopy = databaseCopy2;
                        break;
                    }
                }
            }
            DatabaseCopy databaseCopy3 = databaseCopy ?? new DatabaseCopy();

            databaseCopy3.HostServer = (ADObjectId)this.OwnerServer.Identity;
            if (databaseCopy == null)
            {
                databaseCopy3.ActivationPreference = 1;
            }
            else
            {
                databaseCopy3.ActivationPreference = databaseCopy3.ActivationPreference;
            }
            ADRawEntry  adrawEntry = databaseCopy3;
            TDataObject dataObject = this.DataObject;

            adrawEntry.SetId(dataObject.Id.GetChildId(this.OwnerServer.Name));
            databaseCopy3.ParentObjectClass = ((this.DatabaseType == NewDatabaseTask <TDataObject> .ExchangeDatabaseType.Public) ? PublicFolderDatabase.MostDerivedClass : MailboxDatabase.MostDerivedClass);
            TDataObject dataObject2 = this.DataObject;
            ActivationPreferenceSetter <DatabaseCopy> activationPreferenceSetter = new ActivationPreferenceSetter <DatabaseCopy>(dataObject2.AllDatabaseCopies, databaseCopy3, (databaseCopy == null) ? EntryAction.Insert : EntryAction.Modify);
            UpdateResult updateResult = activationPreferenceSetter.UpdateCachedValues();

            if (updateResult == UpdateResult.AllChanged)
            {
                activationPreferenceSetter.SaveAllUpdatedValues(base.DataSession);
            }
            base.DataSession.Save(databaseCopy3);
            this.forcedReplicationSites = DagTaskHelper.DetermineRemoteSites(base.GlobalConfigSession, databaseCopy3.OriginatingServer, this.OwnerServer);
            if (this.forcedReplicationSites != null)
            {
                ITopologyConfigurationSession session = (ITopologyConfigurationSession)base.DataSession;
                TDataObject dataObject3    = this.DataObject;
                string      objectIdentity = dataObject3.Identity.ToString();
                if (DagTaskHelper.ForceReplication(session, this.DataObject, this.forcedReplicationSites, objectIdentity, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)))
                {
                    DagTaskHelper.ForceReplication(session, databaseCopy3, this.forcedReplicationSites, objectIdentity, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                }
            }
            TaskLogger.LogExit();
            return(databaseCopy3);
        }
예제 #3
0
        private static bool PopulateConsumerMailboxProperties(ADRawEntry user, ulong puid, IEnumerable <ADPropertyDefinition> propertiesToSet, PropertyBag propertyValuesBag, bool setMbxPropertyDefinition = false)
        {
            bool result = false;

            if (!setMbxPropertyDefinition)
            {
                user.SetId(ConsumerIdentityHelper.GetADObjectIdFromPuid(puid));
            }
            foreach (ADPropertyDefinition adpropertyDefinition in propertiesToSet)
            {
                if (propertyValuesBag.IsModified(adpropertyDefinition))
                {
                    if (adpropertyDefinition.IsMultivalued)
                    {
                        MultiValuedPropertyBase multiValuedPropertyBase  = setMbxPropertyDefinition ? ((MultiValuedPropertyBase)user[adpropertyDefinition.MbxPropertyDefinition]) : ((MultiValuedPropertyBase)user[adpropertyDefinition]);
                        MultiValuedPropertyBase multiValuedPropertyBase2 = (MultiValuedPropertyBase)propertyValuesBag[adpropertyDefinition];
                        foreach (object item in multiValuedPropertyBase2.Added)
                        {
                            multiValuedPropertyBase.Add(item);
                        }
                        foreach (object item2 in multiValuedPropertyBase2.Removed)
                        {
                            multiValuedPropertyBase.Remove(item2);
                        }
                    }
                    else if (setMbxPropertyDefinition)
                    {
                        user[adpropertyDefinition.MbxPropertyDefinition] = propertyValuesBag[adpropertyDefinition];
                    }
                    else
                    {
                        user[adpropertyDefinition] = propertyValuesBag[adpropertyDefinition];
                    }
                    result = true;
                }
            }
            return(result);
        }
예제 #4
0
        public static ADRawEntry PerformADLookup(ADObjectId identity, List <ADPropertyDefinition> properties)
        {
            ADUser        aduser        = (ADUser)TemplateTenantConfiguration.GetLocalTempateUser().Clone();
            ADPropertyBag adpropertyBag = new ADPropertyBag();

            foreach (ADPropertyDefinition adpropertyDefinition in properties)
            {
                adpropertyBag.SetField(adpropertyDefinition, aduser[adpropertyDefinition]);
                if (adpropertyDefinition.IsCalculated)
                {
                    foreach (ProviderPropertyDefinition providerPropertyDefinition in adpropertyDefinition.SupportingProperties)
                    {
                        ADPropertyDefinition adpropertyDefinition2 = (ADPropertyDefinition)providerPropertyDefinition;
                        adpropertyBag.SetField(adpropertyDefinition2, aduser[adpropertyDefinition2]);
                    }
                }
            }
            ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag);

            adrawEntry.SetId(identity);
            adrawEntry.ValidateRead();
            adrawEntry.ResetChangeTracking(true);
            return(adrawEntry);
        }