.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Forum >> SharePoint >> Post New QuestionBookmark and Share Subscribe to Forum

Content Type Change could not be migrated on existing custom list, which having data!

Posted By: Bhavdip Shah     Posted Date: January 28, 2011    Points:2   Category :SharePoint
We are having so many custom lists in to the system, each custom lists has attached a content type with it. So our primary focus is to attach a content type on custom list - That's already been done through custom feature developed by us so far.

Now, we are adding hundreds/thousands of items to the custom list programmatically, now a requirement came from the client side that we have to add / modify couple of columns to the existing content type (In terms of Required columns should now become optional, many of the columns we have to show on NewForm, many of them should be displayed on EditForm and all the columns associated with their values should display on DispForm of Custom List).

Below is a sample Custom Site Column feature code that we had implemented so far almost couple of years back:

<FieldRef ID="{C253C2EC-2904-4770-B4EB-99A2FC1AAAF6}" Name="RootListID" Required="TRUE" />

<FieldRef ID="{9907926D-CD27-4960-A213-D95DD44CF233}" Name="RootItemID" Required="TRUE" />

<FieldRef ID="{6E30F806-CB5E-4734-AD06-FE8B633A3A87}" Name="ParentListID" Required="TRUE" />

<FieldRef ID="{9567942E-B290-4a95-912F-42BC3D131521}" Name="ParentItemID" Required="TRUE" />

Now, Requirement associated with above Site Columns (which are migrated with Content Type) is changed at the client end i.e. now, all above column should be set with below property values:

<FieldRef ID="{C253C2EC-2904-4770-B4EB-99A2FC1AAAF6}" Name="RootListID" ShowInNewForm="false" ShowInEditForm="FALSE" ShowInDisplayForm="TRUE" Required="FALSE" />

<FieldRef ID="{9907926D-CD27-4960-A213-D95DD44CF233}" Name="RootItemID" ShowInNewForm="false" ShowInEditForm="FALSE" ShowInDisplayForm="TRUE" Required="FALSE" />

<FieldRef ID="{6E30F806-CB5E-4734-AD06-FE8B633A3A87}" Name="ParentListID" ShowInNewForm="false" ShowInEditForm="FALSE" ShowInDisplayForm="TRUE" Required="FALSE" />

<FieldRef ID="{9567942E-B290-4a95-912F-42BC3D131521}" Name="ParentItemID" ShowInNewForm="false" ShowInEditForm="FALSE" ShowInDisplayForm="TRUE" Required="FALSE" />

We have set all the suggested column specific property values with SiteColumns.xml and ContentType.xml file (which is a custom feature file).

On SPFeatureReceiver ? FeatureActivated event, we are fetching property values from specified XML file and set those property values to that specific column and at the time of creation of NEW custom list (associated with content type/site column attached with it); all column specific properties are set perfectly. The only issue is that existing lists whose having content type that property values is remain as it is. New set values could not be affecting on existing content type / custom list.

We have tried below cases at our end:
1) On Feature FeatureDeactivating / FeatureUninstalling, We have tried to delete existing content type and tried to add new (fresh) content type on list but it gives error that's "Content Type still in use" and in result it could not affect with new changes, but no luck.
2) Using MOSS 2007 site collection feature list, I have tried to deactivate/activate those features manually, but no luck.
3) Using STSADM command line utility with below combination of commands I had also tried, but no luck. Below are the commands for the same:

Compliance.SiteColumns :

STSADM.EXE -o deactivatefeature -name Compliance.SiteColumns -url http://localhost -force

STSADM.EXE -o uninstallfeature -name Compliance.SiteColumns -force

STSADM.EXE -o installfeature -name Compliance.SiteColumns -force

STSADM.EXE -o activatefeature -name Compliance.SiteColumns -url http://localhost -force

STSADM.EXE -o deactivatefeature -name Compliance.ContentTypes.Activity -url http://localhost -force

STSADM.EXE -o uninstallfeature -name Compliance.ContentTypes.Activity -force

STSADM.EXE -o installfeature -name Compliance.ContentTypes.Activity -force

STSADM.EXE -o activatefeature -name Compliance.ContentTypes.Activity -url http://localhost -force

4) Also tried using Console Application code and using Custom web part (Content Type Change Migration Web Part), but no luck.
5) I had surf / refer so many blogs from the net and most of the people suggests that This is a very known issue and you cannot delete the content type is already attached on any of the custom list and if "Content type still in use" error encounters, You can try delete that content type directly through query on share point content database but that might cause results in terms of loss of data which are already placed under content type/custom list. So, I have not tried with this step yet.

If anybody had worked with this issue so far and can help me out in this regard that will be greatly helpful to me to move towards the destiny.

Bhavdip Shah
(Project Lead @ Cybage)


No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend