Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing room calendar in EWS returns "No mailbox with such guid"

I am trying to get the list of meetings from a room shared calendar using Microsoft Exchange (EWS) API and it's returning this error: No mailbox with such guid

var service = new ExchangeService();
service.Credentials = new NetworkCredential("username", "password");
service.Url = new Uri("exchangeUrl");

var startDate = DateTime.Today;
var endDate = DateTime.Today.AddDays(1);
var cv = new CalendarView(startDate, endDate);
var mailboxToAccess = "[email protected]";
var calendarFolderId = new FolderId(WellKnownFolderName.Calendar, mailboxToAccess);
var appointments = service.FindAppointments(calendarFolderId, cv); // << Exception happens here

Any ideas what could be wrong?

like image 640
AndreFeijo Avatar asked Sep 07 '25 13:09

AndreFeijo


2 Answers

Make sure that the user that you're using in

service.Credentials = new NetworkCredential("username", "password");

is a licensed user, with their own mailbox, that has been granted access to the Shared Mailbox in question.

like image 109
Glen Scales Avatar answered Sep 10 '25 23:09

Glen Scales


Use this, if you're trying to access Outlook mail box from an application end.
Language:C#

service.Credentials = new NetworkCredential("username", "password");   
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
like image 20
Ragu Avatar answered Sep 10 '25 22:09

Ragu