I am doing some site branding on Office 365 (SharePoint Online). There are few page layouts required to have a custom webpart (sanboxed webpart) on the right column (Ex: related topics, lastest updates....). I was successfully to add custom webpart to page layouts when deploy it as farm solution but it doesn't work on SharePoint Online because assemblies are deployed to content database instead of GAC. However, when we add webpart manually on page, it work perfect Is there any solution to add sanboxed webpart to page layouts?
2
votes
1 Answers
1
votes
Could you provide some code samples? I think it should be doable in some ways, either using javascript and SP.WebParts.LimitedWebPartManager to add webpart programmatically when page is accessed or using following markup in page layout aspx.
<WebPartPages:SPUserCodeWebPart runat="server"
Description="Your webpart"
Title="Webpart1"
AssemblyFullName="$SharePoint.Project.AssemblyFullName$"
SolutionId="{Your SPSolutionGuid}"
ID="WebpartId"
TypeFullName="Contoso.SharePoint.WebPart"></WebPartPages:SPUserCodeWebPart>
Although i didn't test the above markup in page layouts, only on dedicated aspx page.