Example #1
0
        public static FreeBusyPermissionLevel DetermineAllowedAccess(ClientContext clientContext, MailboxSession session, CalendarFolder calendarFolder, FreeBusyQuery freeBusyQuery, bool defaultFreeBusyOnly)
        {
            RawSecurityDescriptor rawSecurityDescriptor = calendarFolder.TryGetProperty(CalendarFolderSchema.FreeBusySecurityDescriptor) as RawSecurityDescriptor;

            if (rawSecurityDescriptor == null)
            {
                FreeBusyPermission.SecurityTracer.TraceDebug <object, CalendarFolder>(0L, "{0}: Unable to retrieve FreeBusySecurityDescriptor from folder {1}. Using None as permission level.", TraceContext.Get(), calendarFolder);
                return(FreeBusyPermissionLevel.None);
            }
            if (FreeBusyPermission.SecurityTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                string sddlForm = rawSecurityDescriptor.GetSddlForm(AccessControlSections.All);
                FreeBusyPermission.SecurityTracer.TraceDebug <object, EmailAddress, string>(0L, "{0}: The SDDL form of calendar folder security descriptor of mailbox {1} is: {2}.", TraceContext.Get(), freeBusyQuery.Email, sddlForm);
            }
            if (defaultFreeBusyOnly)
            {
                FreeBusyPermission.SecurityTracer.TraceDebug(0L, "{0}: Using DefaultClientSecurityContext because of defaultFreeBusyOnly is set.", new object[]
                {
                    TraceContext.Get()
                });
                return(FreeBusyPermission.AccessCheck(rawSecurityDescriptor, ClientSecurityContext.FreeBusyPermissionDefaultClientSecurityContext));
            }
            InternalClientContext internalClientContext = clientContext as InternalClientContext;

            if (internalClientContext != null)
            {
                return(FreeBusyPermission.FromInternalClient(internalClientContext, rawSecurityDescriptor, freeBusyQuery));
            }
            ExternalClientContext externalClientContext = clientContext as ExternalClientContext;

            return(FreeBusyPermission.FromExternalClient(externalClientContext, session, rawSecurityDescriptor, freeBusyQuery));
        }
Example #2
0
        private void Complete1(AsyncTask task)
        {
            GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Completed GetFolder requests.", new object[]
            {
                TraceContext.Get()
            });
            this.CheckResultsOfGetFolder();
            QueryList queryList = new QueryList(base.QueryList.Count);

            foreach (BaseQuery baseQuery in ((IEnumerable <BaseQuery>)base.QueryList))
            {
                if (baseQuery.Result == null || baseQuery.Result.ExceptionInfo == null)
                {
                    queryList.Add(baseQuery);
                }
            }
            if (queryList.Count == 0)
            {
                GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Completed and no ProxyWebRequest is necessary.", new object[]
                {
                    TraceContext.Get()
                });
                base.Complete();
                return;
            }
            this.proxyWebRequest = new ProxyWebRequest(base.Application, base.ClientContext, base.RequestType, base.RequestLogger, base.QueryList, this.targetVersion, this.proxyAuthenticator, this.webServiceUri, this.webServiceUri.Source);
            this.proxyWebRequest.BeginInvoke(new TaskCompleteCallback(this.Complete2));
        }
 // Token: 0x060013AF RID: 5039 RVA: 0x00073030 File Offset: 0x00071230
 public bool LoadData(IMailboxSession itemStore, IXSOFactory factory)
 {
     if (this.inboxFolderId == null)
     {
         StoreObjectId defaultFolderId = itemStore.GetDefaultFolderId(DefaultFolderType.Inbox);
         if (defaultFolderId != null)
         {
             this.inboxFolderId = defaultFolderId.ProviderLevelItemId;
             using (IFolder folder = factory.BindToFolder(itemStore, defaultFolderId))
             {
                 this.InboxItemCount   = (long)folder.ItemCount;
                 this.InboxUnreadCount = (long)folder.GetValueOrDefault <int>(FolderSchema.UnreadCount, 1);
                 if (this.InboxUnreadCount == 0L)
                 {
                     this.InboxUnreadCount = 1L;
                     ExTraceGlobals.PushNotificationAssistantTracer.TraceError <Guid, object>((long)this.GetHashCode(), "MailboxData.LoadData('{0}'): {1} - The UnreadCount coming from the folder is = 0", itemStore.MailboxGuid, TraceContext.Get());
                 }
                 return(true);
             }
         }
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_FailedToResolveInboxFolderId, itemStore.MdbGuid.ToString(), new object[]
         {
             itemStore.MdbGuid,
             itemStore.MailboxGuid
         });
         ExTraceGlobals.PushNotificationAssistantTracer.TraceWarning((long)this.GetHashCode(), "MailboxData.LoadData: {0} - Load Data: Inbox folder is null", new object[]
         {
             TraceContext.Get()
         });
         return(false);
     }
     return(true);
 }
Example #4
0
        public override void EndProxyWebRequest(ProxyWebRequest proxyWebRequest, QueryList queryList, IService service, IAsyncResult asyncResult)
        {
            MailTipsApplication.GetMailTipsTracer.TraceFunction((long)this.traceId, "Entering MailTipsApplication.EndProxyWebRequest");
            GetMailTipsResponseMessageType getMailTipsResponseMessageType = service.EndGetMailTips(asyncResult);
            int hashCode = proxyWebRequest.GetHashCode();

            if (getMailTipsResponseMessageType == null)
            {
                Application.ProxyWebRequestTracer.TraceError((long)this.traceId, "{0}: Proxy web request returned NULL GetMailTipsResponseMessageType", new object[]
                {
                    TraceContext.Get()
                });
                queryList.SetResultInAllQueries(new MailTipsQueryResult(new NoEwsResponseException()));
                base.HandleNullResponse(proxyWebRequest);
                return;
            }
            ResponseCodeType responseCode = getMailTipsResponseMessageType.ResponseCode;

            if (responseCode != ResponseCodeType.NoError)
            {
                Application.ProxyWebRequestTracer.TraceError <object, string>((long)hashCode, "{0}: Proxy web request returned error code {1}", TraceContext.Get(), responseCode.ToString());
                queryList.SetResultInAllQueries(new MailTipsQueryResult(new ErrorEwsResponseException(responseCode)));
                return;
            }
            this.ProcessResponseMessages(hashCode, queryList, getMailTipsResponseMessageType);
        }
Example #5
0
 // Token: 0x0600034B RID: 843 RVA: 0x00014DB4 File Offset: 0x00012FB4
 internal void Build()
 {
     ElcUserInformation.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Looking up ELC folder information for mailbox.", new object[]
     {
         TraceContext.Get()
     });
     this.userAdFolders = AdFolderReader.GetUserElcFolders(base.MailboxSession, base.ADUser, this.allAdFolders, false, false);
     if (this.userAdFolders != null && this.userAdFolders.Count > 0)
     {
         ElcUserInformation.Tracer.TraceDebug <object, int>((long)this.GetHashCode(), "{0}: has {1} elc folders in the AD.", TraceContext.Get(), this.userAdFolders.Count);
     }
     else
     {
         ElcUserInformation.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: has no elc folders.", new object[]
         {
             TraceContext.Get()
         });
     }
     ProvisionedFolderReader.GetProvisionedFoldersFromMailbox(base.MailboxSession, false, out this.elcRootFolderData, out this.mailboxFolders);
     if (this.mailboxFolders != null && this.mailboxFolders.Count > 0)
     {
         ElcUserInformation.Tracer.TraceDebug <object, int>((long)this.GetHashCode(), "{0}: Contains {1} elc folders in its mailbox.", TraceContext.Get(), this.mailboxFolders.Count);
     }
     else
     {
         ElcUserInformation.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Has no elc folders in its mailbox.", new object[]
         {
             TraceContext.Get()
         });
     }
     ProvisionedFolderReader.GetElcRootFolderInfo(base.MailboxSession, out this.elcRootId, out this.elcRootName, out this.elcRootHomePageUrl);
     ElcUserInformation.TracerPfd.TracePfd <int, object>((long)this.GetHashCode(), "PFD IWE {0} {1}: Completed ELC information for mailbox from AD and Store.", 27287, TraceContext.Get());
 }
Example #6
0
        // Token: 0x06000192 RID: 402 RVA: 0x0000B980 File Offset: 0x00009B80
        internal ElcUserInformation(MailboxSession session)
        {
            this.mailboxSession = session;
            this.utcNow         = DateTime.UtcNow;
            this.now            = (DateTime)ExDateTime.Now;
            IRecipientSession recipientSession;

            this.adUser = AdReader.GetADUser(this.mailboxSession, true, out recipientSession);
            if (this.adUser == null)
            {
                ElcUserInformation.Tracer.TraceError((long)this.GetHashCode(), "{0}: Failed to get the AD information for the user.", new object[]
                {
                    TraceContext.Get()
                });
                throw new SkipException(Strings.descADUserLookupFailure(this.mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()));
            }
            if (this.adUser.RetentionHoldEnabled && (this.adUser.StartDateForRetentionHold == null || this.now >= this.adUser.StartDateForRetentionHold) && (this.adUser.EndDateForRetentionHold == null || this.now <= this.adUser.EndDateForRetentionHold))
            {
                this.suspendExpiration = true;
            }
            if (this.adUser.LitigationHoldEnabled)
            {
                this.litigationHold         = true;
                this.litigationHoldDuration = this.adUser.LitigationHoldDuration;
                if (this.litigationHoldDuration == null && this.ApplyLitigationHoldDuration)
                {
                    this.GetLegacyStateAndSetLitigationHoldDuration();
                }
            }
            this.auditEnabled             = this.adUser.MailboxAuditEnabled;
            this.InPlaceHolds             = this.adUser.InPlaceHolds;
            this.InPlaceHoldConfiguration = new List <InPlaceHoldConfiguration>();
        }
Example #7
0
        // Token: 0x06000193 RID: 403 RVA: 0x0000BB44 File Offset: 0x00009D44
        private void GetLegacyStateAndSetLitigationHoldDuration()
        {
            ElcMailboxHelper.ConfigState configState = ElcMailboxHelper.ConfigState.Unknown;
            IRecipientSession            recipientSession;
            ADUser aduser = AdReader.GetADUser(this.mailboxSession, false, out recipientSession);

            if (aduser == null)
            {
                ElcUserInformation.Tracer.TraceError((long)this.GetHashCode(), "{0}: Failed to get the writable AD information for the user.", new object[]
                {
                    TraceContext.Get()
                });
                throw new SkipException(Strings.descADUserLookupFailure(this.mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()));
            }
            Unlimited <EnhancedTimeSpan>?legacyLitigationHoldDuration = this.GetLegacyLitigationHoldDuration(out configState);

            aduser.LitigationHoldDuration = legacyLitigationHoldDuration;
            try
            {
                recipientSession.Save(aduser);
            }
            catch (DataValidationException ex)
            {
                ElcUserInformation.Tracer.TraceDebug <ElcUserInformation, string, DataValidationException>((long)this.GetHashCode(), "{0}: DataValidationException occurred when setting LitigationHoldDuration to ADUser. Duration value: {1}. Exception: {2}", this, (legacyLitigationHoldDuration != null) ? (legacyLitigationHoldDuration.Value.IsUnlimited ? Unlimited <EnhancedTimeSpan> .UnlimitedString : legacyLitigationHoldDuration.Value.Value.TotalDays.ToString()) : "No value", ex);
                throw new SkipException(new LocalizedString(string.Format("{0}: DataValidationException occurred when setting LitigationHoldDuration to ADUser. Duration value: {1}.", this, (legacyLitigationHoldDuration != null) ? (legacyLitigationHoldDuration.Value.IsUnlimited ? Unlimited <EnhancedTimeSpan> .UnlimitedString : legacyLitigationHoldDuration.Value.Value.TotalDays.ToString()) : "No value")), ex);
            }
            this.litigationHoldDuration = aduser.LitigationHoldDuration;
        }
Example #8
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()));
             }
         }
     }
 }
Example #9
0
 public void OnActionExecuted(ActionExecutedContext context)
 {
     traceSpan = TraceContext.Get();
     traceSpan.duration = DateTime.Now.ToUnixTimestamp() - traceSpan.timestamp; //运行时间
     traceSpan.tags.Add("status", "200");
     if (context.Exception != null)
     {
         Result result = null;
         if (context.Exception is ChecksException ce) //验证异常(业务)
         {
             result = Result.Fail(ce.Code, ce.Message);
             traceSpan.tags.Add("checks", context.Exception.ToString());
         }
         else if (context.Exception is QueueException qe) //消息队列异常(业务)
         {
             result = Result.Fail(qe.Code, qe.Message);
             traceSpan.tags.Add("queues", context.Exception.ToString());
             traceSpan.tags["status"] = "500";
         }
         else
         {
             result = Result.Fail(500, "服务器连接错误");
             traceSpan.tags.Add("error", context.Exception.ToString());
             traceSpan.tags["status"] = "500";
         }
         context.ExceptionHandled = true;
         context.Result = new ObjectResult(result);
     }
   
     Log.Info(traceSpan.ToJson());
 }
Example #10
0
        private bool GetOutOfOfficeMessage(int traceId, MailboxSession session, MailTips mailTips)
        {
            bool flag = false;

            MailTipsLocalQuery.GetMailTipsTracer.TraceFunction <object, EmailAddress>((long)traceId, "{0} / {1}: Getting OutOfOffice", TraceContext.Get(), mailTips.EmailAddress);
            Stopwatch stopwatch = Stopwatch.StartNew();

            try
            {
                object obj   = session.Mailbox.TryGetProperty(MailboxSchema.MailboxOofState);
                bool   flag2 = true;
                if (!(obj is PropertyError))
                {
                    flag2 = (bool)obj;
                }
                if (flag2)
                {
                    UserOofSettings userOofSettings = UserOofSettings.GetUserOofSettings(session);
                    this.ParseUserOofSettings(userOofSettings, mailTips, traceId);
                }
                flag = true;
            }
            catch (InvalidParameterException ex)
            {
                MailTipsLocalQuery.GetMailTipsTracer.TraceDebug((long)traceId, "{0} / {1}: GetOofMailTip InvalidParameterException: {2}, {3}", new object[]
                {
                    TraceContext.Get(),
                    mailTips.EmailAddress,
                    ex.GetType().Name,
                    ex.Message
                });
                mailTips.OutOfOfficeMessage = null;
                flag = true;
            }
            finally
            {
                stopwatch.Stop();
                MailTipsPerfCounters.OutOfOfficeAnsweredWithinOneSecond_Base.Increment();
                if (stopwatch.ElapsedMilliseconds < 1000L)
                {
                    MailTipsPerfCounters.OutOfOfficeAnsweredWithinOneSecond.Increment();
                    MailTipsPerfCounters.OutOfOfficeAnsweredWithinThreeSeconds.Increment();
                    MailTipsPerfCounters.OutOfOfficeAnsweredWithinTenSeconds.Increment();
                }
                else if (stopwatch.ElapsedMilliseconds < 3000L)
                {
                    MailTipsPerfCounters.OutOfOfficeAnsweredWithinThreeSeconds.Increment();
                    MailTipsPerfCounters.OutOfOfficeAnsweredWithinTenSeconds.Increment();
                }
                else if (stopwatch.ElapsedMilliseconds < 10000L)
                {
                    MailTipsPerfCounters.OutOfOfficeAnsweredWithinTenSeconds.Increment();
                }
                if (flag)
                {
                    MailTipsPerfCounters.OutOfOfficePositiveResponses.Increment();
                }
            }
            return(flag);
        }
 // Token: 0x0600010D RID: 269 RVA: 0x0000679C File Offset: 0x0000499C
 internal static bool IsEventInteresting(MapiEvent mapiEvent)
 {
     if (mapiEvent.ItemType != ObjectType.MAPI_MESSAGE)
     {
         return(false);
     }
     if ((mapiEvent.EventFlags & MapiEventFlags.FolderAssociated) == MapiEventFlags.None)
     {
         return(false);
     }
     if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectModified) == (MapiEventTypeFlags)0 && (mapiEvent.EventMask & MapiEventTypeFlags.ObjectCreated) == (MapiEventTypeFlags)0 && (mapiEvent.EventMask & MapiEventTypeFlags.ObjectMoved) == (MapiEventTypeFlags)0)
     {
         return(false);
     }
     if (string.Compare(mapiEvent.ObjectClass, "IPM.ConversationAction", StringComparison.OrdinalIgnoreCase) != 0)
     {
         return(false);
     }
     if (mapiEvent.ItemEntryId == null || mapiEvent.ParentEntryId == null)
     {
         ActionsProcessor.Tracer.TraceError(0L, "{0}: Found item without entry Id or parent entry Id", new object[]
         {
             TraceContext.Get()
         });
         return(false);
     }
     return(mapiEvent.ClientType != MapiEventClientTypes.EventBasedAssistants && mapiEvent.ClientType != MapiEventClientTypes.Transport);
 }
Example #12
0
        private void InitializeADUserIfNeeded()
        {
            if (this.adUserInitialized)
            {
                return;
            }
            SecurityIdentifier userSid = this.clientSecurityContext.UserSid;

            base.CheckOverBudget();
            ADSessionSettings sessionSettings;

            if (this.organizationId != null)
            {
                sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(this.organizationId);
            }
            else
            {
                sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.FullyConsistent, sessionSettings, 397, "InitializeADUserIfNeeded", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\RequestDispatch\\InternalClientContext.cs");

            if (base.Budget != null)
            {
                tenantOrRootOrgRecipientSession.SessionSettings.AccountingObject = base.Budget;
            }
            this.adUser = (tenantOrRootOrgRecipientSession.FindBySid(userSid) as ADUser);
            InternalClientContext.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: {1}: found internal caller by SID {2} in the AD. User is {3}", new object[]
            {
                TraceContext.Get(),
                this,
                userSid,
                this.adUser
            });
            this.adUserInitialized = true;
        }
 // Token: 0x06000363 RID: 867 RVA: 0x000179D8 File Offset: 0x00015BD8
 internal void Invoke(MailboxSession mailboxSession, ElcUserFolderInformation userELCInfo)
 {
     EnforcerManager.< > c__DisplayClass4 CS$ < > 8__locals1 = new EnforcerManager.< > c__DisplayClass4();
     CS$ < > 8__locals1.mailboxSession = mailboxSession;
     CS$ < > 8__locals1.< > 4__this    = this;
     EnforcerManager.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Invoke called.", new object[]
     {
         TraceContext.Get()
     });
     EnforcerManager.TracerPfd.TracePfd <int, object>((long)this.GetHashCode(), "PFD IWE {0} {1}: Invoke called.", 32023, TraceContext.Get());
     EnforcerManager.< > c__DisplayClass6 CS$ < > 8__locals2 = new EnforcerManager.< > c__DisplayClass6();
     CS$ < > 8__locals2.mailboxData = new MailboxDataForFolders(userELCInfo, this.elcAuditLog);
     try
     {
         EnforcerManager.< > c__DisplayClass8 CS$ < > 8__locals3 = new EnforcerManager.< > c__DisplayClass8();
         CS$ < > 8__locals3.CS$ < > 8__locals7 = CS$ < > 8__locals2;
         CS$ < > 8__locals3.CS$ < > 8__locals5 = CS$ < > 8__locals1;
         CS$ < > 8__locals3.enforcerArray      = new EnforcerBase[]
         {
             new AutoCopyEnforcer(CS$ < > 8__locals2.mailboxData, this.databaseInfo, this.elcAssistant),
             new ExpirationEnforcer(CS$ < > 8__locals2.mailboxData, this.elcAssistant)
         };
         CS$ < > 8__locals3.mailboxOwner    = CS$ < > 8__locals1.mailboxSession.MailboxOwner;
         CS$ < > 8__locals3.folderForFilter = null;
         ILUtil.DoTryFilterCatch(new TryDelegate(CS$ < > 8__locals3, (UIntPtr)ldftn(< Invoke > b__0)), new FilterDelegate(CS$ < > 8__locals3, (UIntPtr)ldftn(< Invoke > b__1)), new CatchDelegate(null, (UIntPtr)ldftn(< Invoke > b__2)));
     }
     finally
     {
         if (CS$ < > 8__locals2.mailboxData != null)
         {
             ((IDisposable)CS$ < > 8__locals2.mailboxData).Dispose();
         }
     }
 }
        private void ValidateAndProcessInput(ExDateTime startDate, ExDateTime endDate, int inputMeetingDuration, AttendeeData[] attendees)
        {
            this.requiredAttendeeCount = 0;
            this.optionalAttendeeCount = 0;
            foreach (AttendeeData attendeeData in attendees)
            {
                if (attendeeData == null)
                {
                    MeetingSuggester.Tracer.TraceError((long)this.GetHashCode(), "{0}: Invalid inputAttendee array; an element is null.", new object[]
                    {
                        TraceContext.Get()
                    });
                    throw new ArgumentException("Invalid inputAttendee array; an element is null.");
                }
                switch (attendeeData.AttendeeType)
                {
                case MeetingAttendeeType.Organizer:
                case MeetingAttendeeType.Required:
                    this.requiredAttendeeCount++;
                    break;

                case MeetingAttendeeType.Optional:
                    this.optionalAttendeeCount++;
                    break;
                }
                if (startDate < attendeeData.FreeBusyStartTime || startDate >= attendeeData.FreeBusyEndTime || endDate <= attendeeData.FreeBusyStartTime || endDate > attendeeData.FreeBusyEndTime)
                {
                    MeetingSuggester.Tracer.TraceError((long)this.GetHashCode(), "{0}: start and end times outside availability data.", new object[]
                    {
                        TraceContext.Get()
                    });
                    throw new InvalidParameterException(Strings.descStartAndEndTimesOutSideFreeBusyData);
                }
            }
        }
        public SuggestionDayResult[] GetSuggestionsByDateRange(ExDateTime startDate, ExDateTime endDate, ExTimeZone timeZone, int inputMeetingDuration, AttendeeData[] attendees)
        {
            this.meetingDuration = inputMeetingDuration;
            MeetingSuggester.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Entering MeetingSuggester.GetSuggestionsByDateRange()", new object[]
            {
                TraceContext.Get()
            });
            MeetingSuggester.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: startDate={1}, endDate={2}, inputMeetingDuration={3}", new object[]
            {
                TraceContext.Get(),
                startDate,
                endDate,
                inputMeetingDuration
            });
            this.ValidateAndProcessInput(startDate, endDate, inputMeetingDuration, attendees);
            List <SuggestionDayResult> list = new List <SuggestionDayResult>();
            ExDateTime exDateTime           = startDate;

            while (exDateTime < endDate)
            {
                list.Add(new SuggestionDayResult(exDateTime, this.meetingDuration, this.requiredAttendeeCount, this.optionalAttendeeCount, attendees, this.options, this.currentMeetingTime));
                exDateTime = exDateTime.AddDays(1.0);
            }
            return(list.ToArray());
        }
Example #16
0
        public void ContextIsPassedToCreatedThreads()
        {
            var trace = Trace.Create();

            TraceContext.Set(trace);

            Trace threadTrace  = null;
            Trace threadTrace2 = null;

            var thread = new Thread(() =>
            {
                threadTrace = TraceContext.Get();
            });

            thread.Start();

            TraceContext.Clear();

            var thread2 = new Thread(() =>
            {
                threadTrace2 = TraceContext.Get();
            });

            thread2.Start();

            thread.Join();
            thread2.Join();

            Assert.AreEqual(trace, threadTrace);
            Assert.IsNull(threadTrace2);
        }
Example #17
0
 protected void HandleNullResponse(ProxyWebRequest proxyWebRequest)
 {
     Application.ProxyWebRequestTracer.TraceError((long)proxyWebRequest.GetHashCode(), "{0}: Proxy web request returned NULL response.", new object[]
     {
         TraceContext.Get()
     });
 }
        internal static CalendarEvent[] GetCalendarEvents(EmailAddress emailAddress, CalendarFolder calendarFolder, ExDateTime windowStart, ExDateTime windowEnd, FreeBusyViewType accessAllowed, bool canActAsMailboxOwner, ExchangeVersionType exchangeVersion)
        {
            CalendarEvent[] array = null;
            int             num   = 0;

            object[][] calendarView = calendarFolder.GetCalendarView(windowStart, windowEnd, InternalCalendarQuery.CalendarQueryProperties);
            InternalCalendarQuery.CalendarViewTracer.TraceDebug(0L, "{0}: Query for {1} found {2} appointment entries between {3} and {4}", new object[]
            {
                TraceContext.Get(),
                emailAddress,
                calendarView.Length,
                windowStart,
                windowEnd
            });
            num += calendarView.Length;
            if (num > Configuration.MaximumResultSetSize)
            {
                LocalizedException ex = new ResultSetTooBigException(Configuration.MaximumResultSetSize, num);
                InternalCalendarQuery.CalendarViewTracer.TraceError <object, EmailAddress, LocalizedException>(0L, "{0}: Query for {1} got exception getting Calendar Data. Exception: {2}", TraceContext.Get(), emailAddress, ex);
                throw ex;
            }
            int length = calendarView.GetLength(0);

            if (length > 0)
            {
                array = new CalendarEvent[length];
                for (int i = 0; i < length; i++)
                {
                    object[] properties = calendarView[i];
                    array[i] = CalendarEvent.CreateFromQueryData(emailAddress, properties, accessAllowed, canActAsMailboxOwner, exchangeVersion);
                }
            }
            return(array);
        }
Example #19
0
 private void ParseConfigurableObject(ConfigurableObject configurableObject, ICollection <PropertyDefinition> propertyDefinitionCollection)
 {
     if (configurableObject == null)
     {
         ExTraceGlobals.RequestRoutingTracer.TraceDebug((long)this.GetHashCode(), "{0}: Trying to parse null configurable object.", new object[]
         {
             TraceContext.Get()
         });
         return;
     }
     if (0 < propertyDefinitionCollection.Count)
     {
         this.propertyMap = new Dictionary <PropertyDefinition, object>(propertyDefinitionCollection.Count);
         using (IEnumerator <PropertyDefinition> enumerator = propertyDefinitionCollection.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 PropertyDefinition propertyDefinition = enumerator.Current;
                 if (configurableObject[propertyDefinition] == null)
                 {
                     ExTraceGlobals.RequestRoutingTracer.TraceDebug <object, PropertyDefinition>((long)this.GetHashCode(), "{0}: {1} property was null.", TraceContext.Get(), propertyDefinition);
                 }
                 this.propertyMap[propertyDefinition] = configurableObject[propertyDefinition];
             }
             return;
         }
     }
     ExTraceGlobals.RequestRoutingTracer.TraceError <object, int>((long)this.GetHashCode(), "{0}: Property definition collection contains {1} property definitions, nothing is parsed in RecipientData.", TraceContext.Get(), propertyDefinitionCollection.Count);
 }
        // Token: 0x0600010F RID: 271 RVA: 0x00006A18 File Offset: 0x00004C18
        private static bool MergeDuplicateActionItems(MailboxSession session, ConversationActionItem actionItem, MailboxData mailboxData)
        {
            ActionsProcessor.Tracer.TraceDebug(0L, "{0}: Calling ActionsProcessor.MergeDuplicateActionItems", new object[]
            {
                TraceContext.Get()
            });
            ConversationId  conversationId = actionItem.ConversationId;
            int             totalActionItemCount;
            IList <StoreId> list = ConversationActionItem.QueryConversationActionsFolder(session, conversationId, 10, out totalActionItemCount);

            mailboxData.UpdateConversationActionsEnabledStatus(totalActionItemCount);
            if (list == null || list.Count <= 1)
            {
                ActionsProcessor.Tracer.TraceDebug <object, int>(0L, "{0}: No duplicates found.  Count = {1}", TraceContext.Get(), (list != null) ? list.Count : -1);
                return(false);
            }
            StoreId[] array  = new StoreId[list.Count - 1];
            bool      result = false;

            for (int i = 1; i < list.Count; i++)
            {
                if (list[i].Equals(actionItem.Id))
                {
                    result = true;
                }
                array[i - 1] = list[i];
            }
            ActionsProcessor.Tracer.TraceDebug <object, int>(0L, "{0}: Attempting to delete {1} duplicates...", TraceContext.Get(), array.Length);
            session.Delete(DeleteItemFlags.HardDelete, array);
            return(result);
        }
Example #21
0
 private void Complete2(AsyncTask task)
 {
     GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Completed ProxyWebRequest.", new object[]
     {
         TraceContext.Get()
     });
     base.Complete();
 }
        // Token: 0x06000112 RID: 274 RVA: 0x00006B14 File Offset: 0x00004D14
        internal static bool IsEventInteresting(MapiEvent mapiEvent, MailboxData mailboxData)
        {
            if (mapiEvent.ItemType != ObjectType.MAPI_MESSAGE)
            {
                return(false);
            }
            if ((mapiEvent.EventFlags & MapiEventFlags.FolderAssociated) != MapiEventFlags.None)
            {
                return(false);
            }
            if (mapiEvent.ItemEntryId == null || mapiEvent.ParentEntryId == null)
            {
                SentItemsProcessor.Tracer.TraceError(0L, "{0}: Found item without entry Id or parent entry Id", new object[]
                {
                    TraceContext.Get()
                });
                return(false);
            }
            bool flag = ObjectClass.IsSmsMessage(mapiEvent.ObjectClass);

            if (mapiEvent.ClientType == MapiEventClientTypes.Transport || (mapiEvent.ClientType == MapiEventClientTypes.AirSync && flag))
            {
                if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectCreated) != (MapiEventTypeFlags)0)
                {
                    if (mailboxData == null)
                    {
                        return(true);
                    }
                    DefaultFolderType defaultFolderType = mailboxData.MatchCachedDefaultFolderType(mapiEvent.ParentEntryId);
                    if (defaultFolderType == DefaultFolderType.SentItems)
                    {
                        SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: Found item created in sent items by Transport", new object[]
                        {
                            TraceContext.Get()
                        });
                        return(flag || mailboxData.ConversationActionsEnabled);
                    }
                }
            }
            else if ((mapiEvent.ClientType == MapiEventClientTypes.MOMT || mapiEvent.ClientType == MapiEventClientTypes.User || mapiEvent.ClientType == MapiEventClientTypes.RpcHttp) && flag && (mapiEvent.EventMask & MapiEventTypeFlags.ObjectMoved) != (MapiEventTypeFlags)0)
            {
                if (mailboxData == null)
                {
                    return(true);
                }
                DefaultFolderType defaultFolderType2 = mailboxData.MatchCachedDefaultFolderType(mapiEvent.ParentEntryId);
                DefaultFolderType defaultFolderType3 = mailboxData.MatchCachedDefaultFolderType(mapiEvent.OldParentEntryId);
                if (defaultFolderType2 == DefaultFolderType.SentItems && defaultFolderType3 == DefaultFolderType.Outbox)
                {
                    SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: Found item moved to sent items by Outlook", new object[]
                    {
                        TraceContext.Get()
                    });
                    return(true);
                }
            }
            return(false);
        }
        // Token: 0x06000B7A RID: 2938 RVA: 0x0004A418 File Offset: 0x00048618
        private static bool InternalCheckForAutomaticBooking(bool isEventForConfigObject, MailboxSession itemStore, CachedState cachedState)
        {
            cachedState.LockForRead();
            CalendarConfiguration calendarConfiguration;

            try
            {
                calendarConfiguration = (cachedState.State[0] as CalendarConfiguration);
                if (calendarConfiguration == null || isEventForConfigObject)
                {
                    LockCookie lockCookie = cachedState.UpgradeToWriterLock();
                    try
                    {
                        using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(itemStore))
                        {
                            calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read <CalendarConfiguration>(null);
                            if (calendarConfiguration == null)
                            {
                                Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_CorruptCalendarConfiguration, null, new object[]
                                {
                                    itemStore.MailboxOwner.LegacyDn
                                });
                                calendarConfigurationDataProvider.Delete(new CalendarConfiguration());
                                calendarConfiguration = new CalendarConfiguration();
                            }
                        }
                        if (calendarConfiguration.AutomateProcessing == CalendarProcessingFlags.AutoAccept)
                        {
                            calendarConfiguration.AddNewRequestsTentatively = true;
                        }
                        cachedState.State[0] = calendarConfiguration;
                        ResourceCheck.Tracer.TraceDebug((long)itemStore.GetHashCode(), "{0}: The calendar settings object was new or has been changed - (re)reading contents.", new object[]
                        {
                            TraceContext.Get()
                        });
                    }
                    catch (ObjectNotFoundException innerException)
                    {
                        ResourceCheck.Tracer.TraceError((long)itemStore.GetHashCode(), "{0}: The calendar configuration was deleted while we were looking at it. Back off and retry.", new object[]
                        {
                            TraceContext.Get()
                        });
                        throw new TransientMailboxException(innerException);
                    }
                    finally
                    {
                        cachedState.DowngradeFromWriterLock(ref lockCookie);
                    }
                }
            }
            finally
            {
                cachedState.ReleaseReaderLock();
            }
            ResourceCheck.Tracer.TraceDebug <object, CalendarProcessingFlags>((long)itemStore.GetHashCode(), "{0}: MailboxType {1}", TraceContext.Get(), calendarConfiguration.AutomateProcessing);
            ResourceCheck.TracerPfd.TracePfd <int, object, CalendarProcessingFlags>((long)itemStore.GetHashCode(), "PFD IWR {0} {1}: ResourceMailbox: {2}", 19223, TraceContext.Get(), calendarConfiguration.AutomateProcessing);
            return(calendarConfiguration.AutomateProcessing == CalendarProcessingFlags.AutoAccept);
        }
Example #24
0
        public void ContextCanBeSetThenGetAndCleared()
        {
            var trace = Trace.Create();

            TraceContext.Set(trace);
            Assert.AreEqual(trace, TraceContext.Get());

            TraceContext.Clear();
            Assert.IsNull(TraceContext.Get());
        }
Example #25
0
        public void SetOverridesPreviousTrace()
        {
            var firstTrace  = Trace.Create();
            var secondTrace = Trace.Create();

            TraceContext.Set(firstTrace);
            TraceContext.Set(secondTrace);

            Assert.AreEqual(secondTrace, TraceContext.Get());
        }
Example #26
0
 private void ThrowIfClientDisconnected(HttpResponse httpResponse)
 {
     if (httpResponse != null && !httpResponse.IsClientConnected)
     {
         RequestDispatcher.RequestRoutingTracer.TraceDebug((long)this.GetHashCode(), "{0}: Client has disconnected. Aborting now.", new object[]
         {
             TraceContext.Get()
         });
         throw new ClientDisconnectedException();
     }
 }
Example #27
0
        // Token: 0x06000847 RID: 2119 RVA: 0x0003A104 File Offset: 0x00038304
        public override bool Synchronize(MailboxSession mailboxSession, FolderRow folderRow, Deadline deadline, CalendarSyncPerformanceCountersInstance counters, CalendarSyncFolderOperationLogEntry folderOpLogEntry)
        {
            SynchronizableFolderType.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: InternetCalendarType.Synchronize will try to sync folder {1} with id {2} for mailbox {3}.", new object[]
            {
                TraceContext.Get(),
                folderRow.DisplayName,
                folderRow.FolderId,
                mailboxSession.DisplayName
            });
            bool flag = true;
            PublishingSubscriptionData subscriptionData = this.GetSubscriptionData(mailboxSession, folderRow);

            if (subscriptionData == null)
            {
                folderOpLogEntry.AddErrorToLog("NoSubscriptionData", null);
                return(true);
            }
            folderOpLogEntry.SubscriptionData = subscriptionData;
            folderOpLogEntry.FolderUrl        = subscriptionData.PublishingUrl.ToString();
            SynchronizableFolderType.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: InternetCalendarType.Synchronize will try to open URL {1} to sync folder {2} with id {3} for mailbox {4}.", new object[]
            {
                TraceContext.Get(),
                subscriptionData.PublishingUrl,
                folderRow.DisplayName,
                folderRow.FolderId,
                mailboxSession.DisplayName
            });
            try
            {
                flag = this.SyncFolder(mailboxSession, folderRow, subscriptionData, deadline, counters, folderOpLogEntry);
            }
            catch (ObjectNotFoundException ex)
            {
                SynchronizableFolderType.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: InternetCalendarType.Synchronize for subscription {1} folder {2} with id {3} for mailbox {4} hit exception {5}.", new object[]
                {
                    TraceContext.Get(),
                    subscriptionData,
                    folderRow.DisplayName,
                    folderRow.FolderId,
                    mailboxSession.DisplayName,
                    ex
                });
                folderOpLogEntry.AddExceptionToLog(ex);
            }
            SynchronizableFolderType.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: InternetCalendarType.Synchronize for folder {1} with id {2} for mailbox {3} will return {4}.", new object[]
            {
                TraceContext.Get(),
                folderRow.DisplayName,
                folderRow.FolderId,
                mailboxSession.DisplayName,
                flag
            });
            return(flag);
        }
        public static ProxyAuthenticator CreateForSoap(string messageId)
        {
            ProxyAuthenticator.SecurityTracer.TraceDebug(0L, "{0}: creating ProxyAuthenticator for network service", new object[]
            {
                TraceContext.Get()
            });
            SoapHttpClientAuthenticator soapHttpClientAuthenticator = SoapHttpClientAuthenticator.CreateNetworkServiceForSoap();

            ProxyAuthenticator.SetMessageId(soapHttpClientAuthenticator, messageId);
            return(new ProxyAuthenticator(soapHttpClientAuthenticator, AuthenticatorType.NetworkCredentials));
        }
Example #29
0
 private void SetErrorRedirectionDepthExceeded()
 {
     AutoDiscoverQuery.AutoDiscoverTracer.TraceError((long)this.GetHashCode(), "{0}: We exceeded the number of times we can do autodiscover redirection. Failing autodiscover.", new object[]
     {
         TraceContext.Get()
     });
     foreach (AutoDiscoverQueryItem autoDiscoverQueryItem in this.queryItems)
     {
         autoDiscoverQueryItem.SetResult(new AutoDiscoverResult(new AutoDiscoverFailedException(Strings.descExceededMaxRedirectionDepth(autoDiscoverQueryItem.EmailAddress.ToString(), 3))));
     }
 }
        // Token: 0x06000627 RID: 1575 RVA: 0x0002F4D8 File Offset: 0x0002D6D8
        internal void Invoke(MailboxDataForTags mailboxDataForTags, ElcParameters parameters)
        {
            SysCleanupEnforcerManager.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Invoke called.", new object[]
            {
                TraceContext.Get()
            });
            ICollection <SysCleanupEnforcerBase> collection;

            if (parameters != ElcParameters.None)
            {
                collection = new List <SysCleanupEnforcerBase>();
                if ((parameters & ElcParameters.HoldCleanup) == ElcParameters.HoldCleanup)
                {
                    collection.Add(new HoldCleanupEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant));
                }
                if ((parameters & ElcParameters.EHAHiddenFolderCleanup) == ElcParameters.EHAHiddenFolderCleanup)
                {
                    collection.Add(new EHAHiddenFolderCleanupEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant));
                }
            }
            else
            {
                collection = new List <SysCleanupEnforcerBase>(new SysCleanupEnforcerBase[]
                {
                    new MigrateToArchiveEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new DumpsterExpirationEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new CalendarLogExpirationEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new AuditExpirationEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new DumpsterQuotaEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new AuditQuotaEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new SupplementExpirationEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new EHAQuotaWarningEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new EHAMigratedMessageMoveEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new EHAMigratedMessageDeletionEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant),
                    new DiscoveryHoldEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant)
                });
                if (mailboxDataForTags.HoldCleanupFolderType != DefaultFolderType.None)
                {
                    collection.Add(new HoldCleanupEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant));
                }
                if (mailboxDataForTags.IsEHAHiddenFolderWatermarkSet())
                {
                    collection.Add(new EHAHiddenFolderCleanupEnforcer(mailboxDataForTags, this.sysCleanupSubAssistant));
                }
            }
            foreach (SysCleanupEnforcerBase sysCleanupEnforcerBase in collection)
            {
                this.sysCleanupSubAssistant.ThrowIfShuttingDown(mailboxDataForTags.MailboxSession.MailboxOwner);
                SysCleanupEnforcerManager.Tracer.TraceDebug <object, SysCleanupEnforcerBase>((long)this.GetHashCode(), "{0}: Calling enabled enforcer '{1}'.", TraceContext.Get(), sysCleanupEnforcerBase);
                mailboxDataForTags.StatisticsLogEntry.LastProcessedEnforcer = sysCleanupEnforcerBase.GetType().Name;
                sysCleanupEnforcerBase.Invoke();
            }
        }