Microsoft Teams ‘chats: getAllMessages’ API on 'v1.0' - microsoft-graph-api

As per the documentation ‘chats: getAllMessages’ (GET /users/{id | user-principal-name}/chats/getAllMessages) of MSTeams Export API is available only as a beta endpoint [1] [2]. But as this is a limitation for us, I checked the ‘chats: getAllMessages’ API on ‘v1.0’ endpoint by changing the endpoint URL and It worked.
I checked ‘getAllMessages’ for a couple of different users on v1.0 and beta endpoints traversing through all result pages. For both users, results are the almost same between 'v1.0' and 'beta' (except for these; Beta has a field 'eventDetail', but the value is null for all & Attachment ids are different) which should be fine for us.
So as v1.0 seems to be fine, I would like to get confirmation on whether 'chats: getAllMessages' is production-ready on v1.0 endpoint.
[1] https://learn.microsoft.com/en-us/microsoftteams/export-teams-content
[2] https://learn.microsoft.com/en-us/graph/api/chats-getallmessages?view=graph-rest-beta

This API endpoint is available in v1.0 also.
You can check if the particular API is supported in v1.0 or not, you can use the version selector like below:

Related

Graph API fails for Archive mailboxes

I've been using the Microsoft Graph API to access Exchange Online (Office365) In-Place Archives.
It's basically an authenticated GET HTTPS request against https://graph.microsoft.com/v1.0/users/user#company.onmicrosoft.com/mailFolders/ArchiveMsgFolderRoot and it used to work fine.
Starting this week (end of April 2020), the same request against the same resource (no change) started failing with:
404 Response: {'error': {'code': 'ErrorInvalidMailboxItemId', 'message': "Item Id doesn't belong to the current mailbox.", 'innerError': {'request-id': '4a339242-9821-42a9-9622-4b1f7cd2c162', 'date': '2020-04-24T10:01:35'}}}
Other mailboxes (not ArchiveMsgFolderRoot) continue to work fine, no problem there. Only In-Place archives are affected.
How do you access In-places Archives from the Graph API now? Can you share an example?
Same here. We are trying to figure out what exactly changed on MS side.
MS removed support for In-Place Archives in API. All options on the internet are not working anymore. We are implementing a workaround.
Support of ArchiveMsgFolderRoot was never an official feature. There was an announcement that archiving is going be changing coming time.

Unable to get channels using graph api

while fetching channels from the team using graph API is not working. It is not working from today. I am getting the following exception.
https://i.stack.imgur.com/tA1Qv.png
I tried the same with code that worked just fine 3h ago to get channels from a specific team. Now I'm getting the same exception. Same Exception when using Graph-Tester.
Coworker tried it aswell with Graph-Tester, apparently it works just fine for her. Seems like its user related. Propably a bug on Microsofts side.
It seems that it could be a bug. I'm confirming that right now GET /teams/[-groupid-]/channels fails for Delegated permission type requests, both for v1.0 & beta with a 400 Bad Request "Failed to execute Skype backend request GetThreadS2SRequest."
However, it's working for me (200) when I use Application permission type in Postman.
It was fixed by the Microsoft Graph team. Now it's working fine. It's not the only problem with channels. It's a problem with team endpoint API. The graph team is fixed the API related issue.

Microsoft Graph API get message returns empty string

I am querying to get a single message from the Microsoft graph API like the following:
https://graph.microsoft.com/v1.0/users/<name>/messages/<id>
However, i am getting a response that is just an empty string. If i make the same request using the beta version of the api like the following:
https://graph.microsoft.com/beta/users/<name>/messages/<id>
The email in question is a calendar share invitation of content-type of "application/ms-tnef" and content-class of "Sharing" in the email headers.
I can't find any documentation indicating this is a known issue in the system. Is there any way to get this to work in the graph API or is the only work-around is to use the beta version instead?
Using Graph Explorer, and recreating your request using their demo accounts returns a result in v1.0. I assumed by name you meant the user's email address and I made the same request using the Guid id of the user.
https://graph.microsoft.com/v1.0/users/MeganB#M365x214355.onmicrosoft.com/messages/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAAHi4GJzAAA=
https://graph.microsoft.com/v1.0/users/48d31887-5fad-4d73-a9f5-3c356e68a038/messages/AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAEMAAAiIsqMbYjsT5e-T7KzowPTAAIgOnGGAAA=
Have you attempted the same request using graph explorer?

How to use appRoleAssignment in Graph Api

I'm trying to leverage the beta api for assigning azure users to applications.
I looked at the documentation and tried a variety of attempts in a C# console app using HttpClient and WebClient and couldn't succeed. I then went to the Microsoft graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer . I couldn't get it to work.
I looked at the documentation
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/approleassignment_get
The document's actual documentation of the HTTP request which doesn't match the Example. The Graph Explorer seems to hint that the example is correct, but through various attempts, I can only get a response of
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Direct queries to this resource type are not supported.",
...
}
}
My essential url is
https://graph.microsoft.com/beta/appRoleAssignments/
The example says {id} but I have no idea what to put in. I put in several guids, user ids, object ids, resource ids, and none worked.
It isn't saying any access denied messages so I assume it has nothing to do with Scopes (all though the documentation is a little empty regarding that as well).
Ideally, I'd be able to see if for a given Guest Azure User has access to a particular App, then I'd be able to go and Update the assignment. I'll probably also need to delete the assignment as well.
[Edit (2021-07-06): Use Microsoft Graph v1.0 for all of this.]
It looks like the Microsoft Graph API's beta endpoint doesn't currently allow you to list AppRoleAssignments.
[Edit (2018-10-11): The Microsoft Graph beta endpoint now supports the ability to list AppRoleAssignments, though you should still use Azure AD Graph for any production application, until it gets to v1.0.] Fortunately, the Azure AD Graph API does work for this (plus, it's not a beta endpoint, so it's more likely to be stable).
To list all app roles a user is assigned with Microsoft Graph:
https://graph.microsoft.com/v1.0/users/{id}/appRoleAssignments
To list all app roles a group is assigned:
https://graph.microsoft.com/v1.0/groups/{id}/appRoleAssignments
To do the reverse, and list all users or groups assigned to an app:
https://graph.microsoft.com/v1.0/servicePrincipals/{id}/appRoleAssignedTo
Azure AD Graph is deprecated and all support for it will cease in June 2022. The equivalent requests were (in the same order as above):
https://graph.windows.net/{tenant-id}/users/{id}/appRoleAssignments?api-version=1.6
https://graph.windows.net/{tenant-id}/groups/{id}/appRoleAssignments?api-version=1.6
https://graph.windows.net/{tenant-id}/servicePrincipals/{id}/appRoleAssignedTo?api-version=1.6
In the new Azure portal, under "Enterprise applications" > (your app) > "Users and groups", you'll see the list of users who are assigned to the application, as well as the app role they are assigned to. After testing , you could do the equivalent thing using Microsoft Graph API request :
https://graph.microsoft.com/beta/servicePrincipals/d0790296-0a14-4ab1-8f6c-4e4d3eb03036/appRoleAssignments
Your could get the service principal under "Enterprise applications" > (your app) >Properties>Object ID .Here is sample of the response :
id is the role id , In your scenario ,you could check whether record exists when the principalId matches the object id of the specific user , and principalType is user .

How to use YouTube analytics monetary

I am trying to access earnings and monetizedPlaybacks from the YouTube analytics API and all I am able to get is "401 Unauthorized"-Responses. I have logged in using OAuth2 and I used the scopes
https://www.googleapis.com/auth/yt-analytics-monetary.readonly
https://www.googleapis.com/auth/yt-analytics.readonly
https://www.googleapis.com/auth/youtube.readonly
Here is the Java-Snippet that I use in my application:
analytics.reports()
.query("channel==" + channelId, "2013-06-01", "2013-07-01", "earnings,views,monetizedPlaybacks")
.setFilters("video==" + videoId)
.setDimensions("month")
.execute()
I also tried to use the APIs Explorer, but this behaves identical.
If I retrieve only the number of views (no earnings and not monetizedPlaybacks) everything works fine.
I found this bugreport that claims that the API is broken, but it causes remarkably few reactions.
Any ideas appreciated.
This feature is currently not available in the API for youtube partner even though the information can be retrieved using the GUI. Instead a CMS-Account is needed.
There is a bugreport / feature request about the issue:
https://code.google.com/p/gdata-issues/issues/detail?id=4826

Resources