As of a previous question, whenever an item is added in a list, I create a document library based on a template, and set defaultvalues for some of its fields. In Sharepoint Manager I see defaultvalues correctly set, but if I add an item to the document library, the fields are not filled with their expected default values: any hint? I am running Sharepoint Foundation 2013. This is the code:
public override void ItemAdded(SPItemEventProperties properties) { SPWeb myWeb = properties.Web; string projectName = properties.ListItem["Project Name"].ToString(); var customTemplate = myWeb.ListTemplates["ProjectTemplate"]; Guid myItemGuid = myWeb.Lists.Add(projectName , projectName , customTemplate); SPList myItem = myWeb.Lists[myItemGuid]; var projectCategoryField = myItem.Fields["Project Category"]; projectCategoryField.DefaultValue = "Test default value"; projectCategoryField.Update(); properties.ListItem.Update(); base.ItemAdded(properties); }