web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Graph API get SharePoi...
Power Automate
Unanswered

Graph API get SharePoint guid ID

(1) ShareShare
ReportReport
Posted on by 303
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?

 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,488 Super User 2025 Season 2 on at
    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.
  • nick9one1 Profile Picture
    303 on at
    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'



     
  • Ellis Karim Profile Picture
    11,695 Super User 2025 Season 2 on at
    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

     
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard