We are planing to add a policy page as first page in SharePoint site. Its a simple page with only text about company policy and a continue or exit button.

We would like to track which users have hit the continue button and in future not show the page to them. Instead take them to the homepage.

I was thinking that maybe we should create a list containing all the users but then I will have to fetch all AD accounts into a list and add a column and some code on the policy page to detect whether user hit continue and update the column accordingly. Then, code a http redirector to query this list and redirect to homepage if column is set.

Is this ideal approach?


I have accepted an answer but we have taken a different approach for this requirement. We have implemented this using the user profile service application. We imported all users from AD into the SP user profile application rather than into a list. Here are links that will help you to fetch/save info into the user profile properties via JS code.

User Profile Service Application to sync User Info List with AD

How can we save data into the User Profile custom property?

How to access the data from Manage User Profiles?


Here is the scenario that PirateEric outlines, using SPServices and jQuery.

Prepare: - A SharePoint custom list called PolicyAccepted with two text fields, i.e. Title and UserName. - a document library with two web part pages, PolicySplash.aspx and PolicyAccepted.aspx.

The page PolicySplash loads the script at the top, in the first web part on the page, via script link. If the script is loaded in the footer web part, the page content will briefly show before the redirect, which is not desired.

The page PolicySplash also contains a button that is rendered from the following html:

<button onclick="PolicyButtonClick()" type="submit">I accept the policy</button>

Here is the script:

<script language="javascript" type="text/javascript" src="/path/jquery-1.10.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/path/jquery.SPServices-2013.02a.min.js"></script>
<script type="text/javascript">
// start the code even before the DOM is loaded, so not waiting for document ready
//$(document).ready( function() {
// get the user name
  var userName= getUserName();
// find the user name in the list  
  var userAccepted = matchUserName(userName);
  if (userAccepted == 1 )
    // redirecting page

function getUserName() {
    var thisUserAccount= $().SPServices.SPGetCurrentUser({
    fieldName: "Name",
    debug: false

function createNewItem(theTitle, theUser) {
        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",
        listName: "PolicyAccepted",
        valuepairs: [["Title", theTitle], ["UserName", theUser]],
        completefunc: function(xData, Status) {

function matchUserName(userName) {
    var queryText = "<Query><Where><Eq><FieldRef Name='UserName'/><Value Type='Text'>" + userName + "</Value></Eq></Where></Query>";
        operation: "GetListItems",
        listName: "PolicyAccepted",
        async: false,
        CAMLQuery: queryText,
        completefunc: function (xData, status) {
            itemCount = $(xData.responseXML.xml).find("rs\\:data, data").attr("ItemCount");

function PolicyButtonClick() {
    var userName= getUserName();
    var theTitle= "Accepted";
    createNewItem(theTitle, userName);
    window.location.href = "http://path/Documents/PolicyAccepted.aspx";


Edit. I wrote this up in a blog post.

  • What about using a user control on master page to query list item and redirect or not?? – variable Mar 21 '14 at 10:50
  • Teylyn, an awesome blog post and answer! Upvote that question. – Robert Kaucher Mar 21 '14 at 15:51
  • @NachiketKamat, there are many ways to load script. The CEWP method is good for users who may not be able to change the master page. Plugging it into the master page is another way, for more advanced SharePoint users with higher permissions. – teylyn Mar 22 '14 at 4:39
  • @teylyn for this solution to work, should this policy page set as a landing (welcome) page ? – variable Mar 24 '14 at 9:52
  • You can do what works in your scenario. It can be the welcome page, if you want the user to accept the policy before they can enter the site. But the technique can be used on other pages, too. – teylyn Mar 24 '14 at 19:06

I would probably take that approach. Create a simple custom list. On page load, query the list to see if the user has acknowledged the agreement. If no, present the agreement. When they agree, insert a new record into the list. Then on subsequent visits if they agree you'd just do a javascript redirect.

This gives you the ability to flush the list and enforce everyone to agree to updated policies.

You could also introduce the use of cookies or local storage to cut down on the traffic.

  • I have to create a http redirect module that checks if the username is present in the list. If yes redirect else stay on the page. Correct? – variable Mar 20 '14 at 17:38
  • If you want to do server side code, sure. It can be all done with jQuery/JavaScript and the web services, SOAP or Rest. The implementation can be whatever you're most comfortable with, but making it list based allows you to easily enforce acknowledgement when the policy changes by just deleting the list content. – Eric Alexander Mar 20 '14 at 17:46
  • Ok. Heres what il try. Make the policy page as landing page. Then use js objct model and check for username presence in the custom list and then redirect or not. This is what you mention is your approach right? – variable Mar 20 '14 at 17:56
  • yep, that's what I was thinking. – Eric Alexander Mar 20 '14 at 18:08
  • What about using a user control on master page to query list item and redirect to policy pageor not?? – variable Mar 21 '14 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.