Skip to main content


Showing posts from February, 2012

Issue creating Document Library with some names in SharePoint 2010

When trying to create a document library with name "HSE": I am getting the following error: I don't create a site. I create document library. Also it would be good to know where word "HSE" is reserved? UPDATE: I have found the possible reason. It's a Managed Path existing with the same URL as document library I am about to create: So the word "HSE" is not really a problem here as I initially thought.

Issue with ItemDeleting event receivers

When working with event receivers you can use custom error pages. For example and implementation tips you can look here: This doesn't work for ItemDeleting event receivers. Illustration The following piece of code:   will produce the following result: We don't see the custom error page as we should as per the article above. Semi-solution We can use just custom message, not the custom page in case of ItemDeleting. Code: Result: Enjoy.

Delete Published Content Type from a Document Library

If you use a content type that has been published from a Content Type Hub in your document library then if you decide to delete that content type from the document library you might experience the problem - for some reason published content types are made read only when you add them to libraries. Example 1. We have got a document library with published content type "BaseDocument": 2. If we try deleting it from the library we are getting an error: "The content type "X" at "Document Library Y" is read only." Solution Using SharePoint API we can update the ReadOnly property and then delete the content type. Here's the PowerShell script sample: $siteurl = "http://siteurl" $ctname = "BaseDocument" $libname = "Shared Documents" $site = Get-SPSite $siteurl $web = $site.OpenWeb() $list = $web.Lists[$libname] $ct = $list.ContentTypes[$ctname] $ct.ReadOnly = $false $ct