Difference between FieldLinks and a field in Sharepoint

I am trying to copy a type of custom content from one network to another. I googled around and found some examples that use FieldLinks and fields. I’m kind of getting lost as to which one to use, because when I get FieldLinks from my source network, I get 3 fields; while getting from fields only returned me 2 fields ... there is no user field. I am pretty sure I added the fields at the proper level since I did this through the interface. But when extracting it using code ... the numbers just don't add up.

So, besides this strange problem, I want to know what is the difference between FieldLinks and fields, and when working with them in Content Types (programmatically), which should I use?

Thanks.

+6
content-type sharepoint sharepoint-2007
source share
1 answer

SPFields are the fields themselves, and SPFieldLinks are field references. This is a good read that will explain in more detail . In normal practice, it is safer to use SPFieldLinks when you are working on determining the actual content . However, I will give a brief summary here.

Lists and web pages contain actual fields with field data. On the other hand, the content type contains only the Reference Reference field, which simply points to the corresponding field in the list or on the network. This is a bit confusing because content types have both SPFieldLinkCollection and SPFieldCollection.

SPFieldLinkCollection is used in the actual definition of the type of content and exactly what you would like to use in your situation of copying the type of content from one network to another. SPFieldLinks correspond to the actual XML schema elements for the content type.

Comparatively, when you call the content type SPFieldCollection and extract a field from it, the fact is that the content type checks the corresponding link to the field and then looks at the actual field in the list / web page. Basically, think about SPFieldCollection the same way how search works: it is useless without the meaning of the search and the search source.

+10
source share

All Articles