If I made a list in first time and puts a names on them, it's work good, but when I rename it, and want to call back from the code, it don't see the rename title of items colums. How can i call to rename values of title columns ?

            query1.Query = String.Format(FullQuery, "Dzien", dateISO, DropDownList1.SelectedItem.Text);
            query1.ViewFields = "<FieldRef Name='Kontrakt' /><FieldRef Name='Procenty' />";
            query1.ViewFieldsOnly = true;

            SPListItemCollection listaDniPrzeznaczonychNaProjekt = witryna.Lists["Szczegoly"].GetItems(query1);

If then rename "Kontrakty" to "Numer Kontraktu/Oferty/Szansy" at Sharepoint Edit list column it doesent see the column new name.

  • Put some code to let us see how you are doing this.
    – m.jedrzej
    Commented Oct 25, 2012 at 8:26
  • Ready, I edited my first question :)
    – Grzegorz Z
    Commented Oct 25, 2012 at 8:32

1 Answer 1


If you are using 'Name' in FieldRef node you are referencing field by InternalName. If you want to use new column name use DisplayName:

"<FieldRef DisplayName='newKontrakt' /><FieldRef DisplayName='newProcenty' />";

Edit after comments: Ok I didnt understand you. If you want to get fields without worring about its display name which could be changed you should use InternalName in FieldRef. You are doing it already in your query.

query1.ViewFields = "<FieldRef Name='Kontrakt' /><FieldRef Name='Procenty' />";

By using Name in FieldRef you are referencing to field using its InternalName. So if you changed display name of this column this query should work anyway.

Here you have examples how to check Field InternalName: https://www.nothingbutsharepoint.com/sites/devwiki/SP2007Dev/Pages/Getting%20the%20Field%20by%20the%20Internal%20Name.aspx


  • So Only there I should change it, and don't wory about changing ?
    – Grzegorz Z
    Commented Oct 25, 2012 at 8:50
  • If you dont want to worry about column display name you should use InternalName. Internal names doesnt change.
    – m.jedrzej
    Commented Oct 25, 2012 at 9:03
  • It doesen't work. It write me then in polish Wartość spoza zakresu. In English: Value does not fall within the expected range. How I Schould Use a InternalName in this code ?
    – Grzegorz Z
    Commented Oct 25, 2012 at 9:16
  • I' dont know how to call to the field by InternalName. Whot schould be in this code ?
    – Grzegorz Z
    Commented Oct 25, 2012 at 9:17
  • How to get this internal name in CAML ?
    – Grzegorz Z
    Commented Oct 25, 2012 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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