Display Logged in User Name

Aniruddha Aditya 316 Reputation points
2022-05-11T08:35:03.493+00:00

Hi,

I want to display the logged-in User Name and location just adjacent to the image of the user as shown in the attachment. Getting the values isn't an issue. I am able to get the Logged-in User from the context and Location from the user profile. But How to target the exact location is. I am using SPFx extension but cannot figure out how to tag the value on the top bar.

Hint, Code Snippet Most welcome.

200869-image.png

Thanks
Aniruddha

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,565 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,116 Reputation points
    2022-05-12T08:39:18.403+00:00

    Hi @Aniruddha Aditya ,

    According to my research and testing, There is no way to customize the Top Navigation Suite Bar, so it is unable to display the location on it.

    As a workaround, I found a way to change the settings to display the User Name in Top Navigation Suite Bar.(The User Name is next to the user image, as shown in the screenshots)

    201357-image.png

    You can follow these steps:

    1. Login to Office 365 Admin Center;
    2. Click on Settings >> Org Settings
    3. On the Org Settings page, click on the “Organization Profile” tab at the top and then click on the “Custom themes” link.
    4. In the custom themes property panel, scroll down and select the “Show the user’s display name” checkbox at the bottom of the page.
    5. Click on “Save changes” to apply your settings.

    201356-001.png

    Hope it can help you .Thanks for your understanding and support.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  2. Aniruddha Aditya 316 Reputation points
    2022-05-13T09:28:18.667+00:00

    @Tong Zhang_MSFT I am still working on this issue. Playing around with DOM and Divs to see if I can inject additional div and place the text over there. though you have mentioned, it's not possible at the site collection level.

    We cannot do any changes at a tenant level, since there are 75k sites, and any global changes at the tenant level need 1000s of approval.

    I am still working on it and if I am lucky will let you know.

    Thanks
    Aniruddha