---
schema_version: "1"
id: 4d1fa7fa90788dcf7080d48774633770fc4c170ad119d7fccab34c452c6b4e7d
title: Get a Repository File with Permissions Information
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/connectapi_examples_get_repository_file_with_perms.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_get_repository_file_with_perms.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 93a6cc942d812500f46dc6ce9db03dfaf4b347dd342594f1201309f5cba7a751
description: Call a method to get a repository file with permission information.
---
# Get a Repository File with Permissions Information

Call a method to get a repository file with permission information.

Call [getRepositoryFile(repositoryId, repositoryFileId, includeExternalFilePermissionsInfo)](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_ConnectAPI_ContentHub_static_methods.htm#apex_ConnectAPI_ContentHub_getRepositoryFile_4) to get a repository file with permissions information.

final String gDriveRepositoryId = '0XCxx00000000ODGAY', gDriveFileId = 'file:0B0lTys1KmM3sTmxKNjVJbWZja00';

final ConnectApi.RepositoryFileDetail file = ConnectApi.ContentHub.getRepositoryFile(gDriveRepositoryId, gDriveFileId, true);
System.debug(String.format('File - name: \\'\\'{0}\\'\\', size: {1}, external URL: \\'\\'{2}\\'\\', download URL: \\'\\'{3}\\'\\'', new String\[\]{ file.name, String.valueOf(file.contentSize), file.externalDocumentUrl, file.downloadUrl}));
final ConnectApi.ExternalFilePermissionInformation externalFilePermInfo = file.externalFilePermissionInformation;

//permission types
final List<ConnectApi.ContentHubPermissionType> permissionTypes = externalFilePermInfo.externalFilePermissionTypes;
for(ConnectApi.ContentHubPermissionType permissionType : permissionTypes){
   System.debug(String.format('Permission type - id: \\'\\'{0}\\'\\', label: \\'\\'{1}\\'\\'', new String\[\]{ permissionType.id, permissionType.label}));
}

//permission groups
final List<ConnectApi.RepositoryGroupSummary> groups = externalFilePermInfo.repositoryPublicGroups;
for(ConnectApi.RepositoryGroupSummary ggroup : groups){
   System.debug(String.format('Group - id: \\'\\'{0}\\'\\', name: \\'\\'{1}\\'\\', type: \\'\\'{2}\\'\\'', new String\[\]{ ggroup.id, ggroup.name, ggroup.type.name()}));
}