The type or namespace SharePointOnlineCredentials could not be found error in console application for SharePoint online

This SharePoint csom tutorial, we will discuss how to fix an error The type or namespace SharePointOnlineCredentials could not be found which comes when we create a console application for SharePoint online Office 365 sites (sharepointonlinecredentials not found).

Recently I have created a console application for SharePoint online but when I am using the below code to pass the credentials to connect to SharePoint online site it gave the below error.

clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = new SharePointOnlineCredentials(GetSPOAccountName(), GetSPOSecureStringPassword());

The error comes as:
The type or namespace SharePointOnlineCredentials could not be found (are you missing a using directive or an assembly reference?). It looks like below:

The type or namespace SharePointOnlineCredentials could not be found

In that console application, I have added the Microsoft.SharePoint.Client.dll (version: v14.0.4762.1000) from the NuGet package.

To resolve the issue, I have added the “Microsoft.Sharepoint.Client.Online.CSOM” from NuGet itself. You can find like below:

The type or namespace SharePointOnlineCredentials could not be found

After this, the error (sharepointonlinecredentials not found) will not come.

You may like following SharePoint csom tutorials:

This SharePoint tutorial helps us to solve error The type or namespace SharePointOnlineCredentials could not be found.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>