protected override PolicyContextMenuBase InternalGetPolicyMenu(ref OwaStoreObjectId itemId)
        {
            if (itemId != null)
            {
                if (itemId.OwaStoreObjectIdType != OwaStoreObjectIdType.MailBoxObject && itemId.OwaStoreObjectIdType != OwaStoreObjectIdType.ArchiveMailboxObject && itemId.OwaStoreObjectIdType != OwaStoreObjectIdType.Conversation && itemId.OwaStoreObjectIdType != OwaStoreObjectIdType.ArchiveConversation)
                {
                    throw new OwaInvalidRequestException("Only (archive)mailbox and (archive)conversation objects can be handled.");
                }
                if (itemId.IsConversationId)
                {
                    OwaStoreObjectId[] allItemIds = ConversationUtilities.GetAllItemIds(base.UserContext, new OwaStoreObjectId[]
                    {
                        itemId
                    }, new StoreObjectId[0]);
                    if (allItemIds.Length == 1)
                    {
                        itemId = allItemIds[0];
                    }
                }
            }
            DeletePolicyContextMenu deletePolicyContextMenu = DeletePolicyContextMenu.Create(base.UserContext);

            if (itemId != null && !itemId.IsConversationId && itemId.IsStoreObjectId && itemId.StoreObjectId.IsFolderId)
            {
                StoreObjectId storeObjectId = itemId.StoreObjectId;
                StoreSession  session       = itemId.GetSession(base.UserContext);
                if (Utilities.IsDefaultFolderId(session, storeObjectId, DefaultFolderType.Inbox) || Utilities.IsDefaultFolderId(session, storeObjectId, DefaultFolderType.Drafts) || Utilities.IsDefaultFolderId(session, storeObjectId, DefaultFolderType.SentItems) || Utilities.IsDefaultFolderId(session, storeObjectId, DefaultFolderType.Notes) || Utilities.IsDefaultFolderId(session, storeObjectId, DefaultFolderType.JunkEmail) || Utilities.IsDefaultFolderId(session, storeObjectId, DefaultFolderType.DeletedItems))
                {
                    deletePolicyContextMenu.RenderCheckedOnly = true;
                }
            }
            return(deletePolicyContextMenu);
        }
        // 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);
            }
        }
Пример #3
0
 // Token: 0x06002EA0 RID: 11936 RVA: 0x0010A70C File Offset: 0x0010890C
 protected override PolicyContextMenuBase InternalGetPolicyMenu(ref OwaStoreObjectId itemId)
 {
     if (itemId != null)
     {
         if (itemId.OwaStoreObjectIdType != OwaStoreObjectIdType.MailBoxObject && itemId.OwaStoreObjectIdType != OwaStoreObjectIdType.Conversation)
         {
             throw new OwaInvalidRequestException("Only mailbox and conversation objects can be handled.");
         }
         if (itemId.IsConversationId)
         {
             OwaStoreObjectId[] allItemIds = ConversationUtilities.GetAllItemIds(base.UserContext, new OwaStoreObjectId[]
             {
                 itemId
             }, new StoreObjectId[0]);
             if (allItemIds.Length == 1)
             {
                 itemId = allItemIds[0];
             }
         }
     }
     return(MovePolicyContextMenu.Create(base.UserContext));
 }