We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Outlook 365


Can we use Aspose.Email for connecting to Outlook365? We need to fetch emails from the mailbox and also send mails. Please advice.

Hi Cornelius,

Aspose.Email does provide support for connecting to Outlook365 using the Exchange Web Service (EWS) protocol. Please have a look at the following code sample for your kind reference and feel free to contact us in case you have any further query/inquiry in this regard.

Sample Code:

static void TestOutlook365UserAccount() 


IEWSClient client = GetOffice365Exchange(); 

// get mailbox size 

Console.WriteLine(“Mailbox size: " + client.GetMailboxSize() + " bytes”); 

// get exchange mailbox info 

ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo(); 

ExchangeFolderInfoCollection coll = client.ListSubFolders(mailboxInfo.InboxUri); 

foreach (ExchangeFolderInfo efi in coll) 



static IEWSClient GetOffice365Exchange() 


const string mailboxUri = “[https://outlook.office365.com/EWS/Exchange.asmx ](https://outlook.office365.com/EWS/Exchange.asmx)”;

const string domain = @""; 
const string username = @“username@domain.onmicrosoft.com” 

const string password = @“pasword”; 

NetworkCredential credentials = new NetworkCredential(username, password, domain); 

IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials); 

return client;