GET LOGIN NAME OR EMAIL IN ONE LINE (SHAREPOINT ONLINE)
The best way to get current login name or email is by accessing the page context.
How to get the current login name or email in SharePoint? The solution is to access the page context. Copy and paste the below line to get. // Get current login name / Display name this.context.pageContext.legacyPageContext['userDisplayName']; // Get current login Email this.context.pageContext.legacyPageContext['userEmail']); Click here to see th e complete list of the object's properties
Canonical URL: https://khangkhuiphungdhar.vercel.app/read/get-login-name-or-email-in-one-line-sharepoint-online