Skip to content

Conversation

@NeilRashbrook
Copy link
Collaborator

This is implemented only for the per-folder search at the bottom of the message list because Exchange does not support deep search traversal.

This is implemented only for EWS, because:

  • ActiveSync only has a free-text and/or message date received search, plus it has custom IDs for search results that cannot be mapped onto the original message. Thanks, Microsoft!
  • OWA does not use FindItem for searching, so as yet I don't even know whether you can specify search terms. Instead it uses its own free-text based search. For Office 365 you can at least search for unread messages (this works by appending isRead:false to the search keyword).

@NeilRashbrook NeilRashbrook self-assigned this Oct 2, 2025
@NeilRashbrook
Copy link
Collaborator Author

Looking into searching with OWA, I discovered that it uses a FindItem request to search for deleted contacts. I was eventually able to adapt this request into a request to search messages for starred, unread or keywords.

@NeilRashbrook
Copy link
Collaborator Author

Having tried to directly search contact fields in #901, I realised that for messages I was actually getting a case-insensitive search even though I had not specified in the query, so I've updated the queries to specify case-insensitive searching just in case it makes a difference.

@NeilRashbrook NeilRashbrook force-pushed the neil/ews-search-messages-on-server-poc branch from 205652e to 44ad6a4 Compare October 7, 2025 21:55
to.emailAddress?.toLowerCase().includes(searchTerm)) ||
msg.text?.toLowerCase().includes(searchTerm))
) as ArrayColl<EMail>;
searchMessages = await folder.searchMessages(isShowStarred, isShowUnread, searchTerm);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quick search. It's searching only the displayed emails and therefore extremely fast. It matches the Thunderbird quick search.

The API to implement is SearchEMail. This is searches the entire DB. Now it should also search the server. Please implement that API.

I understand that Exchange can search only 1 folder at a time. We need to discuss how to deal with that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to try it out on a search query that I knew I would be able to code so I implemented it for tags but unfortunately it turns out that the tags pane doesn't work at all for some reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tags bug was actually FastList's fault for not showing me the tagged messages. Filed PR #910.

@NeilRashbrook
Copy link
Collaborator Author

Added commit 538a38d to demonstrate global server-side search. When no folder is specified, we pass the list of folders to Exchange which then gives us an array of results as if we had searched each folder separately, and we then combine the results at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants