I want to get all the files and folders contained inside a office365 onedrive folder in one rest API call, is there any option to do it?
Ok, try this search request:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='%2A')
Or:
https://api.onedrive.com:443/v1.0/drives/(driveid)/items/(itemid)/view.search?q=%2A
Where %2A is asterisk, itemid may be a root folder id. Don't forget about pagination.
Or with OneDriveSDK:
_connection.SearchForItemsAsync(odFolder.ItemReference(), "*", ItemRetrievalOptions.Default)
Don't use "expand" query with search query. This should return all items in current folder recursively - sub-folders, sub-items.