0

Is it possible for users to be presented with some information the first time they log in to SharePoint? I have someone who wants their users to agree with a policy before they begin to use sharepoint. How could I go about this?

Thanks in advance.

1

A thought is having a webpart on the start page showing this document, if and only if, the user Id is not present in some form of list (in SharePoint or SQL table).

So if the user is not found the message is shown and the user Id is added to the list / table

1

If it's user specific, it likely belongs in the users Profile. Use UPS so you can trap that policy agreement anywhere they connect (and potentially on any web application). Then use a user control baked into the masterpage to check for their agreement of the policy and redirect them to the applicable URL. BCS is an option if you have to store it in a separate DB, but UPS is designed for these types of user-specific pieces of data. I don't think I'd go the BCS route to a separate SQL database unless other requirements dictated that.

I don't think I agree with using jQuery for this, managed code would be far more efficient, and you can make the API call straight to User Profile Services to both query for the value, and write the value back when they have accepted.

If you need variability between web applications, store the policy approval property and URL to the acceptance screen in the property bag, so you can make it reusable across multiple web applications (if the policy is different for say extranet users vs intranet users).

0

Create list of users on site root. In list create boolean field for Policy agreement. Then you can use jQuery on checked. Code needs to be adjusted. I removed a lot from working code I use in similiar solution.

$(document).ready(function() {  
    $("input[id$='BooleanField']").click(function(){
         if($(this).is(':checked'))  {
            var taskDesc = $($(this).closest('tr').children(":first")).eq(0).text();
            completeSelectedTask(taskDesc);
         } 
    });
});

function completeSelectedTask(taskDesc)  {
    var queryStr = "<Query> <Where><And><Eq> <FieldRef Name='Assignee'/> <Value Type='Text'>" + loginName + "</Value> </Eq><Eq> <FieldRef Name='Title'/> <Value Type='Text'>" + taskDesc + "</Value> </Eq></And></Where> </Query>";

    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "SharePointCustomUserListNameHERE",
        CAMLQuery: queryStr,
        CAMLViewFields: "<ViewFields> <FieldRef Name='Title' /><FieldRef Name='Assignee' /><FieldRef Name='Completed' /> </ViewFields>",
        completefunc: function (xData, Status) {
            CompleteListItem(xData, status)
        }
    });
}
function CompleteListItem(xData, status) {
    var itemId;
    var itemTitle;

    $(xData.responseXML).find("z\\:row").each(function () {
        itemId = $(this).attr("ows_ID");
        itemTitle = $(this).attr("ows_Title");
        $().SPServices({
            operation: "UpdateListItems",
            aysnc: false,
            batchCmd: "Update",
            ID: itemId,
            listName: "SharePointCustomUserListNameHERE",
            valuepairs: [["Completed", "True"]],
            completefunc: function(xData, Status) {
                if (Status == 'success') {
                    //var msg = "The assigned task '" + itemTitle + "' has been marked as complete.";
                    //messageId = SP.UI.Notify.addNotification(msg, false);
                }
                else {
                    alert(Status +' : There was a problem adding your information to the database.  Please try again or contact Internal Support at 812-468-1000.');
                }
            }
        });
    });
}

This should all go into site page where user list was created. You could then add javascript code to home page to check if user has task completed in list. If not then redirect to your site page mentioned above.

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.