Content type & SPFieldLink & SPField

I’m currently teaching a Sharepoint course for U2U in the splendid city of Gothenburg (Sweden).
A student asked me an interesting question about what is a SPFieldLink.
The correct answer is that a content type (SPContentType class) doesn’t have columns (SPField) (a list does), but the content type has just references to fields (Site columns) and this references are SPFieldLink.
SPContentType as a FieldLinks collection that returns all the SPFieldLink (s).
A quick look at the sdk confirmed this point of view, but I noticed that there was also a Fields property in the SPContent class (of type SPFieldCollection).
Reflector and the following article (see the postscript) confirmed the fact that this Fields property is just a merged view of FieldLinks.
There is a 1-1 correlation between the items of FieldLinks and those of Fields.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s