MS Teams Graph API support to open files in-app

Brass Contributor

Hi,

MS Graph has provided an API support to open files by hitting /preview API.

The parameters that the API expects are in the context of Files since the expected parameter item-id is available only when we hit /children API and the same id for the same attachment is not available when we fetch conversation by hitting /getConversations.

We plan to match the e-tag value and the attachment-id in absence of any API to map both the responses to get item-id? Does that look correct from the implementation perspective?

 

Also Can anyone suggest if there is another API to open files when we do not have the item-id with us?

 

Response of /getConversations with attachment details :

"attachments": [
{
"id": "5c5c0073-c98a-4a9f-9a24-429cbda7f2c4",
"contentType": "reference",
"contentUrl": "https://optytenant.sharepoint.com/sites/FilesTeams/Shared Documents/Trial Delta Channel/Use cases.rtf",
"content": null,
"name": "Use cases.rtf",
"thumbnailUrl": null
}

 

Response of /children with file details : 

"value": [
{
"@microsoft.graph.downloadUrl": "https://optytenant.sharepoint.com/sites/FilesTeams/_layouts/15/download.aspx?UniqueId=5c5c0073-c98a-4a9f-9a24-429cbda7f2c4&Translate=false&tempauth=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvb3B0eXRlbmFudC5zaGFyZXBvaW50LmNvbUA5ZDliYzliMS1mNzhjLTRjMTEtYTk4Mi05Mzk0YzI0MzYxY2IiLCJpc3MiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAiLCJuYmYiOiIxNTY4NjE5MzkzIiwiZXhwIjoiMTU2ODYyMjk5MyIsImVuZHBvaW50dXJsIjoiMk5kWk5aVFBGRnhpT05UTXRnTmliRjAwM3N4ZnZWS3QwYlZPK05HNlRWND0iLCJlbmRwb2ludHVybExlbmd0aCI6IjEzOCIsImlzbG9vcGJhY2siOiJUcnVlIiwiY2lkIjoiTldZNVpUSXpaRFl0WkdVd1lpMDBNMkU0TFdFellqa3RPRFV6TVRGaVptUXdaRGN5IiwidmVyIjoiaGFzaGVkcHJvb2Z0b2tlbiIsInNpdGVpZCI6Ik5UbG1PVGMzTjJZdE1HSXhPUzAwT0RReUxUa3lNbVF0WTJGaU9HWXhNVEZrTjJReCIsImFwcF9kaXNwbGF5bmFtZSI6InRlYW1zZGVtbyIsImdpdmVuX25hbWUiOiJKb2huIiwiZmFtaWx5X25hbWUiOiJEb2UiLCJhcHBpZCI6IjdjMGVjOTkzLTU5NTktNDc1Zi04Yjk5LWVhMWEwMjViZmUxMSIsInRpZCI6IjlkOWJjOWIxLWY3OGMtNGMxMS1hOTgyLTkzOTRjMjQzNjFjYiIsInVwbiI6ImRlbW9Ab3B0eXRlbmFudC5vbm1pY3Jvc29mdC5jb20iLCJwdWlkIjoiMTAwMzIwMDAzMkRDNjdCMCIsImNhY2hla2V5IjoiMGguZnxtZW1iZXJzaGlwfDEwMDMyMDAwMzJkYzY3YjBAbGl2ZS5jb20iLCJzY3AiOiJteWZpbGVzLnJlYWQgYWxsZmlsZXMucmVhZCBteWZpbGVzLndyaXRlIGFsbGZpbGVzLndyaXRlIGdyb3VwLnJlYWQgZ3JvdXAud3JpdGUgYWxsc2l0ZXMuZnVsbGNvbnRyb2wgYWxsc2l0ZXMubWFuYWdlIGFsbHNpdGVzLnJlYWQgYWxsc2l0ZXMud3JpdGUgYWxscHJvZmlsZXMucmVhZCBhbGxwcm9maWxlcy5yZWFkIGFsbHByb2ZpbGVzLndyaXRlIiwidHQiOiIyIiwidXNlUGVyc2lzdGVudENvb2tpZSI6bnVsbH0.amdxOU5HYXlSQXo0dGpwZHhVWVdNMmRZOUJoYVQwbU0yTFE2UjJud2ErOD0&ApiVersion=2.0",
"createdDateTime": "2019-09-13T12:15:21Z",
"eTag": "\"{5C5C0073-C98A-4A9F-9A24-429CBDA7F2C4},2\"",
"id": "01243ZUBDTABOFZCWJT5FJUJCCTS62P4WE",
"lastModifiedDateTime": "2019-09-13T12:15:22Z",
"name": "Use cases.rtf",
"webUrl": "https://optytenant.sharepoint.com/sites/FilesTeams/_layouts/15/WopiFrame.aspx?sourcedoc=%7B5C5C0073-C98A-4A9F-9A24-429CBDA7F2C4%7D&file=Use%20cases.rtf&action=default",
"cTag": "\"c:{5C5C0073-C98A-4A9F-9A24-429CBDA7F2C4},2\"",
"size": 738,
"createdBy": {
"application": {
"id": "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe",
"displayName": "Microsoft Teams Services"
},
"user": {
"email": "demo@optytenant.onmicrosoft.com",
"id": "f97d501b-e78c-412a-a1da-6dd3d486c364",
"displayName": "John Doe (Optymyze)"
}
},
"lastModifiedBy": {
"application": {
"id": "5e3ce6c0-2b1f-4285-8d4b-75ee78787346",
"displayName": "Microsoft Teams Web Client"
},
"user": {
"email": "demo@optytenant.onmicrosoft.com",
"id": "f97d501b-e78c-412a-a1da-6dd3d486c364",
"displayName": "John Doe (Optymyze)"
}
},
"parentReference": {
"driveId": "b!f3f5WRkLQkiSLcq48RHX0Qy05YkLX09GuSOBNZG3-JGtxSZLMJdnQ59Rd0xW3mWK",
"driveType": "documentLibrary",
"id": "01243ZUBDPOTRB6TYVDNFIE2YDAYKT5YBO",
"path": "/drives/b!f3f5WRkLQkiSLcq48RHX0Qy05YkLX09GuSOBNZG3-JGtxSZLMJdnQ59Rd0xW3mWK/root:/Trial Delta Channel"
},
"file": {
"mimeType": "application/rtf",
"hashes": {
"quickXorHash": "XmcM1Y3bsieJcbf6JmmMviOoEVU="
}
},
"fileSystemInfo": {
"createdDateTime": "2019-09-13T12:15:21Z",
"lastModifiedDateTime": "2019-09-13T12:15:22Z"
}
}
]

 

 

0 Replies