I am currently building a tool which creates SharePoint sites automatically. Each site must have a mailbox enabled and a specific Email address specified.
I can create the site which by default has a SharePoint list named “mailbox”.
My questions is how to I allow the “mailbox” SPList to receive email. There is a property within an SPList called CanReceiveEmail but this is Read-only? So is there another way?
I also need to be able to set the Email address of the SPList programtically, does anyone know the best way to do this?
It can be done manually but this is not an option.
A simple list (as far as I know but I may be wrong) does not have the ability to receive emails. You can create a custom list that does.
You can create a document library, which by default has this ability.
How these properties are set, you can see when you examine the code (using Lutz Roeder’s Reflector, http://www.red-gate.com/products/reflector/) of
/_layouts/EmailSettings.aspxwhich can be found in “Microsoft.SharePoint.ApplicationPages.dll” found on your server in path something like\\server\c$\Inetpub\wwwroot\wss\VirtualDirectories\80\_app_bin.So you will have to set multiple properties of the “rootfolder” of the document library.
The code is as follows :
EDIT: added comments to my code