RaccoonDeveloper
RaccoonDeveloper

Reputation: 224

OneDrive API v2.0: OneNote Notebook is not considered as file nor Folder

I'm using Onedrive API and i want to keep in sync my local database with the remote one.

When using view.delta, i noticed that :

Folder got the folder key

files got the file key

but onenote notebook don't have any attributes...

 {u'@odata.editLink': u'drive/items/01LJS4...M',
         u'@odata.etag': u'"{AD...C18C},2"',
         u'@odata.id': u'https://..sharepoint.com/_api/v2.0/drive/items/01LJS4..QMM',
         u'@odata.type': u'#oneDrive.item',
         u'createdDateTime': u'2016-02-05T10:29:36Z',
         u'eTag': u'"{AD.C61C18C},2"',
         u'id': u'01LJ.GGDQMM',
         u'lastModifiedDateTime': u'2016-02-05T10:29:36Z',
         u'name': u'insideFolder2_file2',
         u'parentReference': {u'driveId': u'b!EnUrFN.xGe0841c',
                              u'id': u'01LJS4R.XFXDH',
                              u'path': u'/drive/root:/NewFOlder2'},
         u'size': 0,
         u'webUrl': u'https://..sharepoint.com/personal._onmicrosoft_com/Documents/NewFOlder2/insideFolder2_file2'},

So the question is when parsing, i try to get either the folder key, either the file key, so for one note, the ugly and only solution is to assume that if its neither a folder nor a file, let's make some bet its a notebook ?? :)

Can anyone shed a light on this mystery?

Kind Regards

Upvotes: 0

Views: 173

Answers (1)

Kelly Crossley
Kelly Crossley

Reputation: 11

The result will be a "file" with a mimeType of application/onenote. That facet \ property on the file will allow you to process it it properly through your code.

Take a look at New OneDrive APIs for Developing Against OneDrive AND OneDrive for Business. - 28:10 is where the presenter begins to speak to this. Here is the link https://www.youtube.com/watch?v=iDuwgPcX2-k

Also, look at https://dev.onedrive.com/index.htm for details on the API. Under the samples navigation item there are downloadable samples in github that you can run in Visual Studio, as an example, which will access a oneDrive location. In performing that process, I uploaded a OneNote document and acquired the information about the file as shown below.

"file": {
    "hashes": {
        "crc32Hash": "F056AD54",
        "sha1Hash": "02F0087A6C326FCB9A35380B10761EEA701CFA05"
    },
    "mimeType": "application/onenote"
},

Hope that helps you.

Upvotes: 1

Related Questions