Skip to main content

Posts

Showing posts from March, 2012

How To: Add Audience Field Control to SharePoint 2010 Publishing Page Layout

I just recently needed to add in the default audience field control to a publishing page layout. So that when you edit the page you can easily specify the target audience for the page without having to go to “Edit Properties” in the ribbon. The only issue is that it is not as simple as you would think. In my previous post I provided detail on how to Hide SP 2010 Page Layout Metadata – WebControls however the “Audience” field control requires some additional references to the Microsoft.Office.Server.UserProfiles field types. I found this blog here: Showing the Audience Target field in an EditModePanel #SharePoint #SP2010 #in #ProjectServer #PS2010 that really helped with solving my problem. So basically to add in the audience field control to the page in edit mode you would simply have to do the following within your custom page layout.Add in the following to the reference section near the top of your page layout.
<%@ Register TagPrefix="OfficeWebControls" Namespace=&q…

How To: Add Time/Date to Layouts or Master Page

If you ever needed to add in the local time and a date for the logged in user to your custom page layout or master page below are some ways that you can achieve this.Option #1
The first method uses a SharePoint Portal Web Control to display the logged in users current time. This control is normally used on the profile pages to show current time for the profile that you are viewing. One benefit that you get from this approach is that if you have users that view the site from multiple locations around the world they would see the current time based on the time zone that they have set in their my site Profiles.To add this web control to your master page do the following:Add in the following registration to the top of the master page:
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>Add in the the fol…