This is a quick post, that may sound like a straightforward task at the beginning, but may take a long time to figure it out.
If you have ever tried to change the Title column to be required in SharePoint list, you know that all what you needed to do is to get reference to the title column, and set it to required, then update, it may look something like this:
But it won’t be that straightforward in document libraries, after all, if you try to make it in the user interface, it won’t be straight forward also.
To make it clear, for example, try to create a document library, and try to create a custom list; in the custom list you will have the option of making the title either mandatory or not, but in the document library you will need to access the content type first, then making the title mandatory in that instance, but the purpose of the article this time is to how to do that programmatically. So here it is:
SPField titleField = list.Fields[“Title“];
SPContentType docCtType = list.ContentTypes[“Document“];
SPFieldLink fieldlink = docCtType.FieldLinks[titleField.Id];
This way you will update the properties for the title column inside the document library.
Hope that helps.
M . D