Recently I have requirement to modify the About Me page in My Site.I have create a site feature and in its event receiver added some code. Here is the solution if you have same requirement :
If you want to add Content Editor web part :
string Username = SPContext.Current.Web.CurrentUser.Name;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPWeb web = siteCollection.OpenWeb())
{
if (web.WebTemplate == "SPSMSITEHOST")
{
//About Me Webpart
ContentEditorWebPart contentEditor = new ContentEditorWebPart();
XmlDocument xmlDoc = new XmlDocument();
XmlElement xmlElement = xmlDoc.CreateElement("HtmlContent");
xmlElement.InnerText = "<strong>About " + Username + "</strong>";
contentEditor.Content = xmlElement;
contentEditor.ChromeType = PartChromeType.None;
using (SPLimitedWebPartManager manager =
web.GetLimitedWebPartManager("Person.aspx", PersonalizationScope.Shared))
{
manager.AddWebPart(contentEditor, "TopZone", 2);
}
}
}
});
If you want to add custom web part to page:
Add-custom-webppart-to-mysite
Subscribe to:
Post Comments (Atom)
-
Issue : Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 f...
-
Issue : Recently there was an issue we face while training React. Generally we give training using video series on YouTube but this time we ...
-
Issue: Recently, we were developing a SPFx webpart in which we needed to open a dialog. For that we decide to use Office Fabric UI Dialog co...
No comments:
Post a Comment