From fbbf6aa84c3438edb6510410b0df215c8dc64da0 Mon Sep 17 00:00:00 2001 From: ashmrtn Date: Mon, 19 Dec 2022 15:12:25 -0800 Subject: [PATCH] Fetch isRead attribute in email delta queries (#1867) ## Description Updating the isRead flag in M365 does not cause the mod time of the item to be updated. This means delta queries will not return items marked as [un]read when isRead is not one of the attributes requested in the $select clause. Explicitly fetch isRead so that we get those items. Further changes will be required to ensure the mod time of the item is something that will not cause kopia-assisted dedupe to skip the item when only the isRead attribute has been changed. ## Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No ## Type of change - [ ] :sunflower: Feature - [x] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Test - [ ] :computer: CI/Deployment - [ ] :hamster: Trivial/Minor ## Issue(s) * closes #1866 ## Test Plan - [x] :muscle: Manual - [x] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/connector/exchange/query_options.go | 1 + src/internal/connector/exchange/service_iterators.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/connector/exchange/query_options.go b/src/internal/connector/exchange/query_options.go index 76d9b8c63..e42c4c6b4 100644 --- a/src/internal/connector/exchange/query_options.go +++ b/src/internal/connector/exchange/query_options.go @@ -66,6 +66,7 @@ var ( "subject": 4, "webLink": 5, "id": 6, + "isRead": 7, } fieldsForContacts = map[string]int{ diff --git a/src/internal/connector/exchange/service_iterators.go b/src/internal/connector/exchange/service_iterators.go index 082d4a03a..3a9fa7801 100644 --- a/src/internal/connector/exchange/service_iterators.go +++ b/src/internal/connector/exchange/service_iterators.go @@ -421,7 +421,7 @@ func FetchMessageIDsFromDirectory( deltaURL string ) - options, err := optionsForFolderMessagesDelta([]string{"id"}) + options, err := optionsForFolderMessagesDelta([]string{"isRead"}) if err != nil { return nil, deltaURL, errors.Wrap(err, "getting query options") }