0

I have tried to get image URL using rest Api and PnP js in my SPFx react solution but not get proper image URL from Api response.

Below is the code and response from the Api. Missing serverRelativeUrl and serverUrl from NewImage and TilesImage columns.

Code:

const lItemsSchemaTest: any[] = await _sp.web.lists.getById(lSelectedListTitle).items();

Response:

enter image description here


I have another tenant and from there I got perfect url with serverRelativeUrl and serverUrl.

Code: const lItemsSchemaTest: any[] = await _sp.web.lists.getById(lSelectedListTitle).items();

Response:

enter image description here

enter image description here

Resolution Change the release to Standard Release .

Thanks

8
  • Are you using SharePoint Image Column in your lists? Nov 7, 2023 at 7:15
  • How you set the image column values initially, using SharePoint UI or PowerShell or Power Automate or Power Apps or using any other method? Nov 7, 2023 at 7:15
  • Add image using SharePoint UI. Create new item and add image
    – Chandresh
    Nov 7, 2023 at 7:24
  • I just tried creating a new list item with Image column using SharePoint UI and it returns image URL using REST API without any issue: i.stack.imgur.com/PgB7d.png. Maybe there is some issue with your site/list. Can you try creating a new list with image column in same site and see if it works? Are you using standard release or targeted release tenant where it is not working? Nov 7, 2023 at 7:34
  • 1
    @GaneshSanap-MVP, Issue identify and sorted, Works well in standard release but does not work in target release for everyone. Thanks
    – Chandresh
    Nov 7, 2023 at 8:04

2 Answers 2

1

I just tried creating a new SharePoint list item with Image column using SharePoint UI:

enter image description here

When I tried using SharePoint REST API call like below, it returned an image URL without any issue:

https://contoso.sharepoint.com/sites/SPConnect/_api/web/Lists/getbytitle('Logo Universe')/Items(17)?$select=Image

Where Image is the internal name of my SharePoint list image column. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?

Output:

enter image description here

As discussed in the comments section above, this issue might be for targeted release tenants only due to some recent feature release by Microsoft.

Try:

  1. Use Standard release tenant settings, check: Set up the Standard or Targeted release options
  2. Report this behavior of the image column in targeted release tenant to Microsoft, follow this documentation: Get M365 Support - Online Support
0

Change the release to Standard Release from Admin Center .

Select the Organization Profile , realease preferences

Make Standard here

enter image description here

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.