Forum Discussion
kannan_mck007
Jun 11, 2019Copper Contributor
Get current sharepoint online logged in user from C#
Hi, We are creating a portal site using sharepoint online. In one of the web part we are embedding our internal app which was created in C# code. I need to get the current logged in sharepoint ...
Thomas Berman
Jun 12, 2019Iron Contributor
So presumably you're talking about a SharePoint provider hosted add-in, in which case, you can get your Client Context object (which will be different depending on how you authenticate), then access the Web property, which has a "Current User". This article shows you how to get a Client Context in your provider hosted add-in and access the Web property - from which you can then access the "Web.CurrentUser" property https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-started-creating-provider-hosted-sharepoint-add-ins.