Deniplane
Deniplane

Reputation: 415

How to add default values in existing list items?

I have a custom list, which have some items in it. I dynamically add a new field with defined DefaultValue property (SPField.DefaultValue). But this default value applies only in new items. The existing items remain this field empty. Please, tell me, is there any decision to update existing items with default field value except of writing the code to loop each of them? I am using Sharepoint Server 2007. I'll appreciate any help. Thank you.

Upvotes: 2

Views: 3137

Answers (1)

Goyuix
Goyuix

Reputation: 24370

Unfortunately, I am not aware of any way to populate those values without touching each item. If you have access to the SharePoint server and can run some code to fix the values that may be the easiest way.

Alternatively, you can create a DataGrid View using the web interface and filter it to the items that did not receive the new default value. You can then easily populate that entire column with your desired value: insert the value in the first cell, then drag it down through the rest of the column similar to how you can in Excel).

Upvotes: 1

Related Questions