Forum Discussion

Vincent1230's avatar
Vincent1230
Copper Contributor
Oct 09, 2023

Create dynamic navigation link to each user's personal page in SharePoint

Hello,   I'm trying to add a Navigation link (or just a link in the homepage) to each user's personal page on my SharePoint Site. The goal is that when any user views the homepage, they would see a...
  • SvenSieverding's avatar
    Oct 09, 2023

    Hi Vincent1230,

    you could do this:

    1) Create a new list "MyPages" and add a new hyperlink column "link" and a people column "person" to it.
    2) Now add all of your users to that list and link to the mypage.
    3) Then create a new gallery view that filters the items to only display those items that have the current user in the "person" column.
    4) Format that view using this formatting sheet

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
      "height": "40px",
      "width": "100px",
      "hideSelection": true,
      "formatter":  {
    		"elmType": "a",
            "txtContent": "My Page",
    		"attributes": {
    			"class": "sp-card-defaultClickButton",
    			"role": "presentation",
    			"target": "_blank",
    			"href": "=[$Link]"
    		},
    		"style": {
    			"padding": "10px",
    			"height": "32px",
    			"margin-right": "8px",
    			"margin-botton": "10px",
    			"font-size": "14px",
    			"border-radius": "2px",
    			"border": "none",
    			"font-weight": "600",
    			"background-color": "#0078d4",
    			"cursor": "pointer",
    			"color": "white",
    			"text-decoration": "none",
    			"text-align": "center",
    			"width": "80px"
            }
    	}
    }

    The result should look like this

    5) Use the list view webpart to embed this on your homepage

    Best Regards,
    Sven

Resources