List calendars and events from users - microsoft-graph-api

I need to read the calendars and events of two users to create an event for both users.
The documentation says it should be possible.
https://learn.microsoft.com/en-gb/graph/api/calendar-get?view=graph-rest-1.0&tabs=http
GET /users/{id | userPrincipalName}/calendar
This should give me the users default calendar.
I tried this on the graph explorer page (https://developer.microsoft.com/en-us/graph/graph-explorer) and i always get the same error.
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"date": "2022-09-22T06:40:48",
"request-id": "cc36cb73-348a-4062-a07b-70cf4617e7cc",
"client-request-id": "6932f760-f6b2-5d40-5350-c380917725f2"
}
}
}
I get the same error with calendars, which should give me all calendars. Without the calendar i retrieve the user details, so the id is ok. Any idea or hint why it is not working?

Graph Explorer supports only delegated permission type.
For delegated permissions you can get another user's calendar if another user has shared a calendar with you, or, you have given delegated access to that user.
Resources:
Get calendar
Get shared or delegated Outlook calendar and its events

Related

Group proxyAddress - Cannot Update from Graph API - Get Permissions Issue

It is unlikely that the account that I'm using to call Graph API doesn't have adequate permissions, but whenever I modify proxyAddress property of a Office 365 Group, I receive the following error,
{
"error": {
"code": "Authorization_RequestDenied",
"message": "The requesting application is not authorized to set group proxy addresses.",
"innerError": {
"date": "2022-01-17T12:01:39",
"request-id": "328be4b4-eb20-483e-adf7-bb02dfae3be2",
"client-request-id": "cabb604f-b315-be14-9ba0-9b0571ba7b1b"
}
}
}
If I PATCH without modifying the proxyAddress property at all, then I don't get this error, but whenever I modify the payload for proxyAddress at all, I get this error.
Example, PATCH:
{
"proxyAddresses": [
"SPO:SPO_269b2269-296d-43f4-b67e-88b6f32a7fcd#SPO_af6dd7da-54b5-411e-bab8-0b31f96e9e42",
"smtp:twg35#lincdev.com",
"SMTP:twg35aaa#lincdev.com",
"smtp:twg35#linc.onmicrosoft.com",
"smtp:twg35aab#lincdev.com"
]
}
I can change other properties and I can successfully set proxyAddress when I create the group, but updates always fail with error. Also, I've tried updating the mailNickname property and this has no effect. I can also update this value from the Office 365 Admin UI by modifying the email (primary / alias) and accomplish exactly what I'm after.
Can someone confirm that this isn't possible via Graph API or can you confirm / help me with the process or permission to accomplish this?
According the documentation group proxyAddresses is read-only property. It cannot be updated.

Microsoft Graph API: UnknownError when i am trying to get a call

I am trying to get the subject (ex. Maths 1) of an online TEAMS meeting via Microsoft Graph API.
When i send a request to https://graph.microsoft.com/v1.0/communications/callRecords/8f4477a7-f5b2-40ed-a165-95519825c9cg in the response there is no value for the subject of the meeting.
So my next move is to send a request to https://graph.microsoft.com/v1.0/communications/calls/8f4477a7-f5b2-40ed-a165-95519825c9cg because the Graph API documentation has the property 'subject' in the response. When i send this request i get this response:
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-02-10T12:32:19",
"request-id": "9a81a114-8a58-457b-929v-390bda79669g",
"client-request-id": "9a81a114-8a58-457b-929a-490bda79669g"
}
}
}
with a response status code : 500 Interval Server Error from the Graph API.
I have tried this request with different meeting ids but the result is the same.
My API permissions are these:
API Permissions
I would appreciate it if I had a solution to my problem or some other way to find the subject of the meeting.
The reason why you are getting that error is because you are querying the teams meeting as a resource of type 'call' instead of 'event'.
Please use GET https://graph.microsoft.com/v1.0/users/{id |userPrincipalName}/events/{id} using Calendars.Read Application permission when querying as an application or GET https://graph.microsoft.com/v1.0/me/calendar/events/{id} with the Calendars.Read delegated permissions when querying as a signed-in user.
For further reference, have a look at https://learn.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0&tabs=http

Unable to read team channel messages using microsoft grap API

I am able to read channel messages as long as I am a member of a particular channel but I am unable to read channel messages in which I am not a member but I am a global administrator with following delegated permissions.Can anybody help?
ChannelMessage.Read.All, Group.Read.All, Group.ReadWrite.All
When I am trying to execute I am getting the following response
{
"error": {
"code": "Forbidden",
"message": "Forbidden",
"innerError": {
"date": "2020-09-10T04:37:36",
"request-id": "727d898d-ee3e-484d-b2b6-46582834ca9c",
"client-request-id": "727d898d-ee3e-484d-b2b6-46582834ca9c"
}
}
}
You'll need to use Application rather than Delegated permissions for this. When you're using Delegated permissions, you can only access Channels you are a member of (i.e. the same Channels you see in the Teams app).
Note that these are Protected APIs, so you'll need to request access before you can use them (above and beyond the normal Admin Consent flow).

How to update onlineMeeting - Graph API Microsoft teams meeting?

I am trying to insert a teams meeting link into our emails that are sent out. I want to call the api to generate a teams meeting link, WHICH I can do. However, how do I update this meeting if the time needs to be changed or if new participants are added? I can't find anything on the Microsoft Graph API documentation.
https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=http
Only see get,create,delete options
Currently only create meeting event is exposed by Graph API.
PATCH /beta/me/onlineMeetings/{meetingId} appears to work for me, but /PATCH on the v1.0 endpoint returns an error:
{
"error": {
"code": "NotImplemented",
"message": "PATCH onlineMeeting is only supported in graph beta",
"innerError": {
"date": "2020-07-12T07:50:58",
"request-id": "0a1824d8-e329-452f-bc73-988d1de832ed"
}
}
}

Microsoft Graph: Get user calendar event with beta version

I´m trying to get an user calendar event with Microsoft Graph beta versión.
I can get calendar info with this request:
https://graph.microsoft.com/beta/users/{user}/calendars/{calendarid}
Then I try to access to specific event through this request
https://graph.microsoft.com/beta/users/{user}/calendars/{calendarid}/events/{eventId}
But I get this error code:
{
"error": {
"code": "NavigationNotSupported",
"message": "Recursive navigation is not allowed after property 'Events' according to the entity schema.",
"innerError": {
"request-id": "2c73c51d-05b0-4499-9420-9247f4c8c576",
"date": "2018-05-23T15:16:44"
}
}
}
Both requests works with Microsoft Graph REST API v1.0
Any help?
The way to get an event (regardless of which calendar it is in) once you have the id is like this:
https://graph.microsoft.com/beta/users/{user}/events/{eventId}

Resources