1

I want to retrieve let's say the title field of my item so what's the différence between doing these acces methods :

SPList myList = properties.List;
       string mytitle1 = myList.Items[0]["Title"];
       string mytitle2 = myList.Items[0].Fields["Title"];
       string mytitle3 = myList.Items[0].Fields.GetField("Title");
1

Item[] returns the content of the field in item
Item.Fields[] returns metadata about the field and not the value

  • 1
    how about Item.Fields.GetField("Title") ? – Glolita Oct 16 '12 at 13:55
  • It returns metadata like Item.Fields[] the difference is that Item.Fields[] only does lookup by DisplayName, where Item.Fields.GetField() does it by InternalName, DisplayName, StaticName in that order – Per Jakobsen Oct 16 '12 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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