Self-Service Site Creation Announcements keep showing up
Self-Service Site Creation is a feature that lets end users create new site collections without the need to access Central Administration. You turn it on for the Web Application, and when you do, an Announcement is added to the first Announcements list that is found in the root site collection. The announcement looks like:
You get a new announcement each time Self-Service Site Creation is enabled. The following would be the expected ways this announcement would show up:
- Turn the feature off, then back on in Central Admin (2010 and 2007)
- Each time you ran stsadm.exe –o enablessc
- Used the object model to set SPWebApplication.SelfServiceSiteCreationEnabled to true
- Content Deployment if the source location had the announcement
The problem we were running into, is that the announcements kept showing up randomly in the middle of the night. Sometimes up to 5 – 6 new announcements in a given night. The customer had a workflow that they wanted people to use to create site collections and get approval, so they didn’t actually want the end users browsing the link in the announcement directly.
We searched all their source code and no one was setting the SPWebApplication property. The time window was too large to gather process monitor to check for any console applications running. The IIS logs ruled out the Central Admin settings. We ended up using the approach from a previous blog post in which we used an Event Receiver on the announcements list to capture a memory dump when the announcement was created. This way we could catch the process and stack that was giving us grief.
This resulted in memory dumps of the StsAdm.exe process. The interesting thing is that the person was not running the EnableSSC command, they were actually running SetProperty. The stack is below with the addresses and parameters removed to clean it up:
Microsoft.SharePoint.SPWeb.AddSscAnnouncement Microsoft.SharePoint.Administration.SPWebApplication.set_SelfServiceSiteCreationEnabled Microsoft.SharePoint.Administration.SPBackwardCompatibilityPropertyMapper.SetVirtualServerProperty
From the stack, you can see that SetProperty was the operation used with StsAdm.exe, and this led to a call to set_SelfServiceSiteCreationEnabled. This is the setter of the property mentioned above. The setter of the property calls AddSscAnnouncement, which is the function that actually adds the announcement.
From here I was able to consistently reproduce the problem and get a feel for what was going on. Running StsAdm.exe –o SetProperty, sets a property in the SPWebApplication’s PropertyBag. There’s not a check to see what specific property is being set, and call the setter for that property, so they reapply all the properties in the PropertyBag. With Self-Service Site Creation enabled, this results in this property being re-enabled each time. This results in the announcement.
The only workarounds that we found:
- Create an event receiver that looks for the text “Self-Service Site Creation” and cancel the item creation. (See my previous blog and remove the System.Diagnostics call)
- Don’t use SetProperty once you have Self-Service Site Creation enabled