Geeks With Blogs

@MarkQJones
  • MarkQJones @stacyDraper I had you down as someone that would roll out tons of captions.. It is hard when you get to think. Addictive a bit to. about 448 days ago
  • MarkQJones @joeloleson it's all very exciting, making tons of friends. Great to have you on board to Joel. Thx for the mention. about 448 days ago
  • MarkQJones @zimmergren it happens lots. Saw a vendor that had his product and site completely copied. about 448 days ago

Mark Jones

Introduction

In a previous post, I explained my findings with "Upgrading Content Types", but now I want to test out a few scenarios with upgrading Site Columns. On the whole, the test results for Site Columns were pretty similar to that of Content Types. Although, I wanted to test what we can do when it comes to updating site columns that contain data. If you don't want to read each test case, please check out the "Summary" at the end of this post.

Test Cases – Removing a Site Column

Can we remove a site column by deactivating the Feature that deployed it? Yes

Test Steps:

1.       Deploy a Site Column (via Feature and CAML)

2.       Deactivate the Feature

Outcome:

1.       Site Column will be removed

2.       Feature is deactivated

Can we remove a site column (thats referenced by a List Column) by deactivating the Feature that deployed it? Yes

Test Steps:

1.       Deploy a Site Column (via Feature and CAML)

2.       Add the Site Column to a List (as a List Column)

3.       Deactivate the Feature

4.       Recycle Application Pools

Outcome:

1.       Site Column will be removed

2.       Feature is deactivated

3.       List Column still exists

 

Can we remove a site column (that has been customised) by deactivating the Feature that deployed it? No

Test Steps:

1.       Deploy a Site Column (via Feature and CAML)

2.       Change the “Column Name” via the GUI

3.       Deactivate the Feature

4.       Recycle Application Pools

Outcome:

1.       Site Column will not be removed

2.       Feature is deactivated

3.       (Note. Although Deactivating via a Feature doesn’t remove the site column, it can still be deleted via the GUI).

Can we re-parent a Site Column that’s been deleted? Yes

Test Steps:

1.       Deploy a Site Column (via Feature and CAML)

2.       Add the Site Column to a List (as a List Column)

3.       Deactivate the Feature

4.       Recycle Application Pools

5.       Activate the Feature (put the site column back)

6.       Change the “Column Name” (via the GUI)

7.       Select “Update all list columns based on this site column”

8.       Click Ok

Outcome:

1.       List Column is updated with the new name (hence re-parenting a Site Column that’s previously gone AWOL actually works).

Test Cases – Updating Site Columns

Can we update a site column by editing the CAML XML (within the 12 Hive)? Yes

Test Steps:

1.       Deploy a Site Column (via Feature and CAML)

2.       Change the “Column Name”, “Group” in the CAML

3.       Recycle Application Pools

Outcome:

1.       Site Column is amended as expected

Can we update a site column by editing the CAML XML, when it has child List Columns? Yes, but changes are NOT pushed down to children.

Test Steps:

1.       Deploy a Site Column (via Feature and CAML)

2.       Change the “Column Name”, “Group”,  in the CAML

3.       Recycle Application Pools

Outcome:

1.       Site Column is amended as expected

2.       List Column (Child) doesn’t change

Can we change a columns type from Text to Choice (when it’s not in use)? Yes

Test Steps:

1.       Deploy a “Text” Site Column (via Feature and CAML)

2.       Change the Type, from “Text” to “Choice”  in the CAML (add some sample the Choices into the CAML)

3.       Recycle Application Pools

Outcome:

1.       Site Column changes type to "Choice"

Can we change a columns type from “Text” to “Choice”, when it’s in use? Yes, although this worries me!

Test Steps:

1.       Deploy a “Text” Site Column (via Feature and CAML)

2.       Add the Site Column to a List (as a List Column)

3.       Add some test data into the column (from the list)

4.       Change the Type, from “Text” to “Choice”  in the CAML (add some sample the Choices into the CAML)

5.       Recycle Application Pools

6.       From the GUI “Push” the changes to the list column

Outcome:

1.       The Site Column changes type to Choice

2.       The List Column changes to Choice, although the edit form hides it, but no data is lost!

Summary

When changing the type of a column always recycle application pools immediately after. If the CAML for the Site Column is updated, then this will not cascade the changes to any child List Columns. This must be done via the GUI (using “Update all list columns based on this site column?”).

I suspect, though haven't had time to prove it that SharePoint will always allow the type of the column to change. If this change is then propagated to Lists that use it then this “may” result in loss of data, or some weird casting error. E.g. Text > Number.

Once again, this has short comings as once the Site Column is customised, it can no longer be changed by updating the CAML on the file system. (This is because its definition will reside in the database).

To solve these problems (and to give you the best of both worlds), why not try the "Ensure Site Column" Action in SAF. This action takes the same CAML (as you would use in a feature), but SAF processes it, instead of the standard Feature provisioning in SharePoint.

Try it out here : http://www.collaboris.co.uk/saf/doc/Collaboris.Saf.Actions.Wss.Column.EnsureSiteColumn.html

To download SAF - please read here : http://saf.codeplex.com/

To see a list of all Actions in SAF, go here : http://www.collaboris.co.uk/saf/doc/

Posted on Tuesday, July 28, 2009 7:35 AM | Back to top


Comments on this post: Upgrading SharePoint Site Columns (Fields)

# re: Upgrading SharePoint Site Columns (Fields)
Requesting Gravatar...
Can you elaborate on the processes in
4. Change the Type, from “Text” to “Choice” in the CAML (add some sample the Choices into the CAML)

are you making the changes to the CAML in your feature and then redeploying it? If a site column was not originally created with a feature, can I still update its CAML with a feature?
Left by Dan on Dec 08, 2009 4:15 PM

# re: Upgrading SharePoint Site Columns (Fields)
Requesting Gravatar...
Hi friends

I have created custom site column with type text and I included in one of content types. But it is allowing me for 255 characters only. In which way I can update it, say 1024 characters.
The particular site column is a column in content type on which one page layout depends upon
Can you please help me
Left by anvitha on Jun 07, 2010 5:50 AM

# re: Upgrading SharePoint Site Columns (Fields)
Requesting Gravatar...
How can I change a "list column" to "site column" in SP2010? Column contains data.
Left by Izabella on May 06, 2013 6:08 PM

Your comment:
 (will show your gravatar)
 


Copyright © SAF | Powered by: GeeksWithBlogs.net | Join free