We all know how to add custom web parts on the publishing page declaratively in farm solution. In order to do it first of all we need to create module and provision page itself. In the <File> element for the page we may add web parts (OTB or custom) using <AllUsersWebPart> element:
However the same approach won’t work in sandbox solutions because in this case assembly is not installed to the GAC and instead of web part you will see error message that type of your web part is not found. In order to provision custom web parts declaratively from sandbox solution we need to add <Solution SolutionId=”…” xmlns=xmlns="http://schemas.microsoft.com/sharepoint/" > under <metaData> element. SolutionId attribute should have id of your sandbox solution which you may find in Visual Studio with opened solution, then Package > Package.package > Manifest > copy SolutionId from here. Here is how module should look like in order to work with sandbox solution:
After that your web part will be shown on the page.