[SalesForce] Retrieving Profile with all Components Permissions using Metadata API

We have an application which retrieve Profiles from an Organisation but if we retrieve profile without specifying custom object or other component in package.xml file then it doesn't retrieve permission of any object. It returns user settings only, no other component permissions.

According to the documentation:

The content of a profile returned by Metadata API depends on the
content requested in the RetrieveRequest message. For example,
profiles only include field-level security for fields included in
custom objects returned in the same RetrieveRequest as the profiles.
The profile definition contains the following fields:

When you use the retrieve() call to get information about profiles in
your organization, the returned .profile files only include security
settings for the other metadata types referenced in the retrieve
request (with the exception of user permissions, IP address ranges,
and login hours, which are always retrieved). For example, the
package.xml file below contains a types element that matches all
custom objects, so the returned profiles contain object and field
permissions for all custom objects in your organization, but do not
include permissions for standard objects, such as Account, and
standard fields.

It is also mentioned in a question's answer as well.

Problem is that we don't want custom object or other components in retrieved file because we already have. Is there any way by which we can skip other components definition retrieval in zip file but we get all components permission in profile?

Best Answer

Quick answer: no.

Long answer: There is no current way to do this without fetching them all and then ignoring the unnecessary stuff. The product managers know about this and have received enough feedback from the field. They are working on it but no solution right now.

I would love to be wrong about this though.

Good luck!

Sridhar