EWS.FindItems returning more items than expected from your inbox?

In my inbox, I only have 5 emails (4 unread, as shown in the picture, and one already read).

** Inbox Folder **

Also, in each of the search folders such as unread emails, follow-ups, etc. I have a lot of emails (over 1000) and the oldest is dated 2011 (date / time received).

When doing FindItems, I find an even older email that has a property DateTimeReceived

worth 2004-08-15?

The only thing I can think of is that using the FindItems method also retrieves emails from archived ones, right?

getInboxItems

private FindItemsResults<Item> getInboxItems() {
    var inboxFolderId = new FolderId(WellKnownFolderName.Inbox
                                    , mailboxConfiguration.MailboxName);
    var allItems = new ItemView(int.MaxValue) {
        Traversal = ItemTraversal.Shallow
        , PropertySet = new PropertySet(EmailMessageShema.DateTimeReceived
            , EmailMessageSchema.LastModifiedTime)
    };
    var foundItems = Service.FindItems(inboxFolderId, allItems);
    return foundItems;
}

      

This returns about 40 emails and among them the oldest obsolete email from 2004 was found, which I can't find anywhere in any mailbox folder when accessing it through Outlook.

Short question: What's going on?

I cannot find anything on the internet for this.

UPDATE

After further investigation, the provided sample code is proven to be opaque according to these simple steps:

  • Select the Inbox folder, right click and select Properties

** Inbox Properties **

  1. Inbox tab, General tab, click Show Count of All Items (may differ from the actual English version as I translated myself as I thought it might be in English).

** Display All Items **

  1. Now back to the Inbox, we can see that there are actually a lot of items.

** Inbox folder total count of items **

So, it seems that my code is correct, and although this total count reports 35 when the Inbox is selected, I only see the five aforementioned emails.

I thought it might have something to do with archived items and I was confirmed that archived emails are moved to an external archive tool and removed from Exchange, which leaves me clueless.

+3


source to share


1 answer


It turned out that these are private issues causing the problem.

Private objects are not visible to others than the user who made the items private and are still part of the items contained in the Inbox.

After it was proved that these are personal belongings, it was possible:



  • authenticate yourself OWA

    ** OWA Authentication **

  • click on its name to open the dropdown and enter a mailbox to access

    ** OWA Access target Inbox **

  • after access, you can see the old elements and consider removing them

Once all of these items were removed, everything returned to normal and EWS.FindItems reported the correct number of items, as it always did.

So the problem really was in the inbox on the Exchange side of the coin and not on the EWS side.

0


source







All Articles