I have a sharepoint site page that has some CSV files starting with ABC_datetime (e.g.ABC_20-02-2022 18-10-00) and I have created a sharepoint choice column Datatype that will have some reference value in it while I insert the record in the page.
"fields": {
LinkFilename --- csv filename,
Datatype ---- Choice that I inserted while loading the file,
Modified ---- modified date time - e.g. 2022-06-21T06:16:57Z
}
I would like to extract the latest file that is been loaded along with the above fields and the weburl that will hold the csv file.
I am new to graph and I was trying to first extract, and sort the filenames.
https://graph.microsoft.com/v1.0/sites/company.sharepoint.com/sites/Shared%20Documents:/lists/<listid>/items?expand=fields($select=LinkFilename,name,Datatype,Modified)&orderby=Modified%20desc&$filter=startswith(LinkFilename,'ABC_')
The above was not doing the sort. Please could anyone help me in getting ONLY the latest file based on the modified or any other date that is present in sharepoint and getting the file that I would need in filter condition? Or is there any other way that this can be achieved other than list items?
Thanks in advance.
The correct query for
$orderby
isfields/Modified%20desc
.Not sure, probably you need to add request header
Prefer:HonorNonIndexedQueriesWarningMayFailRandomly