While we have our odata.getAllItems<T>(url) util function, this function doesn't work for SharePoint items.
Because SharePoint REST API uses odata v3 you'll get an error saying that the accept header is not valid.
However, we can tell the SharePoint REST API to use odata v4 which our util function is using. We can do this by adding a new header odata-version: 4.0.
By adding this header, we can use our util function for SharePoint REST API, Graph, ...
To do
- Add a new header
odata-version: 4.0.
|
headers: { |
|
accept: `application/json;odata.metadata=${metadata ?? 'none'}` |
|
}, |
- Let's check which
spo commands should be updated to use this util function.
While we have our
odata.getAllItems<T>(url)util function, this function doesn't work for SharePoint items.Because SharePoint REST API uses odata v3 you'll get an error saying that the accept header is not valid.
However, we can tell the SharePoint REST API to use odata v4 which our util function is using. We can do this by adding a new header
odata-version: 4.0.By adding this header, we can use our util function for SharePoint REST API, Graph, ...
To do
odata-version: 4.0.cli-microsoft365/src/utils/odata.ts
Lines 26 to 28 in 1254da3
spocommands should be updated to use this util function.