Everything works fine.
The answer is use plural form of words in the path:
/v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channels/.../messages/...
instead of:
/v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channel/.../message/...
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm trying to import existing messages in to a new Team in the migration mode.
I'm following instructions from this doc:
https://learn.microsoft.com/en-us/microsoftteams/platform/graph-api/import-messages/import-external-messages-to-teams
I've created a new Team like this:
---------------------- REQUEST LOG -----------------------
POST /v1.0/teams HTTP/1.1
HOST: graph.microsoft.com
HEADERS:
Accept-Encoding: gzip
Authorization: Bearer
Content-Type: application/json; charset=utf-8
BODY :
{
"displayName": "test (2021-08-03T15:50:50Z)",
"isArchived": false,
"createdDateTime": "2021-05-08T17:14:01.537Z",
"@microsoft.graph.teamCreationMode": "migration",
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
}
-----------------------------------------------------------
---------------------- RESPONSE LOG -----------------------
STATUS : 202 Accepted
RECEIVED AT : 2021-08-03T15:52:50.768005z
RESPONSE TIME : 2.338058263s
HEADERS:
Client-Request-Id: 1d0ec4fa-05fb-4288-8bb9-e587acd6663e
Content-Location: /teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')
Date: Tue, 03 Aug 2021 15:52:50 GMT
Location: /teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')/operations('00000000-0000-0000-0000-000000000000')
Request-Id: 1d0ec4fa-05fb-4288-8bb9-e587acd6663e
Strict-Transport-Security: max-age=31536000
BODY :
After that i've got a positive response with a valid teamsAsyncOperation, like following:
---------------------- REQUEST LOG -----------------------
GET /v1.0/teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')/operations('00000000-0000-0000-0000-000000000000') HTTP/1.1
HOST : graph.microsoft.com
HEADERS:
Accept-Encoding: gzip
Authorization: Bearer
BODY :
***** NO CONTENT *****
-----------------------------------------------------------
---------------------- RESPONSE LOG -----------------------
STATUS : 200 OK
RECEIVED AT : 2021-08-03T15:50:54.663107Z
RESPONSE TIME : 73.159567ms
HEADERS:
Client-Request-Id: ba67f20c-6643-4059-af70-ff05167736c0
Content-Encoding: gzip
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Tue, 03 Aug 2021 15:50:32 GMT
Odata-Version: 4.0
Request-Id: ba67f20c-6643-4059-af70-ff05167736c0
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
BODY :
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')/operations/$entity",
"id": "00000000-0000-0000-0000-000000000000",
"operationType": "createTeam",
"createdDateTime": "0001-01-01T00:00:00Z",
"status": "succeeded",
"lastActionDateTime": "0001-01-01T00:00:00Z",
"attemptsCount": 1,
"targetResourceId": "6a499a24-df0a-4795-bd3b-59c861a7cc2c",
"targetResourceLocation": "/teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')",
"error": null
}
Next i've tried to create new channel, also in migration mode:
---------------------- REQUEST LOG -----------------------
POST /v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channels HTTP/1.1
HOST : graph.microsoft.com
HEADERS:
Accept-Encoding: gzip
Authorization: Bearer
Content-Type: application/json; charset=utf-8
BODY :
{
"description": "Channel for Research and Development!",
"displayName": "Research and Development",
"id": "",
"isFavoriteByDefault": false,
"email": "",
"webUrl": "",
"membershipType": "standard",
"createdDateTime": "2021-05-08T18:14:01.537Z",
"@microsoft.graph.channelCreationMode": "migration"
}
----------------------------------------------------------
---------------------- RESPONSE LOG -----------------------
STATUS : 201 Created
RECEIVED AT : 2021-08-03T15:50:56.370108Z
RESPONSE TIME : 1.505545673s
HEADERS:
Client-Request-Id: 2aad3c90-ee24-4152-a38a-d341cdda4e54
Content-Encoding: gzip
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Tue, 03 Aug 2021 15:50:34 GMT
Location: https://teamsgraph.teams.microsoft.com/v1.0/teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')/channels('19:edf791c2ffea132578eb777e5905e5c1@thread.tacv2')
Odata-Version: 4.0
Request-Id: 2aad3c90-ee24-4152-a38a-d341cdda4e54
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
BODY :
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('6a499a24-df0a-4795-bd3b-59c861a7cc2c')/channels/$entity",
"id": "19:edf791c2ffea132578eb777e5905e5c1@thread.tacv2",
"createdDateTime": null,
"displayName": "Research and Development",
"description": "Channel for Research and Development!",
"isFavoriteByDefault": null,
"email": null,
"webUrl": null,
"membershipType": null
}
At this point almost everything looks working.
But next i've tried to complete migration for the channel, with accordance of this doc:
https://learn.microsoft.com/en-us/graph/api/channel-completemigration?view=graph-rest-1.0&tabs=http
and got following error:
---------------------- REQUEST LOG -----------------------
POST /v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channel/19:edf791c2ffea132578eb777e5905e5c1@thread.tacv2/completeMigration HTTP/1.1
HOST : graph.microsoft.com
HEADERS:
Accept-Encoding: gzip
Authorization: Bearer
BODY :
***** NO CONTENT *****
-----------------------------------------------------------
---------------------- RESPONSE LOG -----------------------
STATUS : 400 Bad Request
RECEIVED AT : 2021-08-03T15:50:59.054144Z
RESPONSE TIME : 53.880026ms
HEADERS:
Client-Request-Id: 5e37ccda-fd0b-4cd2-8663-c066a9848b5e
Content-Encoding: gzip
Content-Type: application/json
Date: Tue, 03 Aug 2021 15:50:37 GMT
Request-Id: 5e37ccda-fd0b-4cd2-8663-c066a9848b5e
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
BODY :
{
"error": {
"code": "BadRequest",
"message": "Write requests (excluding DELETE) must contain the Content-Type header declaration.",
"innerError": {
"date": "2021-08-03T15:50:37",
"request-id": "5e37ccda-fd0b-4cd2-8663-c066a9848b5e",
"client-request-id": "5e37ccda-fd0b-4cd2-8663-c066a9848b5e"
}
}
}
Ok, let's try to add appropriate header:
---------------------- REQUEST LOG -----------------------
POST /v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channel/19:edf791c2ffea132578eb777e5905e5c1@thread.tacv2/completeMigration HTTP/1.1
HOST : graph.microsoft.com
HEADERS:
Accept: application/json; utf-8
Accept-Encoding: gzip
Authorization: Bearer
Content-Type: application/json; utf-8
BODY :
***** NO CONTENT *****
-----------------------------------------------------------
---------------------- RESPONSE LOG -----------------------
STATUS : 400 Bad Request
RECEIVED AT : 2021-08-03T16:02:10.4809Z
RESPONSE TIME : 99.262775ms
HEADERS:
Client-Request-Id: 91a7facf-0700-44ba-b495-6eba19c7d7cb
Content-Encoding: gzip
Content-Type: application/json
Date: Tue, 03 Aug 2021 19:01:48 GMT
Request-Id: 91a7facf-0700-44ba-b495-6eba19c7d7cb
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
BODY :
{
"error": {
"code": "BadRequest",
"message": "Empty Payload. JSON content expected.",
"innerError": {
"date": "2021-08-03T19:01:49",
"request-id": "91a7facf-0700-44ba-b495-6eba19c7d7cb",
"client-request-id": "91a7facf-0700-44ba-b495-6eba19c7d7cb"
}
}
}
Next, I've tried to add empty JSON object to request, and another error appeared:
---------------------- REQUEST LOG -----------------------
POST /v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channel/19:edf791c2ffea132578eb777e5905e5c1@thread.tacv2/completeMigration HTTP/1.1
HOST : graph.microsoft.com
HEADERS:
Accept: application/json; utf-8
Accept-Encoding: gzip
Authorization: Bearer
Content-Type: application/json; utf-8
BODY :
{}
-----------------------------------------------------------
---------------------- RESPONSE LOG -----------------------
STATUS : 404 Not Found
RECEIVED AT : 2021-08-03T19:09:05.07888Z
RESPONSE TIME : 69.366717ms
HEADERS:
Client-Request-Id: 44aaad04-7176-4cc5-a57c-d8427374fb7f
Content-Encoding: gzip
Content-Type: application/json
Date: Tue, 03 Aug 2021 19:08:43 GMT
Request-Id: 44aaad04-7176-4cc5-a57c-d8427374fb7f
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
BODY :
{
"error": {
"code": "UnknownError",
"message": "404 page not found\n",
"innerError": {
"date": "2021-08-03T19:08:43",
"request-id": "44aaad04-7176-4cc5-a57c-d8427374fb7f",
"client-request-id": "44aaad04-7176-4cc5-a57c-d8427374fb7f"
}
}
}
Sorry for the long examples.
Could you help me with that error?
What should I do to complete migration for the channel?
Also, similar errors returning when i'm trying to complete team migration and when i'm trying to import message to that channel (which is in migration mode).
Everything works fine.
The answer is use plural form of words in the path:
/v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channels/.../messages/...
instead of:
/v1.0/teams/6a499a24-df0a-4795-bd3b-59c861a7cc2c/channel/.../message/...