public InternalGetMessageTrackingReportResponse GetMessageTrackingReport(GetMessageTrackingReportRequestTypeWrapper request, TimeSpan timeout) { this.ewsBinding.Timeout = (int)Math.Min(timeout.TotalMilliseconds, 2147483647.0); GetMessageTrackingReportResponseMessageType messageTrackingReport = this.ewsBinding.GetMessageTrackingReport(request.PrepareEWSRequest(this.serverVersion)); MessageTrackingReportId messageTrackingReportId; if (!MessageTrackingReportId.TryParse(request.WrappedRequest.MessageTrackingReportId, out messageTrackingReportId)) { throw new ArgumentException("Invalid MessageTrackingReportId, caller should have validated"); } return(InternalGetMessageTrackingReportResponse.Create(messageTrackingReportId.Domain, messageTrackingReport)); }
public GetMessageTrackingQuery(SmtpAddress proxyRecipient, DirectoryContext directoryContext, GetMessageTrackingReportRequestTypeWrapper request, ExchangeVersion minVersionRequested, TimeSpan timeout) : base(directoryContext.ClientContext, null, CasTraceEventType.MessageTracking, GetMessageTrackingApplication.MessageTrackingIOCompletion, InfoWorkerMessageTrackingPerformanceCounters.CurrentRequestDispatcherRequests) { MessageTrackingReportId messageTrackingReportId = null; if (!MessageTrackingReportId.TryParse(request.WrappedRequest.MessageTrackingReportId, out messageTrackingReportId)) { throw new ArgumentException("MessageTrackingReportId invalid"); } this.directoryContext = directoryContext; string address = ServerCache.Instance.GetOrgMailboxForDomain(messageTrackingReportId.Domain).ToString(); this.fakeRecipientQueryResults = MessageTrackingApplication.CreateFakeRecipientQueryResult(address); this.proxyRecipient = proxyRecipient; this.request = request; this.minVersionRequested = minVersionRequested; base.Timeout = timeout; }
InternalGetMessageTrackingReportResponse IClientProxy.GetMessageTrackingReport(GetMessageTrackingReportRequestTypeWrapper request, TimeSpan timeout) { GetMessageTrackingQuery getMessageTrackingQuery = new GetMessageTrackingQuery(this.proxyRecipient, this.directoryContext, request, this.ewsVersionRequested, timeout); GetMessageTrackingQueryResult getMessageTrackingQueryResult = getMessageTrackingQuery.Execute(); if (getMessageTrackingQueryResult == null) { TraceWrapper.SearchLibraryTracer.TraceError(this.GetHashCode(), "Empty result in Request Dispatcher FindMessageTrackingQuery.Execute", new object[0]); return(null); } Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.GetMessageTrackingReportResponseMessageType response = getMessageTrackingQueryResult.Response; MessageTrackingReportId messageTrackingReportId; if (!MessageTrackingReportId.TryParse(request.WrappedRequest.MessageTrackingReportId, out messageTrackingReportId)) { throw new ArgumentException("Invalid MessageTrackingReportId, caller should have validated"); } return(InternalGetMessageTrackingReportResponse.Create(messageTrackingReportId.Domain, response)); }
internal static MessageTrackingSearchResult Create(FindMessageTrackingSearchResultType wsResult, string targetInfoForDisplay) { if (wsResult.Sender == null) { TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "WS-Response Validation Error: Sender is null in FindMessageTrackingReport response from {0}", new object[] { targetInfoForDisplay }); } SmtpAddress smtpAddress = new SmtpAddress(wsResult.Sender.EmailAddress); if (!smtpAddress.IsValidAddress || string.IsNullOrEmpty(wsResult.Sender.Name)) { TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "WS-Response Validation Error: Sender {0} is invalid in FindMessageTrackingReport response from {1}", new object[] { smtpAddress.ToString(), targetInfoForDisplay }); } smtpAddress = SmtpAddress.Parse(wsResult.Sender.EmailAddress); string name = wsResult.Sender.Name; EmailAddressType[] recipients = wsResult.Recipients; SmtpAddress[] array = new SmtpAddress[recipients.Length]; if (recipients == null || recipients.Length == 0) { TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "WS-Response Validation Error: No recipients in FindMessageTrackingReport response from {0}", new object[] { targetInfoForDisplay }); } for (int i = 0; i < recipients.Length; i++) { if (recipients[i] == null) { TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "WS-Response Validation Error: Null recipient in FindMessageTrackingReport response from {0}", new object[] { targetInfoForDisplay }); } array[i] = new SmtpAddress(recipients[i].EmailAddress); if (!array[i].IsValidAddress) { TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "WS-Response Validation Error: Invalid Recipient {0} in FindMessageTrackingReport response from {1}", new object[] { array[i].ToString(), targetInfoForDisplay }); } } MessageTrackingReportId identity = null; if (!MessageTrackingReportId.TryParse(wsResult.MessageTrackingReportId, out identity)) { TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "WS-Response Validation Error: Invalid report ID {0} in FindMessageTrackingReport response from {1}", new object[] { wsResult.MessageTrackingReportId, targetInfoForDisplay }); } return(new MessageTrackingSearchResult(identity, smtpAddress, name, array, wsResult.Subject, wsResult.SubmittedTime, wsResult.PreviousHopServer, wsResult.FirstHopServer)); }