使用Microsoft Graph API过滤SharePoint列表时遇字段类型异常求助
Let's break down the issue you're facing and walk through practical fixes to resolve it:
The Problem Recap
You're attempting to filter a specific SharePoint list item using Microsoft Graph API with this request:
GET https://graph.microsoft.com/v1.0/sites/{id}:/commercial:/lists/{id}/items?filter=id eq 7941
But you're hitting this error response:
{ "error": { "code": "-2130575340, Microsoft.SharePoint.SPException", "message": "One or more field types are not installed properly. Go to the list settings page to delete these fields.", "innerError": { "request-id": "3573cb36-5c0f-47ff-8723-b829d1dc4b8a", "date": "2018-03-28T13:49:59" } } }
Key Root Causes & Fixes
1. You're Targeting the Wrong id Field in Your Filter
This is the most probable issue. Here's the critical distinction you're missing:
- In Microsoft Graph API, the top-level
idproperty of a list item is a GUID string (e.g.,a1b2c3d4-1234-5678-90ab-cdef01234567), not the numeric ID you see in SharePoint's UI. - The integer ID you're trying to filter (7941) maps to SharePoint's built-in
IDfield, which lives under thefieldsproperty in Graph API responses.
Quick Fix: Update your filter to target the correct field:
GET https://graph.microsoft.com/v1.0/sites/{id}:/commercial:/lists/{id}/items?filter=fields/ID eq 7941
2. The SharePoint List Contains Corrupted Fields
The error message directly points to field type issues. Even with a corrected filter, a corrupted field in the list can trigger this error.
Steps to resolve:
- Navigate to your SharePoint list's settings page via the site's web UI.
- Scroll to the Columns section and look for fields marked as "corrupted" or with unusual type labels.
- Delete any problematic fields, then retry your Graph API request.
3. Verify Basic List Accessibility First
Before digging into filter syntax, confirm the list itself is accessible via Graph API without filters:
GET https://graph.microsoft.com/v1.0/sites/{id}:/commercial:/lists/{id}/items
If this request also throws the same field error, the issue lies entirely with the list's configuration, not your filter. Prioritize fixing the corrupted fields in SharePoint first.
内容的提问来源于stack exchange,提问作者Simon Chollet

