Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have some content types for documents. It would be neat if I could have the Version and Date Modified properties attached or replicated to the Content Type.

My goal is to be able to use the property data in words quickparts. the usual Information management policy solution won't do the trick!

Any advice?

Thanks

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Did create custom fields and copied the data to the fields.

string webUrl = properties.WebUrl;
SPSecurity.RunWithElevatedPrivileges(delegate
{
    using (SPSite site = new SPSite(webUrl))
    {
        using (SPWeb web = site.OpenWeb(properties.RelativeWebUrl))
        {
            SPListItem oItem = properties.ListItem;
            //oItem["SharePointVersion"] = oItem["Version"];
            oItem["SharePointVersion"] = oItem.Versions[0].VersionLabel;
            web.AllowUnsafeUpdates = true;
            oItem.SystemUpdate(false);
        }
    }
});
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.