I have a requirement to modify the existing 'Site column' of People/ Groups, which allows end user to chose Single user and I need to update the site column to multiple user select through the code.
I have tried updating the 'Site Column' through code but no use. After lot of research, I found it is not possible to replace existing site column (via same content type).
As a work around, we can replace the existing content type with Newly created content type containing the same set of site columns(to retain the existing list item values) & then add the required column [i.e,.,(Multiple user select) People picker column.
].
It works fine but, when I tried to delete the unused existing Site Content Type, using the below code
SPContentType contentTypePDelete = spWeb.ContentTypes["PAGEPOLICY"];
SPList lstPages = spWeb.Lists.TryGetList("PAGES");
if (contentTypePDelete != null)
{
SPContentTypeId id = lstPages.ContentTypes.BestMatch(contentTypePDelete.Id);
//Error throwing Line
lstPages.ContentTypes.Delete(id);
//Error throwing Line
lstPages.Update();
}
It throws the following Error:
Content Type is still in use
What is the correct approach to remove the (existing)Content Type(which is currently not used) in Sp 2013 Document library?