Welcome to Office and SharePoint Pro Sign in | Join | Help

SUBSCRIBE to Windows IT Pro Magazine & SAVE 30%      FREE Email Newsletters Vista UPDATE, Windows IT Pro UPDATE & More

custom email message welcoming new user in moss - forms authentication

  •  02-25-2008, 3:32 PM

    custom email message welcoming new user in moss - forms authentication

    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.

    NOTE:The following solution works only when form authentication uses email to authenticate user. For other types, code has to be extended.

    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 tagactual tag: <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.AclInv" MasterPageFile="~/_layouts/application.master" %>

     Replace inherits with your own class with two methods,

    1.       PageTitleUrl()2.       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){

    //add the code to add user to group

    //either using  usergroup web service or sharepoint apis

    ArrayList al = userPicker.Accounts;

    string usersList = string.Empty;

    for (int i = 0; i < al.Count; i++)

    {

    usersList += al[i] +
    ";";

    }

    usersList = usersList.ToLower().Replace(
    "providername:", "");

    SPUtility.SendEmail(SPContext.Current.Web, true, true, usersList, txtEmailSubject.Text, txtEmailBody.Text);

     

    //in case of other authentication types replace userPicker.CommaSeperatedAccounts with own method for retrieving user emails from the people picker control

    Server.Transfer("/_layouts/user.aspx");} 
View Complete Thread
SPONSORED LINKS FEATURED LINKS

Order Your Fundamentals CD Today!Get up to speed quickly and learn how to uncover rich information management capabilities with this free SharePoint CD. IT ConnectionsDive into the new Microsoft platforms and products you implement and support with the experts from Microsoft, TechNet Magazine, Windows ITPro and industry gurus. There are 70+ sessions and interactive panels with networking opportunities. Attention User Groups & User Group Leaders...Announcing the eNews Generator—a FREE HTML e-newsletter builder for user group leaders. Build your HTML and text e-newsletters in minutes. And add Windows IT Pro & SQL Server Mag articles alongside your own message!. Get Specialized SharePoint Training!SharePoint MVPs Dan Holme, Michael Noel, and Andrew Connell share their perspective and expertise in these exclusive eLearning seminars. One Event for developers and one for IT pros. Choose the one that fits your needs! Get SQL Server 2008 at SharePoint ConnectionsDon’t miss SharePoint Connections, the premier event for Microsoft IT Professionals, in Las Vegas, November 10-13. Every attendee will receive a copy of SQL Server 2008 Standard Edition with one CAL.