$(document).ready(function () { getCurrentUser(); }); function getCurrentUser() { $.ajax ({ url: url+"/_api/web/CurrentUser", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { getCurrentUserGroupColl(data.d.Id); }, error: function (data) { failure(data); } }); } function getCurrentUserGroupColl(UserID) { $.ajax ({ url: url+"/_api/web/GetUserById(" + UserID + ")/Groups", method: "GET", headers: { "Accept": "application/json; odata=verbose" }, success: function (data) { /* get all group's title of current user. */ var results = data.d.results; var InnrHtmlgrp = "<br /> <ul>"; for (var i = 0; i < results.length; i++) { if(results[i].Title == 'owner') { // Do the changes //InnrHtmlgrp += " <li>" + results[i].Title + "</li> "; $("#manager").append(managerstring); } } } }); }
Friday, November 13, 2015
Find current login user in sharepoint users group using REST and render output as HTML
Subscribe to:
Post Comments (Atom)
HTML
Script:
No comments:
Post a Comment