Skip to content

Conversation

@uipreliga
Copy link
Collaborator

This pull request adds the ability to search for Outlook messages by a specific term, improves header handling for authenticated requests, and introduces a configuration option for specifying a search term. The main logic now conditionally uses the search feature if a search term is provided, otherwise it retrieves inbox messages as before.

New search functionality:

  • Added a new search_messages method to the OutlookClient class, allowing searching for messages containing a specific term, with support for result limiting and field selection. The method also sorts results by receivedDateTime in descending order.

Configuration and main flow updates:

  • Added a search_term option to the configuration, loaded from the SEARCH_TERM environment variable.
  • Updated the main logic in outlook_main.py to use the new search functionality when a search term is specified, otherwise defaulting to inbox retrieval.

Request handling improvements:

  • Enhanced the _make_request method in OutlookClient to accept custom headers, enabling use of the ConsistencyLevel header required for search queries.
  • Improved token refresh logic to update the request headers more robustly when retrying after authentication errors.

@uipreliga uipreliga requested a review from mircean September 22, 2025 22:41
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.

2 participants