There are 2 ‘features’ in SharePoint (MOSS2007) which have kept me busy for quite some time in my last project. Yes, you’ve read it right the first time, my latest project was a MOSS 2007 web portal. Of course these issues aren’t really quirks as the product behaves by design, but it has kept me busy for more time as I would bargain for.
For some reason I had to create a console application to query the SharePoint user list and delete the users. Normally this doesn’t pose a problem at all. However, this time the following error was thrown every time:
The Web application at http://your-website-here:80 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
Quite strange, as the website does exist, I even double checked it.
After doing some research on the matter it turns out you need to specify the Platform target for your application. Mine was set to Any CPU and had to be changed to x86. After changing this specific option the code was running correct.
The other thing I ran in to was not having permission to do anything on my site collection. We were using the stsadm export and stsadm import commands to move SharePoint site applications between environments.
This means I was familiar with setting the proper permissions on the web application and site collection. However, this time it didn’t work. After having spent several hours on this problem I finally noticed a feature which I had never seen before. Apparently you can set a site lock when doing an export on a website. This makes sense as you don’t want your data to change much when doing this.
However, after doing an import, you also need to remove the site lock. If you fail to do so, no one can make changes to the content of the website. To fix this, you can use the stsadm command, like so:
stsadm -o setsitelock -url http://your-website/ -lock none
Because I’m a developer who loves a GUI I’ve also found the option in Central Administration. Navigate to the Application Management tab and search for the Site collection quotas and locks.
On this page you can select your site collection and set the lock status for it.
After setting it to the status Not locked and you press OK, your site should be editable again.
Even though this post references some prehistoric software platform, I do hope you find it useful.