---
schema_version: "1"
id: 5303b2073a5035c05b04c314e9a7a9dfff24b89d88fdb21f2e7412b69b57d6ea
title: Get Repositories
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/connectapi_examples_get_repositories.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_get_repositories.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 371c8169b21dd5a6f3d2746e26651f4fbcf108d5316487c91c591e4b5d072bd4
description: Call a method to get all repositories.
---
# Get Repositories

Call a method to get all repositories.

Call [getRepositories()](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_ConnectAPI_ContentHub_static_methods.htm#apex_ConnectAPI_ContentHub_getRepositories_1) to get all repositories and get the first SharePoint online repository found.

final string sharePointOnlineProviderType ='ContentHubSharepointOffice365';
final ConnectApi.ContentHubRepositoryCollection repositoryCollection = ConnectApi.ContentHub.getRepositories();
ConnectApi.ContentHubRepository sharePointOnlineRepository = null;
for(ConnectApi.ContentHubRepository repository : repositoryCollection.repositories){
   if(sharePointOnlineProviderType.equalsIgnoreCase(repository.providerType.type)){
      sharePointOnlineRepository = repository;
      break;
   }
}