0
votes

Im trying to intsall to app to MS Teams's team using Microsoft with without a user accsess

I have publish app to my organisation catalog and retrived it's installation Id, in the manifest I added:

"webApplicationInfo": {
    "id": "AZURE-ACTIVE-DIRECTORY-APP-ID",
    "resource": "https://RscBasedStoreApp",
    "applicationPermissions": []
  }

In Azure's App Registrations I created a new app, and configured appropriated permissions and grant admin consent, according to https://docs.microsoft.com/en-us/microsoftteams/platform/graph-api/proactive-bots-and-messages/graph-proactive-bots-and-messages

enter image description here

then I got token as described at https://docs.microsoft.com/en-us/graph/auth-v2-service?context=graph%2Fapi%2F1.0&view=graph-rest-1.0

Using token I tried to execute

POST https://graph.microsoft.com/v1.0/teams/TARGET_TEAM_ID/installedApps

body

{
    "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/APP_INSTALLATION_ID"
}

And got BadRequest without any details

{
    "error": {
        "code": "BadRequest",
        "message": "Bad Request",
        "innerError": {
            "date": "2021-05-12T08:54:31",
            "request-id": "b8a4b4b0-50d7-4e91-bf0c-e11a456b8e83",
            "client-request-id": "b8a4b4b0-50d7-4e91-bf0c-e11a456b8e83"
        }
    }
}

If app has already adde to team via MS Teams client everything seems quete logical - I got 409

{
    "error": {
        "code": "Conflict",
        "message": "Conflict",
        "innerError": {
            "date": "2021-05-12T08:56:53",
            "request-id": "48cdfb0d-ea73-4c61-afd0-7fbf6ae80297",
            "client-request-id": "48cdfb0d-ea73-4c61-afd0-7fbf6ae80297"
        }
    }
}

Maybe someone knows what is going wrong?

1

1 Answers

0
votes

For installing the app we should use below graph request.

POST https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps
Content-Type: application/json

{
   "teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsAppId}"
}

could you please check whether you all is listed.

GET /users/{user-id}/teamwork/installedApps