Reputation: 104
In SP2010, create a DocLib
which supports Content Types (add the Dublin Core Document content type, and set it as the default CT) and enable supports Versions.
similarly add another content type Link to document
Create a document which uses the Dublin Core CT. Publish it as version 1
Edit the properties of the document and change content type ko LInk to document Publish it as version 2
Now from Code when I try to read fields of the items (latest version) i can read content type using code
object val = spItem[field.Id]
But in case of versioned document I used this code
object val = spItem[field.InternalName];
but unfortunately the content type value was null
.
How to read content type of version document.
Upvotes: 1
Views: 203
Reputation: 21
I understand the question, and have seen this bug.
Unfortunately, SharePoint 2013 seems to have the same bug (namely that the ContentType field is not populated in SPListItemVersion).
The ContentTypeId field does seem to be populated, so as a workaround, one can hardcode tests against the ContentTypeId.
Upvotes: 2