Home > code, email, SharePoint > Enable Incoming email inside a SharePoint list

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();

Advertisements
Categories: code, email, SharePoint
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: