Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

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

1 Answer 1

up vote 1 down vote accepted

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

http://sp2007hut.wordpress.com/2011/04/05/where-can-i-find-the-internal-fieldname-via-sharepoint-2010-gui/

share|improve this answer
    
So Only there I should change it, and don't wory about changing ? –  Grzegorz Z Oct 25 '12 at 8:50
    
If you dont want to worry about column display name you should use InternalName. Internal names doesnt change. –  m.jedrzej Oct 25 '12 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 Oct 25 '12 at 9:16
    
I' dont know how to call to the field by InternalName. Whot schould be in this code ? –  Grzegorz Z Oct 25 '12 at 9:17
    
How to get this internal name in CAML ? –  Grzegorz Z Oct 25 '12 at 9:25

Your Answer

 
discard

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.