Exemplo n.º 1
0
 private void ValidateIsPrimaryOrArchive(MailboxLocationType locationType)
 {
     if (locationType != MailboxLocationType.Primary && locationType != MailboxLocationType.MainArchive)
     {
         throw new ADOperationException(DirectoryStrings.ExArgumentException("locationType", MailboxLocationType.Primary + ", " + MailboxLocationType.MainArchive));
     }
 }
Exemplo n.º 2
0
 private IMailboxLocationInfo GetPrimaryOrArchiveMailboxInfo(MailboxLocationType locationType)
 {
     this.ValidateIsPrimaryOrArchive(locationType);
     if (this.propertyBag != null)
     {
         if (locationType == MailboxLocationType.Primary)
         {
             if (this.propertyBag[IADMailStorageSchema.ExchangeGuid] != null && !((Guid)this.propertyBag[IADMailStorageSchema.ExchangeGuid]).Equals(Guid.Empty))
             {
                 return(new MailboxLocationInfo((Guid)this.propertyBag[IADMailStorageSchema.ExchangeGuid], (ADObjectId)this.propertyBag[IADMailStorageSchema.Database], MailboxLocationType.Primary));
             }
         }
         else if (this.propertyBag[IADMailStorageSchema.ArchiveGuid] != null && !((Guid)this.propertyBag[IADMailStorageSchema.ArchiveGuid]).Equals(Guid.Empty))
         {
             return(new MailboxLocationInfo((Guid)this.propertyBag[IADMailStorageSchema.ArchiveGuid], (ADObjectId)ADRecipient.ArchiveDatabaseGetter(this.propertyBag), MailboxLocationType.MainArchive));
         }
     }
     else
     {
         foreach (IMailboxLocationInfo mailboxLocationInfo in this.newArchiveAndExchangeInfo)
         {
             if (mailboxLocationInfo.MailboxLocationType == locationType)
             {
                 return(mailboxLocationInfo);
             }
         }
     }
     return(null);
 }
 // Token: 0x06001D08 RID: 7432 RVA: 0x00078A14 File Offset: 0x00076C14
 public MailboxLocationInfo(Guid mailboxGuid, ADObjectId databaseLocation, MailboxLocationType mailboxLocationType)
 {
     MailboxLocationInfo.ValidateMailboxInfo(mailboxGuid, databaseLocation);
     this.MailboxGuid         = mailboxGuid;
     this.databaseLocation    = ((databaseLocation != null) ? new ADObjectId(databaseLocation.ObjectGuid, databaseLocation.PartitionFQDN) : null);
     this.MailboxLocationType = mailboxLocationType;
     this.infoToString        = null;
 }
Exemplo n.º 4
0
        public IMailboxLocationInfo GetMailboxLocation(MailboxLocationType mailboxLocationType)
        {
            if (MailboxLocationCollection.NonSingletonMailboxLocationType.Contains(mailboxLocationType))
            {
                throw new MailboxLocationException(DirectoryStrings.ErrorNonUniqueMailboxGetMailboxLocation(mailboxLocationType.ToString()));
            }
            if (this.mailboxTypeCount[(int)mailboxLocationType] == 0)
            {
                return(null);
            }
            IList <IMailboxLocationInfo> mailboxLocations = this.GetMailboxLocations(mailboxLocationType);

            if (mailboxLocations.Count != 0)
            {
                return(mailboxLocations[0]);
            }
            return(null);
        }
Exemplo n.º 5
0
        public IList <IMailboxLocationInfo> GetMailboxLocations(MailboxLocationType mailboxLocationType)
        {
            IList <IMailboxLocationInfo> list = new List <IMailboxLocationInfo>();

            if (mailboxLocationType == MailboxLocationType.Primary || mailboxLocationType == MailboxLocationType.MainArchive)
            {
                IMailboxLocationInfo primaryOrArchiveMailboxInfo = this.GetPrimaryOrArchiveMailboxInfo(mailboxLocationType);
                if (primaryOrArchiveMailboxInfo != null)
                {
                    list.Add(primaryOrArchiveMailboxInfo);
                }
            }
            else
            {
                foreach (IMailboxLocationInfo mailboxLocationInfo in this.mailboxInfo.Values)
                {
                    if (mailboxLocationInfo.MailboxLocationType == mailboxLocationType)
                    {
                        list.Add(mailboxLocationInfo);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 6
0
 private void RemovePrimaryOrArchiveMailboxInfo(MailboxLocationType mailboxLocationType)
 {
     this.ValidateIsPrimaryOrArchive(mailboxLocationType);
     if (this.propertyBag == null)
     {
         for (int i = 0; i < this.newArchiveAndExchangeInfo.Count; i++)
         {
             if (this.newArchiveAndExchangeInfo[i].MailboxLocationType == mailboxLocationType)
             {
                 this.newArchiveAndExchangeInfo.RemoveAt(i);
                 return;
             }
         }
         return;
     }
     if (mailboxLocationType == MailboxLocationType.Primary)
     {
         this.propertyBag[IADMailStorageSchema.ExchangeGuid] = null;
         this.propertyBag[IADMailStorageSchema.Database]     = null;
         return;
     }
     this.propertyBag[IADMailStorageSchema.ArchiveGuid] = null;
     ADRecipient.ArchiveDatabaseSetter(null, this.propertyBag);
 }
Exemplo n.º 7
0
        public void AddMailboxLocation(Guid mailboxGuid, ADObjectId databaseLocation, MailboxLocationType mailboxLocationType)
        {
            IMailboxLocationInfo mailboxLocation = new MailboxLocationInfo(mailboxGuid, databaseLocation, mailboxLocationType);

            this.AddMailboxLocation(mailboxLocation);
        }