How can I get Current Logged in user of SharePoint Site in Provider Hosted App's code behind since the app is Provider Hosted, using S2S and with App-Only policy
I tried this:
Web web = clientContext.Web; clientContext.Load(web); clientContext.ExecuteQuery(); clientContext.Load(web.CurrentUser); clientContext.ExecuteQuery(); currentUser = clientContext.Web.CurrentUser.LoginName;
I am getting all the time a user
i:0i.t|<some key>|app@sharepoint. It looks like an user exclusive for the App as the definition in policy types says (msdn).
I would like to have your help on this, since I need to work in app context with the user that is logged in Sharepoint Portal, and where is rendered the app into a page. I suppose I have to change the policy the app for a App+user policy, and if yes, how can I force this policy?