There is an interesting thing that I found and it is very useful.
This will help in avoiding writing the Column Name Titles at some extend.
I found two classes that have built-in feature to get the all built in Columns .
These two classes are :
SPBuiltInFieldId
SPBuiltInContentTypeId
For example,
Instead of using "Title" which refers to “Title” column, we can use SPBuiltInFieldId.Title . So no margin of error in typing, because sometimes we want to refer columns like Created By, Last Modified, which includes (space) which gets converted to _x0020_ at the time of code. so better to rely on given class rather than declaring and using our own as far as default column names are concern.
Same way for all built in content types.
SPBuiltInFieldId.Created_x0020_By
SPBuiltInFieldId.Created_x0020_Date
SPBuiltInFieldId.ID
SPBuiltInFieldId.JobTitle
SPBuiltInFieldId.Last_x0020_Modified
Same goes for SPBuiltInContentTypeId.
I hope this will help you...
No comments:
Post a Comment