문제

I want to get current user login name with PnP-Core-Library for SPFx in Office365.

My page is modern Page аnd I can not use it _spContextPageInfo

How to do this?

도움이 되었습니까?

해결책

you can use it by doing the following

import  Web  from 'sp-pnp-js';

let web = new Web(this.context.pageContext.site.absoluteUrl);
let curruser = web.currentUser.get().then(function(res){ 
console.log(res.Title); })
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top