Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: SPServices.SPGetCurrentUser returns null when [Manager] is the required field

$
0
0

I see it.

I was debugging and thinking.....

There's a way to resolve it (it should be updated to get an array of properties):

function GetProfilePropertyValue(userId, propertyName) {
    var retVal;

    $().SPServices({
        operation: 'GetUserProfileByName',
        AccountName: userId,
        async: false,
        completefunc: function (xData, Status) {
            var properties = xData.responseXML.getElementsByTagName('PropertyData');

            var propertyValues = new Array();
            for (var i = 0; i < properties.length; i++) {
                var propName = properties[i].getElementsByTagName('Name')[0].childNodes[0].nodeValue;
                propertyValues[propName] = properties[i].getElementsByTagName('Value');

                var oValueNode = properties[i].getElementsByTagName('Value');
                if (oValueNode.length > 0) {
                    propertyValues[propName] = oValueNode[0].childNodes[0].nodeValue;
                } else {
                    propertyValues[propName] = '';
                }
            }
            retVal = propertyValues[propertyName];
        }
    });
    return retVal;

}

It works :)


Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>