0

I have a client with currently hundreds of Modern Communication sites in SharePoint Online, and will potentially be creating thousands in the near future. They have a fairly simple Footer with only a few hyperlinks. The trick is that they want to have the exact same Footer on every site.

I know that I can turn the Footer on/off via PnP-PowerShell, but I cannot find any evidence that Footer links can be added or removed via script or API.

I know that I could create an entirely custom-coded Footer via an SPFx extension, but seems like overkill since they only have a few links. Are my only options truly to either set them all by hand through the UI, or remove all configured links and create an SPFx Footer extension to be globally deployed? Are there any options in-between these two?

-1

We can turn on or off Footer in SharePoint pages using REST API,

To Get the Footer status of the status using below snippet

    function getRequest(url) {
    var request = new XMLHttpRequest();
    return new Promise(function(resolve, reject) {
        request.onreadystatechange = function() {
            if (request.readyState !== 4) return;
            if (request.status >= 200 && request.status < 300) {
                resolve(request);
            } else {
                reject({
                    status: request.status,
                    statusText: request.statusText
                });
            }
        };

        request.open('GET', url, true);
        request.setRequestHeader("Content-Type", "application/json;charset=utf-8");
        request.setRequestHeader("ACCEPT", "application/json; odata.metadata=minimal");
        request.setRequestHeader("ODATA-VERSION", "4.0");
        request.send();

    });
}

getRequest(_spPageContextInfo.webAbsoluteUrl + '/_api/web/FooterEnabled').then(function(output) {
    var result = JSON.parse(output.response);
    console.log(result.value);
});
//Reference: https://gist.github.com/ktskumar/a75c1fa55afccbe956510b530460cc37

To update footer in SharePoint Modern Site using below snippet:

function updateRequest(url, params, digest) {
    var request = new XMLHttpRequest();
    return new Promise(function(resolve, reject) {
        request.onreadystatechange = function() {
            if (request.readyState !== 4) return;
            if (request.status >= 200 && request.status < 300) {
                resolve(request);
            } else {
                reject({
                    status: request.status,
                    statusText: request.statusText
                });
            }
        };

        request.open('PATCH', url, true);
        request.setRequestHeader("Content-Type", "application/json;charset=utf-8");
        request.setRequestHeader("ACCEPT", "application/json; odata.metadata=minimal");
        request.setRequestHeader("x-requestdigest", digest);
        request.setRequestHeader("ODATA-VERSION", "4.0");
        request.send(params ? JSON.stringify(params) : void 0);
    });
}

//Variable used to set Footer property in web
var footerValue = {
    "FooterEnabled": true
};

//Call the method to update the property in web object
updateRequest(_spPageContextInfo.webAbsoluteUrl + "/_api/web", footerValue, _spPageContextInfo.formDigestValue).then(function(output) {
    console.log("Success")
});

I hope this will helps to turn on or off the footer property in web object.

1
  • Please read my question again. I had posted that I already know how to enable and disable the footer via the API. What I am looking for is how to set the text and link contents of that footer.
    – willman
    Mar 3 '20 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.