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

Posted on 2011-04-19
Last Modified: 2012-08-13
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!!!
Question by:Simbios
    LVL 7

    Accepted Solution

    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.


    Author Comment

    both exists! otherwise it would throw another exception in those lines that the first thing I checked!

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    I used to be SharePoint evangelist in our company, so my Outlook always full of questions about how to do this, or where I can find that. One day I found such an email with the following question: "how to attach 3-State workflow (one of the workflow…
    SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now