Example #1
0
        internal void MarkPayloadAsRead()
        {
            string queryStringParameter = Utilities.GetQueryStringParameter(this.Request, "mrd", false);

            if (queryStringParameter != null)
            {
                JunkEmailStatus junkEmailStatus       = JunkEmailStatus.Unknown;
                string          queryStringParameter2 = Utilities.GetQueryStringParameter(this.Request, "JS", false);
                int             num;
                if (queryStringParameter2 != null && int.TryParse(queryStringParameter2, out num) && (num == 1 || num == 0))
                {
                    junkEmailStatus = (JunkEmailStatus)num;
                }
                OwaStoreObjectId   owaStoreObjectId = OwaStoreObjectId.CreateFromString(queryStringParameter);
                OwaStoreObjectId[] localItemIds     = ConversationUtilities.GetLocalItemIds(this.UserContext, new OwaStoreObjectId[]
                {
                    owaStoreObjectId
                }, null, new PropertyDefinition[]
                {
                    MessageItemSchema.IsRead
                }, (IStorePropertyBag propertyBag) => !ItemUtility.GetProperty <bool>(propertyBag, MessageItemSchema.IsRead, true));
                if (localItemIds.Length > 0)
                {
                    Utilities.MarkItemsAsRead(this.UserContext, localItemIds, junkEmailStatus, false);
                }
            }
        }
        // Token: 0x06002E97 RID: 11927 RVA: 0x0010A150 File Offset: 0x00108350
        private void MarkAsReadOrUnread(bool isRead)
        {
            OwaStoreObjectId[] array = (OwaStoreObjectId[])base.GetParameter("id");
            if (ConversationUtilities.ContainsConversationItem(base.UserContext, array))
            {
                List <OwaStoreObjectId> list  = new List <OwaStoreObjectId>();
                List <OwaStoreObjectId> list2 = new List <OwaStoreObjectId>();
                foreach (OwaStoreObjectId owaStoreObjectId in array)
                {
                    if (base.UserContext.SentItemsFolderId.Equals(owaStoreObjectId.ParentFolderId))
                    {
                        list.Add(owaStoreObjectId);
                    }
                    else
                    {
                        list2.Add(owaStoreObjectId);
                    }
                }
                List <OwaStoreObjectId>        list3  = new List <OwaStoreObjectId>();
                Func <IStorePropertyBag, bool> filter = (IStorePropertyBag propertyBag) => ItemUtility.GetProperty <bool>(propertyBag, MessageItemSchema.IsRead, isRead) != isRead;
                if (list2.Count > 0)
                {
                    list3.AddRange(ConversationUtilities.GetAllItemIds(base.UserContext, list2.ToArray(), new PropertyDefinition[]
                    {
                        MessageItemSchema.IsRead
                    }, filter, new StoreObjectId[]
                    {
                        base.UserContext.SentItemsFolderId
                    }));
                }
                if (list.Count > 0)
                {
                    list3.AddRange(ConversationUtilities.GetAllItemIds(base.UserContext, list.ToArray(), new PropertyDefinition[]
                    {
                        MessageItemSchema.IsRead
                    }, filter, new StoreObjectId[0]));
                }
                array = list3.ToArray();
            }
            if (array.Length > 500)
            {
                throw new OwaInvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Marking {0} item(s) as read or unread in a single request is not supported", new object[]
                {
                    array.Length
                }));
            }
            JunkEmailStatus junkEmailStatus = JunkEmailStatus.NotJunk;

            if (base.IsParameterSet("JS"))
            {
                junkEmailStatus = (JunkEmailStatus)base.GetParameter("JS");
            }
            if (array.Length > 0)
            {
                Utilities.MarkItemsAsRead(base.UserContext, array, junkEmailStatus, !isRead);
            }
        }