the name configurationmanager does not exist in the current context in SharePoint Online

This tutorial will discuss, how to fix an error the name configurationmanager does not exist in the current context.

The issue came while trying to retrieve information from App.config file like ConfigurationManager.AppSettings[“SPOPassword”]).

We were developing a console application to connect to our SharePoint Online sites. Here we have saved the credentials inside App.Config file and we were retrieving like below:

private static string GetSPOAccountName()
{
try
{
return ConfigurationManager.AppSettings["SPOAccount"];
}
catch
{
throw;
}
}

But it shows the error like below:

The name ‘ConfigurationManager’ does not exist in the current context.

the name configurationmanager does not exist in the current context

the name configurationmanager does not exist in the current context

To resolve this issue we need to add System.Configuration dll. If you have .Net framework installed, then we can add it from the local drive from the .NET tab.

And then write the below using statment.

using System.Configuration;

Also, you can add one dll from the NuGet package. Right-click on the References folder -> Manage NuGet Packages… like below:

the name configurationmanager does not exist in the current context

Then in the NuGet screen, search for System.Configuration in the Browse tab and then from there add select System.Configuration.Abstractions and click on Install like below:

the name configurationmanager does not exist in the current context sharepoint

You may like following SharePoint tutorials:

This tutorial, we learned how to fix an error the name configurationmanager does not exist in the current context.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

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

>