---
schema_version: "1"
id: c1d51f3f91a72f3d20ab2b489b0a49ed0a7e8a3d8c9dfa8e1b39b53198dad0b8
title: Update a Repository File Without Content (Metadata Only)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/connectapi_examples_update_repository_item_metadata.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/connectapi_examples_update_repository_item_metadata.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7788c6e4a7269f6abd15c862b8e55cd38739cfe1e967a45c14369f3a62737fa0
description: Call a method to update the metadata of a repository file.
---
# Update a Repository File Without Content (Metadata Only)

Call a method to update the metadata of a repository file.

Call [updateRepositoryFile(repositoryId, repositoryFileId, file)](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_ConnectAPI_ContentHub_static_methods.htm#apex_ConnectAPI_ContentHub_updateRepositoryFile_7) to update the metadata of a file in a repository folder. After the file is updated, we show the file’s ID, name, description, external URL, download URL.

final String gDriveRepositoryId = '0XCxx00000000ODGAY', gDriveFolderId = 'folder:0B0lTys1KmM3sSVJ2bjIzTGFqSWs', gDriveFileId = 'document:1q9OatVpcyYBK-JWzp\_PhR75ulQghwFP15zhkamKrRcQ';

final ConnectApi.ContentHubItemInput updatedItem = new ConnectApi.ContentHubItemInput();
updatedItem.itemTypeId = 'document'; //see getAllowedTypes for any file item types available for creation/update
updatedItem.fields = new List<ConnectApi.ContentHubFieldValueInput>();

//Metadata: name field
final ConnectApi.ContentHubFieldValueInput fieldValueInputName = new ConnectApi.ContentHubFieldValueInput();
fieldValueInputName.name = 'name';
fieldValueInputName.value =  'updated file name.txt';
updatedItem.fields.add(fieldValueInputName);

final ConnectApi.RepositoryFileDetail updatedFile = ConnectApi.ContentHub.updateRepositoryFile(gDriveRepositoryId, gDriveFileId, updatedItem);
System.debug(String.format('Updated file - id: \\'\\'{0}\\'\\', name: \\'\\'{1}\\'\\', description: \\'\\'{2}\\'\\',\\n external URL: \\'\\'{3}\\'\\', download URL: \\'\\'{4}\\'\\'',  new String\[\]{ updatedFile.id, updatedFile.name, updatedFile.description, updatedFile.externalDocumentUrl, updatedFile.downloadUrl}));

#### See Also

- [_Apex Reference Guide_: ConnectApi.ContentHubItemInput](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_connectapi_input_content_hub_item.htm "Apex Reference Guide:
    ConnectApi.ContentHubItemInput - HTML (New Window)")
- [_Apex Reference Guide_: ConnectApi.ContentHubFieldValueInput](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_connectapi_input_content_hub_field_value.htm "Apex Reference Guide:
    ConnectApi.ContentHubFieldValueInput - HTML (New Window)")