What was it again with those Content Type ID’s?

It’s still hard to explain to developers why the Content Type ID’s are as they are: “one-dimensional hierarchical partly-hexadecimal unique identifiers“… The structure is documented at MSDN here: http://msdn2.microsoft.com/en-us/library/aa543822.aspx “Content type IDs uniquely identify the content type and are designed to be recursive. The content type ID encapsulates that content type’s lineage, or the line … Read more

Set Audience targeting on a web part programmatically

Just received some lines of code for my colleague Wouter about setting audience targeting on a web part programmatically. I thought sharing would be useful because there is very little documentation out there… SPLimitedWebPartManager mgr = webMS.GetLimitedWebPartManager(“default.aspx”, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); SPLimitedWebPartCollection col = mgr.WebParts; webparts[0].AuthorizationFilter = “;;;;” + “ROLE 1″ + “,” + “ROLE 2″; mgr.SaveChanges(webparts[0]); In … Read more