Monday, September 29, 2008

SPBuiltInFieldId and SPBuiltInContentTypeId : two useful classes

Hi All,

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:




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com