Enable or disable Microsoft Teams Integration using code

Enable Microsoft Teams Integration in Dynamics 365 Customer Engagement to seamlessly collaborate and work effectively across Microsoft Teams and Customer Engagement (on-premises). For detailed information about the feature, see Integrate Dynamics 365 Customer Engagement (on-premises) with Microsoft Teams.

When your admin enables the Microsoft Teams integration feature for your instance in system settings, the collaboration feature is enabled only for a selected set of system entities. If you want to enable Microsoft Teams integration for additional system entities or custom entities, you can only do it programmatically using the msdyn_SetTeamsDocumentStatus Web API action.

msdyn_SetTeamsDocumentStatus action parameters

The msdyn_SetTeamsDocumentStatus action expects the following input parameters:

Name Type Description
Enable Edm.Boolean Indicates whether to enable or disable Teams Integration. Required.
LogicalEntityNames Edm.String An array with the list of logical names of all the entities for which you want to enable or disable the Teams Integration. Required.

msdyn_SetTeamsDocumentStatus action return type

The msdyn_SetTeamsDocumentStatus action returns the following value:

Name Type Description
msdyn_SetTeamsDocumentStatusResponse ComplexType Contains the response from msdyn_SetTeamsDocumentStatus action. It contains the following properties that contain the structured data of the type:
Name Type Description
FailedLogicalEntityNames Edm.String List of logical names of entities for which operation has failed.
PassedLogicalEntityNames Edm.String List of logical names of entities for which operation has passed.
OperationResult Edm.Boolean Indicates whether the operation succeeded or failed.

msdyn_SetTeamsDocumentStatus action example

Request

POST [Organization URI]/api/data/v9.1/msdyn_SetTeamsDocumentStatus
HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0
{
    "Enable":false,
    "LogicalEntityNames":"[\"account\", \"contact\"]"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json; odata.metadata=minimal  
OData-Version: 4.0
{
    "@odata.context": [Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_SetTeamsDocumentStatusResponse",
    "PassedLogicalEntityNames": "[account,contact]",
    "FailedLogicalEntityNames": "[]",
    "OperationResult": true
}

See also

Integrate Dynamics 365 Customer Engagement (on-premises) with Microsoft Teams
Admins: Enable Microsoft Teams integration Preview features