Monday, February 8, 2016

How to adding content type in Custom List programmatically gets null reference exception

In this article ,When user trying to add content type return s error,"null reference exception"

SPContentType test = web.AvailableContentTypes["Employee Details"];
newList.ContentTypesEnabled = true;
newList.Update();
newList.ContentTypes.Add(test);

No comments:

Post a Comment