diff --git a/CHANGELOG.md b/CHANGELOG.md index 56f24db17..b981d778a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Check if the user specified for an exchange backup operation has a mailbox. +- Handle case where user's drive has not been initialized ## [v0.1.0] (alpha) - 2023-01-13 diff --git a/src/internal/connector/onedrive/drive.go b/src/internal/connector/onedrive/drive.go index e98e8d35b..18a1b2477 100644 --- a/src/internal/connector/onedrive/drive.go +++ b/src/internal/connector/onedrive/drive.go @@ -76,7 +76,8 @@ const ( itemChildrenRawURLFmt = "https://graph.microsoft.com/v1.0/drives/%s/items/%s/children" itemByPathRawURLFmt = "https://graph.microsoft.com/v1.0/drives/%s/items/%s:/%s" itemNotFoundErrorCode = "itemNotFound" - userDoesNotHaveDrive = "BadRequest Unable to retrieve user's mysite URL" + userMysiteURLNotFound = "BadRequest Unable to retrieve user's mysite URL" + userMysiteNotFound = "ResourceNotFound User's mysite not found" ) // Enumerates the drives for the specified user @@ -134,7 +135,8 @@ func userDrives(ctx context.Context, service graph.Servicer, user string) ([]mod r, err = service.Client().UsersById(user).Drives().Get(ctx, nil) if err != nil { detailedError := support.ConnectorStackErrorTrace(err) - if strings.Contains(detailedError, userDoesNotHaveDrive) { + if strings.Contains(detailedError, userMysiteURLNotFound) || + strings.Contains(detailedError, userMysiteNotFound) { logger.Ctx(ctx).Debugf("User %s does not have a drive", user) return make([]models.Driveable, 0), nil // no license }