I am making a graphi api search call on driveItem and the result is having both files and folders. How do i differentiate between the files and folders?
Sample request
Endpoint - https://graph.microsoft.com/v1.0/$batch
Body -
{
"requests": [
{
"url": "/search/query",
"method": "POST",
"id": "1",
"body": {
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "test document"
},
"from": 0,
"size": 500
}
]
},
"headers": {
"Content-Type": "application/json"
}
}
]
}
Sample Response -
"hits": [
{
"hitId": "01G7HBIV4QOXJ3QMEMWFEZLWD3OVWEUC7N",
"rank": 1,
"summary": "<c0>test</c0> <ddd/>",
"resource": {
"@odata.type": "#microsoft.graph.driveItem",
"size": 4678,
"id": "01G7HBIV4QOXJ3QMEMWFEZLWD3OVWEUC7N",
"createdDateTime": "2022-01-03T03:50:44Z",
"lastModifiedDateTime": "2022-01-03T03:50:44Z",
"name": "test12.xlsx",
"webUrl": "https://xyz.sharepoint.com/personal/xyz/Documents/TestBatchingFolder/test12.xlsx",
"fileSystemInfo": {
"createdDateTime": "2022-01-03T03:50:44Z",
"lastModifiedDateTime": "2022-01-03T03:50:44Z"
},
"createdBy": {
"user": {
"displayName": "xyz",
"email": "xyz.onmicrosoft.com"
}
},
"lastModifiedBy": {
"user": {
"displayName": "xyz",
"email": "xyz@jaswant .onmicrosoft.com"
}
},
"parentReference": {
"driveId": "xyz",
"id": "xyz",
"siteId": "xyz.sharepoint.com,9b7a4044-3da1-43f4-90d0-b71144f97aae,e9adba9f-a7b2-4a80-a288-60a5bdee9086",
"sharepointIds": {
"listId": "76946dc1-0bfa-48e4-a3a4-977be9f2172d",
"listItemId": "2",
"listItemUniqueId": "B8D37590-8C30-49B1-95D8-7B756C4A0BED"
}
}
}
},
{
"hitId": "01RRXSZS4ESTNUK4WNTBAJHN4OC6RULMZ4",
"rank": 2,
"summary": "",
"resource": {
"@odata.type": "#microsoft.graph.driveItem",
"size": 0,
"id": "01RRXSZS4ESTNUK4WNTBAJHN4OC6RULMZ4",
"createdDateTime": "2022-01-06T23:01:10Z",
"lastModifiedDateTime": "2022-01-06T23:01:10Z",
"name": "Test",
"webUrl": "https://xyz/sites/CustomerSuccess/Shared Documents/Test",
"fileSystemInfo": {
"createdDateTime": "2022-01-06T23:01:10Z",
"lastModifiedDateTime": "2022-01-06T23:01:10Z"
},
"createdBy": {
"user": {
"displayName": "xyz",
"email": "xyz@jaswant .onmicrosoft.com"
}
},
"lastModifiedBy": {
"user": {
"displayName": "xyz",
"email": "xyz@jaswant .onmicrosoft.com"
}
},
"parentReference": {
"driveId": "xyz",
"id": "xyz",
"siteId": "xyz.sharepoint.com,94166574-cd89-4a54-95c4-706daf206b6a,bae9cc2e-6dc8-45ee-906a-9e800af0267e",
"sharepointIds": {
"listId": "ae552a53-63c8-4bc8-9709-031391930c60",
"listItemId": "35",
"listItemUniqueId": "45db9484-cd72-4098-93b7-8e17a345b33c"
}
}
}
}
]