Removing user My Sites

I recently was investigating how to clean up a SharePoint Farm of users who have left an organisation.

One annoying thing I found hard to locate a ‘how to’ was about removing a users My Site from the Shared Service Provider. It’s actually really simple.

You can easily enough just delete the personal Site Collection (as every users My Site is a separate Site Coll) and this will remove it. However this will leave loose ends as if the user returns the will not be able to create a new my site as the profile has a property called ‘Personal Site’ with the relative url to their my site location.

You could also just delete the profile itself from the profiles DB, but the my site Site Collection for that user will still exist. This may be acceptable if you can tolerate the disk space for each user My Site being left in the DB. So if they do return, the user profile will find the existing My Site.

To clean completely, go to the Shared Service Provider where that users profile is stored, go to ‘User profile and properties’ –> ‘View user profiles’ and find the user. Select Manage Personal Site from the drop down and from there you can simply delete the site. Then of course remove the user profilem, and also remove or lock the user in AD otherwise it will re-import again on the next import schedule.

Hope this helps someone else, as I had a difficult time finding any info about how to do this!

Failed to instantiate file “default.master” from module “DefaultMasterPage”

An error occured when provisioning a new custom site definition with custom features.

No useful logging information or error messages other than the line:

Failed to instantiate file “default.master” from module “DefaultMasterPage”: Source path “default.master” not found.

Problem was a custom feature with an activation dependency. In the process of trying to set it to a hidden feature, I forgot that you can’t hide a feature with an activation dependency. Hence it was throwing an error.

So in short it was a real pain to debug, as you can see the MS error message is absolutely useless!

Hide Site Definitions via a Feature

Creating site definitions is a good way to deploy customisations for different projects or clients. However if they all run on the same farm, how do you stop users from creating sites based on the wrong project?

By default if you create a site definition, it will appear in the Site Actions -> Create Site sites list (publishing feature), unless you have limited the site templates available through site settings. 

But what if you dont want to allow the site owners access to provide these templates to their users? You can restrict it at the Site Definition level.

  1. Create an empty site feature called something like ‘Project.EnableSiteTemplates’ (set hidden=”TRUE” if you want to control the feature activation via Site Def or STSADM only – not through Site Settings) 
  2. In the webtemp*.xml for your site definition, in each <Configuration> template node set the VisibilityFeatureDependency property to the GUID of your newly created feature so that the site only appears for users to select in Create Site box when that feature has been activated. eg. VisibilityFeatureDependency=”7C30466D-62A2-43eb-99EB-7650E5D14B77″
  3. In your onet.xml file of the project Site Definition, enable the ‘Project.EnableSiteTemplates’ feature in the <SiteFeatures> section, so when your new site collection is created it also enables your site templates for this project. 
This is the same principle behind hiding sites based on publishing infrastructure until the prerequisite features for Publishing have been enabled.
Note: The Site Owner will actually see and be able to select the custom site templates on the ‘Page Layout and Site Template Settings’ page even when the feature is not activate on the site collection. However nobody can actually see the site on the ‘Create Site’ page until the feature is activated.

Comparing to a time in a CQWP

I had been struggling to find out how to compare a time in a CAML statement for a while now (not that I was looking particularly hard though). To do a date comparison is easy using the <Today/> tag, but I was (and still am!) confused as to why the <Now/> tag doesn’t work in the query, as it’s listed in the SDK. Very frustrating!

However I came across this blog on the Microsoft ECM team blog, where buried in the comments trail there was a little gem!

Normally to compare a date in a Query override you would use something like:

<Geq><FieldRef Name=”Expires” /><Value Type=”DateTime”><Today /></Value></Geq>

this will compare the whole date, so if the items date is today it will be included, no matter what the time. If you want to compare the time also, you need to add this IncludeTimeValue attribute to the Value tag:

<Geq><FieldRef Name=”Expires” /><Value Type=”DateTime” IncludeTimeValue=”TRUE”><Today /></Value></Geq>

Pretty simple, one of those annoying little bits of crucial info that’s really hard to find!

Search Results performance

I was trying some fixed query searches today in order to find all documents recently updated across the MOSS farm. So I set up a Core Search Results web part to find all documents throughout all site collections, and view by modified date and return, say, the 10 most recently modified documents.

I got a bit of a shock when I switched between ‘search by relevance’ and ‘search by modified date’ preferences in the query. By Relevance the search took a reasonable ~0.3sec, however by Modified date took a somewhat more sluggish ~7secs, that quite a difference in my books! Not sure why, but I’ll avoid that one in future!

ServerTemplate Numbers

I’ve put these here because I keep having to trawl the web for these numbers each time I want to do a CQWP… Next time I’ll just print them out antd stick them to the wall!

   
100 Generic list
101 Document library
102 Survey
103 Links list
104 Announcements list
105 Contacts list
106 Events list
107 Tasks list
108 Discussion board
109 Picture library
110 Data sources
111 Site template gallery
112 User Information list
113 Web Part gallery
114 List template gallery
115 XML Form library
116 Master pages gallery
117 No-Code Workflows
118 Custom Workflow Process
119 Wiki Page library
120 Custom grid for a list
130 Data Connection library
140 Workflow History
150 Gantt Tasks list
200 Meeting Series list
201 Meeting Agenda list
202 Meeting Attendees list
204 Meeting Decisions list
207 Meeting Objectives list
210 Meeting text box
211 Meeting Things To Bring list
212 Meeting Workspace Pages list
300 Portal Sites list
301 Blog Posts list
302 Blog Comments list
303 Blog Categories list
850 Page Library
1100 Issue tracking
1200 Administrator tasks list
2002 Personal document library
2003 Private document library

Custom Alerts – Part 2 – Filters

In my previous post on how to customise Alerts, we could see how to change the html of an alert. In this post, I will show how to change the filter for an alert, which defines the conditions in which events cause and alert to trigger and an email sent.

Say for example we have a list with a field called “Assigned To”, and we want know when someone (other than yourself) changes the assignment on that list item.

If we open the custom alert XML file we created in the 12 Hive at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\alerttemplates.xml, and search for our customised AlertTemplate node, we will find a section called Filters. Inside that node is a few different default FilterDefinitions, which specify the conditions for an alert to fire. Read the rest of this entry »