Change “Access Request Settings” via REST in SharePoint

    url: “https://<yoursite>/sites/<yourSite>/ABCteamSite/_api/web”,
    type: “POST”,
    data: JSON.stringify({‘__metadata’:  {‘type’: ‘SP.Web’ },’Description’: ‘ABCteamSite’,’RequestAccessEmail’: ‘<youraddress>’}),
    headers: {
        “accept”: “application/json; odata=verbose”,
        “X-RequestDigest”: jQuery(“#__REQUESTDIGEST”).val(),
        “X-HTTP-Method”: “MERGE”
   }).done(function (data) {
}).fail(function (error) {

Getting the logged on user name using the client object model

If you want to use the SharePoint 2010 client object model you can use the code below:

ExecuteOrDelayUntilScriptLoaded(getWebUserData, “sp.js“);
    var context = null;
    var web = null;
    var currentUser = null; 

        function getWebUserData() { 
        context = new SP.ClientContext.get_current();
        web = context.get_web();
        currentUser = web.get_currentUser();
        context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), 
             Function.createDelegate(this, this.onFailureMethod));

    function onSuccessMethod(sender, args) {
        var userObject = web.get_currentUser();
        var UserTitle = userObject.get_title();

    function onFailureMethod(sender, args) {
        alert(‘request failed ‘);

Here is a video and a simple way to test it.

If you want to save some time by not having to open SharePoint Designer 2010, you run this code directly from Chrome using the web developer tool. The video below shows you how to do that.