Is there a way to get a complete list of tags used in Salesforce for Content? I can get sub lists, but ideally would list to get a full listing. If it's possible via the API, or with a SOQL query I'm happy to do that either as a means to get the full listing.


Okay, a week later I have the answer. With SOQL you can get them all with

SELECT Id, Name FROM TagDefinition.

Then for each standard object you have a separate table linking records to tags, e.g. AccountTag. Custom objects have their own ObjectName__tag object type which can be queried.


TagDefinition gives us the list of tag names used across eligible objects but not for the Content documents.

You can get that list by parsing the log that is generated by this script. Not at all a friendly way but this is the only workaround I could think of.

Execute as Anonymous block:

List<ContentVersion> cVer = new List<ContentVersion>();
cVer = [select tagcsv from ContentVersion limit 50000];
List<String> tagList = new List<String>();
for(ContentVersion cRec: cVer){
    if(cRec.tagcsv != null)

system.debug('Final tags list: '+tagList);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.