Saturday, May 5, 2012

How to utilize Microsoft SharePoint via Visual Studio .NET

First download appropriate installer for Visual Studio 2008 Extensions for Windows SharePoint Services 3.0 - VSeWWSv13_x64.exe

Then, download Windows SharePoint Services 3.0 - SharePoint.exe

If you attempt to install Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, it will ask you to first install Windows SharePoint Services 3.0, which, in turn, will give you an installation error. There is one thing you need to do before attempting to install Windows SharePoint Services 3.0: Run SharePoint on Vista Installation Helper File. It is created for Windows Vista, but works just fine on Windows 7 and can be downloaded from here

After downloading Vista Installation Helper File, run WssVista.msi.

After install is compete, run C:\Program Files (x86)\WssOnVista\Setup\SetupLauncher.exe and when it prompts, navigate to SharePoint.exe that you have downloaded in previous steps.

After all this is done, you can safely install Visual Studio 2008 Extensions for Windows SharePoint Services 3.0 - the first file you have downloaded.

Now, in order to add SharePint dll to your project, right-click on the Visual Studio project name, select Add Reference and browse to "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll" and add Microsoft.SharePoint directove to your .NET class.

Thursday, May 3, 2012

Login failed for user [name] error

So you have been moving database from one server or instance to another, you backed up and restored the database, scripted all logins, did everything in the book, and suddently, when loging in with sql server login, that worked so well before, you get "Login failed for user [name]" error.

First thing to check is whether your SQL Server is configured to use Mixed mode or Windows only authentication. because if it is configured to use Windows only, any sql login will be rejected, no matter what type of permissions it has.

Right-click on the server name, go to Properties, select Security and make sure "SQL Server and Windows Authentication mode" is selected.

Wednesday, May 2, 2012

Moving databases: Detach/Attach method vs. Backup/Restore

Personally, when moving a database from one server to another, I prefer using backup/restore since if I encounter any issues with SQL Server versions or something else, I can always restore backup somewhere else and I will also have a working copy of the database on the source server, while if anything goes wrong during the detach/attach process, I will not have a copy of the database elsewhere. My second reason is that backup/restore requires no downtime, which is always a big plus.

So far I have encountered only one case where using detach/attach scenario was better then backup/restore - I needed to move a database from the default instance to a named instance on the same server and I did not want to use backup/restore since I wanted mdf and ldf files to stay at the same location on the server. Also detach/attach is much faster than backup/restore since it only takes minutes to detach database, copy the files to another server and attach the database, and both backup and restore processes can take hours.