Forum Discussion
SharePoint Communication Sites - "Send by email" settings
I have built a small web-part that can be put an a modern page and offers the ability to hide some predefined elements (Office 365 Launcher Bar, Share Site, Send by Email, and the Footer) as well as adding any other elements which can be selected using a querySelector query. Anyone is welcome to use and/or modify it.
https://github.com/fuzion9/spfxExternalSiteShareCleaner
Hi Dave,
Where would you paste your code on the modern page? I cannot seem to figure out how to do so. Dave Field
- Dave FieldApr 23, 2019Copper Contributor
Hi - this is the source code for building a Sharepoint app. You will need to follow the instructions on this site: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part
I'm sorry I can't be of more help right now.
Thanks,
Dave
- Robert HovorkaApr 30, 2019Copper Contributor
So my manager approached me yesterday about this button, asking if we could disable it. Official answer from MS is "no."
So I whipped up this quick Application Customizer Extension. As the page loads it checks for the button, and replaces it with an empty div. It's a bit of a hack job, but appears to be working so far. Biggest downside is it needs to be installed to each site collection individually. And if MS ever changes the name of the actual button element, it'll have to be updated.
export default class RemoveSendByEmailButtonApplicationCustomizer extends BaseApplicationCustomizer<IRemoveSendByEmailButtonApplicationCustomizerProperties> {private maxRetries: number = 20;private retries: number = 0;@overridepublic onInit(): Promise<void> {document.onreadystatechange = () => {if(document.readyState === 'complete') {this._hideButton();}};return Promise.resolve();}private _hideButton(): void {if(this.retries < this.maxRetries) {this.retries++;setTimeout(() => {let buttonElements: NodeListOf<HTMLElement> = document.getElementsByName("Send by email");if(buttonElements.length > 0 ) {for(var i = 0; i < buttonElements.length; i++) {buttonElements.item(i).parentElement.innerHTML = "<div></div>";}} else {this._hideButton();}}, 100);}}}- Don00135Oct 09, 2020Copper Contributor
Looking at your code, regarding the removal of the 'Send by Email' button, in Sharepoint 365; where does that code, get fitted in, on the site-page? Do I need a special webpart, for it?
It is a real pain that there is no solution for the 'Send by EMail' link, which keeps appearing on site pages, in Sharepoint 365.
It is definately, a drawback!
Regards,
Dan