Example #1
0
        internal static IList <RecipientData> CreateFakeRecipientQueryResult(string address)
        {
            Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress emailAddress = new Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress(string.Empty, address);
            Dictionary <PropertyDefinition, object> propertyMap = new Dictionary <PropertyDefinition, object>
            {
                {
                    ADRecipientSchema.RecipientType,
                    RecipientType.MailContact
                },
                {
                    ADRecipientSchema.PrimarySmtpAddress,
                    new SmtpAddress(address)
                },
                {
                    ADRecipientSchema.ExternalEmailAddress,
                    new SmtpProxyAddress(address, true)
                }
            };
            RecipientData item = RecipientData.Create(emailAddress, propertyMap);

            return(new List <RecipientData>
            {
                item
            });
        }
Example #2
0
        private static MailTips ParseWebServiceMailTips(MailTips webServiceMailTips)
        {
            Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress emailAddress = new Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress(string.Empty, webServiceMailTips.RecipientAddress.EmailAddress, webServiceMailTips.RecipientAddress.RoutingType);
            MailTips mailTips = new MailTips(emailAddress);

            if (webServiceMailTips.CustomMailTip != null)
            {
                mailTips.CustomMailTip = webServiceMailTips.CustomMailTip;
            }
            if (webServiceMailTips.DeliveryRestrictedSpecified)
            {
                mailTips.DeliveryRestricted = webServiceMailTips.DeliveryRestricted;
            }
            if (webServiceMailTips.ExternalMemberCountSpecified)
            {
                mailTips.ExternalMemberCount = webServiceMailTips.ExternalMemberCount;
            }
            if (webServiceMailTips.InvalidRecipientSpecified)
            {
                mailTips.InvalidRecipient = webServiceMailTips.InvalidRecipient;
            }
            if (webServiceMailTips.ScopeSpecified)
            {
                mailTips.Scope = (ScopeTypes)webServiceMailTips.Scope;
            }
            if (webServiceMailTips.IsModeratedSpecified)
            {
                mailTips.IsModerated = webServiceMailTips.IsModerated;
            }
            if (webServiceMailTips.MailboxFullSpecified)
            {
                mailTips.MailboxFull = webServiceMailTips.MailboxFull;
            }
            if (webServiceMailTips.MaxMessageSizeSpecified)
            {
                mailTips.MaxMessageSize = webServiceMailTips.MaxMessageSize;
            }
            if (webServiceMailTips.OutOfOffice != null && webServiceMailTips.OutOfOffice.ReplyBody != null)
            {
                mailTips.OutOfOfficeMessage         = webServiceMailTips.OutOfOffice.ReplyBody.Message;
                mailTips.OutOfOfficeMessageLanguage = webServiceMailTips.OutOfOffice.ReplyBody.Lang;
                mailTips.OutOfOfficeDuration        = webServiceMailTips.OutOfOffice.Duration;
            }
            if (webServiceMailTips.MailboxFullSpecified)
            {
                mailTips.MailboxFull = webServiceMailTips.MailboxFull;
            }
            if (webServiceMailTips.TotalMemberCountSpecified)
            {
                mailTips.TotalMemberCount = webServiceMailTips.TotalMemberCount;
            }
            return(mailTips);
        }
Example #3
0
        internal static IList <RecipientData> CreateRecipientQueryResult(DirectoryContext directoryContext, DateTime queryPrepareDeadline, string proxyRecipient)
        {
            RecipientQuery recipientQuery = new RecipientQuery(directoryContext.ClientContext, directoryContext.TenantGalSession, queryPrepareDeadline, FindMessageTrackingQuery.RecipientProperties);

            Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress   emailAddress      = new Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress(string.Empty, proxyRecipient);
            Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress[] emailAddressArray = new Microsoft.Exchange.InfoWorker.Common.Availability.EmailAddress[]
            {
                emailAddress
            };
            IList <RecipientData> list = recipientQuery.Query(emailAddressArray);

            if (list[0].IsEmpty)
            {
                list = MessageTrackingApplication.CreateFakeRecipientQueryResult(ServerCache.Instance.GetOrgMailboxForDomain(emailAddress.Domain).ToString());
            }
            return(list);
        }
Example #4
0
 private OrganizationId GetTargetOrganizationIdFromCache(EmailAddress targetAddress)
 {
     return(DomainToOrganizationIdCache.Singleton.Get(new SmtpDomain(targetAddress.Domain)));
 }
Example #5
0
        protected AutoDiscoverRequestResult GetAutodiscoverResult(string urlValue, string versionValue, EmailAddress emailAddress)
        {
            if (string.IsNullOrEmpty(urlValue) || !Uri.IsWellFormedUriString(urlValue, UriKind.Absolute))
            {
                SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError((long)this.GetHashCode(), "{0}: Request '{1}' got ExternalEwsUrl setting for user {2} has invalid value: {3}", new object[]
                {
                    TraceContext.Get(),
                    this,
                    emailAddress.Address,
                    urlValue
                });
                return(null);
            }
            int serverVersion = Globals.E14Version;

            if (!string.IsNullOrEmpty(versionValue))
            {
                Exception ex = null;
                try
                {
                    Version version = new Version(versionValue);
                    serverVersion = version.ToInt();
                }
                catch (ArgumentException ex2)
                {
                    ex = ex2;
                }
                catch (FormatException ex3)
                {
                    ex = ex3;
                }
                catch (OverflowException ex4)
                {
                    ex = ex4;
                }
                if (ex != null)
                {
                    SoapAutoDiscoverRequest.AutoDiscoverTracer.TraceError <object, Exception>((long)this.GetHashCode(), "{0}: Exception parsing version: {1}", TraceContext.Get(), ex);
                }
            }
            string url = urlValue;

            if (this.authenticator.ProxyAuthenticator != null && this.authenticator.ProxyAuthenticator.AuthenticatorType == AuthenticatorType.WSSecurity)
            {
                url = EwsWsSecurityUrl.Fix(url);
            }
            return(new AutoDiscoverRequestResult(this.TargetUri, null, null, new WebServiceUri(url, null, UriSource.EmailDomain, serverVersion), null, null));
        }
 internal AutoDiscoverRequest(Application application, ClientContext clientContext, RequestLogger requestLogger, Uri targetUri, EmailAddress emailAddress, ICredentials credentialsForDiscovery, UriSource uriSource) : base(application, clientContext, requestLogger, "AutoDiscoverRequest")
 {
     this.uriSource               = uriSource;
     this.emailAddress            = emailAddress;
     this.credentialsForDiscovery = credentialsForDiscovery;
     this.targetUri               = targetUri;
     CertificateValidationManager.RegisterCallback(Globals.CertificateValidationComponentId, new RemoteCertificateValidationCallback(CertificateErrorHandler.CertValidationCallback));
 }
Example #7
0
 private AutoDiscoverRequest GetRequest(EmailAddress emailAddress)
 {
     return(new AutoDiscoverRequest(base.Application, base.ClientContext, base.RequestLogger, base.TargetUri, emailAddress, base.Authenticator.Credentials, this.uriSource));
 }
Example #8
0
 internal MailboxData(EmailAddress email)
 {
     this.Init();
     this.email = email;
 }