Forum Discussion
Create dynamic navigation link to each user's personal page in SharePoint
- 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
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
- Vincent1230Oct 10, 2023Copper Contributor
Hi SvenSieverding,
Thank you so much for your reply!
I successfully made the dynamic personalized link as intended! However, I have a few additional questions regarding the style:
1. The "My Page" Button is not centered. Is it possible to edit the view formatting to center align the "Button"?
2. I also notice there are horizontal and vertical scrollbars on the view. Is there a way to remove these?
3. There seems to be a lot empty space below the "button". Can the view height be adjusted to reduce the blank area?
Thank you again for your time and for sharing your expertise, it's much appreciated! Please let me know if you have any other suggestions.Best Regards,
Vincent