5

I am using RetrieveRequest object to retrieve packaged and unpackaged components. Part of the code is:

String[] packageName = {"Salesforce for Google AdWords"};

RetrieveRequest retrieveRequest = new RetrieveRequest();

retrieveRequest.setApiVersion( API_VERSION );

String[] packageNames = retrieveRequest.getPackageNames();

System.out.println("Array length : " + packageNames.length );

retrieveRequest.setPackageNames( packageName );

setUnpackaged( retrieveRequest );

I am able to retrieve unpackaged components along with packaged components of "packageName" i.e "Salesforce for Google AdWords". But i am not able to retrieve "packageNames" via "getPackageNames()".

Is there any way i can retrieve names of all installed packages through API ? or if this is the way what wrong am i doing ? Is there is any other work around to get package names?

  • You can query for the NamespaecPrefix field on ApexClass to get namespace prefixes or use the method described here to get the full names. – Phil Rymek Oct 13 '13 at 14:22
1

I don't think you can get the full managed package name via the FileProperties that are returned by listMetadata.

A work around would be to screen scrap the HTML from the Installed Packages page. I.e. send a request to https://instance.salesforce.com/0A3 with the session ids in a cookie and then parse the package names out of the resulting HTML.

Remember that doing this isn't supported by Salesforce and could easily break if they make changes to the page.

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.