Sharepoint Online with Office 365 credentials

Viewed 155

I am trying to connect to a Sharepoint online from my .NET application (in this case VSTO powerpoint COM addin) by using the cached credentials of Office 365.

I can establish my connection using the SharepointOnline.CSOM package and creating a ClientContext by providing the server URL and my credentials.

ClientContext oCtx = new ClientContext(sUrl);
System.Security.SecureString oPassword = new System.Security.SecureString();

foreach (char cPwd in sPassword)
    oPassword.AppendChar(cPwd);

oCtx.Credentials = new SharePointOnlineCredentials(sUsername, oPassword);
oCtx.ExecuteQuery();

However, I do not want the user to enter the password in my application. I would prefer to make use of the active Office 365 credentials. My research brought me to the PnP.Framework package which I downloaded. However I cannot find a way to connect without username/password or the clientID and clientSecret.

Is there any way for a Single Sign On to Sharepoint Online by using stored Office 365 credentials? C# or VB.NET does not matter, both ok for me.

Thank you very much!

0 Answers
Related