I have a SharePoint list form which has been customized using SharePoint Designer. I am using the script to populate logged in user details in the form.
I have full control of the site and list. So when I log in everything is working as expected. But when someone with Contribute/Edit permission is trying to log in they are getting the following error:
Access denied. You do not have permission to perform this action or access this resource.
Because of this, the user details are not populated correctly. Ideally, this should be working for anyone with contribute permission.
Can someone help?
<script type="text/javascript">
$(document).ready(function() {
var loginName = "";
var userid = _spPageContextInfo.userId;
var mgr=GetCurrentUser();
});
function GetCurrentUser() {
var mgr;
var requestUri =_spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties";
}
</script>