Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

SharePoint Online 2013 - Clear the "Send an email invitation" checkbox when adding permissions

$
0
0

Hi,

I've created an app that uses javascript injection to clear the Send an email invitation checkbox in the permissions dialog.

Here is the code that I used in the JS file:

function JavaScript_Embed() {

    loadScript(jQuery, function () {
        $(document).ready(function () {
            if (IsOnPage("aclinv.aspx")) {
                //Uncheck the send mail checkbox
                $("[id$='chkSendEmailv15']").prop("checked", false);
            }
        });
    });
}

function IsOnPage(pageName) {
    if (window.location.href.toLowerCase().indexOf(pageName.toLowerCase()) > -1) {
        return true;
    } else {
        return false;
    }
}

function loadScript(url, callback) {
    var head = document.getElementsByTagName("head")[0];
    var script = document.createElement("script");
    script.src = url;

    // Attach handlers for all browsers
    var done = false;
    script.onload = script.onreadystatechange = function () {
        if (!done && (!this.readyState
					|| this.readyState == "loaded"
					|| this.readyState == "complete")) {
            done = true;

            // Continue your code
            callback();

            // Handle memory leak in IE
            script.onload = script.onreadystatechange = null;
            head.removeChild(script);
        }
    };

    head.appendChild(script);
}

But from two weeks ago this stop working.

Any idea why and how this could be achieved?

Thanks,

Shady


Viewing all articles
Browse latest Browse all 8089

Trending Articles