0

In a list located in SharePoint, that has over 100 items, there are 5 hyperlink columns, with each entry in it including the URL address and a display name.

I am creating a form for this list that allows the user to edit both the URL and the display name, but I can't seem to reference the display name of hyperlink columns.

How do I do that?

Here is the form made in Power Apps

The hyperlink columns have display names that were covered in blue. I need to get them in Power Apps

  • Does this answer your question? [Sharepoint List Hyperlink Column - get Alternative Text in PowerApps](https://stackoverflow.com/questions/75447617/sharepoint-list-hyperlink-column-get-alternative-text-in-powerapps) – carlosfigueira Aug 04 '23 at 14:03
  • No, since calculated column doesn't work the way that it was specified there as a solution. – Marcelo Marcolino Aug 04 '23 at 14:38

1 Answers1

1

Yes, it's possible! Not with the built-in SharePoint connector, but with an HTTP request with the standard (not premium!) Office 365 Groups connector and the Graph API.

Let's go!

Step 1

Create a SharePoint list with an hyperlink column.

Create a new item with a Title, an URL and the URL Description:

list item with an URL

Create more items... SharePoint list

The goal is to display the URL description, not the Title in a PowerApps Canvas. Unfortunately with the SharePoint connector, only the title and URL are returned. Not the URL description. For example, with a simple gallery the result is:

Gallery with the SharePoint Connector

But there is a simple solution!

Step 2

In your Power Apps Canvas, create a new connection with the Office 365 Groups connector.

Step 3

In your Power Apps Canvas, open App > OnStart and write this expression (replace YOUR-SITE-GUID by your site GUID). The sample is written for an English Power Apps Studio (it not, change the , and ; according to your language: https://learn.microsoft.com/en-us/power-platform/power-fx/global#formula-separators-and-chaining-operator)

To get YOUR-SITE-GUID, you can call this simple web request https://your-tenant.sharepoint.com/sites/your-site/_api/site/id in your browser (with your tenant and site name of course.)

Set(AllFavorites, Office365Groups.HttpRequest("https://graph.microsoft.com/v1.0/sites/YOUR-SITE-GUID/lists/Favorites/items?expand=fields", "GET", ""));

ClearCollect(
    colAllFavorites,
    ForAll(
        Table(AllFavorites.value),
        {
            Title: Text(Value.fields.Title),
            Url: Text(Value.fields.Bookmark.Url),
            Description: Text(Value.fields.Bookmark.Description)
        }
    )
);

App On Start

Now, you have a new collection (colAllFavorites) with the title, URL and URL description!

Step 4

You can create a new gallery with the collection colAllFavorites as the gallery's datasource and use the description as the title of each card. The gallery is only here to display the results (for this demonstration). Fell to free to adapt to your project (with a dropdown list instead of a gallery, etc.)

Gallery with URL description

Conclusion

The SharePoint GetItems connector does not return the description of an hyperlink column. The SharePoint API (Graph API or REST API) does indeed return this value! In Power Automate, SharePoint HTTP action can be used but in Power Apps it's easier to use the Office 365 Groups HTTP action (standard connector).

jleture
  • 538
  • 1
  • 4
  • 11
  • Is there a way to use this solution for a form that already uses a datasource for the other fields, or do I have to remake them all to fit into this solution? – Marcelo Marcolino Aug 04 '23 at 19:34
  • I am afraid that you have to edit yours forms to use these kind of collections instead of direct SharePoint datasources. Maybe you can add screenshots in your initial post to illustrate your need. – jleture Aug 04 '23 at 20:02
  • Also the expression on Power Apps isn't working – Marcelo Marcolino Aug 04 '23 at 20:14
  • It’s working with an English interface. For some other language, separators are not the same (1 coma = 1 semicolon, 1 semicolon = 2 semicolons). It’s easier to setup Power Apps Studio in English. – jleture Aug 04 '23 at 20:36
  • I made the changes, but the code snippet of ClearCollect still shows errors. Here's how the code is now: `ClearCollect( colAllFavorites.value; ForAll( Table(AllFavorites.value); { Title: Text(Value.fields.Title); Url: Text(Value.fields.Legisla_x00e7__x00e3_o_x0020_Ref.Url); Description: Text(Value.fields.Legisla_x00e7__x00e3_o_x0020_Ref.Description) } ) );;` – Marcelo Marcolino Aug 07 '23 at 15:34
  • The first argument of ClearCollect is wrong on your code but mine is correct. Why do you add .value? – jleture Aug 07 '23 at 16:16
  • If possible, could you show more of a step-by-step? I still can't get the data to display. – Marcelo Marcolino Aug 09 '23 at 12:14
  • What is your issue? My answer is a step by step because there is only one step: in the App OnStart you just have to enter the formula to get a collection with the data you need. – jleture Aug 09 '23 at 16:23
  • Perhaps I am having difficulty with getting the proper GUID. I even tried it out in the graph explorer but can't seem to find the list location. – Marcelo Marcolino Aug 09 '23 at 16:48
  • There is no difficulty to get site id. Just enter `https://your-tenant.sharepoint.com/sites/your-site/_api/site/id` in your browser! – jleture Aug 09 '23 at 19:54
  • Thanks to you I managed to obtain the data, but now I need to display it on the form that uses the SharePoint list directly. The idea is that on the cards 'Legislação Referência', the url value should check for any entries that matches its value on the Office 365 Groups connector, and then put the display name on the field below. – Marcelo Marcolino Aug 15 '23 at 17:36
  • Great job! Now you have a collection, you could use a `LookUp` to find the description for your card. Something like that `LookUp(colAllFavorites, Url = ThisItem.Url)` to find the record, or `LookUp(colAllFavorites, Url = ThisItem.Url).Description` to get only the description. Maybe you have to store and add the id of the items if you want to filter on that. – jleture Aug 15 '23 at 18:12
  • It worked! The description is being shown on the form! The issue now is when I need to alter the description. Do I need to create a PUT/POST expression to change the description of each URL? – Marcelo Marcolino Aug 15 '23 at 19:52
  • Great! Yes, you can edit the description as well with the REST API. In fact, your question was only about to display it You can check a solution here: https://powerusers.microsoft.com/t5/Building-Flows/Updating-a-SP-Hyperlink-Field-using-Send-HTTP-request/td-p/648460 – jleture Aug 16 '23 at 05:06