SPC050237: Do not request SPField from SPFieldCollection by index. Use SPFieldCollection.GetField() instead. |
SPC050237: Do not request SPField from SPFieldCollection by index. Use SPFieldCollection.GetField() instead. |
Calling SPFieldCollection[] to retrieve a SPField in a web could fail if not the display name is used as argument. Better use SPWeb.Fields.GetField() which returns the field with the specified internal, display, or static name.
TypeName: | DoNotUseFieldCollectionByIndex |
CheckId: | SPC050237 |
Severity: | CriticalWarning |
Type: | AssemblyFileReference |
Replace calls to SPFieldCollection[] with SPFieldCollection.GetField(). SharePoint searches first by internal name; then, if necessary, by display name; finally, if necessary, by static name.
Bad Practice:
Copyright © 2013 RENCORE AB. All Rights Reserved
Disclaimer: The views and opinions expressed in this documentation and in SPCAF are those of the creators and do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. All trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners. SharePoint Code Analysis Framework, Version 4.5.2.7855, see www.spcaf.com for more information |