OneDrive metadata hack

Sorry about the deluge of OneDrive questions.

In the current docs:

"Warning There is no Download Link metadata for folders; no file (or folder) will download for folder records. To determine whether a record represents a file or a folder, include the size field. Folders display as Size = 0. "
However when I connect, the folders do in fact have sizes greater than zero.

Is there a new technique for this? My client doesn’t put “.” in folders so we can cheat for a bit but not a long term solution.

Thanks!
AP

Hey Arne-Per!

Thanks for keeping our docs honest. It looks like that size = 0 trick works for some folders, but definitely not all! I saw the behavior you noted in tests on my own OneDrive instance.

I’m updating our docs to reflect that the metadata we currently surface doesn’t allow for differentiating around folders/files declaratively, and I’ll raise this issue with our product management team to see if we can incorporate a solution at some point.

Thanks again.

I hope you are well Cody. Thanks for the update. In case we return to One Drive (we went to Google Drive for now) did you find a work around to differentiate? I don’t mind coding it :). Thanks again!

Ooooh, code you say? Well, if you insist… (He says taking off his documentation hat.)

So OneDrive seems to return different metadata for files versus folders. Rows for folders will have the folder key, while file rows will have the file key.

This is hackery, but you could probably use a snippet like this that filters your data like a condition:

const model = skuid.model.getModel(‘modelId’);
const filterTo = “folder”;
let rowsToAbandon = ;
model.getRows().forEach((row)=>{
if ( !row[filterTo] ){(rowsToAbandon.push(row))}
});
model.abandonRows(rowsToAbandon);