6

I want to do what Eclipse is doing: pull metadata for Standard objects. I basically need to inspect what Views, WebLinks, and Validation Rules Opportunity has in my org. For Custom objects I do the following:

SFDCMetadata.RetrieveRequest rr = new SFDCMetadata.RetrieveRequest();
        SFDCMetadata.Package package = new SFDCMetadata.Package();
        SFDCMetadata.PackageTypeMembers ptm = new SFDCMetadata.PackageTypeMembers();
        ptm.name = "CustomObject";
        ptm.members = new string[] { "*" };
        package.types = new SFDCMetadata.PackageTypeMembers[] { ptm };

        rr.singlePackage = true;
        rr.unpackaged = package;
        SFDCMetadata.AsyncResult res = port.retrieve(sh, null, rr);
        Thread.Sleep(1500);
        SFDCMetadata.RetrieveResult retRes = port.checkRetrieveStatus(sh, null, res.id);
        while (!retRes.done)
        {
            Thread.Sleep(1000);
            retRes = port.checkRetrieveStatus(sh, null, res.id);
        }
        List<FileInfo> fis = DecompressToFiles(retRes.zipFile, folderName);

But I get back only a collection of custom objects. How do I retrieve the standard objects, like Eclipse does: enter image description here enter image description here

How do they do it?

2 Answers 2

1

You have to specify the <Member>such as Account for each custom object when requesting the CustomObject.

See this post: http://luigimontanez.com/2008/custom-fields-on-standard-objects-in-the-force-com-ide/

Hope that helps.

1
  • How does this work dynamically? Where certain org types do not support certain standard objects?
    – Phil Rymek
    Commented Aug 22, 2014 at 15:57
1

You retrieve it just like a custom object - using the name CustomObject

You need to add some additional member to the PackageTypeMembers

ptm.members = new string[] { "*", "StandardObjectName" };

so for instance setting ptm.members = new string[] { "*", "Account" };

should return the account meta data

I found this reference that provided the information http://blog.nathanwisman.com/2012/01/master-list-of-metadata-api-xml.html

1
  • URL provided by you is not working. Commented May 6, 2015 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .