Creating custom folders in Mailboxes
The following code in the Program.cs
file will create a folder under the inbox using the FolderClass
property value of the IPF.Note
. The folder called DisplayName
sets the display name as Special Projects. The folder.save
method will save it under the inbox folder. The rest of the code is used to create the instance of the ExchangeService
object. It passes the user credentials and sets the AutodiscoverURL
as discussed in the previous section:
using System; using Microsoft.Exchange.WebServices.Data; namespace CreateFoldersthroughEWS { class Program { static void Main(string[] args) { ExchangeService Exchange2013 = new ExchangeService(ExchangeVersion.Exchange2013_SP1); Exchange2013.UseDefaultCredentials = true; Exchange2013.AutodiscoverUrl("[email protected]"); // Create a folder called Special Projects under inbox Folder folder = new Folder(Exchange2013); ...