Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Can we add Site Column to All Content Types using server object model?
SPList currentList = currentWeb.Lists["DocLib"];
SPField newField = currentList.Fields.CreateNewField(SPFieldType.Text.ToString(), "New Field2");
currentList.Fields.AddFieldAsXml(newField.SchemaXml, true, SPAddFieldOptions.AddToAllContentTypes);
Required, but never shown