SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I has this Code:

                    var query3 = new SPQuery();
                query3.Query = "<Where><Eq><FieldRef Name='Dzien' /><Value Type='DateTime'>" + e.Day.Date.ToShortDateString() + "</Value></Eq></Where>";
                SPListItemCollection poszczególnyDzien = witryna.Lists["Szczegoly"].GetItems(query3);
                int sumaProcentow = 0;
                foreach (SPListItem oDzienSzczegolowy in poszczególnyDzien)
                    int index;

                    index = oDzienSzczegolowy["Procenty"].ToString().IndexOf("#");
                    string procentKolejny = Convert.ToString(oDzienSzczegolowy["Procenty"]).Substring(index + 1,1);

Hoe to call on this field by Display Names, and Internal Names ?

share|improve this question
up vote 1 down vote accepted

If you access the field the way you do in your sample, SharePoint will first try to look it up by internal name and, if that fails, will try to look it up by display name.

If you want to access it by internal name only, you do it like this:

SPField field = witryna.Lists["Szczegoly"].Fields.GetFieldByInternalName("Procenty");
foreach (SPListItem oDzienSzczegolowy in poszczególnyDzien)
    int index;

    index = oDzienSzczegolowy[field.Id].ToString().IndexOf("#");
share|improve this answer
And in CAML what schould I Write ? If i change name to the "Procenty22" It dont show me anything and throw null acception. – Grzegorz Z Oct 25 '12 at 10:37
Use the Internal name for CAML; it should not change. – lgaud Oct 25 '12 at 11:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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