Home

Using Microsoft Graph to access Office 365 Group Calendar Events

%3CLINGO-SUB%20id%3D%22lingo-sub-21037%22%20slang%3D%22en-US%22%3EUsing%20Microsoft%20Graph%20to%20access%20Office%20365%20Group%20Calendar%20Events%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-21037%22%20slang%3D%22en-US%22%3E%3CP%3EI%20recently%20used%20the%20Graph%20API%20to%20access%26nbsp%3Bthe%20calendar%20and%20events%20from%20a%20public%20Office%20365%20Group.%20However%2C%20it%20has%20stopped%20working%20and%20I%20have%20now%20tried%20numerous%20ways%20to%20get%26nbsp%3Bit%20working%20again%20to%20no%20avail%2C%20feels%20like%20it%20was%20just%20a%20dream....%3C%2FP%3E%3CP%3EThe%20error%20I%20get%20back%20is%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%7B%0A%20%20%22error%22%3A%20%7B%0A%20%20%20%20%22code%22%3A%20%22ErrorNonExistentMailbox%22%2C%0A%20%20%20%20%22message%22%3A%20%22No%20mailbox%20was%20found%20that%20includes%20the%20external%20directory%20object%20ID%20that%20was%20specified.%22%2C%0A%20%20%20%20%22innerError%22%3A%20%7B%0A%20%20%20%20%20%20%22request-id%22%3A%20%221234567-de44-43d6-8c9d-5fcc10196590%22%2C%0A%20%20%20%20%20%20%22date%22%3A%20%222016-10-01T11%3A21%3A10%22%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%20%7C%20%3C%2FPRE%3E%3CP%3EThe%20application%20has%20the%20correct%20rights%20to%20the%20Microsoft%20Graph%20i.e.%26nbsp%3B%3CEM%3EGroups.Read.All%26nbsp%3B%3C%2FEM%3EI%20get%20a%20token%20back%20from%20the%20ADAL%20authentication%2C%20use%20it%20as%20the%20Bearer.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20URL%20is%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%26lt%3Bmy%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%3CMY%3E%3C%2FMY%3E%3C%2FA%3E%20group%20id%20here%26gt%3B%2Fevents%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20returns%20the%20response%20given%20above%2C%20if%20I%20remove%20the%20events%20part%20of%20the%20URL%20I%20successfully%20get%20the%20group%20information%20back.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-43748%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Using%20Microsoft%20Graph%20to%20access%20Office%20365%20Group%20Calendar%20Events%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-43748%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.io%2Fen-us%2Fdocs%2Fapi-reference%2Fv1.0%2Fapi%2Fgroup_list_events%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.io%2Fen-us%2Fdocs%2Fapi-reference%2Fv1.0%2Fapi%2Fgroup_list_events%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EList%20events%3C%2FSTRONG%3E%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3ERetrieve%20a%20list%20of%20%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.io%2Fen-us%2Fdocs%2Fapi-reference%2Fv1.0%2Fresources%2Fevent.htm%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eevent%3C%2FA%3E%20objects.%3C%2FP%3E%3CP%3EPrerequisites%3C%2FP%3E%3CP%3EOne%20of%20the%20following%20%3CSTRONG%3Escopes%3C%2FSTRONG%3E%20is%20required%20to%20execute%20this%20API%3A%20%3CEM%3EGroup.Read.All%3C%2FEM%3E%20or%20%3CEM%3EGroup.ReadWrite.All%3C%2FEM%3E%3C%2FP%3E%3CP%3EHTTP%20request%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22pln%22%3EGET%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Egroups%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2F%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eid%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%7D%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eevents%0AGET%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Egroups%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2F%7B%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eid%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%7D%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Ecalendar%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22pln%22%3Eevents%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETried%20both%2C%20still%20didn't%20work%2C%20this%20is%20not%20beta%20functionality.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-42830%22%20slang%3D%22en-US%22%3ERE%3A%20Using%20Microsoft%20Graph%20to%20access%20Office%20365%20Group%20Calendar%20Events%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-42830%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fgroups%2F%2F41525360-8eca-49ce-bcee-b205cd0aa747%2Fcalendar%2Fevents%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fgroups%2F%2F41525360-8eca-49ce-bcee-b205cd0aa747%2Fcalendar%2Fevents%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-40834%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Microsoft%20Graph%20to%20access%20Office%20365%20Group%20Calendar%20Events%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-40834%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Terry%2C%3C%2FP%3E%3CP%3ECan%20you%20please%20help%20me%20if%20you%20have%20found%20a%20solution%20for%20this%20already.%20Groups%20are%20working%20fine%20but%20I%20get%20'%3CSPAN%3EErrorNonExistentMailbox%3C%2FSPAN%3E'%20error%20when%20I%20try%20to%20get%20events%20using%20below%20code%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Elet%20url%20%3D%20%60%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%24%7Bgroupid%7D%2Fevents%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fgroups%2F%24%7Bgroupid%7D%2Fevents%3C%2FA%3E%60%3B%3CBR%20%2F%3EjQuery.ajax(%7B%3CBR%20%2F%3Eurl%3A%20url%2C%3CBR%20%2F%3Etype%3A%20'GET'%2C%3CBR%20%2F%3Eheaders%3A%20%7B%3CBR%20%2F%3E'Authorization'%3A%20'Bearer%20'%20%2B%20token%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3Esuccess%3A%20function(data)%20%7B%3CBR%20%2F%3Econsole.log(data)%3B%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3Eerror%3A%20function(err)%20%7B%3CBR%20%2F%3Econsole.log(err)%3B%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D)%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-22750%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Microsoft%20Graph%20to%20access%20Office%20365%20Group%20Calendar%20Events%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-22750%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20it%20possible%20the%20mailbox%20is%20hidden%20from%20the%20Global%20address%20list%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%22EWS%20queries%20will%20fail%20if%20the%20mailbox%20is%20hidden%20from%20the%20Global%20Address%20List%22%20%26nbsp%3BNot%20sure%26nbsp%3Bin%20Graph%20but%20might%20be%20fertile%20ground%20to%20explore.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-21237%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Microsoft%20Graph%20to%20access%20Office%20365%20Group%20Calendar%20Events%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-21237%22%20slang%3D%22en-US%22%3E%3CP%3EAt%20first%20glance%2C%20that%20looks%20correct.%20I%20have%20a%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FPnP%2Ftree%2Fmaster%2FSamples%2FMicrosoftGraph.Office365.GroupsExplorer%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Esample%20in%20the%20PnP%20repo%3C%2FA%3E%20that%20reads%20group%20events.%20There%20is%20also%20an%20online%20version%20at%20%3CA%20href%3D%22https%3A%2F%2Foffice365groupsexplorer.azurewebsites.net%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foffice365groupsexplorer.azurewebsites.net%3C%2FA%3E.%20Perhaps%20you%20can%20compare%20to%20the%20sample%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Terry Hagan
Contributor

I recently used the Graph API to access the calendar and events from a public Office 365 Group. However, it has stopped working and I have now tried numerous ways to get it working again to no avail, feels like it was just a dream....

The error I get back is:

 

{
  "error": {
    "code": "ErrorNonExistentMailbox",
    "message": "No mailbox was found that includes the external directory object ID that was specified.",
    "innerError": {
      "request-id": "1234567-de44-43d6-8c9d-5fcc10196590",
      "date": "2016-10-01T11:21:10"
    }
  }
} | 

The application has the correct rights to the Microsoft Graph i.e. Groups.Read.All I get a token back from the ADAL authentication, use it as the Bearer. 

 

My URL is 

 

https://graph.microsoft.com/v1.0/groups/<my group id here>/events

 

This returns the response given above, if I remove the events part of the URL I successfully get the group information back.

 

5 Replies
Highlighted

At first glance, that looks correct. I have a sample in the PnP repo that reads group events. There is also an online version at https://office365groupsexplorer.azurewebsites.net. Perhaps you can compare to the sample?

Is it possible the mailbox is hidden from the Global address list?

 

"EWS queries will fail if the mailbox is hidden from the Global Address List"  Not sure in Graph but might be fertile ground to explore.

Hi Terry,

Can you please help me if you have found a solution for this already. Groups are working fine but I get 'ErrorNonExistentMailbox' error when I try to get events using below code,

 

let url = `https://graph.microsoft.com/v1.0/groups/${groupid}/events`;
jQuery.ajax({
url: url,
type: 'GET',
headers: {
'Authorization': 'Bearer ' + token
},
success: function(data) {
console.log(data);
},
error: function(err) {
console.log(err);
}
});

https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/group_list_events

 

List events

 

Retrieve a list of event objects.

Prerequisites

One of the following scopes is required to execute this API: Group.Read.All or Group.ReadWrite.All

HTTP request

GET /groups/{id}/events
GET /groups/{id}/calendar/events

 

Tried both, still didn't work, this is not beta functionality. 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies