Question

I'm following the code at https://blogs.msdn.microsoft.com/cliffgreen/2008/06/23/creating-a-link-to-a-document-item-in-a-sharepoint-document-library-programmatically/, and I'm worried about the line:

item["Content Type"] = "Link to a Document";

Does the value here need to be localized to the language of the SharePoint installation? I can't find any documentation either way (or much documentation relevant to this code at all), and I've been burned by too many SharePoint localization problems before (e.g. Is stsadm output guaranteed to be XML?) to assume it will work. But at the same time, I don't have a non-English system to test with.

Was it helpful?

Solution

You can refer to the localized Content Type Name with SPUtility.GetLocalizedString

However make it simple for yourself and just refer to content type ID.

item["ContentTypeId"] = ID;

The below page lists all of the Content Type ID's for out of box content types. https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms452896(v%3Doffice.14)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top