What is the maximal size of an ItemView in EWS?
Asked Answered
R

3

7

The ViewSize is specified at constructor level. I found the documentation for the constructor, but it doesn't say how big the maximal size is.

Rectrix answered 10/10, 2012 at 6:50 Comment(0)
S
9

There is limit of 2,147,483,647 as it's data type is Int32, I used it and also tested it not return any error if we pass ItemView(2147483647);

It's just define page size of search item,if there are more search item results than the view page size,subsequent calls that use ItemView offsets must be performed to return the rest of the results.

ref - http://msdn.microsoft.com/en-us/library/exchange/dd633693%28v=exchg.80%29.aspx http://msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx

Synesthesia answered 28/2, 2013 at 16:14 Comment(3)
but when I do var privateContacts = service.FindItems(WellKnownFolderName.Contacts, new ItemView(9999)); it always gets me to a limit of 1000...Sami
HI, @sLw I am sorry to say that I am no more pursuing exchange-server development so I can not further comments or evaluate your saying. If you think my answer is outdated (As posted in 2013) please feel free to update it or create new answer.Synesthesia
I fixed it by using the Answer below by Raja. It goes through every next 1000 records ;)Sami
C
9

You can specify Int32 value in ItemView constructor but only thousand items will be returnd. You have to specify a loop to get the remaining items.

        bool more = true;
        ItemView view = new ItemView(int.MaxValue, 0, OffsetBasePoint.Beginning);
        view.PropertySet = PropertySet.IdOnly;
        FindItemsResults<Item> findResults;
        List<EmailMessage> emails = new List<EmailMessage>();
        while (more)
        {
            findResults = service.FindItems(WellKnownFolderName.Inbox, view);
            foreach (var item in findResults.Items)
            {
                emails.Add((EmailMessage)item);
            }
            more = findResults.MoreAvailable;
            if (more)
            {
                view.Offset += 1000;
            }
        }
Classmate answered 26/5, 2015 at 7:24 Comment(0)
U
5

The default policy in Exchange limits the page size to 1000 items. Setting the page size to a value that is greater than this number has no practical effect. Applications should also account for the fact that the EWSFindCountLimit throttling parameter value may result in a partial result set being returned for applications that make concurrent requests.

http://msdn.microsoft.com/en-us/library/office/jj945066(v=exchg.150).aspx

Undergraduate answered 18/2, 2014 at 17:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.