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
Ayan SarkarAyan Sarkar 

fetching list of all values of Profile Metadata component using Apex code MEtaData Api.

I want a Apex Class that writes MetaData API code to fetch all data related to all profiles. For example their tabVisibilities, fullnames, etc..

Urgently needed
Alexander TsitsuraAlexander Tsitsura
Hi Ayan,

You can use Metadata API for it. For it use MetadataService.cls class from https://github.com/financialforcedev/apex-mdapi

Example below describe how to query info about System Administrator profile.
MetadataService.MetadataPort service = new MetadataService.MetadataPort(
    URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/m/32.0',
     UserInfo.getSessionId()
);
MetadataService.Profile[] profiles = (MetadataService.Profile[]) service.readMetadata('Profile', new String[] { 'Admin' }).getRecords();
System.debug(profiles);

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you.

Thanks,
Alex