internal static void Execute(IMailboxContext userContext, string eventId, Action <MailboxSession, IRecipientSession, RequestDetailsLogger> action)
 {
     SimulatedWebRequestContext.Execute(userContext, eventId, delegate(RequestDetailsLogger logger)
     {
         ExchangePrincipal exchangePrincipal = userContext.ExchangePrincipal;
         if (exchangePrincipal == null)
         {
             return;
         }
         IRecipientSession arg = InstantMessageUtilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, exchangePrincipal, userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN);
         try
         {
             userContext.LockAndReconnectMailboxSession(3000);
             MailboxSession mailboxSession = userContext.MailboxSession;
             action(mailboxSession, arg, logger);
         }
         catch (OwaLockTimeoutException exception)
         {
             SimulatedWebRequestContext.ProcessException(logger, eventId, exception);
         }
         finally
         {
             if (userContext.MailboxSessionLockedByCurrentThread())
             {
                 userContext.UnlockAndDisconnectMailboxSession();
             }
         }
     });
 }
Exemplo n.º 2
0
 public void Clean(IList <string> rootDirectories)
 {
     if (this.IsCleaningOverdue())
     {
         lock (CobaltStoreCleaner.syncObject)
         {
             if (this.IsCleaningOverdue())
             {
                 SimulatedWebRequestContext.ExecuteWithoutUserContext("WAC.CleanCobaltStore", delegate(RequestDetailsLogger logger)
                 {
                     WacUtilities.SetEventId(logger, "WAC.CleanCobaltStore");
                     foreach (string text in rootDirectories)
                     {
                         CobaltStoreCleaner.ValidatePath(text);
                         try
                         {
                             this.CleanRootDirectory(text);
                         }
                         catch (DirectoryNotFoundException)
                         {
                         }
                     }
                 });
             }
         }
     }
 }
        internal static void LogExceptionsOnly(IMailboxContext userContext, string eventId, Action action)
        {
            ExchangeVersion value = ExchangeVersion.Current;

            try
            {
                ExchangeVersion.Current = ExchangeVersion.Latest;
                OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate()
                {
                    action();
                });
            }
            catch (GrayException ex)
            {
                string primarySmtpAddress = SimulatedWebRequestContext.GetPrimarySmtpAddress(userContext);
                bool   flag = false;
                RequestDetailsLogger requestDetailsLogger = SimulatedWebRequestContext.GetRequestDetailsLogger(eventId, userContext, primarySmtpAddress ?? "[user logged out]", out flag);
                SimulatedWebRequestContext.ProcessException(requestDetailsLogger, eventId, ex.InnerException);
                if (flag)
                {
                    requestDetailsLogger.Commit();
                }
            }
            finally
            {
                ExchangeVersion.Current = value;
            }
        }
        // Token: 0x06000D65 RID: 3429 RVA: 0x00032C78 File Offset: 0x00030E78
        private void LoadConversationFeedPropertiesIfRequested(QueryNotification notification, ConversationType conv)
        {
            bool flag   = false;
            int  index  = Array.IndexOf <PropertyDefinition>(this.SubscriptionProperties, ConversationItemSchema.ConversationInitialMemberDocumentId);
            int  index2 = Array.IndexOf <PropertyDefinition>(this.SubscriptionProperties, ConversationItemSchema.ConversationMemberDocumentIds);
            int? initialMemberDocumentId = null;

            int[] memberDocumentIds = null;
            if (RowNotificationHandler.IsPropertyDefined(notification, index))
            {
                initialMemberDocumentId = RowNotificationHandler.GetItemProperty <int?>(notification, index);
                flag = true;
            }
            if (RowNotificationHandler.IsPropertyDefined(notification, index2))
            {
                memberDocumentIds = RowNotificationHandler.GetItemProperty <int[]>(notification, index2);
                flag = true;
            }
            if (flag)
            {
                SimulatedWebRequestContext.Execute(base.UserContext, "LoadConversationFeedPropertiesIfRequested", delegate(MailboxSession mailboxSession, IRecipientSession adSession, RequestDetailsLogger logger)
                {
                    ConversationFeedLoader conversationFeedLoader = new ConversationFeedLoader(mailboxSession, this.TimeZone);
                    conversationFeedLoader.LoadConversationFeedItems(conv, initialMemberDocumentId, memberDocumentIds);
                });
            }
        }
 // Token: 0x06000D5D RID: 3421 RVA: 0x00032494 File Offset: 0x00030694
 public ConversationRowNotificationHandler(string subscriptionId, SubscriptionParameters parameters, StoreObjectId folderId, IMailboxContext userContext, Guid mailboxGuid, ExTimeZone timeZone, bool remoteSubscription, IFeaturesManager featuresManager) : base(subscriptionId, parameters, folderId, userContext, mailboxGuid, timeZone, remoteSubscription)
 {
     this.conversationViewQuerySubscriptionProperties = ConversationRowNotificationHandler.GetSubscriptionProperties(parameters.ConversationShapeName, featuresManager);
     SimulatedWebRequestContext.Execute(userContext, "ConversationNotificationDraftFolderId", delegate(MailboxSession mailboxSession, IRecipientSession adSession, RequestDetailsLogger logger)
     {
         this.draftFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Drafts);
     });
 }
Exemplo n.º 6
0
 // Token: 0x0600019F RID: 415 RVA: 0x0000706A File Offset: 0x0000526A
 private void TimerCallback(object unused)
 {
     SimulatedWebRequestContext.ExecuteWithoutUserContext("WAC.AutoSave", delegate(RequestDetailsLogger logger)
     {
         WacUtilities.SetEventId(logger, "WAC.AutoSave");
         logger.ActivityScope.SetProperty(OwaServerLogger.LoggerData.PrimarySmtpAddress, this.smtpAddress);
         logger.ActivityScope.SetProperty(WacRequestHandlerMetadata.ExchangeSessionId, this.exchangeSessionId);
         this.SaveAndLogExceptions(logger);
     });
 }
Exemplo n.º 7
0
 // Token: 0x06000F07 RID: 3847 RVA: 0x0003A878 File Offset: 0x00038A78
 protected virtual void SetPayloadOnQueryResultChangedNotification(PeopleIKnowRowNotificationPayload payload)
 {
     SimulatedWebRequestContext.Execute(base.UserContext, "PeopleIKnowRowNotification", delegate(MailboxSession mailboxSession, IRecipientSession adSession, RequestDetailsLogger logger)
     {
         FindPeopleParameters parameters = this.CreateFindPeopleParameters(logger);
         BrowsePeopleInMailFolder browsePeopleInMailFolder = new BrowsePeopleInMailFolder(parameters, mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.FromFavoriteSenders), NullTracer.Instance);
         FindPeopleResult findPeopleResult = browsePeopleInMailFolder.Execute();
         payload.Personas = findPeopleResult.PersonaList;
     });
 }
Exemplo n.º 8
0
 private void LogExceptionFromO365ShellService(Exception exception, string userPrincipalName, string userPuid, string shellServiceUrl)
 {
     SimulatedWebRequestContext.ExecuteWithoutUserContext("GetShellInfo", delegate(RequestDetailsLogger logger)
     {
         OwsLogRegistry.Register("GetShellInfo", typeof(SuiteServiceProxyHelper.GetShellInfoMetadata), new Type[0]);
         logger.ActivityScope.SetProperty(ExtensibleLoggerMetadata.EventId, "GetShellInfo");
         logger.ActivityScope.SetProperty(OwaServerLogger.LoggerData.PrimarySmtpAddress, userPrincipalName);
         logger.ActivityScope.SetProperty(SuiteServiceProxyHelper.GetShellInfoMetadata.UserPuid, userPuid);
         logger.ActivityScope.SetProperty(SuiteServiceProxyHelper.GetShellInfoMetadata.ShellServiceUrl, shellServiceUrl);
         logger.ActivityScope.SetProperty(ServiceCommonMetadata.GenericErrors, exception.ToString());
     });
 }
Exemplo n.º 9
0
        // Token: 0x06000205 RID: 517 RVA: 0x00007F14 File Offset: 0x00006114
        private bool TryExecuteWithNewLogger(out Dictionary <Guid, string> result)
        {
            Dictionary <Guid, string> paths = null;

            SimulatedWebRequestContext.ExecuteWithoutUserContext("WAC.MdbCacheUpdate", delegate(RequestDetailsLogger logger)
            {
                WacUtilities.SetEventId(logger, "WAC.MdbCacheUpdate");
                ADNotificationAdapter.RunADOperation(delegate()
                {
                    paths = this.ExecuteQuery(logger);
                });
            });
            result = paths;
            return(result != null);
        }
        internal static void Execute(IMailboxContext userContext, string eventId, Action <RequestDetailsLogger> action)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (string.IsNullOrEmpty(eventId))
            {
                throw new ArgumentException("String should not be null or empty.", "eventId");
            }
            string primarySmtpAddress = SimulatedWebRequestContext.GetPrimarySmtpAddress(userContext);

            if (primarySmtpAddress == null)
            {
                return;
            }
            ExchangeVersion      value = ExchangeVersion.Current;
            bool                 flag;
            RequestDetailsLogger logger = SimulatedWebRequestContext.GetRequestDetailsLogger(eventId, userContext, primarySmtpAddress, out flag);

            try
            {
                ExchangeVersion.Current = ExchangeVersion.Latest;
                OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate()
                {
                    action(logger);
                });
            }
            catch (GrayException ex)
            {
                SimulatedWebRequestContext.ProcessException(logger, eventId, ex.InnerException);
            }
            finally
            {
                if (flag)
                {
                    logger.Commit();
                }
                ExchangeVersion.Current = value;
            }
        }
Exemplo n.º 11
0
 internal static void OnCacheEntryExpired(CachedAttachmentInfo attachmentInfo)
 {
     SimulatedWebRequestContext.ExecuteWithoutUserContext("WAC.CacheEntryExpired", delegate(RequestDetailsLogger logger)
     {
         WacUtilities.SetEventId(logger, "WAC.CacheEntryExpired");
         logger.ActivityScope.SetProperty(OwaServerLogger.LoggerData.PrimarySmtpAddress, attachmentInfo.MailboxSmtpAddress);
         CobaltStore store = attachmentInfo.CobaltStore;
         ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
         {
             store.Saver.SaveAndLogExceptions(logger);
         });
         store.Dispose();
         Exception exception = adoperationResult.Exception;
         if (exception != null)
         {
             logger.ActivityScope.SetProperty(ServiceCommonMetadata.GenericErrors, exception.ToString());
         }
     });
 }
        internal static void ExecuteWithoutUserContext(string eventId, Action <RequestDetailsLogger> action)
        {
            RequestDetailsLogger logger = OwaApplication.GetRequestDetailsLogger;

            ActivityContext.ClearThreadScope();
            logger = RequestDetailsLoggerBase <RequestDetailsLogger> .InitializeRequestLogger();

            try
            {
                OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate()
                {
                    action(logger);
                });
            }
            catch (GrayException ex)
            {
                SimulatedWebRequestContext.ProcessException(logger, eventId, ex.InnerException);
            }
            finally
            {
                logger.Commit();
            }
        }
        // Token: 0x06000D64 RID: 3428 RVA: 0x00032724 File Offset: 0x00030924
        private ConversationType GetConversationFromNotification(QueryNotification notification)
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[ConversationRowNotificationHandler.GetConversationFromNotification] Start. SubscriptionId: {0}", base.SubscriptionId);
            ConversationType conv = new ConversationType();

            conv.InstanceKey = notification.Index;
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                conv.ConversationId          = new ItemId(IdConverter.ConversationIdToEwsId(base.MailboxGuid, RowNotificationHandler.GetItemProperty <ConversationId>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationId))), null);
                conv.ConversationTopic       = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationTopic));
                conv.UniqueRecipients        = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMVTo));
                conv.UniqueSenders           = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMVFrom));
                conv.LastDeliveryTime        = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationLastDeliveryTime));
                conv.LastDeliveryOrRenewTime = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationLastDeliveryOrRenewTime));
                conv.Categories = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationCategories));
                FlagType flagType = new FlagType();
                if (RowNotificationHandler.IsPropertyDefined(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationFlagStatus)))
                {
                    flagType.FlagStatus = (FlagStatus)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationFlagStatus), 0);
                }
                conv.FlagStatus         = flagType.FlagStatus;
                conv.HasAttachments     = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationHasAttach)));
                conv.HasIrm             = new bool?(RowNotificationHandler.GetItemProperty <bool>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationHasIrm)));
                conv.MessageCount       = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMessageCount)));
                conv.GlobalMessageCount = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalMessageCount)));
                conv.UnreadCount        = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationUnreadMessageCount)));
                conv.GlobalUnreadCount  = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalUnreadMessageCount)));
                conv.Size             = new int?(RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMessageSize)));
                conv.ItemClasses      = RowNotificationHandler.GetItemProperty <string[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationMessageClasses));
                conv.ImportanceString = ((ImportanceType)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationImportance), 1)).ToString();
                StoreId[] itemProperty = RowNotificationHandler.GetItemProperty <StoreId[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationItemIds), new StoreId[0]);
                conv.ItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty, (StoreId s) => new ItemId(base.GetEwsId(s), null));
                StoreId[] itemProperty2 = RowNotificationHandler.GetItemProperty <StoreId[]>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalItemIds), new StoreId[0]);
                conv.GlobalItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty2, (StoreId s) => new ItemId(base.GetEwsId(s), null));
                conv.DraftStoreIds = from storeId in itemProperty2
                                     where DraftItemIdsProperty.IsItemInDraftsFolder(storeId, this.draftFolderId)
                                     select StoreId.GetStoreObjectId(storeId);

                if (conv.DraftStoreIds.FirstOrDefault <StoreId>() != null)
                {
                    SimulatedWebRequestContext.Execute(base.UserContext, "ConversationNotificationDraftItemIds", delegate(MailboxSession mailboxSession, IRecipientSession adSession, RequestDetailsLogger logger)
                    {
                        NormalQueryView.PrepareDraftItemIds(mailboxSession, new ConversationType[]
                        {
                            conv
                        });
                    });
                }
                conv.LastModifiedTime   = base.GetDateTimeProperty(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, StoreObjectSchema.LastModifiedTime));
                conv.Preview            = RowNotificationHandler.GetItemProperty <string>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationPreview));
                conv.MailboxScopeString = MailboxSearchLocation.PrimaryOnly.ToString();
                IconIndex itemProperty3 = (IconIndex)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationReplyForwardState));
                if (itemProperty3 > (IconIndex)0)
                {
                    conv.IconIndexString = itemProperty3.ToString();
                }
                itemProperty3 = (IconIndex)RowNotificationHandler.GetItemProperty <int>(notification, Array.IndexOf <PropertyDefinition>(this.conversationViewQuerySubscriptionProperties, ConversationItemSchema.ConversationGlobalReplyForwardState));
                if (itemProperty3 > (IconIndex)0)
                {
                    conv.GlobalIconIndexString = itemProperty3.ToString();
                }
                this.LoadConversationFeedPropertiesIfRequested(notification, conv);
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[ConversationRowNotificationHandler.GetConversationFromNotification] End. SubscriptionId: {0}", base.SubscriptionId);
            }
            return(conv);
        }