Last year while working with sandboxed solution for SharePoint 2010, i faced a problem while creating a module to provision publishing pages with WebParts.
I used this code :
I added this module on a feature, but when i activate the feature i get :
- The page is draft
- The WebPart is not added.
This approach assume that the file “page.aspx” will be copied on the 14 folder on the feature folder. However SandBoxed solutions do not have access to root folder.
The solution is to use a file which is already on the SharePoint root folder :
What i changed is the “SetupPath” , this property is used to specify a physical path to a folder that contains a file to include on the module.
I will use the file “SiteTemplates\SPS\default.aspx” so i set SetupPath to “SiteTemplates\SPS” and the Path of the file to “default.aspx”.
And now everything is working fine 🙂