0

In my Person components in my React application, I would like to add links on the names of the people it renders. I.e. when the displayName is clicked on, the user is sent to the profile page in Delve of the person it clicked on. For example https://contoso-my.sharepoint.com/_layouts/15/me.aspx/?mail@contoso.com

I was actually hoping this was a setting on the component or similar, but I see that it's not. Is it possible to achieve this using a template? I have already set up atemplate, referring to my other thread here: Working example for Graph Toolkit using SharePoint spfx, React and Get component with template.

Please advise.

  • 1
    Short from re-templating the entire component, there isn't currently a way to add a click handler to just the display name. You can still add a click handler to the entire person component. For individual click handlers, I can see us adding `line1Clicked`, `line2Clicked`, etc events. If this sounds like something that would be useful, could you help us by creating an issue on our repo: https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2C+feature-request&template=feature_request.md&title= ? – Nikola Metulev Nov 03 '20 at 16:51
  • Thank you Nikola. How would you go about creating a click handler on the entire component then? Will this come in conflict with 'hover' on person-card? – Frank-Ove Kristiansen Nov 04 '20 at 08:22
  • Great question. One way to add the click handler is to wrap the person component in a div and attach the click handler to that div. It won't affect the hover behavior for the person card. – Nikola Metulev Nov 04 '20 at 23:01
  • Hi Nikola, I tried wrapping an A HREF tag around the Person component. When I click on the Person in the web page, it now takes me to the page specified. But the same happens when I click on anything inside the Person Card as well. My code: `` – Frank-Ove Kristiansen Nov 27 '20 at 11:04
  • Hi again @NikolaMetulev, I have now registered a Feature Request on this issue. Please check it out here: [link](https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/826). Please let me know if more information is needed. – Frank-Ove Kristiansen Dec 10 '20 at 20:32
  • Thanks @Frank-Ove. – Nikola Metulev Dec 18 '20 at 20:42

0 Answers0