SharePoint REST orderby on expanded field
-
07-02-2021 - |
Вопрос
I would like to do an orderby on an expanded field when querying a SharePoint list.
so for example: $select=File/Name&$expand=File&$orderby=File/Name
However, including the orderby on the expanded property causes an error. I can successfully order by fields on the main level, just not at the expanded level.
Any ideas?
Thanks in advance, Jake.
Нет правильного решения
Другие советы
Jake,
I haven't been able to order by an expanded field (yet), but if you're trying to sort by file name, you can use the following REST ODATA query:
/_api/lists/getbytitle('documents')/items/?$select=FileLeafRef&$orderby=FileLeafRef%20asc
FileLeafRef
is a top-level field containing the file name.
Which I found using:
/_api/lists/getbytitle('documents')/Fields
to get the list of fields available on the list.
I hope it helps?
Не связан с sharepoint.stackexchange