How to obtain current logged in user Display Name in lists?

Anonymous
2022-03-07T03:20:32+00:00

Hello,

Recently I changed SharePoint Server on-premise to SharePoint Online. In lists, we want to obtain current user name for fields. But failed.

In SharePoint Server on-premise, the formula =[me] is supported. But in SharePoint Online, it is no longer supported. I tried to use Mid, but didn't work.

Do you have a solution for that? Thanks in advance.

Screenshot 1: SharePoint Online

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2022-03-08T05:51:21+00:00

    Hi BillYoung

    Thank you for coming back to forum.

    Based on your further description about your question, if you just want to the user name will fill automatically when you create a new list.

    We suggest you can go to the list>All Items>Edit current view>check the Creates by box then to see the result.

    Hope the suggestion can help you.

    Regards,

    Stacey

    2 people found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2022-03-07T04:51:45+00:00

    Hi BillYoung

    Thanks for posting the thread on our forum.

    According to your description, it seems that you want to obtain the current logged in user name  display in the SharePoint list.

    If my understanding is correct, we suggest you can use the JavaScript to achieve your requirement.

    Open the drop-down menu under a column>Format this column>then type the below script in the box>Save to see the result.

    {

    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

    "elmType": "div",

    "txtContent": "@currentField.title"

    }

    For more detailed information, you can refer to Use column formatting to customize SharePoint | Microsoft Docs

    Hope the suggestion can help you.

    Best regards,

    Stacey

    0 comments No comments
  2. Anonymous
    2022-03-07T07:08:48+00:00

    Hello Stacey,

    Thanks for your reply. My requirement is when user create a new item in list, they don't have to input user name. The user name will be filled automatically.

    For example, when staff creates a new item, the name will be obtained from logged in user information.

    0 comments No comments
  3. Anonymous
    2022-03-08T07:14:37+00:00

    Thank you. This is really a smart way!

    0 comments No comments