How to get all the items contained inside a office365 onedrive

后端 未结 2 1989
無奈伤痛
無奈伤痛 2021-01-14 09:21

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?

2条回答
  •  抹茶落季
    2021-01-14 09:25

    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.

提交回复
热议问题