1

In the SharePoint list, I want to make a dynamic link to a Delve profile. I have a JSON like this:

  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "a",
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover",
    "title": "Otevřít v Delve",
    "target": "_blank",
    "href": "='https://eur.delve.office.com?p=' + [$email]"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer",
    "text-decoration": "none"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "OpenPane",
        "class": "ms-font-xxl"
      }
    }
  ]
}

In fact, it does redirect me to the profile, but it's showing me only a profile image and the rest of the page is empty.

  • What is the data type of your column? – Ganesh Sanap Feb 14 at 9:49
  • The type is hyperlink – Jakub Feb 14 at 9:53
  • Why are you not using Person or Group column? it by default has all the user information in list view. – Ganesh Sanap Feb 14 at 10:01
  • What exactly you are storing in hyperlink field? Email address of user or something else? – Ganesh Sanap Feb 14 at 10:10
0

The URL format for Delve profile of user is in below format:

https://<tenant-name>-my.sharepoint.com/PersonImmersive.aspx?accountname=<account name>

Where <account name> is in i:0#.f|membership|user@tenant.onmicrosoft.com format.

In account name, i:0#.f|membership| this part is fix and rest of the part is email ID of user.

Encoding i:0#.f|membership| will give you i%3A0%23.f%7Cmembership%7C.

So, you need to convert the link in above format so that it will redirect to delve profile of users.

Considering you have an email address of user in [$email], use below code:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "a",
    "attributes": {
        "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover",
        "title": "Otevřít v Delve",
        "target": "_blank",
        "href": "='https://<tenant-name>-my.sharepoint.com/PersonImmersive.aspx?accountname=i%3A0%23.f%7Cmembership%7C' + [$email]"
    },
    "style": {
        "border": "none",
        "background-color": "transparent",
        "cursor": "pointer",
        "text-decoration": "none"
    },
    "children": [
        {
            "elmType": "span",
            "attributes": {
                "iconName": "OpenPane",
                "class": "ms-font-xxl"
            }
        }
    ]
}

Note: Replace <tenant-name> with your tenant name.

| improve this answer | |
  • It's kinda working, but I've just found out, that there's different "login email", which I need. I mean, instead of "[$email]" I would need something like "[$username]". But when I try that, the icon disappears. For example: for login, I'm using "firstname@tenant.com", but displayed email looks like "first.last@tenant.com" – Jakub Feb 14 at 10:33
  • Do you have any field/column with username name in your list? Also, in order to generate the dynamic link to profile either you will need an email or account name of user. it will not work with display name/full name. – Ganesh Sanap Feb 14 at 10:34
  • I only have columns firstname and lastname, so do I have to make column username? – Jakub Feb 14 at 10:38
  • I am not sure how are able to login with firstname@tenant.com. As delve profile url is in https://<tenant-name>-my.sharepoint.com/PersonImmersive.aspx?accountname=<account name> format. so, you will need the account name of user for sure. – Ganesh Sanap Feb 14 at 10:46
  • Maybe for your case you can create a column (say, LoginEmail) with the data in format firstname@tenant.com and try using the json code like: "href": "='https://<tenant-name>-my.sharepoint.com/PersonImmersive.aspx?accountname=i%3A0%23.f%7Cmembership%7C' + [$LoginEmail]" – Ganesh Sanap Feb 14 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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