12.07.2015 Views

Database.com Metadata API Developer's Guide - Salesforce.com

Database.com Metadata API Developer's Guide - Salesforce.com

Database.com Metadata API Developer's Guide - Salesforce.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Utility Callslist<strong>Metadata</strong>()SyntaxFileProperties[] = metadataConnection.list<strong>Metadata</strong>(List<strong>Metadata</strong>Query[] queries, doubleasOfVersion);UsageThis call is useful when you want to identify individual <strong>com</strong>ponents in package.xml for a retrieve() call or if you wanta high-level view of particular metadata types in your organization. For example, you could use this call to return a list of namesof all the CustomObject <strong>com</strong>ponents in your organization, and use this information to make a subsequent retrieve() callto return a subset of these <strong>com</strong>ponents. For more information about working with package.xml, see Deploying and Retrieving<strong>Metadata</strong> on page 14.Note: This is a synchronous call so the results are returned in one call. This differs from asynchronous calls, such asretrieve(), where at least one subsequent call is needed to get the results.PermissionsYour client application must be logged in with the “Modify All Data” permission.Sample Code—JavaThe sample code below lists information about your custom objects. The code assumes that the SOAP binding has alreadybeen established.public void list<strong>Metadata</strong>() {try {List<strong>Metadata</strong>Query query = new List<strong>Metadata</strong>Query();query.setType("CustomObject");//query.setFolder(null);double asOfVersion = 30.0;// Assuming that the SOAP binding has already been established.FileProperties[] lmr = metadataConnection.list<strong>Metadata</strong>(new List<strong>Metadata</strong>Query[] {query}, asOfVersion);if (lmr != null) {for (FileProperties n : lmr) {System.out.println("Component fullName: " + n.getFullName());System.out.println("Component type: " + n.getType());}}} catch (ConnectionException ce) {ce.printStackTrace();}}ArgumentsNamequeriesasOfVersionTypeList<strong>Metadata</strong>Query[]doubleDescriptionA list of objects that specify which <strong>com</strong>ponents you are interested in.The <strong>API</strong> version for the metadata listing request. If you don't specify a value in thisfield, it defaults to the <strong>API</strong> version specified when you logged in. This field allowsyou to override the default and set another <strong>API</strong> version so that, for example, youcould list the metadata for a metadata type that was added in a later version than the<strong>API</strong> version specified when you logged in. This field is available in <strong>API</strong> version 18.0and later.57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!