Hi,
we are using MySites and i have developed a WebPart which should be placed on the person.aspx page.
I want to modify this page by the feature event receiver and add the custom webpart to the person.aspx page for all users.
How can i achieve
Technology Tips and News
Hi,
we are using MySites and i have developed a WebPart which should be placed on the person.aspx page.
I want to modify this page by the feature event receiver and add the custom webpart to the person.aspx page for all users.
How can i achieve
Hi,
According to your post, my understanding is that you wanted to add web part to the person.aspx page.
We can use the following code snippets to add the web part to the person.aspx page with feature event receiver.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
using (SPSite rootSite = properties.Feature.Parent as SPSite)
{
using (SPWeb web=rootSite.OpenWeb())
{
SPFile file = web.GetFile(web.Url + "person.aspx");
using (SPLimitedWebPartManager webpartsMng = file.GetLimitedWebPartManager(PersonalizationScope.User))
{
ContentEditorWebPart webPart = new ContentEditorWebPart();
webPart.Title = "Test Web Part";
webpartsMng.AddWebPart(webPart, "Right", 0);
webpartsMng.Web.Dispose();
}
}
}
}
Thanks & Regards,
Jason