Exemple #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));
        }
Exemple #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);
        }
Exemple #3
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));
        }
Exemple #4
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));
            }
        }
Exemple #5
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);
        }
Exemple #6
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;
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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;
        }
Exemple #10
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);
        }