Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get this error because the FindItemsResult isn't compatible with exchange version I'm using which is 2013.

Exchange Server doesn't support the requested version.


My codes:

C#
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
        FindItemsResults<Item> items = service.FindItems(WellKnownFolderName.Inbox, sf, new ItemView(10));

        foreach (Item item in items.Items)
        {
            PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.TextBody);
            EmailMessage email = EmailMessage.Bind(service, item.Id, propSet);
            Program.SearchItems(email);  
        }


What I have tried:

I could just change it into Exchange 2010 but I get an error in TextBody since this is only for Exchange 2013 and later versions.

Is there any way to convert the code which can work in Exchange 2013?
Posted
Comments
Dave Kreskowiak 4-Apr-16 22:52pm    
What does the code look like where you created your service, ExchangeService, object?

Judging by the error message, it would seem that the server either isn't running Exchange 2013 or the code you used to create the ExchangeService object isn't using the Exchange version you assume it is.
dumbasian 4-Apr-16 22:57pm    
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
Dave Kreskowiak 4-Apr-16 23:06pm    
OK, next step is to look at the contents of service.ServerInfo and verify that is contains what you expect.
dumbasian 4-Apr-16 23:28pm    
It's in version 14.3.210.4002 so I should be using Exchange2010_SP2. I did first but I can't use the ItemSchema.TextBody because it isn't compatible in 2010 version so I changed it but got the error in FindItemsResults instead.
dumbasian 5-Apr-16 3:16am    
I've already solved this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900