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)
InfoPath Retirement: What IT Professionals Need to Know
Microsoft InfoPath, a forms tool that has been in use for over two decades, is officially retiring. With InfoPath Forms Services scheduled t...
-
Code Review :- General 1. Remove the commented code 2. Variable name should not be contain "_". 3. Query should be in separat...
-
Issue : Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 f...
-
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...
No comments:
Post a Comment