最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - SharePoint REST query SP.UserProfiles.PeopleManager - Stack Overflow

programmeradmin4浏览0评论

Is it possible to get data using REST query like below:

/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='user_domain\user'&$filter=DirectReports

And call by JavaScript.

I would like to create script which will check if user is a manager (has DirectReports) and next display JavaScript alert.

Thanks in advance!

Is it possible to get data using REST query like below:

http://moss.moss/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='user_domain\user'&$filter=DirectReports

And call by JavaScript.

I would like to create script which will check if user is a manager (has DirectReports) and next display JavaScript alert.

Thanks in advance!

Share Improve this question asked Apr 28, 2014 at 11:49 stockDevelopersstockDevelopers 531 gold badge3 silver badges8 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

How to retrieve Manager property via SharePoint User Profiles REST API

var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
var accountName = 'Domain\\Login';
$.ajax({
        url: siteUrl + "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='" + encodeURIComponent(accountName) + "'",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            if(data.d.DirectReports.results.length > 0)
            {
                 console.log('User has managers');     
            }
        },
        error: function (data) {
            console.log(JSON.stringify(data));
        }
});
发布评论

评论列表(0)

  1. 暂无评论