Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Login issue when fetching data from SharePoint Group

$
0
0

Hello Experts, 

I want to get sharepoint group users emails, for achieve this i use below code.

var requestUri= _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('XYZ')/users";

$.ajax(
{
url:requestUri,
type: "GET",
async:false,
headers: {"accept": "application/json;odata=verbose"},
success: function (data)
{
if (data.d.results.length)
{
for (var i = 0; i < data.d.results.length; i++)
{
if (data.d.results[i] != null && data.d.results[i] != undefined)
MYEMAIL.push(data.d.results[i].Email);
}
}
},
error: function (error) 
{
alert(JSON.stringify(error));
}
});

when i execute this call, suddenly Sharepoint login prompt is open, which require username and password, so to execute this call each time i need to fed in login detail. may be possible i have contribute permission that's why its asking to enter each time.

how can i resolve this issue. can i run this rest api code with full control rights, like run withelevated privileges

Please Help!


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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