コード例 #1
0
 private void CheckResultsOfGetFolder()
 {
     foreach (GetFolderRequest getFolderRequest in this.getFolderRequests)
     {
         BaseQuery query = getFolderRequest.Query;
         if (string.IsNullOrEmpty(getFolderRequest.ResultFolderId))
         {
             GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress>((long)this.GetHashCode(), "{0}: No ResultFolderId returned for mailbox {1}.", TraceContext.Get(), query.Email);
         }
         else
         {
             StoreObjectId storeObjectId      = StoreId.EwsIdToStoreObjectId(getFolderRequest.ResultFolderId);
             StoreObjectId associatedFolderId = query.RecipientData.AssociatedFolderId;
             if (!associatedFolderId.Equals(storeObjectId))
             {
                 GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Requested folder id {2} doesn't match default folder id {3} for mailbox {1}.", new object[]
                 {
                     TraceContext.Get(),
                     query.Email,
                     associatedFolderId,
                     storeObjectId
                 });
                 query.SetResultOnFirstCall(base.Application.CreateQueryResult(new NotDefaultCalendarException()));
             }
         }
     }
 }
コード例 #2
0
        private void ExecuteInternal(BaseQuery query)
        {
            IStandardBudget standardBudget = null;

            if (Interlocked.Exchange(ref this.firstThreadEntryTimeCaptured, 1) == 0)
            {
                base.RequestLogger.Add(RequestStatistics.Create(RequestStatisticsType.LocalFirstThreadExecute, this.localRequestStopwatch.ElapsedMilliseconds));
            }
            if (base.Aborted)
            {
                return;
            }
            RequestStatisticsForMapi requestStatisticsForMapi = RequestStatisticsForMapi.Begin();
            Stopwatch stopwatch = Stopwatch.StartNew();

            try
            {
                if (base.ClientContext.Budget != null)
                {
                    standardBudget = StandardBudget.Acquire(base.ClientContext.Budget.Owner);
                    if (standardBudget != null)
                    {
                        standardBudget.StartLocal("LocalRequest.ExecuteInternal", default(TimeSpan));
                    }
                }
                LocalRequest.RequestRoutingTracer.TraceDebug <object, int>((long)this.GetHashCode(), "{0}: Entered LocalRequest.Execute() using thread {1}", TraceContext.Get(), Environment.CurrentManagedThreadId);
                if (query.SetResultOnFirstCall(this.localQuery.GetData(query)))
                {
                    LocalRequest.RequestRoutingTracer.TraceDebug <object, EmailAddress, int>((long)this.GetHashCode(), "{0}: Request for mailbox {1} complete and result set in time. Thread {2}", TraceContext.Get(), query.Email, Environment.CurrentManagedThreadId);
                }
            }
            finally
            {
                stopwatch.Stop();
                if (standardBudget != null)
                {
                    standardBudget.EndLocal();
                    standardBudget.Dispose();
                }
                base.RequestLogger.Add(RequestStatistics.Create(RequestStatisticsType.LocalElapsedTimeLongPole, stopwatch.ElapsedMilliseconds, query.ExchangePrincipal.MailboxInfo.Location.ServerFqdn));
                base.RequestLogger.Add(requestStatisticsForMapi.End(RequestStatisticsType.Local, query.ExchangePrincipal.MailboxInfo.Location.ServerFqdn));
                if (Interlocked.Decrement(ref this.pendingItems) == 0)
                {
                    this.ComputeStatistics();
                    this.DisposeIfInternalContext();
                    base.Complete();
                }
                LocalRequest.RequestRoutingTracer.TraceDebug <object, int>((long)this.GetHashCode(), "{0}: Exited LocalRequest.Execute() using thread {1}", TraceContext.Get(), Environment.CurrentManagedThreadId);
            }
        }
コード例 #3
0
 public DispatcherWithAutoDiscoverResults(Application application, QueryList queryList, IList <AutoDiscoverQueryItem> autoDiscoverQueryItems, ProxyAuthenticator proxyAuthenticator, RequestType requestType, DispatcherWithAutoDiscoverResults.CreateRequestWithQueryListDelegate createRequestDelegate)
 {
     DispatcherWithAutoDiscoverResults < > 4__this = this;
     this.createRequestDelegate = createRequestDelegate;
     for (int i = 0; i < queryList.Count; i++)
     {
         BaseQuery          baseQuery          = queryList[i];
         AutoDiscoverResult autoDiscoverResult = autoDiscoverQueryItems[i].Result;
         if (autoDiscoverResult.Exception != null)
         {
             DispatcherWithAutoDiscoverResults.RequestRoutingTracer.TraceError <object, EmailAddress>((long)this.GetHashCode(), "{0}: autodiscover for {1} failed and it will not be dispatched for query", TraceContext.Get(), baseQuery.Email);
             baseQuery.SetResultOnFirstCall(application.CreateQueryResult(autoDiscoverResult.Exception));
         }
         else
         {
             string key = autoDiscoverResult.WebServiceUri.Uri.ToString();
             if (autoDiscoverResult.WebServiceUri.EmailAddress != null)
             {
                 baseQuery.RecipientData.EmailAddress = autoDiscoverResult.WebServiceUri.EmailAddress;
             }
             base.Add(key, baseQuery, requestType, (QueryList perRequestQueryList) => < > 4__this.createRequestDelegate(perRequestQueryList, proxyAuthenticator ?? autoDiscoverResult.ProxyAuthenticator, autoDiscoverResult.WebServiceUri, UriSource.EmailDomain));
         }
     }
 }