1

First time a user logon to the system they should get a "policy" that they should accept. Without the accept on the policy they cannot use the solution!

I've created a custom user property on every user that I'm trying to get with REST. And if the policy is not accepted the user should get a popup (modal dialog).

JS

    $.ajax({
    url: "http://awesome.com/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='PolicyAccept')?@v='sp2013dev\administrator'",
    type: "GET",
    headers: { "accept": "application/json;odata=verbose" },
    success: function (data) {
        alert(JSON.stringify(data));
    },
    error: function (error) {
        alert(JSON.stringify(error));
    }

But when I'm running the query I only get a object, and cannot see any "value" only the property.

If I run the same query with "advanced rest client" (chrome extention), I get

<?xml version="1.0" encoding="utf-8"?><d:GetUserProfilePropertyFor xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">false</d:GetUserProfilePropertyFor>

What do I do wrong here?

Question nr 2 .. what's the best way to make users accept the policy before they can use the solution? I think that it's probably not a good way of checking a user for that property every time they open a site...

Maby the best way could be to break inherance and make a custom "grant permission" page that could add the user to the right group ... (or is this a big job?)

Running SharePoint 2013 Enterprise on-premise

3
  • What version of SharePoint are you using for this? Mar 13 '15 at 14:58
  • @RodrigoMolinas Sharepoint 2013 Enterprise On-premise
    – Plexus81
    Mar 13 '15 at 15:00
  • add the following header: 'content-type' : 'application/json;odata=verbose'. That should make your return object a JSON object instead of XML.
    – wjervis
    Mar 13 '15 at 17:07

Your Answer

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

Browse other questions tagged or ask your own question.