0

Like OOB,

Can we add Site Column to All Content Types using server object model?

Thanks

0

Try This

   SPList currentList = currentWeb.Lists["DocLib"];
   SPField newField = currentList.Fields.CreateNewField(SPFieldType.Text.ToString(), "New Field2");
   currentList.Fields.AddFieldAsXml(newField.SchemaXml, true, SPAddFieldOptions.AddToAllContentTypes);
   currentList.Update();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.