Forum Discussion
Get current sharepoint online logged in user using PHP and Python scripting or C# or Java or NodeJS
Hi Sir, Mam,
How can I get the currently logged in user in sharepoint online using PHP or Python or Java or C# programmatically?
I want to parse the output of this sharepoint site thru PHP or Python or Java or C# programmatically
https://<tenantid>.sharepoint.com/_api/web/CurrentUser.
is it possible and any suggestion how can I accomplish our goal?
I have filed a ticket [Case #:27194893] but the suggestion ended in this forum.
I was tried the CSCOM in C# from MS documentation but it returned only the current set credentials in code and not the actual logged in user when accessing the sharepoint site via a web browser
Sample code:
using Microsoft.SharePoint.Client;
System.Security.SecureString passWord = new SecureString();
foreach (char c in "sample".ToCharArray()) passWord.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials("username", passWord);
Web web = context.Web;
context.Load(web);
User user = context.Web.CurrentUser;
context.Load(user);
context.ExecuteQuery();
Console.Write("CSOM\nUser Information\nUser ID : " + user.Id + "\nUser Login Name : " +
user.LoginName + "\nUser Title: " + user.Title);
Project:
We have a project called rostering and the web app to be developed in PHP or any other available technology will integrate in our sharepoint. Once the user is logged in their sharepoint account it will access the rostering website in sharepoint to do the scheduling Of their calendar.
This web app site will grab the current logged user in sharepoint, this website will integrate in sharepoint using The embed code
Like this <iframe src=https://url_site/index.php height="200" width="300"></iframe>
Thank you very much.
Rodel