I am here to get some details on User Information List(available at http://domainname.com/_catalogs/users/simple.aspx ), which i did find on the internet.
As it is available under _catalogs, only admins should have access to the list, which happend to me also.
But when i put some script in a content editor and gave the page to a person who has just read rights on the site, the script fetched the data.
Below is the script i used:
<script type="text/ecmascript" language="ecmascript">
ExecuteOrDelayUntilScriptLoaded(getProfile, "sp.js");
var _spUserId="domain\ID"
var context = null;
var web = null;
function getProfile() {
alert(_spUserId);
context = SP.ClientContext.get_current();
web = context.get_web();
userInfoList = web.get_siteUserInfoList();
camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Name\'/><Value Type=\'Text\'>' + _spUserId + '</Value></Eq></Where></Query><RowLimit>1</RowLimit></View>');
this.listItems = userInfoList.getItems(camlQuery);
context.load(listItems);
context.executeQueryAsync(Function.createDelegate(this, this.onProfileSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
}
function onProfileSuccessMethod(sender, args) {
var item = listItems.itemAt(0);
var tit = item.get_item('Title');
if (tit) {
alert(tit);
}
}
function onFailureMethod(sender, args) {
alert('Error: ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
Please could some explain me the things as i am very confused.