I have issue with my connectionstring:


<?xml version="1.0" encoding="utf-8" ?>
    <add name="prod" connectionString="YourConnectionString"/>


    public override void ItemAdding(SPItemEventProperties properties)
        string conn = ConfigurationManager.ConnectionStrings["prod"].ConnectionString;

and I got error: An exception of type 'System.NullReferenceException' on it. I tested it on a simple console app and it works as expected. Any suggestions?


You should save the connectionstring in web.config of your SharePoint web application.

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.