I am working on a remote event receiver which uses app only permission. now i am trying to get the current user who execute the RER:-
context.Load(context.Web);
context.Load(context.Web.CurrentUser);
context.ExecuteQuery();
var o = context.Web.CurrentUser.LoginName;
listItem["Author"] = context.Web.EnsureUser(HttpContext.Current.User.Identity.Name);
but the context.Web.CurrentUser.LoginName
will return app@sharepoint
instead of the actual username, and the HttpContext.Current.User.Identity.Name
will return object reference not set to an instance...
.. any advice on this please?
Thanks