转贴:Sample event handler to set a field as a pr imary key (enforce no duplicates)
Got this as a request from a reader- how to prevent users from adding items with same titles as ones that already exist in the list.
Code
上面的代码中,已经写了使用方法,就是用SPWeb web = properties.OpenWeb()