Enable Incoming email inside a SharePoint list

SharePoint provides a functionality where lists can be configured to receive and store emails. Let us look at how we can do this from SharePoint UI as well as code

From UI:

  • Navigate to the list for which you want to enable and configure incoming e-mail support.
  • Click Settings, and then click List Settings.
  • Under Communications, click Incoming e-mail settings. (The Incoming e-mail settings link is available only if incoming e-mail support is not enabled in Central Administration.)
  • In the E-Mail section, choose Yes to enable this list to receive e-mail, and then type the alias that you want to use to send e-mail to this list.
  • In the E-Mail Attachments section, choose whether you want to archive the e-mail attachments in this list.
  • In the E-Mail Message section, choose whether to save the original e-mail in this list. (If you choose Yes, the original e-mail is saved as an attachment.)
  • In the E-Mail Meeting Invitations section, choose whether to archive meeting invitations that were sent as e-mail in this list.
  • In the E-Mail Security section, choose whether to accept e-mail from only members of the site who can write to the list or to accept e-mail regardless of who sends the e-mail.
From Code:

SPSite site = new SPSite("{yoursite"});
            SPWeb web =  site.OpenWeb();
            
            SPList list = site.Lists[listGuid];

            list.ContentTypesEnabled = true;            
            list.EnableAssignToEmail = true;
            list.EmailAlias = myText.Text;
            list.Update();

            //Group attachments in folders, options: "subject"/ "sender"/ "root"
            list.RootFolder.Properties["vti_emailattachmentfolders"] = "sender";
           
            
            //Options 1=true 0=false
            list.RootFolder.Properties["vti_emailoverwrite"] = 0;                  
            
            list.RootFolder.Properties["vti_emailusesecurity"] = 0;
            
            list.RootFolder.Properties["vti_emailsaveattachments"] = 1;

            list.RootFolder.Properties["vti_emailsaveoriginal"] = 1;                
            
            list.RootFolder.Properties["vti_emailsavemeetings"] = 0;                
            
            list.RootFolder.Properties["vti_emailusesecurity"] = 1;                
             
            list.RootFolder.Update();

Related Post

1 thought on “Enable Incoming email inside a SharePoint list

Leave a Reply

Your email address will not be published. Required fields are marked *