Often developers find the requirement from the clients on the email message body that sharepoint sends out when a user is added to the site. It looks like the following,
Welcome to the SharePoint site at: http://sharepointsite. System Account (domain\username) has granted you access to this site with the following permissions: Permission set.
Clients do not need that message or they want to customize it. It is pretty easy to implement that.
Check the aclinv.aspx file in the _layouts folder, modify the following two sections of the file to send out custom email message..
Method 1:
under the declarations sections modify the page declaration tag
actual tag:
<%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.AclInv" MasterPageFile="~/_layouts/application.master" %>
Replace inherits with your own class with two methods,
-
PageTitleUrl()
-
BtnOK_Click()
Method 2:
Else if you leave the Inherits to blank value, and write those two methods as part of the same page.
Here is the simple Implementation for BtnOK_Click()
private void AddUser(Object sender , EventArgs args)
{
SPUtility.SendEmail(SPContext.Current.Web, true, true, userPicker.
CommaSeparatedAccounts
, txtEmailSubject.Text, txtEmailBody.Text);
Server.Transfer(
"/_layouts/user.aspx");
}