0

I have a VBA macro I'm using to interface with the graphAPI to upload a ton of files to SharePoint Online.

That's working fine.

The issue is changing the contentTypes after the fact. I'm using the createUploadSession method of uploading the file, which treats the document library as a Drive. Evidently, document libraries are somewhat hybrid lists and OneDrive drives. The only way I've found to modify the contentType is to grab the library using the list API and changing the items that way.

However, I can't seem to search or filter the results in graph...based on anything. I've tried etag and createdDateTime, I only get "invalid filter clause" errors.

Is it possible to search or filter listitem results?

UPDATE:

I've found it's possible to do:

/items?$filter=fields/Created lt '{date}'

this isn't ideal. Can I filter by etag or a more identifying property? The title isn't populated by uploading the list.

1 Answer 1

0

Got it!

you can do:

/items?$filter=startswith(fields/FileLeafRef, {fileName})

if you add the following header: "Prefer": "HonorNonIndexedQueriesWarningMayFailRandomly"

Basically, this will work so long as the list isn't huge, my list happens to only have a few fields so it works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.