0
votes

I am trying to use Microsoft Graph beta getAllMessage api to get all messages from all teams chats. This is the getAllMessage url below: https://docs.microsoft.com/en-us/graph/api/chats-getallmessages?view=graph-rest-beta

The problem is I am always getting Unknown Error and Unauthorized 401 response and I have consented all the permission as the pic shown: enter image description here

I also found a Note shown this api is a Protected API in Microsoft Teams. enter image description here

But I can not see this getAllMessage api in the list of Protected API.enter image description here

I am starting getting lost now. Hope someone knows the real cause of this problem and let me know whether should I submit the Protected API request form or not.

Thanks

Di

1
Not sure about the form if you should submit or not but the API call which you are using support only App token. So you cannot use Graph Explorer to test it because explorer gets user token.Shiva Keshav Varma
I also test this API via postman with application bearer token in header. It gave me the same error response above.Di Wang
I see that you're calling Getallmessages() and facing the error. Yes the documentation is correct. As you're calling application permission and getting the messages/chat then it comes under protected api's - so you need to submit the request, get approval as discussed in the document. This will help you move forward.Dev
Yes, I agree with you. Thank you for helping me verifying it.Di Wang
You're welcome @DiWang. Glad that it helped!!Dev

1 Answers

2
votes

I see that you're calling Getallmessages() and facing the error. Yes the documentation is correct. As you're calling application permission and getting the messages/chat then it comes under protected api's - so you need to submit the request, get approval as discussed in the document. This will help you move forward.