Tag: User Profiles

User Profiles – Adding a Custom Tab and Page

The User Profile Pages within the MySites area of SharePoint 2010 is significantly more robust than in previous versions.  I really like the concept of making it a central/social hub and using it as a central place to hold and maintain content.  While I generally shy away from major customizations to the Personal sites (aka My Content), the My Site Host that stores the User Profile Pages and Activity Stream provides a great place to load centralized content and features.  It could be for integrating into other social applications your organization might use, or perhaps a place to hold executive Dashboards.  Since the My Site Host is shared between all users within that profile store it is easier to maintain than the individual Personal sites.

I have found myself in a number of conversations recently with people asking about how to customize and extend the User Profile Pages but I have not seen any good sources of information on how to approach it.  Today we will look at how you can define a custom ApplicationPage that uses the User Profile format and how to link to it from within the tabs present in the User Profiles section.

Managing User Profile Tabs

For those that are not aware, the horizontal tabbed navigation displayed in the User Profiles section is actually powered by the QuickLaunch menu for the MySite Host site.  You can add a new tab simply by adding a new Heading entry for the QuickLaunch.

Here is a screenshot of the tabbed QuickLaunch on the User Profile page.

Here is what the QuickLaunch configuration looks like:

 

Custom User Profile ApplicationPage

The sample code included in this project includes the standard formatting for the page so that it blends in perfectly with the other pages within the section.  Your custom page has access to the full Server OM and can include complex user controls or visualizations.

<%@ Page language="C#" DynamicMasterPageFile="~masterurl/custom.master" Inherits="Microsoft.SharePoint.Portal.WebControls.PersonalAdminPage,Microsoft.SharePoint.Portal,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="OSRVWC" Namespace="Microsoft.Office.Server.WebControls" Assembly="Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="OSRVUPWC" Namespace="Microsoft.Office.Server.WebControls" Assembly="Microsoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SEARCHWC" Namespace="Microsoft.Office.Server.Search.WebControls" Assembly="Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderLeftNavBarDataSource" runat="server">
<SPSWC:DataSourceReplacer runat="server" ControlID="PlaceHolderLeftNavBar/QuickLaunchNavigationManager/QuickLaunchMenu">
<SPSWC:MySiteDataSource runat="server" ShowStartingNode="False" SiteMapProvider="MySiteLeftNavProvider" />
</SPSWC:DataSourceReplacer>
</asp:Content>

<asp:Content ID="Content2" contentplaceholderid="PlaceHolderPageTitle" runat="server">
Custom Page Title
</asp:Content>

<asp:Content ID="Content3" contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">
Custom Page Title
</asp:Content>

<asp:Content ID="Content4" contentplaceholderid="PlaceHolderSiteName" runat="server">
<SPSWC:PersonalSpaceMainHeading TitleMode="true" runat="server" />
</asp:Content>

<asp:Content ID="Content5" contentplaceholderid="PlaceHolderMain" runat="server">
<Sharepoint:FormDigest runat="server" id="FormDigest" />

<div class="s4-notdlg noindex">
<a id="A1" href="javascript:;" onclick="javascript:this.href='#SkipContactCard';" class="ms-SkiptoMainContent" runat="server">
<SPSWC:StringValueEx ResourceFile="spscore" LocId="SkipContactCard_Text" runat="server" />
</a>
</div>
<SPSWC:ProfilePropertyLoader id="m_objLoader" LoadFullProfileOfCurrentUser="true" runat="server" />
<div class="ms-profilepageheader">
<table border="0" cellpadding="3" cellspacing="0" ID="ZoneTable" width="100%" class="ms-tztable">
<!-- business card zone -->
<tr><td colspan=3 width="100%" style="padding:24px">
<table class="ms-contactcardtext3" cellspacing=0 cellpadding=0 width="100%">
<tr>
<td width="150" valign="top">
<div class="ms-contactcardtext3" style=""width:100%;">
<SPSWC:LocalTimeControl runat="server" />
</div>
<div class="ms-profilepicture ms-contactcardpicture ms-largethumbnailimage">
<SPSWC:ProfilePropertyImage PropertyName="PictureUrl" RenderWrapTable="False" ShowPlaceholder="true" id="PictureUrlImage" ImageSize="Large" CenterVertically="true" runat="server"/>
</div>
<div class="ms-contactcardtext3" style="width:100%;">
<div><SPSWC:EditProfileButton runat="server" id="ddlEditProfile" /></div>
<div><SPSWC:AddToColleaguesButton runat="server" id="TBBAddtoColleagues" class="ms-my-addcolleague"/></div>
</div>
</td>
<td valign="top" width="320">
<div style="min-height:175px">
<div class="ms-contactcardtext2 ms-identitypiecenotediv">
<SPSWC:StatusNotesControl runat="server"/>
</div>
<div style="padding-top: 50px;vertical-align:top;" class="ms-name ms-contactcardtext1" id="ProfileViewer_Name">
<SPSWC:PersonalSpaceMainHeading TitleMode="false" runat="server"/>
</div>
<div style="padding-left: 20px;" class="ms-contactcardtext3" id="ProfileViewer_ValueTitle">
<SPSWC:ProfilePropertyValue PropertyName="Title" runat="server"/>
</div>
<div style="padding-left: 20px;" class="ms-contactcardtext3" id="ProfileViewer_ValueDept">
<SPSWC:ProfilePropertyValue PropertyName="Department" runat="server"/>
</div>
<br/>
<div style="padding-left: 20px;" class="ms-contactcardtext3" id="ProfileViewer_ValueOfficePhone">
<SPSWC:ProfilePropertyValue PropertyName="WorkPhone" dir="ltr" runat="server"/>
</div>
<div style="padding-left: 20px;" class="ms-contactcardtext3" id="ProfileViewer_ValueOfficeLocation">
<SPSWC:ProfilePropertyValue PropertyName="Office" runat="server"/>
<SPSWC:ProfilePropertyCheckValue PropertyNames="Office,Location" runat="server" Text=", "/>
<SPSWC:ProfilePropertyValue PropertyName="SPS-Location" runat="server"/>
</div>
<div style="padding-left: 20px;" class="ms-contactcardtext3" id="ProfileViewer_ValueEmail">
<SPSWC:ProfilePropertyValue PropertyName="WorkEmail" runat="server" PrefixBrIfNotEmpty="true"/>
</div>
<br/>
<div style="padding-left: 20px;display:none;" class="ms-contactcardtext3" id="ProfileViewer_ProfileDetails" >
<SPSWC:ProfileDetailsViewer id="ProfileViewer" Collapsible="false" runat="server" />
</div>
</div>
<div style="padding-left: 20px;" class="ms-contactcardtext3">
<SPSWC:ContactCardDetailsLink AboutMeId="ProfileViewer_ValueAboutMe" ProfileDetailsId="ProfileViewer_ProfileDetails" EllipsisId="ProfileViewer_Ellipsis" runat="server" />
</div>
</td>
<td valign="top" width="418">
<div style="padding: 50px 5px 0px 15px; overflow:hidden; min-height: 142px; height: 142px;" class="ms-contactcardtext3" id="ProfileViewer_ValueAboutMe">
<SPSWC:ProfilePropertyValue PropertyName="AboutMe" runat="server" PrefixBrIfNotEmpty="false"/>
</div>
<div style="padding-left: 15px;display:none" id="ProfileViewer_Ellipsis" class="ms-contactcardtext3"></div>
</td>
</tr>
</table>
</td></tr>
</table>

<SharePoint:AspMenu
ID="MySiteSubNavigationMenu"
Runat="server"
EnableViewState="false"
DataSourceID="MySiteSubNavDS"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Horizontal"
StaticDisplayLevels="1"
MaximumDynamicDisplayLevels="0"
PopOutImageUrl=""
SkipLinkText=""
CssClass="s4-sn">
</SharePoint:AspMenu>
<SPSWC:MySiteDataSource
ShowStartingNode="False"
SiteMapProvider="MySiteSubNavProvider"
id="MySiteSubNavDS"
runat="server"/>

</div>

<a name="SkipContactCard" tabindex=0></a>

<div class="ms-profilepagecontent">
Your Page Content Here!
</div>
</asp:Content>

Managing the QuickLaunch Entries

For this to be a robust feature the QuickLaunch entries should be managed as part of the feature activation/deactivation process so a FeatureReceiver has been added to the project to add and remove the entries respectively.

using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;
using Microsoft.SharePoint.Security;

namespace CustomMySitePage.Features.Customer_User_Profile_Page
{
[Guid("d2754488-4038-42fd-9c9e-f93f19d4e093")]
public class Customer_User_Profile_PageEventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
using (SPWeb web = properties.Feature.Parent as SPWeb)
{
SPNavigationNode node = new SPNavigationNode("Custom Page", web.Url + "/_layouts/CustomMySitePage/PageTemplate.aspx");
web.Navigation.QuickLaunch.AddAsLast(node);
}
}

public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
using (SPWeb web = properties.Feature.Parent as SPWeb)
{
SPNavigationNodeCollection nodeCol = web.Navigation.QuickLaunch;
foreach (SPNavigationNode node in nodeCol)
{
if (node.Title == "Custom Page")
{
node.Delete();
}
}
}
}
}
}

Deployed Custom Tab and Page

Here is a final look at what it looks like with the feature activated and the Tab and Page available.

 

Template Project Source Code

The source code for this project is available for download here:  CustomMySitePage Project

I will not be providing support for the code as it is merely an example of how the pages within the User Profile section of MySites works.

SPS The Conference Slides and Additional Info

SharePoint Saturday The Conference has been a pretty impressive event so far.  It is amazing how well it has been run which is a real testament to the organizers and volunteers that have made it all happen. 

Both of my sessions seemed to go off fairly well, hopefully everyone managed to learn something and has a takeaway.

Here is the slide deck for the Developing Reusable Wokflow Features as well as the VS project code for SPBlueprints.Activities.

Here is the slide deck for the afternoon session Getting the Most from the User Profiles.

Another full day of sessions tomorrow, with many great sessions still on the schedule.  I’ll be roaming around as an attendee, if you have any questions feel free to stop and say hello.

Bulk Updates of User Profile Properties

This past week fellow SharePoint MVP Yaroslav Pentsarskyy posted an excellent PowerShell script for doing bulk updates on the UserProfile properties via PowerShell.  The Bulk Update SharePoint 2010 User Profile Properties is a great script that makes it extremely easy to populate any new fields that are not set to synchronize. 

My team has been doing a lot of client work promoting the user of User Profiles for use within customizations or to drive business processes.  For a quick overview check out my blog post Permanent Link to User Profiles – Driving Business Process or sit in on my Developing Reusable Workflow Features presentation at SharePoint Saturday NY on July 30th or SharePoint Saturday The Conference 2011 August 11-13th.

This also demonstrates another great example of the value that PowerShell can bring to Building and Maintaining a high functioning SharePoint environment.

SharePoint Saturday Tampa Wrap-up

SharePoint Saturday Tampa was a lot of fun, and there were a lot of great attendees there soaking up the SharePoint goodness.  A big thanks to the organizers, sponsors and volunteers that made this happen.

I also hope that everyone that attended my Planning for the User Profiles session got a lot out of it.  Here is a link to the slides.  Getting the Most from SharePoint’s User Profiles

 

During the event I had a number of good conversations with people on how the User Profiles (and MySites) are being used, and where they are facing some challenges.  I have a few ideas I expect to put into a blog post soon so stay tuned for that if you are interested.

SharePoint Saturday Atlanta Wrap-up

SharePoint Saturday Atlanta was a huge success.  A big thank you to the participants, sponsors, speakers and of course the organizers that put so much effort into the event.

I would also like to thank everyone that sat in on my session on “Getting the Most from the User Profiles” and hope that it does in fact help you maximize the value of the feature in your organization.

Here is a copy of my slide deck for anyone interested: Getting the Most from SharePoint’s User Profiles

Hope to see everyone at additional events throughout the year!

SharePoint Saturday Atlanta

I’ll be presenting at SharePoint Saturday Atlanta on Saturday May 7th.  The lineup is impressive and this is sure to be one of the bigger SharePoint Saturday events in the region this year. 

Session details:

Getting the Most from the User Profiles
This session will help you maximize the power and value of the SharePoint User Profiles available in SharePoint Server. We will cover strategies on how to approach defining and maintaining custom attributes, how to approach synchronizing content with other business systems, and how to leverage the information to drive business processes both inside of and outside of SharePoint.

Hope to see a full house, if you are in the Atlanta area be sure to stop by and say hello!

Disabling the “What’s Happening?” Display on the User Profiles

One of the SharePoint 2010 features I really like is the user status information that is integrated into the updated User Profiles.  Unfortunately some organizations are not quite comfortable or ready to support the feature.
Here is what it looks like with the user status set:
User Profile with Status

Disabling the Status Message field

With normal User Profile property management you can disable the Status Message field (known internally as SPS-StatusNotes).  You want to not only change the Edit Settings to not allow users to edit the value, but you want to also ensure that the property is not displayed on any of the profile pages.
Here is a screenshot of the Edit User Profile Property screen:
Edit User Profile Property screen

Removing the Control

While the property is now disabled and we have configured it to not show on the regular profile forms, the Status Message control still shows on the Person.aspx page and gives the users the impression that they can continue to use it.
Here is a screenshot from after the property was disabled:
Edit User Profile without Status
The status essentially stays unset, and anything that the user might type in cannot be saved. There is no way for them to know that the status can no longer be set and no error is displayed so it is confusing.
The control cannot be removed through configuration unfortunately.  To remove the control you will need to edit the Person.aspx page in the MySite Host site collection.  It is important to note that the Person.aspx page is shared among all user profiles in the User Profile Service Application so any changes to the page impact all uses.
To edit the page you will need to be a site collection administrator for the site collection.  Open the site collection in SharePoint Designer and then open the Person.aspx page.  You will need to go into Advanced Mode, which is selectable in the SharePoint Designer ribbon on the right hand side.
Once the page is editable, find and remove the following code:

[sourcecode type=”plain”]
<SPSWC:StatusNotesControl runat="server"/>
[/sourcecode]

Once the page is saved, the control will be removed and you will no longer see the pop-up bubble.
Here is what it looks like with the control removed:
Edit User Profile without Status Control

Re-Enabling the Control In The Future

If you need to re-enable the control in the future, you can simply reset it to the original Site Definition in SharePoint Designer.  This will restore the control and the page back to normal.
%d bloggers like this: