function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicole NammourNicole Nammour 

Get Custom Labels Values Through Metadata api

Hello,

Is there a way to get custom labels (FullName and values) through metadata api?
Currently i can get only FullName, i can't retrieve the values.

Thanks,

Nicole
Best Answer chosen by Nicole Nammour
Maria AssalMaria Assal
Hi Nicole,

You can use the Metadat API method listMetadata specifying the type as "CustomLabel" to get the fullName of the label, and then use readMetadata passing the fullName as parameter to retrieve its value.

Good Luck

All Answers

Bhawani SharmaBhawani Sharma
I think you can retrieve by Metadata Type = CustomLabel.
Nicole NammourNicole Nammour
I tried the below:
queryRecord.type = "CustomLabel"; 
foreach(metadata.FileProperties fileProperty in fileProperties){
          ......
}

But fileProperty allows me to get only the fullName of the custom label, and not its value.
Is there a way to get both fullName and value of the custom label?

Thanks in advance,
Bhawani SharmaBhawani Sharma
Probably this link can help:
https://github.com/BhawaniSharma/apex-mdapi
Nicole NammourNicole Nammour
I checked this link, but what i am trying to do is to retrieve the custom labels (Name and value) using a .Net application, and not from apex. The Metadata Retrieve Demo can be used only from salesforce.

Is there any idea how to get the custom labels? (Not necessary using the metadata api)

I appreciate your help,
Nicole
Bhawani SharmaBhawani Sharma
You are correct, but actually my goal was to point you on the Metadata files. I have not played with Label metadata yet, but I have been played a lot with other components metadata using Java. What all I think you need to do is, using the org's wsdl files, create client in your .Net application. Then using these client stubs to get metadata. See this package on code share, this is javacode, but I think will be much similar in .Net also. http://developer.force.com/codeshare/projectpage?id=a063000000EXDULAA5
Maria AssalMaria Assal
Hi Nicole,

You can use the Metadat API method listMetadata specifying the type as "CustomLabel" to get the fullName of the label, and then use readMetadata passing the fullName as parameter to retrieve its value.

Good Luck

This was selected as the best answer