Exemplo n.º 1
0
        public static MailboxId Parse(string input)
        {
            if (string.IsNullOrEmpty(input))
            {
                throw new FormatException(Strings.ExceptionFormatNotSupported);
            }
            Guid guid;
            Guid guid2;

            if (73 == input.Length && '\\' == input[36] && GuidHelper.TryParseGuid(input.Substring(0, 36), out guid) && GuidHelper.TryParseGuid(input.Substring(37, 36), out guid2))
            {
                return(new MailboxId(new DatabaseId(guid), guid2));
            }
            if (GuidHelper.TryParseGuid(input, out guid2))
            {
                return(new MailboxId(null, guid2));
            }
            MailboxId result;

            try
            {
                result = new MailboxId((byte[])new MapiEntryId(input));
            }
            catch (FormatException)
            {
                result = new MailboxId(input);
            }
            return(result);
        }
 public void SyncMailboxWithDS(MailboxId mailboxId)
 {
     this.CheckRequirementsOnMailboxIdToContinue(mailboxId);
     base.InvokeWithWrappedException(delegate()
     {
         this.Administration.SyncMailboxWithDS(mailboxId.MailboxDatabaseId.Guid, mailboxId.MailboxGuid);
     }, Strings.ExceptionFailedToLetStorePickupMailboxChange(mailboxId.MailboxGuid.ToString(), mailboxId.MailboxDatabaseId.Guid.ToString()), mailboxId);
 }
 public void DeleteMailbox(MailboxId mailboxId)
 {
     this.CheckRequirementsOnMailboxIdToContinue(mailboxId);
     base.InvokeWithWrappedException(delegate()
     {
         this.Administration.DeletePrivateMailbox(mailboxId.MailboxDatabaseId.Guid, mailboxId.MailboxGuid, 2);
     }, Strings.ExceptionDeleteMailbox(mailboxId.MailboxDatabaseId.Guid.ToString(), mailboxId.MailboxGuid.ToString()), mailboxId);
 }
        public RawSecurityDescriptor GetMailboxSecurityDescriptor(MailboxId mailboxId)
        {
            this.CheckRequirementsOnMailboxIdToContinue(mailboxId);
            RawSecurityDescriptor returnValue = null;

            base.InvokeWithWrappedException(delegate()
            {
                returnValue = this.Administration.GetMailboxSecurityDescriptor(mailboxId.MailboxDatabaseId.Guid, mailboxId.MailboxGuid);
            }, Strings.ExceptionGetMailboxSecurityDescriptor(mailboxId.MailboxDatabaseId.Guid.ToString(), mailboxId.MailboxGuid.ToString()), mailboxId);
            return(returnValue);
        }
 private void CheckRequirementsOnMailboxIdToContinue(MailboxId mailboxId)
 {
     if (null == mailboxId)
     {
         throw new ArgumentNullException("mailboxId");
     }
     if (null == mailboxId.MailboxDatabaseId || Guid.Empty == mailboxId.MailboxDatabaseId.Guid || Guid.Empty == mailboxId.MailboxGuid)
     {
         throw new ArgumentException(Strings.ExceptionIdentityInvalid);
     }
 }
 public void SetMailboxSecurityDescriptor(MailboxId mailboxId, RawSecurityDescriptor rawSecurityDescriptor)
 {
     this.CheckRequirementsOnMailboxIdToContinue(mailboxId);
     if (rawSecurityDescriptor == null)
     {
         throw new ArgumentNullException("rawSecurityDescriptor");
     }
     base.InvokeWithWrappedException(delegate()
     {
         this.Administration.SetMailboxSecurityDescriptor(mailboxId.MailboxDatabaseId.Guid, mailboxId.MailboxGuid, rawSecurityDescriptor);
     }, Strings.ExceptionSetMailboxSecurityDescriptor(mailboxId.MailboxDatabaseId.Guid.ToString(), mailboxId.MailboxGuid.ToString()), mailboxId);
 }
Exemplo n.º 7
0
 private void AnalyzeMailboxLogonFailedAndThrow(MailboxId mailboxId, Exception innerException)
 {
     if (null == mailboxId)
     {
         throw new ArgumentNullException("mailboxId");
     }
     if (null != mailboxId.MailboxDatabaseId)
     {
         throw new MailboxLogonFailedException(Strings.MailboxLogonFailedInDatabaseExceptionError(mailboxId.MailboxGuid.ToString(), this.GetDatabaseIdentityString(mailboxId.MailboxDatabaseId), this.ServerName), innerException);
     }
     if (string.IsNullOrEmpty(mailboxId.MailboxExchangeLegacyDn))
     {
         throw new MailboxLogonFailedException(Strings.MailboxLogonFailedExceptionError(mailboxId.ToString(), this.ServerName), innerException);
     }
     throw new MailboxLogonFailedException(Strings.MailboxLogonFailedExceptionError(mailboxId.MailboxExchangeLegacyDn, this.ServerName), innerException);
 }
Exemplo n.º 8
0
        public override bool Equals(MapiObjectId other)
        {
            bool result = false;

            if (this.mailboxGuid != Guid.Empty)
            {
                MailboxId mailboxId = other as MailboxId;
                if (mailboxId != null)
                {
                    result = this.MailboxGuid.Equals(mailboxId.MailboxGuid);
                }
            }
            else
            {
                result = base.Equals(other);
            }
            return(result);
        }
 public void ForceStoreToRefreshMailbox(MailboxId mailboxId)
 {
     this.CheckRequirementsOnMailboxIdToContinue(mailboxId);
     MapiSession.ErrorTranslatorDelegate translateError = delegate(ref LocalizedString message, Exception e)
     {
         return(new FailedToRefreshMailboxException(e.Message, mailboxId.ToString(), e));
     };
     base.InvokeWithWrappedException(delegate()
     {
         int num = 0;
         while (3 > num)
         {
             try
             {
                 this.Administration.ClearAbsentInDsFlagOnMailbox(mailboxId.MailboxDatabaseId.Guid, mailboxId.MailboxGuid);
                 this.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid);
                 break;
             }
             catch (MapiExceptionNoAccess)
             {
                 if (2 <= num)
                 {
                     throw;
                 }
                 this.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid);
             }
             catch (MapiExceptionNotFound)
             {
                 if (2 <= num)
                 {
                     throw;
                 }
                 this.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid);
             }
             catch (MapiExceptionUnknownMailbox)
             {
                 this.Administration.PurgeCachedMailboxObject(mailboxId.MailboxGuid);
                 break;
             }
             num++;
         }
     }, LocalizedString.Empty, null, translateError);
 }
Exemplo n.º 10
0
 internal MailboxEntry(MailboxId mapiObjectId, MapiSession mapiSession) : base(mapiObjectId, mapiSession)
 {
 }
Exemplo n.º 11
0
 internal MailboxStatistics(MailboxId mapiObjectId, MapiSession mapiSession) : base(mapiObjectId, mapiSession)
 {
 }