@VisibleForTesting
  ExportResult<MediaContainerResource> exportOneDrivePhotos(TokensAndUrlAuthData authData,
      Optional<IdOnlyContainerResource> albumData, Optional<PaginationData> paginationData,
      UUID jobId) throws IOException {
    Optional<String> albumId = Optional.empty();
    if (albumData.isPresent()) {
      albumId = Optional.of(albumData.get().getId());
    }
    Optional<String> paginationUrl = getDrivePaginationToken(paginationData);

    MicrosoftDriveItemsResponse driveItemsResponse;
    if (paginationData.isPresent() || albumData.isPresent()) {
      driveItemsResponse =
          getOrCreateMediaInterface(authData).getDriveItems(albumId, paginationUrl);
    } else {
      driveItemsResponse = getOrCreateMediaInterface(authData).getDriveItemsFromSpecialFolder(
          MicrosoftSpecialFolder.FolderType.photos);
    }

    PaginationData nextPageData = setNextPageToken(driveItemsResponse);
    ContinuationData continuationData = new ContinuationData(nextPageData);
    MediaContainerResource containerResource;
    MicrosoftDriveItem[] driveItems = driveItemsResponse.getDriveItems();
    List<MediaAlbum> albums = new ArrayList<>();
    List<PhotoModel> photos = new ArrayList<>();
    List<VideoModel> videos = new ArrayList<>();

    if (driveItems != null && driveItems.length > 0) {
      for (MicrosoftDriveItem driveItem : driveItems) {
        MediaAlbum album = tryConvertDriveItemToMediaAlbum(driveItem, jobId);
        if (album != null) {
          albums.add(album);
          continuationData.addContainerResource(new IdOnlyContainerResource(driveItem.id));
          continue;
        }

        PhotoModel photo = tryConvertDriveItemToPhotoModel(albumId, driveItem, jobId);
        if (photo != null) {
          photos.add(photo);
          continue;
        }

        VideoModel video = tryConvertDriveItemToVideoModel(albumId, driveItem, jobId);
        if (video != null) {
          videos.add(video);
          continue;
        }
      }
    }

    ExportResult.ResultType result =
        nextPageData == null ? ExportResult.ResultType.END : ExportResult.ResultType.CONTINUE;
    containerResource = new MediaContainerResource(albums, photos, videos);
    return new ExportResult<>(result, containerResource, continuationData);
  }
Exports Microsoft OneDrive photos using the Graph API.

<p>Converts folders to media albums.
extensions/data-transfer/portability-data-transfer-microsoft/src/main/java/org/datatransferproject/transfer/microsoft/media/MicrosoftMediaExporter.java