Get the Id of Office365 for the file API from SharePoint REST API

1.2k views Asked by At

I'm working on an iOS app using the Office365 iOS SDK.

I'm also using the SharePoint REST API to search for files in the Office 365 SharePoint/OneDrive files. The search call looks like this:

.../search/query?querytext='myQuery'&SelectProperties='UniqueId,Title,Path,Size,Author'

The search works fine and gives me results. Now I want to download files from the search results. For this I am using the Office iOS SDK. To download a file, I need the ID of the file, as described here: https://msdn.microsoft.com/office/office365/APi/files-rest-operations#FileoperationsDownloadafileREST

In the iOS SDK, there's this corresponding method:

spClient.getfiles().getById(fileID)

The problem is, how do I get this fileID from the search REST API? I tried UniqueID but that doesn't work. Is there any way to get this ID?

1

There are 1 answers

1
Joe Martella On

UniqueId isn't a property of a File/Folder object. Selecting Id will return what you want. For reference, here are the properties of a File/Folder object.

EDIT: Here's the request I made to test this. GET /_api/v1.0/me/files?$select=id,name,size HTTP/1.1. Without pasting the entire response, I'll say I got what's expected, an array of File/Folder items with the ID, name, and size properties. Please let me know if you need more help!