It seems that documentation for 1.0 mentions that now there is support for application permissions for sending messages with scope Group.ReadWrite.All.
But from what I tested sending message using Application doesn't really work. Example reply that I receive is:
Status Code: Unauthorized
Microsoft.Graph.ServiceException: Code: UnknownError
Inner error:
AdditionalData:
request-id: e83662eb-0ef4-426d-9ddc-c6eb757148be
date: 2020-05-20T08:14:28
ClientRequestId: e83662eb-0ef4-426d-9ddc-c6eb757148be
I've tried both v1.0 and beta endpoints. The last discussion I saw on this topic https://github.com/microsoftgraph/microsoft-graph-docs/issues/6610#issuecomment-606281010 mention that there will be post on Graph Blog when this will be supported, but I cant find any news about this. Was this change in documentation deployed before the actual change on Graph backend and that's why there was no announcement yet?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I'm also experiencing the same issue, I'm receiving an unknown error even though my application has the appropriate permissions. I've also tried this with v1.0 and beta.
Further clarification would be appreciated.
Invoke-RestMethod : {
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "05eb1fc8-85ca-4f6b-82c7-2ca9af8b31a5",
"date": "2020-05-20T10:38:36"
}
}
}
I am unable to send messages to channel.
As per the Permission Scope reference Now Application Permission Scope also supported for this.
But i am receiving the following Error
Code: UnknownError
Inner error:
AdditionalData:
request-id: 0d9d2541-a2b2-4731-8d10-a9325ce33d19
date: 2020-05-20T06:19:31
ClientRequestId: 0d9d2541-a2b2-4731-8d10-a9325ce33d19
Can some one help us on this ?
I tested sending message using Application which dint work. Example reply that I receive is:
Status Code: Unauthorized
Microsoft.Graph.ServiceException: Code: UnknownError
I've tried both v1.0 and beta endpoints through Graph explorer and it worked. but through application its giving the error mentioned. I have given all necessary permission as well.
Can some one suggestion and help us on this?
I tested sending message using Application which dint work. Example reply that I receive is:
Status Code: Unauthorized Microsoft.Graph.ServiceException: Code: UnknownError
I've tried both v1.0 and beta endpoints through Graph explorer and it worked. but through application its giving the error mentioned. I have given all necessary permission as well.
Can some one suggestion and help us on this?
I believe thru Graph Explorer it works on delegate permission with your sign-in user account.
Yes @user370305 , It works with delegate permission
My concern is that "Can we try delegate permission used in application and post a message?"
if yes, I need example code like how can we post with user details.
if No, what are the steps to post through Application.
Yes @user370305 , It works with delegate permission
My concern is that "Can we try delegate permission used in application and post a message?"
if yes, I need example code like how can we post with user details.
if No, what are the steps to post through Application.
Use IAuthenticationProvider from Teams Graph SDK with user account to generate token.
Just as an update - exact same problem occurs with replying to existing message using POST to teams/{tid}/channels/{cid}/messages/{mid}/replies . This was also checked on both v1.0 and beta endpoints.
Also, to make sure that the problem is not somewhere in my codebase, I rechecked original problem of creating new message and the replying to the message, this time in postman where I get exact same kind of reply as in my application.
And just to be triple sure, I've tried other methods that work on channels(updating channel description) using same client_secret, client_id etc(so same client credentials, same permissions) with same team id and channel id. This was just to be sure that there is nothing wrong with IDs or authorization. Updating channel description worked without any problem, using the credentials with admin-consented Application permission Group.ReadWrite.All, same that should be enough for sending messages.
I just think that the Application permission is still not supported and documentation change was introduced by accident(?). This is further confirmed by the fact that there was no announcement for introducing of this feature. I hope that I'm wrong, but can someone from Microsoft confirm or deny that this is indeed the case?
I think I found "solution", but not the one anyone would hope for. It seems that almost a day ago there was a commit that "fixed" the issue by reverting the documentation change. https://github.com/microsoftgraph/microsoft-graph-docs/pull/8348/commits/e4b41c224d80ade750ea9843cad9703be30b8d00 Still not merged but I think this is matter of time.
Too bad no one replied about this here, just to stop people like me from investigating this issue, hoping that this is something that I can fix on my end 😄
This issue could probably be closed after documentation change goes live, I would leave it open so that at least issue will be visible on the documentation page until merge.
tl;dr: sending chat messages using application permission is not supported
I think I found "solution", but not the one anyone would hope for. It seems that almost a day ago there was a commit that "fixed" the issue by reverting the documentation change. e4b41c2 Still not merged but I think this is matter of time.
Too bad no one replied about this here, just to stop people like me from investigating this issue, hoping that this is something that I can fix on my end 😄
This issue could probably be closed after documentation change goes live, I would leave it open so that at least issue will be visible on the documentation page until merge.tl;dr: sending chat messages using application permission is not supported
So you mean to say that it wont work if we post it from Application right?
Yep, according to the documentation changes that are now waiting to be merged ( https://github.com/microsoftgraph/microsoft-graph-docs/pull/8348 ) only delegated permissions will work for sending chat messages.
So from what I know options left if we want to send messages to users would be:
Thanks for looking into this one @konto - It's a shame that this wasn't updated sooner to save you the bother of working out their incorrect documentation! Hopefully this support gets introduced in the near future, as there's clearly a demand for it.
Most helpful comment
I am unable to send messages to channel.
As per the Permission Scope reference Now Application Permission Scope also supported for this.
But i am receiving the following Error
Code: UnknownError
Inner error:
AdditionalData:
request-id: 0d9d2541-a2b2-4731-8d10-a9325ce33d19
date: 2020-05-20T06:19:31
ClientRequestId: 0d9d2541-a2b2-4731-8d10-a9325ce33d19
Can some one help us on this ?