How to use metadata API. I have generated Metadata WSDL through Develop >> Api, and created an apex class through it. The generated apex class contains lot of wrapper classes. Actually I am confused how to start with it. As per my requirement I have to add components to Home Page Layout through Apex, and my client has suggested to use Metadata API.

  • Is it necessary to generate class through WSDL or there is other way also to use Metadata API.
  • There are wrapper classes named "HomePageLayout" and "HomePageComponent" in the generated class but I have no idea how to use them.

2 Answers 2


Rather than starting from scratch yourself, I would recommend using existing libraries or snippets which can be found online. The most extensive one I know is the one written by Andrew Fawcett and can be found on github.

The ReadMe contains quite some references to blog posts which illustrate how these apex classes can be used.


Andy Fawcett of FinancialForce has built a great wrapper for the metadata API that solves any issues of XML namespacing and also includes some useful help and documentation examples on how to use it.

The entire codebase is available on github

You must log in to answer this question.

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