I found some code on http://blogs.msdn.com/b/joncole/archive/2009/09/21/impersonation-code-in-c.aspx which showed me how to impersonate a user.
The one tweak I had to make was to change
LogonType.Interactive,
to
LogonType.NewCredentials,
and it worked.