コード例 #1
0
        // Token: 0x06000FD4 RID: 4052 RVA: 0x000629F4 File Offset: 0x00060BF4
        public override bool IsEqualsTo(OwaIdentity otherIdentity)
        {
            if (otherIdentity == null)
            {
                return(false);
            }
            OwaMiniRecipientIdentity owaMiniRecipientIdentity = otherIdentity as OwaMiniRecipientIdentity;

            if (owaMiniRecipientIdentity == null)
            {
                throw new OwaInvalidOperationException("Comparing OwaMiniRecipientIdentity with identities of another type is not supported");
            }
            return(owaMiniRecipientIdentity.ProxyAddress == this.proxyAddress);
        }
コード例 #2
0
ファイル: OwaIdentity.cs プロジェクト: YHZX2013/exchange_diff
        internal static OwaIdentity CreateOwaIdentityFromSmtpAddress(OwaIdentity logonIdentity, string smtpAddress, out ExchangePrincipal logonExchangePrincipal, out bool isExplicitLogon, out bool isAlternateMailbox)
        {
            OwaIdentity owaIdentity = null;

            isAlternateMailbox     = false;
            isExplicitLogon        = false;
            logonExchangePrincipal = null;
            try
            {
                logonExchangePrincipal = logonIdentity.CreateExchangePrincipal();
                Guid?alternateMailbox = OwaAlternateMailboxIdentity.GetAlternateMailbox(logonExchangePrincipal, smtpAddress);
                if (alternateMailbox != null)
                {
                    owaIdentity        = OwaAlternateMailboxIdentity.Create(logonIdentity, logonExchangePrincipal, alternateMailbox.Value);
                    isAlternateMailbox = true;
                    ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "The request is under alternate mailbox: {0}", smtpAddress);
                }
                else
                {
                    isExplicitLogon = true;
                }
            }
            catch (AdUserNotFoundException)
            {
                isExplicitLogon = true;
            }
            catch (UserHasNoMailboxException)
            {
                isExplicitLogon = true;
            }
            if (isExplicitLogon)
            {
                if (owaIdentity != null)
                {
                    owaIdentity.Dispose();
                    owaIdentity = null;
                }
                owaIdentity = OwaMiniRecipientIdentity.CreateFromProxyAddress(smtpAddress);
                ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "The request is under explicit logon: {0}", smtpAddress);
            }
            return(owaIdentity);
        }
コード例 #3
0
        private ExchangePrincipal GetExchangePrincipalFromWindowsIdentity(WindowsIdentity windowsIdentity, string smtpAddress)
        {
            OwaIdentity       owaIdentity  = OwaWindowsIdentity.CreateFromWindowsIdentity(windowsIdentity);
            OwaIdentity       owaIdentity2 = null;
            bool              flag         = false;
            bool              flag2        = false;
            ExchangePrincipal result;

            try
            {
                ExchangePrincipal exchangePrincipal = null;
                if (smtpAddress != null)
                {
                    owaIdentity2 = OwaIdentity.CreateOwaIdentityFromSmtpAddress(owaIdentity, smtpAddress, out exchangePrincipal, out flag, out flag2);
                }
                else
                {
                    owaIdentity2 = owaIdentity;
                }
                if (flag && owaIdentity2.IsPartial)
                {
                    OwaMiniRecipientIdentity owaMiniRecipientIdentity = owaIdentity2 as OwaMiniRecipientIdentity;
                    try
                    {
                        owaMiniRecipientIdentity.UpgradePartialIdentity();
                    }
                    catch (DataValidationException ex)
                    {
                        PropertyValidationError propertyValidationError = ex.Error as PropertyValidationError;
                        if (propertyValidationError == null || propertyValidationError.PropertyDefinition != MiniRecipientSchema.Languages)
                        {
                            return(null);
                        }
                        OWAMiniRecipient owaminiRecipient = owaIdentity2.FixCorruptOWAMiniRecipientCultureEntry();
                        if (owaminiRecipient != null)
                        {
                            owaIdentity2.Dispose();
                            owaIdentity2 = OwaMiniRecipientIdentity.CreateFromOWAMiniRecipient(owaminiRecipient);
                        }
                    }
                }
                if (owaIdentity == owaIdentity2 && exchangePrincipal != null)
                {
                    result = exchangePrincipal;
                }
                else
                {
                    try
                    {
                        result = owaIdentity2.InternalCreateExchangePrincipal();
                    }
                    catch (UserHasNoMailboxException)
                    {
                        result = null;
                    }
                }
            }
            finally
            {
                if (owaIdentity != owaIdentity2 && owaIdentity2 != null)
                {
                    owaIdentity2.Dispose();
                    owaIdentity2 = null;
                }
                if (owaIdentity != null)
                {
                    owaIdentity.Dispose();
                    owaIdentity = null;
                }
            }
            return(result);
        }