1

I am trying to query a specific item from a SharePoint list. I have the following query string: 

https://graph.microsoft.com/v1.0/sites/myCompany.sharepoint.com:/sites/Global:/lists/%7MY_LIST%7D/items?expand=fields%28select%3DProduction_Code%29 

This query returns a set of objects that looks like this:    

"value": [
        {
            "@odata.etag": "\"000000-0000-4a29-0000-00000000,12\"",
            "createdDateTime": "2015-09-22T05:43:03Z",
            "eTag": "\"0000000-0000-0000-0000-00000000,12\"",
            "id": "0000",
            "lastModifiedDateTime": "2022-11-07T04:01:07Z",
            "webUrl": "https://graph.microsoft.com/v1.0/sites/myCompany.sharepoint.com:/sites/Global:/lists/%7MY_LIST%7D/",
            "createdBy": {
                "user": {
                    "email": "[email protected]",
                    "displayName": "LastName, FirstName"
                }
            },
            "lastModifiedBy": {
                "user": {
                    "email": "[email protected]",
                    "displayName": "LastName, FirstName"
                }
            },
            "parentReference": {
                "id": "0000000-0000-0000-0000-000000000",
                "siteId": "my_company.sharepoint.com,000000-0000-00000-000000-0000000--0000000"
            },
            "contentType": {
                "id": "0x0000000000000000000000000000000000000000000",
                "name": "Generic E-Mail"
            },
            "[email protected]": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('%7MY_LIST%7D')/items('0000')/fields/$entity",
            "fields": {
                "@odata.etag": "\"000000-0000-4a29-0000-00000000,12\"",
                "Production_Code": "."
            }
        }]

 Instead of all fields being returned, I want JUST the fields object, like below: 

"fields": {
                "@odata.etag": "\"000000-0000-4a29-0000-00000000,12\"",
                "Production_Code": "."
            } 

To achieve this, I tried the following query:  https://graph.microsoft.com/v1.0/sites/myCompany.sharepoint.com:/sites/Global:/lists/%7MY_LIST%7D/items?filter=fields%2FProduction_Code%20eq%20%27ARCH0090%27&select=fields 

However, the result set looks like so:    

{
    "@odata.context": ""https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('%7MY_LIST%7D')/items",
    "value": [
        {
            "@odata.etag": "\"000000-0000-0000-0000-0000000,11\""
        }
    ]
} 

and omits fields that I requested as part of the query string. I have read through Microsoft's Documentation exhaustively in search of why this happens, but with no luck.  How do I create a query string that returns a fields object like so:            

"fields": {
                "@odata.etag": "\"000000-0000-4a29-0000-00000000,12\"",
                "Production_Code": "."
            } 

1 Answer 1

0

Try using the expand and select queries like so:

https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields(select=Production_Code)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.