Value does not fall within the expected range. When modifying data type MSFT HELP!!!!

I want to change a column type from multiline text to HTML.

I tried this

            string urlRoot = ConfigurationManager.AppSettings["url"].ToString();
            SPSite site = new SPSite(urlRoot);
            SPList list = site.RootWeb.Lists["Agenda"];
            HtmlField htmlField = new HtmlField(list.Fields, "HTML", "NewHTMLField");
            SPField fieldInContentType = list.ContentTypes["Agenda"].Fields["Body Intro"];
            fieldInContentType = htmlField;


But I got that exception,


Any help is appreciated!!!
Who is Participating?
JuanCarnigliaConnect With a Mentor Commented:
This means that you are seeking a "position" on an array, identified by a string (for instance "Body Intro") and that string does not exist on that array.

Please see that Agenda and Body Intro, both exist.

SimbiosAuthor Commented:
both exists! otherwise it would throw another exception in those lines that the first thing I checked!
All Courses

From novice to tech pro — start learning today.