From 95f9ae199ebb5c31b351df8c9c420084570a1e81 Mon Sep 17 00:00:00 2001 From: Sean Story Date: Fri, 15 Nov 2024 11:13:19 -0600 Subject: [PATCH 1/3] Filter users to only include active ones --- connectors/sources/outlook.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/connectors/sources/outlook.py b/connectors/sources/outlook.py index 47a495162..3b9c67cb4 100644 --- a/connectors/sources/outlook.py +++ b/connectors/sources/outlook.py @@ -43,7 +43,7 @@ hash_id, html_to_text, iso_utc, - retryable, + retryable, url_encode, ) RETRIES = 3 @@ -410,7 +410,8 @@ async def _fetch_token(self): ) async def get_users(self): access_token = await self._fetch_token() - url = f"https://graph.microsoft.com/v1.0/users?$top={TOP}" + filter_ = url_encode("accountEnabled eq true") + url = f"https://graph.microsoft.com/v1.0/users?$top={TOP}&$filter={filter_}" while True: try: async with self._get_session.get( From 3908e078841ae0c042c83db105f6d7bcdf07d5d0 Mon Sep 17 00:00:00 2001 From: Sean Story Date: Fri, 15 Nov 2024 11:19:08 -0600 Subject: [PATCH 2/3] autoformat --- connectors/sources/outlook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connectors/sources/outlook.py b/connectors/sources/outlook.py index 3b9c67cb4..1f3573fb0 100644 --- a/connectors/sources/outlook.py +++ b/connectors/sources/outlook.py @@ -43,7 +43,8 @@ hash_id, html_to_text, iso_utc, - retryable, url_encode, + retryable, + url_encode, ) RETRIES = 3 From 78cb52d7d60a5cc4e5ac698c531b7b7670a526ca Mon Sep 17 00:00:00 2001 From: Sean Story Date: Fri, 15 Nov 2024 13:05:02 -0600 Subject: [PATCH 3/3] fix outlook tests --- tests/sources/test_outlook.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/sources/test_outlook.py b/tests/sources/test_outlook.py index 31cc507c2..213717112 100644 --- a/tests/sources/test_outlook.py +++ b/tests/sources/test_outlook.py @@ -420,7 +420,10 @@ def side_effect_function(url, headers): Args: url, ssl: Params required for get call """ - if url == "https://graph.microsoft.com/v1.0/users?$top=999": + if ( + url + == "https://graph.microsoft.com/v1.0/users?$top=999&$filter=accountEnabled%20eq%20true" + ): return get_json_mock( mock_response={ "@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$top=999&$skipToken=fake-skip-token",