Unable to create sharepoint list items for location and hyperlink columns

Hitesh Pattanayak 15 Reputation points
2024-01-09T17:11:21.3633333+00:00

Looking for any workaround for below stated issue.

If I create a list with location column in the site and then try to fetch the columns of that list I get below response from GRAPH:

API used: https://graph.microsoft.com/v1.0/sites/{{siteid}}/lists/{{listid}}/columns

...
{
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "0fbe07e6-28f7-4bed-ba05-c62cfaae9247",
            "indexed": false,
            "name": "item_x002d_loc",
            "readOnly": false,
            "required": false
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: Country/Region",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "df94e72d-8ade-47bc-a4d8-260d6f58db6a",
            "indexed": false,
            "name": "CountryOrRegion",
            "readOnly": true,
            "required": false,
            "text": {
                "allowMultipleLines": false,
                "appendChangesToExistingText": false,
                "linesForEditing": 0,
                "maxLength": 255
            }
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: State",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "25dd2636-0235-4de7-855f-7139667ca6ce",
            "indexed": false,
            "name": "State",
            "readOnly": true,
            "required": false,
            "text": {
                "allowMultipleLines": false,
                "appendChangesToExistingText": false,
                "linesForEditing": 0,
                "maxLength": 255
            }
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: City",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "c1e02124-2a43-49dd-92ba-00ab2ada3fef",
            "indexed": false,
            "name": "City",
            "readOnly": true,
            "required": false,
            "text": {
                "allowMultipleLines": false,
                "appendChangesToExistingText": false,
                "linesForEditing": 0,
                "maxLength": 255
            }
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: Postal Code",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "824de7f8-cf8a-4294-a8fa-bd08833f863b",
            "indexed": false,
            "name": "PostalCode",
            "readOnly": true,
            "required": false,
            "text": {
                "allowMultipleLines": false,
                "appendChangesToExistingText": false,
                "linesForEditing": 0,
                "maxLength": 255
            }
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: Street",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "4f6e3b89-16c4-4578-a57a-203879b254cb",
            "indexed": false,
            "name": "Street",
            "readOnly": true,
            "required": false,
            "text": {
                "allowMultipleLines": false,
                "appendChangesToExistingText": false,
                "linesForEditing": 0,
                "maxLength": 255
            }
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: Coordinates",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "6077b757-d00d-4af1-a583-0060a0c80ff9",
            "indexed": false,
            "name": "GeoLoc",
            "readOnly": true,
            "required": false,
            "geolocation": {}
        },
        {
            "columnGroup": "Custom Columns",
            "description": "",
            "displayName": "item-loc: Name",
            "enforceUniqueValues": false,
            "hidden": false,
            "id": "35a31383-a431-4b46-9f2e-959cac690967",
            "indexed": false,
            "name": "DispName",
            "readOnly": true,
            "required": false,
            "text": {
                "allowMultipleLines": false,
                "appendChangesToExistingText": false,
                "linesForEditing": 0,
                "maxLength": 255
            }
        },
...

From this response, it is not evident that column item-loc is of Location column type.
The other columns in the response are readonly columns that gets created when you create a Location column.

Also if we populate an item for above column, this is what the response we get from GRAPH:

API used: https://graph.microsoft.com/v1.0/sites/{{siteid}}/lists/{{listid}}/items/{{itemid}}/fields

...
"item_x002d_loc": {
        "address": {
            "city": "Calgary",
            "countryOrRegion": "Canada",
            "postalCode": "T2E6W5",
            "state": "Alberta",
            "street": "2000 Airport Rd NE"
        },
        "coordinates": {
            "latitude": 51.1333,
            "longitude": -114.008
        },
        "displayName": "Calgary International Airport",
        "locationUri": "https://www.bingapis.com/api/v6/localbusinesses/YN1226x8430288103509718371",
        "uniqueId": "https://www.bingapis.com/api/v6/localbusinesses/YN1226x8430288103509718371"
    },
    "CountryOrRegion": "Canada",
    "State": "Alberta",
    "City": "Calgary",
    "PostalCode": "T2E6W5",
    "Street": "2000 Airport Rd NE",
    "GeoLoc": {
        "latitude": 51.1333,
        "longitude": -114.008
    },
    "DispName": "Calgary International Airport",
...

The value for item-loc field is a nested map structure and there should be a column definition to accept this data.

It would be good to have implementation for column definition of location type, so that we can identify the location column type from response, create the column and populate values accordingly to it.

Similar issue for hyperlink column as well.

Issue details for hyperlink column: https://github.com/microsoftgraph/msgraph-sdk-go/issues/640

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2024-01-10T03:17:16.1433333+00:00

    Hi @Hitesh Pattanayak,

    Currently, the create of sharepoint listitem with hyperlink and location field is not supported. There was a similar problem on github before, but it has not been resolved yet. I suggest you submit a user voice to add a support request for updating hyperlink column, and I'll vote for you.

    As a workaround, you could use rest api to create a list item with hyperlink. Please refer to the following issue

    https://stackoverflow.com/questions/47231751/create-or-update-sharepoint-listitem-with-hyperlink-field


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.