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)
The "Mark as Decorative" Feature in SharePoint: A Small Toggle With a Big Accessibility Impact
If you've spent any time building pages in SharePoint Online, you've probably noticed a new checkbox tucked inside the Accessibility...
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
Issue : Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 f...
-
If you're managing SharePoint Online environments, there's a significant change on the horizon that you need to prepare for. Microso...
No comments:
Post a Comment