mike hodnick -> mhodnick <-> kindohm

Mike Hodnick is a geeky consultant guy living in Chaska, MN. He enjoys writing code, writing music, and doing fun stuff with his wife and daughter. This is his personal website, where you can get to his blog, music library, and other nonsense.

Latest From Twitter...

The Blog

SharePoint

This is arguably one of the easiest tasks you can perform in code as a SharePoint developer, but not very well known or documented.  Start off by referencing the Microsoft.SharePoint.Publishing assembly.  The rest is cake: // assume we're using the // Microsoft.SharePoint.Publishing.Administration namespace ContentDeploymentJobCollection jobs = ContentDeploymentJob.GetAllJobs(); foreach (Job job in jobs) { Console.WriteLine(job.Name); job.Run(); } The ContentDeploymentJob class also has a GetAllQuickDeployJobs() method to return only Quick Deploy jobs. The ContentDeploymentJob class hosts the expected methods and properties you'd find on a job, such as Name, Description, LastStatus, Run(), and Test() (among others). Technorati Tags: sharepoint code

Thanks to everyone who attended my talk on extending the MOSS Search API today.  Slides and code are available here: Slides (PowerPoint 2007) Slides (PowerPoint 2003) Code Technorati Tags: code sharepoint presentation

If you are writing code using the SharePoint migration API (e.g. using the SPExport/SPImport classes, which Stefan Goßner has blogged in detail about), you'll want to be careful about the scope of your exports when exporting custom layout pages in MOSS.  In short, custom layout pages get copied to the wrong folder when performing an export scoped at the site collection level.  Make sure you use an export scoped at the top-level web rather than the site collection in order to get layout pages in their proper place. Let's start with a scenario - let's build a custom content...

There are good ways and bad ways to use Microsoft Office SharePoint Server (MOSS) for hosting an Internet web site.  When at its best, MOSS will take care of all the details of navigation, storage, content management, and page layouts for you.  It might even perform really, really well.  It's these times when MOSS allows you (a developer) to focus on the killer features and writing code - rather than the mundane site management tasks.  At its worst, MOSS can be a performance hog, clog up SQL server connections, and be very difficult to manage.  Every custom artifact...

Best SharePoint error ever: Actually, I don't know that this is a SharePoint error at all.  The core exception thrown is a COMException.  Internet research has only yielded a small amount of forum posts relating to using System.IO.Directory and System.IO.DirectoryInfo, which as far as I can tell are not being used on this page.  I cracked open Reflector hoping to learn more.  An internal SharePoint class just catches the COMException and throws a new SPException.  As you can guess, the SharePoint method that does the work is just wrapping a COM call.   Unfortunately,...

For "Publishing" sites In Microsoft Office SharePoint Server, you have the ability to specify a master page that all pages in the web should use: Optionally, you have the ability to inherit the master page of the parent web (if a parent exists): Setting these two values programmatically is easy, but not necessarily intuitive. First, to set the master page, it is as easy as setting the value of an SPWeb object's CustomMasterUrl property to the server-relative path of the master page: SPSite site = new SPSite("http://myserver"); SPWeb web = site.OpenWeb("/some/web/path"); web.CustomMasterUrl =...

The first ever Twin Cities SharePoint Camp is on June 14h, 2008 at New Horizons Minnesota.  I'll be presenting at least one code-related topic.  If you're interested in presenting, information about the event is here: http://geekswithblogs.net/cwilliams/archive/2008/04/28/121737.aspx Technorati Tags: sharepoint code twin cities

Thanks to everyone who attended the MODIG tonight on the MOSS Search API.  Slides and code are posted here: http://tinyurl.com/6y5hc7 Technorati Tags: sharepoint MODIG code MOSS

I'll be presenting on the Microsoft Office SharePoint Server (MOSS) Search API at the next Minneapolis Office Developer Interest Group (MODIG) meeting on April 22, 2008 at 5:30 PM.  I wasn't originally scheduled for this talk, but I'm filling in for Neil while he tends to his new paternal duties.  The talk will be almost the same as the one I did at the last Twin Cities Code Camp, except this time there will be a little more time available for the presentation.  I'll add that you can now buy a MODIG t-shirt! http://www.cafepress.com/cp/customize/product.aspx?clear=true&number=%20253292961 ...

Version 1.1.0.0 of SharePoint Search Bench has been released: http://www.codeplex.com/SPSearchBench There are a few new features in this release: Full Text query generation tools.  If you're not familiar with the syntax of Full Text search queries, there is a FullTextBuilder class (and some other supporting classes) that can build the queries for you.  Something like this:FullTextBuilder text = FullTextBuilder.Select("Title, Author").Where(Condition.FreeText("dog, cat"));Any number of conditions may be "and'ed" and "or'ed" together. Support for verbose logging with log4net. A CHM help file with API documentation.  The documentation goes a little beyond listing the types and members in the assembly by...

There are lots of questions out on forums and blogs about how to programmatically create an InfoPath form from an InfoPath XSN template, but they all suggest the same thing: use the InfoPath application (or the Forms Server hosting page) to fill out a new, blank form by hand and then save the empty form xml somewhere.  Use the empty xml as a blank placeholder form that you can copy programmatically whenever you want. This approach is valid, but it's a pain in the arse for deploying an InfoPath forms solution on a project.  Imagine you have ten InfoPath forms...

ACS302: Building Custom ASP.NET AJAX Controls I feared that this session might cover the basics of AJAX, but it didn't.  The speaker covered two main ways to develop custom AJAX controls (using extenders and the AJAX toolkit or through your own complete customization).  Not a bad presentation for someone like me who has done little that is useful yet with AJAX. VWF306: Build Workflow Activities Using Objects Rocky presented this one, and drove home the point that you should create your own custom activities (deriving from the Activity class) and use dependency properties when developing workflows with Workflow Foundation.  There...

Some decent sessions today.  I think I've gotten a little better at weeding out the bad ones by title :)  By tomorrow I may have a complete day of worthwhile sessions.  AGN301: Dealing with Long Running Requests in ASP.NET I wasn't sure if I was going to learn anything in this one, but I took away a few new things I didn't know already.  Rick Strahl covered three main ways to deal with long-running requests (each may be better/worse to use depending on what you really need to improve): 1) modify the user interface (disable buttons after clicking, hide the UI...

I'm finding that the presentations aren't quite meeting all of my expectations out here at DevConn, although I think I've learned to weed out the less-interesting stuff based on the titles and short descriptions in the schedule.  VMS306: A Lap Around Visual Studio Team System 2008 This session did not meet my expectations.  It was a run through of the basic features of VS TS 2008 - most of which are available in VS TS 2005.  Work items, reporting, source control, etc.  Ho hum.  HMS308: Microsoft ASP .NET AJAX 1.0 and SharePoint This session was worth the price...

Download SharePoint Search Bench from www.codeplex.com/SPSearchBench SharePoint Search Bench is a WPF application used to run full-text SQL and keyword queries against Microsoft Office SharePoint Server (MOSS) search.   This project is something I've had in the works for a little while.  Extending MOSS search is a common task among SharePoint developers, yet there aren't really any tools available to test, try, or develop queries against MOSS search.  Unlike SQL Server, MOSS doesn't ship with a "Query Analyzer".  On projects where I was extending MOSS search, I found myself writing my own app to write and test queries.  Here...

In the object-oriented world, when I hear the word "sealed" I think of preventing inheritance.  If I create a sealed class named Car, it means that I don't want anyone else to inherit or derive from Car.  In WSS 3.0, you can create new Content Types that derive from a parent Content Type (e.g. a Car Content Type that derives from a parent Vehicle Content Type).  You can also create sealed Content Types.  You can refer to the Content Type Definition Schema and the SPContentType class for details.  So what does it mean to create a sealed Content Type?  Not as much...

Check out this WSS Feature that performs automatic backups of SharePoint sites upon their deletion: http://www.codeplex.com/governance. Handy. From a developer's perspective, I doubt I'd use this myself, but I can't count the number of times a user has asked me if it is possible to restore a site they've accidentally deleted. You don't get this functionality out-of-the-box with WSS 2.0/3.0, but this feature makes it possible. All deletions and backups are logged to a folder of your choice and specific information such as the logged in user, deleted site, etc are all logged. SQL backups are created...

I just wasted $20.  I subscribed to my web host's (webhost4life.com) Windows SharePoint Services 3.0 offering, only to find that site owners do not have access to their own WSS virtual root. That means no bin folder, no wpcatalog folder, and no web.config file. All you get is out-of-the-box stuff. Webhost4life.com does not say much about their WSS 3.0 offering on their site. Arguably I was a bad consumer and didn't look in to it deeply enough before making my payment. I will say though that their WSS 2.0 offering does allow customizations, and I...

Creating your own custom field types in Windows SharePoint Service v3 is an awesome thing. Instead of relying on the out-of-the-box types (text, number, Url, etc), you can create your own fields that incorporate whatever logic and data you want. You can derive from the SPField class or a specific type of field (such as SPFieldText, SPFieldNumber, etc). A custom field can have some custom properties. For example, if you have a custom field named Car, you could have a custom property named Color on the Car field. The user could select a color from a...