diff --git a/src/internal/connector/exchange/iterators_test.go b/src/internal/connector/exchange/iterators_test.go index 7310c295f..0c8797d72 100644 --- a/src/internal/connector/exchange/iterators_test.go +++ b/src/internal/connector/exchange/iterators_test.go @@ -1,6 +1,7 @@ package exchange import ( + "context" "testing" absser "github.com/microsoft/kiota-abstractions-go/serialization" @@ -75,6 +76,7 @@ func loadService(t *testing.T) *exchangeService { // functions are valid for current versioning of msgraph-go-sdk func (suite *ExchangeIteratorSuite) TestIterativeFunctions() { var ( + ctx = context.Background() t = suite.T() mailScope, contactScope selectors.ExchangeScope userID = tester.M365UserID(t) @@ -141,6 +143,7 @@ func (suite *ExchangeIteratorSuite) TestIterativeFunctions() { // callbackFunc iterates through all models.Messageable and fills exchange.Collection.jobs[] // with corresponding item IDs. New collections are created for each directory callbackFunc := test.iterativeFunction( + ctx, userID, test.scope, errs, false, diff --git a/src/internal/connector/exchange/service_iterators.go b/src/internal/connector/exchange/service_iterators.go index 04305ebe1..7fcdbf50e 100644 --- a/src/internal/connector/exchange/service_iterators.go +++ b/src/internal/connector/exchange/service_iterators.go @@ -1,6 +1,7 @@ package exchange import ( + "context" "fmt" "github.com/microsoftgraph/msgraph-sdk-go/models" @@ -29,6 +30,7 @@ type displayable interface { // GraphIterateFuncs are iterate functions to be used with the M365 iterators (e.g. msgraphgocore.NewPageIterator) // @returns a callback func that works with msgraphgocore.PageIterator.Iterate function type GraphIterateFunc func( + ctx context.Context, user string, scope selectors.ExchangeScope, errs error, @@ -43,6 +45,7 @@ type GraphIterateFunc func( // objects belonging to any folder are // placed into a Collection based on the parent folder func IterateSelectAllDescendablesForCollections( + ctx context.Context, user string, scope selectors.ExchangeScope, errs error, @@ -108,6 +111,7 @@ func IterateSelectAllDescendablesForCollections( // and storing events in collections based on // the calendarID which originates from M365. func IterateSelectAllEventsForCollections( + ctx context.Context, user string, scope selectors.ExchangeScope, errs error, @@ -191,6 +195,7 @@ func IterateSelectAllEventsForCollections( // that places exchange mail message ids belonging to specific directories // into a Collection. Messages outside of those directories are omitted. func IterateAndFilterMessagesForCollections( + ctx context.Context, user string, scope selectors.ExchangeScope, errs error, @@ -204,6 +209,7 @@ func IterateAndFilterMessagesForCollections( return func(messageItem any) bool { if !isFilterSet { err := CollectMailFolders( + ctx, scope, user, collections, @@ -237,6 +243,7 @@ func IterateAndFilterMessagesForCollections( } func IterateFilterFolderDirectoriesForCollections( + ctx context.Context, user string, scope selectors.ExchangeScope, errs error, diff --git a/src/internal/connector/exchange/service_query.go b/src/internal/connector/exchange/service_query.go index f43567205..a5d5c04b6 100644 --- a/src/internal/connector/exchange/service_query.go +++ b/src/internal/connector/exchange/service_query.go @@ -1,6 +1,7 @@ package exchange import ( + "context" "fmt" absser "github.com/microsoft/kiota-abstractions-go/serialization" @@ -124,6 +125,7 @@ func RetrieveMessageDataForUser(gs graph.Service, user, m365ID string) (absser.P } func CollectMailFolders( + ctx context.Context, scope selectors.ExchangeScope, user string, collections map[string]*Collection, @@ -155,6 +157,7 @@ func CollectMailFolders( } callbackFunc := IterateFilterFolderDirectoriesForCollections( + ctx, user, scope, err, diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index 38fff9e67..901523a21 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -350,7 +350,7 @@ func (gc *GraphConnector) createCollections( // callbackFunc iterates through all M365 object target and fills exchange.Collection.jobs[] // with corresponding item M365IDs. New collections are created for each directory. // Each directory used the M365 Identifier. The use of ID stops collisions betweens users - callbackFunc := gIter(user, scope, errs, gc.failFast, gc.credentials, collections, gc.statusCh) + callbackFunc := gIter(ctx, user, scope, errs, gc.failFast, gc.credentials, collections, gc.statusCh) iterateError := pageIterator.Iterate(callbackFunc) if iterateError != nil {