Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Graph API get SharePoint guid ID

Like (1) ShareShare
ReportReport
Posted on 15 Feb 2025 09:28:22 by 281
I have a power automate flow that collects news articles across SharePoint.

I'm using a get request like this
https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/?$filter=fields/FirstPublishedDate gt '2025-01-01'&$expand=fields($select=*,FirstPublishedDate,title,thumbnailURL,Description,LinkFileName)
 
 
I also need the thumbnailURL, which the first call does not provide. So I need to make a second call using microsoft.graph.sitePage;
https://graph.microsoft.com/beta/sites/{siteId}/pages/microsoft.graph.sitePage?filter=webUrl eq '{siteUrl}'
 
Unfortunately the filter in the s second call does not work well, it often contains apostrophes which are encoded to %27, and cause the request to fail. 

 
So, using the first call, is it possible to get the item GUID? - this would be better to filter with in the second call?

 
  • Ellis Karim Profile Picture
    10,940 Super User 2025 Season 1 on 16 Feb 2025 at 21:33:38
    Graph API get SharePoint guid ID
    Hi nick9one1,

    A method I used some years back (2021) was to use the Get Items action to get the news details and the news post image. The response will contain the "BannerImageUrl" property if the news post has an image.
     
    "BannerImageUrl": "https://cdn.hubblecontent.osi.office.net/m365content/publish/a9e53c5b-4fba-4762-8844-a2b10dff5c96/thumbnails/large.jpg?file=75650029.jpg"
     
    You could use the Get Item with the news item ID to get the BannerImageUrl property, then use the Send HTTP request to SharePoint action to get the image:
     
    Or you could use the use the HTTP action to download the image.
     
     
    I ended up using both at the time because the Send HTTP request to SharePoint would sometimes fail to return an image even though the URL was valid. If that happened, I'd try the HTTP action, and if that also failed, I'd return a default image. Maybe you can find a better method.
     
     

    Ellis Karim Ellis Karim
    Blog | LinkedIn | Bluesky

     
     
  • nick9one1 Profile Picture
    281 on 16 Feb 2025 at 09:38:45
    Graph API get SharePoint guid ID
    Hi, thank you for the reply. My ultimate goal here is to get the thumbnailURL for the news article. It would be great if I could get it with this first 'pages' Graph call, but it does not appear even with the * in expand fields. 

    This is one item from this call;
     
    https://graph.microsoft.com/v1.0/sites/company.sharepoint.com,8b916ccb-d28a-4cb8-8d3a-366b2884a2f9,dd15c2e1-9d25-4f5e-8b94-8e06818ca2dd/lists/2ce55294-ef84-45f7-a188-9a63492164f7/items/?$filter=fields/FirstPublishedDate gt '2025-01-01'&$expand=fields($select=*)
    response;
    {
                "@odata.etag": "\"43de8128-7061-4fa6-8dde-d9e3e74cd7a7,119\"",
                "createdDateTime": "2025-02-13T14:47:07Z",
                "eTag": "\"43de8128-7061-4fa6-8dde-d9e3e74cd7a7,119\"",
                "id": "29",
                "lastModifiedDateTime": "2025-02-13T15:26:34Z",
                "webUrl": "https://companygroup.sharepoint.com/functions/AnnualPeopleAwards/SitePages/We%27re-at-the-halfway-mark.aspx",
                "createdBy": {
                    "user": {
                        "email": "user.user@company-ltd.com",
                        "id": "73bdf718-5cbf-4c1a-bb4c-6ea656ebd0a2",
                        "displayName": "user user"
                    }
                },
                "lastModifiedBy": {
                    "user": {
                        "email": "user.user@company-ltd.com",
                        "id": "f983ea15-7f00-4ac6-9593-b6d3802c435a",
                        "displayName": "user user"
                    }
                },
                "parentReference": {
                    "id": "0338b3e0-1f05-4e67-ab12-429d5c74bdd0",
                    "siteId": "companygroup.sharepoint.com,8b916ccb-d28a-4cb8-8d3a-366b2884a2f9,dd15c2e1-9d25-4f5e-8b94-8e06818ca2dd"
                },
                "contentType": {
                    "id": "0x0101009D1CB255DA76424F860D91F20E6C41180053E73BB56D7B3C4C9CD782724B5152F7",
                    "name": "Site Page"
                },
                "fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('companygroup.sharepoint.com%2C8b916ccb-d28a-4cb8-8d3a-366b2884a2f9%2Cdd15c2e1-9d25-4f5e-8b94-8e06818ca2dd')/lists('2ce55294-ef84-45f7-a188-9a63492164f7')/items('29')/fields(*)/$entity",
                "fields": {
                    "@odata.etag": "\"43de8128-7061-4fa6-8dde-d9e3e74cd7a7,119\"",
                    "FileLeafRef": "We're-at-the-halfway-mark.aspx",
                    "Title": "It's all to play for...",
                    "Description": "The Annual People Awards take place in May and are a celebration of our fantastic company people. As part of our Kudos recognition framework, the celebration process starts with your nominations. This year, you have the whole month of February to put fo…",
                    "_PublishStartDate": "2025-02-13T14:47:07Z",
                    "Hero_x0020_Story": true,
                    "Hero_x0020_Headline": "Headline",
                    "LinkTitle": "It's all to play for...",
                    "id": "29",
                    "ContentType": "Site Page",
                    "Created": "2025-02-13T14:47:07Z",
                    "AuthorLookupId": "2347",
                    "Modified": "2025-02-13T15:26:34Z",
                    "EditorLookupId": "2780",
                    "_CheckinComment": "",
                    "LinkFilenameNoMenu": "We're-at-the-halfway-mark.aspx",
                    "LinkFilename": "We're-at-the-halfway-mark.aspx",
                    "DocIcon": "aspx",
                    "FileSizeDisplay": "21837",
                    "ItemChildCount": "0",
                    "FolderChildCount": "0",
                    "_ComplianceFlags": "",
                    "_ComplianceTag": "",
                    "_ComplianceTagWrittenTime": "",
                    "_ComplianceTagUserId": "",
                    "_CommentCount": "",
                    "_LikeCount": "",
                    "_DisplayName": "",
                    "Edit": "0",
                    "_UIVersionString": "2.0",
                    "ParentVersionStringLookupId": "29",
                    "ParentLeafNameLookupId": "29"
                }
            }
        ]
    }
     
    Unfortunately there is no thumbnailURL, and no GUID id. Only the sharepoint list id '695'.
    The only unique field I can see to make the second Graph call, is the URL or filename

    So my second call looks like this;
     
    https://graph.microsoft.com/beta/sites/company.sharepoint.com,8b916ccb-d28a-4cb8-8d3a-366b2884a2f9,dd15c2e1-9d25-4f5e-8b94-8e06818ca2dd/pages/microsoft.graph.sitePage?filter=webUrl eq 'https://companygroup.sharepoint.com/functions/AnnualPeopleAwards/SitePages/We%27re-at-the-halfway-mark.aspx'
    as expected, this gives an error;
    "message": "Invalid filter clause: Syntax error at position 91 in 'webUrl eq 'https://companygroup.sharepoint.com/functions/AnnualPeopleAwards/SitePages/We're-at-the-halfway-mark.aspx''.",


    So I tried escaping the apostrophe by replacing it with double apostrophes in both formats ('') and (%27%27). Both responses have no value;

    e.g. 
    https://graph.microsoft.com/beta/sites/companygroup.sharepoint.com,8b916ccb-d28a-4cb8-8d3a-366b2884a2f9,dd15c2e1-9d25-4f5e-8b94-8e06818ca2dd/pages/microsoft.graph.sitePage?filter=webUrl eq 'https://company.sharepoint.com/functions/AnnualPeopleAwards/SitePages/We%27%27re-at-the-halfway-mark.aspx'
     
    {
        "@odata.context": "https://graph.microsoft.com/beta/$metadata#sites('company.sharepoint.com%2C8b916ccb-d28a-4cb8-8d3a-366b2884a2f9%2Cdd15c2e1-9d25-4f5e-8b94-8e06818ca2dd')/pages/microsoft.graph.sitePage",
        "@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET sites('<key>')/pages/microsoft.graph.sitePage?$select=promotionKind,reactions",
        "value": []
    }
    I have also just tried escaping with a \
    i.e.  \%27 and \'
    Both give' Bad Request'



     
  • Michael E. Gernaey Profile Picture
    42,027 Super User 2025 Season 1 on 16 Feb 2025 at 04:09:56
    Graph API get SharePoint guid ID
    Hi
     
    you should be able to add id into the Select to get it, although it already has *
     
    What is the response that you get from the first call look like? Are you sure its not already there?
    But that is how
    And yes a much better filter
     
    But you are saying that you are using '{XXXX}' and because the XXXX has single ' quotes in it, the call fails is that correct?
     
    or that webUrl has them and it fails?
     
    And what does fail mean? you get an error, or you just dont get a result.
     
    This is another one of your posts I believe that I have answered on, please please make sure to provide the actual details of failures versus assuming we can figure or know what it was.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 87

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard