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

Free Support Forum - aspose.com

IEWSClient Object is not getting created!

Dear Team,

We are evaluating ASPOSE.EMAIL .NET product for fetching mails from the office 365 exchange server.

Code written in console application working absolutely fine but it is not working in Windows Service on Windows Server 2003 Operating System.

We are getting below error -
object reference not set to an instance of an object

on below line -
IEWSClient client = EWSClient.GetEWSClient(“URL”, NetworkCredential);

Hi Kamlakar,

Thank you for writing to Aspose Support team.

We have tried to reproduce this issue at our end but are facing some issues installing the application as a windows service. Could you please share your sample application with us that we can try to install at our end for assisting you further? I would further request you to please share the steps you are carrying out to run the service at your end.


It seems that issue is related to the Service Account Permission. Can you please let us know what kind of permissions required to create object of IEWSClient.

We used ServiceAccount.LocalSystem account I.e NT AUTHORITY\SYSTEM.

Hi Kamlakar,

There is no such information about limitations on IEWSClient for the required permissions as we have tested this as normal application on Server 2003 a number of times. Please share your sample application with us for our further investigation and assistance. We’ll analyze it and share with our product team for further investigation into this issue.

Dear Team,

Please have a look of below Windows Service Code. I have also highlighted line where exact error is.

protected override void OnStart(string[] args)
timer = new System.Timers.Timer();
double intervalMins = 5;
this.timer.Interval = intervalMins * 60 * 1000; //Runs timer every intervalMins mins
this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Ticked);
this.timer.Enabled = true;

private void timer_Ticked(object sender, ElapsedEventArgs e)
// Get Emails from Exchange Server
NetworkCredential Networkcredentials = new NetworkCredential("USERNAME", "PASSWORD", "Domain");
IEWSClient client = EWSClient.GetEWSClient("EXCHANGE URL", Networkcredentials);
ExchangeQueryBuilder builder1 = new ExchangeQueryBuilder();


MailQuery query = builder1.GetQuery();

ExchangeMessageInfoCollection Emails = client.ListMessages(client.MailboxInfo.InboxUri, query, false);

Please check and help us to solve this issue.


Thank you for sharing your feedback.

We have logged this issue as EMAILNET-35154 in our issue tracking system fro further investigation by our Product team. We’ll update you here once there is some information available in this regard.

Please revert on this as we have to roll out our system asap.


The issue has been logged too recently and is pending for analysis by our Product team. Once there is some information available about the status of this problem, we’ll update you here via this thread.

The issues you have found earlier (filed as EMAILNET-35154) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.