Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        // Token: 0x06000EFF RID: 3839 RVA: 0x000484C4 File Offset: 0x000466C4
        private ADRawEntry ADRawEntryFromMservRecords(ulong puid, IList <MservRecord> mservRecords, IEnumerable <MServPropertyDefinition> properties, string originatingServerName, List <ValidationError> errors)
        {
            ADObjectId    adobjectIdFromPuid = ConsumerIdentityHelper.GetADObjectIdFromPuid(puid);
            ADPropertyBag adpropertyBag      = new ADPropertyBag(this.isReadOnly, 16);

            adpropertyBag.SetField(ADObjectSchema.Id, adobjectIdFromPuid);
            adpropertyBag.SetField(MServRecipientSchema.Puid, puid);
            foreach (MservRecord mservRecord in mservRecords)
            {
                object value = mservRecord;
                ProviderPropertyDefinition providerPropertyDefinition;
                switch (mservRecord.ResourceId)
                {
                case 0:
                    if (mservRecord.SourceKey == null)
                    {
                        providerPropertyDefinition = MServRecipientSchema.MservPrimaryRecord;
                    }
                    else
                    {
                        providerPropertyDefinition = MServRecipientSchema.MservEmailAddressesRecord;
                        value = new MultiValuedProperty <MservRecord>
                        {
                            mservRecord
                        };
                    }
                    break;

                case 1:
                    providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedPrimaryRecord;
                    break;

                case 2:
                case 3:
                case 5:
                case 6:
                    goto IL_D0;

                case 4:
                    providerPropertyDefinition = MServRecipientSchema.MservCalendarRecord;
                    break;

                case 7:
                    providerPropertyDefinition = MServRecipientSchema.MservSecondaryRecord;
                    break;

                case 8:
                    providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedCalendarRecord;
                    break;

                default:
                    goto IL_D0;
                }
                PropertyValidationError propertyValidationError = providerPropertyDefinition.ValidateValue(value, true);
                if (propertyValidationError != null)
                {
                    errors.Add(propertyValidationError);
                }
                adpropertyBag.SetField(providerPropertyDefinition, value);
                continue;
IL_D0:
                throw new NotSupportedException("Unexpected record received:" + mservRecord.ToString());
            }
            ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag);

            adrawEntry.OriginatingServer = originatingServerName;
            adrawEntry.WhenReadUTC       = new DateTime?(DateTime.UtcNow);
            adrawEntry.IsCached          = false;
            adrawEntry.ValidateRead(errors, properties);
            adrawEntry.ResetChangeTracking(true);
            return(adrawEntry);
        }