示例#1
0
        private static object DatabaseGetter(IPropertyBag propertyBag)
        {
            bool        flag;
            MservRecord record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Exo, out flag);

            if (record == null)
            {
                return(null);
            }
            string exoForestFqdn = record.ExoForestFqdn;

            if (!Fqdn.IsValidFqdn(exoForestFqdn))
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculatePropertyGeneric(MServRecipientSchema.Database.Name), MServRecipientSchema.Database, record));
            }
            Guid guid;

            try
            {
                guid = new Guid(record.ExoDatabaseId);
            }
            catch (Exception ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty(MServRecipientSchema.Database.Name, ex.Message), MServRecipientSchema.Database, record), ex);
            }
            return(new ADObjectId(guid, exoForestFqdn));
        }
示例#2
0
        private static MservRecord GetRecord(IPropertyBag propertyBag, MservValueFormat format, out bool isPrimary)
        {
            MServPropertyDefinition mservPropertyDefinition;
            MservRecord             record = MServRecipientSchema.GetRecord(propertyBag, format, false, out mservPropertyDefinition);

            isPrimary = (mservPropertyDefinition == MServRecipientSchema.MservPrimaryRecord);
            return(record);
        }
示例#3
0
 private static SetterDelegate MservFlagSetterDelegate(byte mask, ProviderPropertyDefinition propertyDefinition)
 {
     return(delegate(object value, IPropertyBag propertyBag)
     {
         MServRecipientSchema.UpdateRecordFlag((bool)value, mask, propertyBag, MServRecipientSchema.MservPrimaryRecord);
         MServRecipientSchema.UpdateRecordFlag((bool)value, mask, propertyBag, MServRecipientSchema.MservSecondaryRecord);
     });
 }
示例#4
0
        internal static object AliasGetter(IPropertyBag propertyBag)
        {
            bool flag = false;

            if (MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Exo, out flag) == null)
            {
                return(null);
            }
            return(MServRecipientSchema.NameGetter(propertyBag));
        }
示例#5
0
        internal static void PrimaryMailboxSourceSetter(object value, IPropertyBag propertyBag)
        {
            bool        flag;
            MservRecord record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Exo, out flag);
            bool        flag2;
            MservRecord record2 = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Hotmail, out flag2);

            if (record != null)
            {
                bool isEmpty = record.IsEmpty;
            }
            if (record2 != null)
            {
                bool isEmpty2 = record2.IsEmpty;
            }
            switch ((PrimaryMailboxSourceType)value)
            {
            case PrimaryMailboxSourceType.None:
                if ((flag && !record.IsEmpty) || (flag2 && !record2.IsEmpty))
                {
                    throw new DataValidationException(new PropertyValidationError(DirectoryStrings.MailboxPropertiesMustBeClearedFirst(flag ? record : record2), MServRecipientSchema.MservPrimaryRecord, flag ? record : record2));
                }
                return;

            case PrimaryMailboxSourceType.Hotmail:
                if (flag2)
                {
                    return;
                }
                if (flag)
                {
                    propertyBag[MServRecipientSchema.MservPrimaryRecord]   = record.GetUpdatedRecord(7);
                    propertyBag[MServRecipientSchema.MservSecondaryRecord] = record2.GetUpdatedRecord(0);
                    return;
                }
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotMakePrimary(record2, "Exo"), MServRecipientSchema.MservPrimaryRecord, record2));

            case PrimaryMailboxSourceType.Exo:
                if (flag)
                {
                    return;
                }
                if (flag2)
                {
                    propertyBag[MServRecipientSchema.MservPrimaryRecord]   = record2.GetUpdatedRecord(7);
                    propertyBag[MServRecipientSchema.MservSecondaryRecord] = record.GetUpdatedRecord(0);
                    return;
                }
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotMakePrimary(record, "Hotmail"), MServRecipientSchema.MservPrimaryRecord, record));

            default:
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.ExArgumentOutOfRangeException("PrimaryMailboxSource", value), MServRecipientSchema.PrimaryMailboxSource, value));
            }
        }
示例#6
0
        private static object SatchmoDGroupGetter(IPropertyBag propertyBag)
        {
            bool        flag;
            MservRecord record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Hotmail, out flag);

            if (record == null)
            {
                return(string.Empty);
            }
            return(record.HotmailDGroupId);
        }
示例#7
0
        internal static void SatchmoDGroupSetter(object value, IPropertyBag propertyBag)
        {
            MServPropertyDefinition propertyDefinition;
            MservRecord             record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Hotmail, true, out propertyDefinition);
            MservRecord             value2;

            if (record.HotmailClusterIp == null && value == null)
            {
                value2 = null;
            }
            else
            {
                value2 = record.GetUpdatedHotmailRecord(record.HotmailClusterIp, (string)value);
            }
            propertyBag[propertyDefinition] = value2;
        }
示例#8
0
        private static object RecipientDisplayTypeGetter(IPropertyBag propertyBag)
        {
            bool flag;

            MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Exo, out flag);
            if (flag)
            {
                return(Microsoft.Exchange.Data.Directory.Recipient.RecipientDisplayType.MailboxUser);
            }
            MservRecord record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Hotmail, out flag);

            if (flag && record.IsXmr)
            {
                return(Microsoft.Exchange.Data.Directory.Recipient.RecipientDisplayType.MailboxUser);
            }
            return(null);
        }
示例#9
0
        private static object SatchmoClusterIpGetter(IPropertyBag propertyBag)
        {
            bool        flag;
            MservRecord record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Hotmail, out flag);

            if (record == null || record.HotmailClusterIp == null)
            {
                return(null);
            }
            IPAddress result;

            if (!IPAddress.TryParse(record.HotmailClusterIp, out result))
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculatePropertyGeneric(MServRecipientSchema.SatchmoClusterIp.Name), MServRecipientSchema.SatchmoClusterIp, record));
            }
            return(result);
        }
示例#10
0
        internal static void DatabaseSetter(object value, IPropertyBag propertyBag)
        {
            MServPropertyDefinition propertyDefinition;
            MservRecord             record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Exo, true, out propertyDefinition);
            ADObjectId  adobjectId         = (ADObjectId)value;
            MservRecord value2;

            if (adobjectId == null)
            {
                value2 = null;
            }
            else
            {
                value2 = record.GetUpdatedExoRecord(adobjectId.PartitionFQDN, adobjectId.ObjectGuid.ToString());
            }
            propertyBag[propertyDefinition] = value2;
        }
示例#11
0
        private static MservRecord GetRecord(IPropertyBag propertyBag, MservValueFormat format, bool createIfMissing, out MServPropertyDefinition recordPropDef)
        {
            MservRecord mservRecord  = (MservRecord)propertyBag[MServRecipientSchema.MservPrimaryRecord];
            MservRecord mservRecord2 = (MservRecord)propertyBag[MServRecipientSchema.MservSecondaryRecord];

            if (mservRecord != null && mservRecord.ValueFormat == format)
            {
                recordPropDef = MServRecipientSchema.MservPrimaryRecord;
                return(mservRecord);
            }
            if (mservRecord2 != null && mservRecord2.ValueFormat == format)
            {
                recordPropDef = MServRecipientSchema.MservSecondaryRecord;
                return(mservRecord2);
            }
            if (!createIfMissing)
            {
                recordPropDef = null;
                return(null);
            }
            bool flag = mservRecord == null;

            if (mservRecord != null && mservRecord2 != null)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CrossRecordMismatch(mservRecord, mservRecord2), MServRecipientSchema.MservPrimaryRecord, mservRecord));
            }
            string puidKey    = MServRecipientSchema.GetPuidKey(propertyBag);
            byte   resourceId = flag ? 0 : 7;

            recordPropDef = (flag ? MServRecipientSchema.MservPrimaryRecord : MServRecipientSchema.MservSecondaryRecord);
            byte flags = 0;

            if (!flag)
            {
                flags = mservRecord.Flags;
            }
            MservRecord mservRecord3 = new MservRecord(puidKey, resourceId, null, null, flags);

            propertyBag[recordPropDef] = mservRecord3;
            return(mservRecord3);
        }
示例#12
0
        private static object PrimaryMailboxSourceGetter(IPropertyBag propertyBag)
        {
            bool flag;

            MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Exo, out flag);
            if (flag)
            {
                return(PrimaryMailboxSourceType.Exo);
            }
            MservRecord record = MServRecipientSchema.GetRecord(propertyBag, MservValueFormat.Hotmail, out flag);

            if (!flag)
            {
                return(PrimaryMailboxSourceType.None);
            }
            if (record.IsXmr)
            {
                return(PrimaryMailboxSourceType.Exo);
            }
            return(PrimaryMailboxSourceType.Hotmail);
        }
示例#13
0
        internal static void EmailAddressesSetter(object value, IPropertyBag propertyBag)
        {
            ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)value;

            if (proxyAddressCollection == null || proxyAddressCollection.WasCleared)
            {
                throw new MservOperationException(DirectoryStrings.NoResetOrAssignedMvp);
            }
            string puidKey = MServRecipientSchema.GetPuidKey(propertyBag);
            MultiValuedProperty <MservRecord> multiValuedProperty = (MultiValuedProperty <MservRecord>)propertyBag[MServRecipientSchema.MservEmailAddressesRecord];

            foreach (ProxyAddress proxyAddress in proxyAddressCollection.Added)
            {
                bool        flag        = true;
                MservRecord mservRecord = new MservRecord(proxyAddress.AddressString, 0, null, puidKey, 0);
                foreach (MservRecord record in multiValuedProperty.Added)
                {
                    if (mservRecord.SameRecord(record))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    multiValuedProperty.Add(mservRecord);
                }
            }
            foreach (ProxyAddress proxyAddress2 in proxyAddressCollection.Removed)
            {
                foreach (MservRecord mservRecord2 in multiValuedProperty.ToArray())
                {
                    if (proxyAddress2.AddressString.Equals(mservRecord2.Key, StringComparison.OrdinalIgnoreCase))
                    {
                        multiValuedProperty.Remove(mservRecord2);
                        break;
                    }
                }
            }
        }