I was recently writing a windows forms application that would run on a SharePoint server and run a set of actions if a solution was deployed. I used the standard approach of getting the solution by its ID from the solutions in the farm.
When I hit the SPFarm object the Local property was null.
How could SPFarm.Local be null?
The project had been given x86 by default when creating it in Visual Studio, and 32-bit application can’t call the SharePoint 2010 64bit Object Model.
Quick change to the Platform target and its good to go.
If your finding this post and changing your platform does not fix your issue, make sure you look at your permission too. You need to have permission to access the farm.
This got me the first several times I wrote a throw away Console app against 2010... hopefully I remember next time and won't bang my head against the wall. :)
ReplyDelete