diff --git a/src/internal/connector/discovery/api/users.go b/src/internal/connector/discovery/api/users.go index 931b689fe..b47fc1184 100644 --- a/src/internal/connector/discovery/api/users.go +++ b/src/internal/connector/discovery/api/users.go @@ -182,10 +182,19 @@ func (c Users) GetInfo(ctx context.Context, userID string) (*UserInfo, error) { var ( err error userInfo = newUserInfo() + + requestParameters = &users.ItemMailFoldersRequestBuilderGetQueryParameters{ + Select: []string{"id"}, + Top: ptr.To[int32](1), // if we get any folders, then we have access. + } + + options = users.ItemMailFoldersRequestBuilderGetRequestConfiguration{ + QueryParameters: requestParameters, + } ) // TODO: OneDrive - _, err = c.stable.Client().UsersById(userID).MailFolders().Get(ctx, nil) + _, err = c.stable.Client().UsersById(userID).MailFolders().Get(ctx, &options) if err != nil { if !graph.IsErrExchangeMailFolderNotFound(err) { return nil, graph.Wrap(ctx, err, "getting user's mail folder") diff --git a/src/internal/connector/exchange/api/api_test.go b/src/internal/connector/exchange/api/api_test.go index c5708f159..3d15cc6ec 100644 --- a/src/internal/connector/exchange/api/api_test.go +++ b/src/internal/connector/exchange/api/api_test.go @@ -84,86 +84,6 @@ func (suite *ExchangeServiceSuite) TestOptionsForCalendars() { } } -// TestOptionsForFolders ensures that approved query options -// are added to the RequestBuildConfiguration. Expected will always be +1 -// on than the input as "id" are always included within the select parameters -func (suite *ExchangeServiceSuite) TestOptionsForFolders() { - tests := []struct { - name string - params []string - checkError assert.ErrorAssertionFunc - expected int - }{ - { - name: "Valid Folder Option", - params: []string{"parentFolderId"}, - checkError: assert.NoError, - expected: 2, - }, - { - name: "Multiple Folder Options: Valid", - params: []string{"displayName", "isHidden"}, - checkError: assert.NoError, - expected: 3, - }, - { - name: "Invalid Folder option param", - params: []string{"status"}, - checkError: assert.Error, - }, - } - for _, test := range tests { - suite.Run(test.name, func() { - t := suite.T() - - config, err := optionsForMailFolders(test.params) - test.checkError(t, err, clues.ToCore(err)) - if err == nil { - assert.Equal(t, test.expected, len(config.QueryParameters.Select)) - } - }) - } -} - -// TestOptionsForContacts similar to TestExchangeService_optionsForFolders -func (suite *ExchangeServiceSuite) TestOptionsForContacts() { - tests := []struct { - name string - params []string - checkError assert.ErrorAssertionFunc - expected int - }{ - { - name: "Valid Contact Option", - params: []string{"displayName"}, - checkError: assert.NoError, - expected: 2, - }, - { - name: "Multiple Contact Options: Valid", - params: []string{"displayName", "parentFolderId"}, - checkError: assert.NoError, - expected: 3, - }, - { - name: "Invalid Contact Option param", - params: []string{"status"}, - checkError: assert.Error, - }, - } - for _, test := range tests { - suite.Run(test.name, func() { - t := suite.T() - - options, err := optionsForContacts(test.params) - test.checkError(t, err, clues.ToCore(err)) - if err == nil { - assert.Equal(t, test.expected, len(options.QueryParameters.Select)) - } - }) - } -} - //nolint:lll var stubHTMLContent = "\r\n
Happy New Year,

In accordance with TPS report guidelines, there have been questions about how to address our activities SharePoint Cover page. Do you believe this is the best picture? 



Let me know if this meets our culture requirements.

Warm Regards,

Dustin
" diff --git a/src/internal/connector/exchange/api/options.go b/src/internal/connector/exchange/api/options.go index b822070d9..3f53fd91e 100644 --- a/src/internal/connector/exchange/api/options.go +++ b/src/internal/connector/exchange/api/options.go @@ -155,27 +155,6 @@ func optionsForContactFolderByID(moreOps []string) ( return options, nil } -// optionsForMailFolders transforms the options into a more dynamic call for MailFolders. -// @param moreOps is a []string of options(e.g. "displayName", "isHidden") -// @return is first call in MailFolders().GetWithRequestConfigurationAndResponseHandler(options, handler) -func optionsForMailFolders( - moreOps []string, -) (*users.ItemMailFoldersRequestBuilderGetRequestConfiguration, error) { - selecting, err := buildOptions(moreOps, fieldsForFolders) - if err != nil { - return nil, err - } - - requestParameters := &users.ItemMailFoldersRequestBuilderGetQueryParameters{ - Select: selecting, - } - options := &users.ItemMailFoldersRequestBuilderGetRequestConfiguration{ - QueryParameters: requestParameters, - } - - return options, nil -} - // optionsForMailFoldersItem transforms the options into a more dynamic call for MailFoldersById. // moreOps is a []string of options(e.g. "displayName", "isHidden") // Returns first call in MailFoldersById().GetWithRequestConfigurationAndResponseHandler(options, handler) @@ -236,24 +215,6 @@ func optionsForContactChildFolders( return options, nil } -// optionsForContacts transforms options into select query for MailContacts -// @return is the first call in Contacts().GetWithRequestConfigurationAndResponseHandler(options, handler) -func optionsForContacts(moreOps []string) (*users.ItemContactsRequestBuilderGetRequestConfiguration, error) { - selecting, err := buildOptions(moreOps, fieldsForContacts) - if err != nil { - return nil, err - } - - requestParameters := &users.ItemContactsRequestBuilderGetQueryParameters{ - Select: selecting, - } - options := &users.ItemContactsRequestBuilderGetRequestConfiguration{ - QueryParameters: requestParameters, - } - - return options, nil -} - // buildOptions - Utility Method for verifying if select options are valid for the m365 object type // @return is a pair. The first is a string literal of allowable options based on the object type, // the second is an error. An error is returned if an unsupported option or optionIdentifier was used