Search This Blog

Sunday, September 27, 2020

SPFx -display logged in user Photo our custom page

 // Add this import statement    

import {sp} from '@pnp/sp';  
import pnp, { PermissionKind } from "sp-pnp-js";

webparts.ts

public render(): void {
    this.context.statusRenderer.clearLoadingIndicator(this.domElement);
    this._trimSuiteBar();
    this.domElement.innerHTML = `    <a class="nav-link dropdown-toggle" href="#" id="profileDropdown" role="button"
                      data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <img src="/_layouts/15/userphoto.aspx?UserName=${this.context.pageContext.user.email}" alt="profile">
                    </a> `;
}

No comments:

Post a Comment