3

This question already has an answer here:

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?

marked as duplicate by Atish Dipongkor, Waqas Sarwar MVP Jul 31 '17 at 13:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

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); })

Not the answer you're looking for? Browse other questions tagged or ask your own question.