Home > Work > Showing the Audience Target field in an EditModePanel #SharePoint #SP2010 #in #ProjectServer #PS2010

Showing the Audience Target field in an EditModePanel #SharePoint #SP2010 #in #ProjectServer #PS2010

I have been meaning to blog about this since the public beta of 2010 but never quite got round to it until now!

I was reminded of the functionality we implemented for a client recently that allowed the Audience Target field to appear in the Edit Mode Panel of a Publishing page layout.

You would think that it would be easier, but after lots of digging around we finally found a solution.

Firstly in the Page Layout we need to register a new reference at the top of the page:

<%@ Register
   TagPrefix="OfficeWebControls"
   Namespace="Microsoft.Office.Server.WebControls.FieldTypes"
   Assembly="Microsoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>

With this new reference in place we can now implement the field in a standard EditModePanel way like so:

<PublishingWebControls:EditModePanel runat="server" PageDisplayMode="Edit">
   <table>
      <tr>
         <td>
            <span>
               Use if you wish to ‘push’ this content to a particular
               audience select here. Leaving it blank will make it
               available to all site users.
            </span>
            <br />
            <OfficeWebControls:SPFieldTargetToControl
               ID="Audience"
               runat="server"
               FieldName="Audience"
            />
         </td>
      </tr>
   </table>
</PublishingWebControls:EditModePanel>

Have fun!

Advertisement
  1. March 30, 2012 at 16:57

    Thanks, Your post really helped! Figure I would return the reply favor!

  1. April 11, 2012 at 09:54

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: