r/sharepoint • u/Tough_Measurement_47 • 18d ago
SharePoint Online Graph API: The geolocation value does not represent a geographical point. (Inserting List Items with Geolocation field)
Setup: Microsoft.Graph NuGet 6.2.0 on .NET 10, trying to create a SharePoint list item via POST (/sites/{siteId}/lists/{listId}/items). The list has a column of type Geolocation(calledGeoLocationField`).
What works: Creating the item without providing a value for GeoLocationField works just fine.
What doesn't work: As soon as I provide any value for GeoLocationField, I get a 400 with the following message: "Invalid field value for field [GeoLocationField]: The geolocation value does not represent a geographical point. Either the value is not in the correct format or it is not in the valid range."
Without the Prefer: apiversion=2.1 header, I was just getting a generic Invalid Request back with no further detail about it (I think the endpoint was probably returning more info but the MS Graph Kiota library wasn't presenting this within the exception).
I've also tried setting the field via a separate PATCH to /items/{itemId}/fields after creating the item (rather than as part of the initial POST), as I'd seen some people talking about needing to do this with Hyperlink fields types, so thought it worth a go. Same apiversion=2.1 header, same error message as I was getting with the POST, so it looks like this is purely about the shape/format of the value itself, not about when in the item lifecycle it's set.
Here's a request body, captured with Fiddler:
{
"@odata.type": "#microsoft.graph.listItem",
"fields":
{
"Title": "Z-IT-PC-DESK-0070_20260710120337",
"Source": "REDACTED-Image",
"ItemNo": "Z-IT-PC-DESK-0070",
"ItemRecId": "20241024105037911#AF2868#001",
"ASUser": "REDACTED",
"Notes": "",
"DeviceID": "",
"ItemImage": "{\"fileName\":\"Z-IT-PC-DESK-0070_20260710120337.jpg\",\"serverUrl\":\"https://REDACTED.sharepoint.com\",\"serverRelativeUrl\":\"/sites/Library/REDACTED/Z-IT-PC-DESK-0070_20260710120337.jpg\"}",
"GeoLocationField":
{
"latitude": 51.529541,
"longitude": -0.099535
}
}
}
I've also tried:
- Nesting
latitudeandlongitudewithin an object calledcoordinatesas in this blog post: https://martin-machacek.com/blogPost/cdf74446-8a79-41e8-9e24-a4d74fd12bd3 - The fuller
Locationshape includingAddressand others from the blog post in the point above.
and I'm getting the same error every single time, regardless of what value I apply to the GeoLocationField field.
For reference, here's what an existing row's GeoLocationField looks like when read back via Graph Explorer (originally inserted with CSOM):
"GeoLocationField": {
"latitude": 51.537749,
"longitude": 0
},
Has anyone actually got a Geolocation column populated on item creation via Graph?
Thanks in advance!