Forum Discussion
Can we create Tag inside Team using graph api?
- Jan 30, 2022
Yogi4 - Now you can create/Get teams tags using Beta Graph API.
Reference doc: Create teamworkTag - Microsoft Graph beta | Microsoft Docs
You can also get the created tags using below Beta Graph API:
GET /teams/{team-Id}/tags
List teamworkTags - Microsoft Graph beta | Microsoft Docs
You can also send the message with mentioning teams tag using below API
Post request: https://graph.microsoft.com/v1.0/teams/{team id}/channels/{channel id}/messages
Message body:
{
"subject": "This is very urgent!",
"importance": "urgent",
"body": {
"contentType": "html",
"content": "Programmatically mentioning of Tagged users <at id=\"0\">String_1234</at>"
},
"mentions": [
{
"id": 0,
"mentionText": "String_1234",
"mentioned": {
"tag": {
"@odata.type": "#microsoft.graph.teamworkTagIdentity",
"id": "", //tag id
"displayName": "" // tag name
}
}
}
]
}
Thanks!!
Yogi4 - Now you can create/Get teams tags using Beta Graph API.
Reference doc: Create teamworkTag - Microsoft Graph beta | Microsoft Docs
You can also get the created tags using below Beta Graph API:
GET /teams/{team-Id}/tags
List teamworkTags - Microsoft Graph beta | Microsoft Docs
You can also send the message with mentioning teams tag using below API
Post request: https://graph.microsoft.com/v1.0/teams/{team id}/channels/{channel id}/messages
Message body:
{
"subject": "This is very urgent!",
"importance": "urgent",
"body": {
"contentType": "html",
"content": "Programmatically mentioning of Tagged users <at id=\"0\">String_1234</at>"
},
"mentions": [
{
"id": 0,
"mentionText": "String_1234",
"mentioned": {
"tag": {
"@odata.type": "#microsoft.graph.teamworkTagIdentity",
"id": "", //tag id
"displayName": "" // tag name
}
}
}
]
}
Thanks!!
ChetanSharma-msft
Hi there,
Creating tags isn't working, tried PA funtion and Rest API. I always get the error
{
"statusCode": 409,
"headers": {
"Transfer-Encoding": "chunked",
"Vary": "Accept-Encoding",
"Strict-Transport-Security": "max-age=31536000",
"request-id": "e0a71003-xxx-3d2b4ecb792f",
"client-request-id": "e0a71003-xxx-3d2b4ecb792f",
"x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"002\",\"RoleInstance\":\"AM2PEPF0001F036\"}}",
"Date": "Mon, 12 Feb 2024 11:22:00 GMT",
"Content-Type": "application/json"
},
"body": {
"error": {
"code": "Conflict",
"message": "UnknownError",
"innerError": {
"date": "2024-02-12T11:22:00",
"request-id": "e0a71003-xxx-3d2b4ecb792f",
"client-request-id": "e0a71003-xxx-3d2b4ecb792f"
}
}
}
}
This is my HTTP post
{
"uri": "https://graph.microsoft.com/v1.0/teams/2cb01ad0-xxx-66f91a63cbba/tags",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"authentication": {
"authority": "https://login.microsoft.com",
"tenant": "9848535f-xxx-1f82d3bd14d1",
"audience": "https://graph.microsoft.com",
"clientId": "fd912418-xxx-a8167630599e",
"secret": "*sanitized*",
"type": "ActiveDirectoryOAuth"
},
"body": {
"displayName": "AAW",
"members": [
{
"userId": "78d481c1-66f9-4d30-9000-db76d9cb89bd"
}
]
}
}
Does anybody has a clue?