Step-by-step Forms-Based Authentication (FBA) on SharePoint 2010

This is an A-Z guide that helps you setup a web application with Forms-Based Authentication (FBA) in SharePoint Foundation 2010, using Claims-Based authentication. It uses MS SQL Server to store users. The SharePoint server is running in Windows Server 2008 R2. Although this guide uses SharePoint Foundation 2010, the same steps apply to SharePoint Server 2010.

In this guide, you’ll create a SQL Server database to hold users and roles, create a SharePoint Web Application that uses FBA, configure IIS and the web.config files for the Web App, Central Admin and the Security Token Service, create a test user in the database and test your setup.

Click here to read the entire article →

List of all databases used by a SharePoint 2010 farm

Someone recently asked me how to get a listing of databases used by a farm, with the server instance name and database names.

There are ways to retrieve this info from Central Administration, but PowerShell makes your life much easier:

Get-SPDatabase | select name, databaseconnectionstring

Where the Data Source element in the Connection String contains the exact DB server instance used by the farm.

Using SharePoint Powershell from PowerShell ISE

Whoever has worked with PowerShell probably came to the same conclusion: this stuff is potent and powerful!

The ‘standard’ SharePoint 2010 Management Shell does have some drawbacks.

Working with a Command-Prompt-like environment does not appeal to everyone, especially those used to visual IDE’s like Visual Studio. Fortunately, PowerShell v2 comes with PowerShell ISE, a more visual experience that makes it much easier to work with scripts. This is available by default on Windows 7 and can be enabled as a feature on Windows Server 2008, using the following PowerShell command:

Add-WindowsFeature PowerShell-ISE

You can now find PowerShell ISE shortcuts in the Start Menu.

However, when you start PowerShell ISE, you’ll find that it only works with Windows cmdlets. For PowerShell ISE to work with SharePoint cmdlets, you’ll only need to add a PowerShell Snapin, using the following command.

Add-PSSnapin Microsoft.SharePoint.PowerShell

After this, you’ll be able to access the SharePoint commandlets, whose noun all start with “sp”.

Now if you’re like me, you’ll always want these SharePoint cmdlets available from PowerShell ISE. Zubair Alexander posted a way of doing this earlier this year on his blog.

  1. You can check if a PowerShell profile is available for your current identity using the Test-Path $profile command. This will return true if a profile is present and false if not.
  2. You can create a new profile for your identity by using the following command:
    Test-Path $profile
    if (!(test-path $profile)) {new-item -type file -path $profile -force}

    This will perform a “Create Directory” operation on the target destination folder C:\Users\<username>\Documents\WindowsPowerShell, and add a file titled “Microsoft.PowerShellISE_profile.ps1” to this folder.

  3. Now, use PowerShell ISE to open the newly created .ps1 file
  4. Add the command
    Add-PSSnapIn Microsoft.SharePoint.PowerShell

    (and any other commands you want to automatically run when you open PowerShell ISE) to the file and press Save.

  5. Restart PowerShell ISE. You’ll now find you’ll be able to access all SharePoint cmdlets directly, each time you run PowerShell ISE on this machine.

Adding filters to System.Nullable types in BCS

It took me a while to find the solution for this problem, which was eventually handed to me by Dmitry Kaloshin, so I’ll share it here:

Filters in BCS are very handy, and often necessary, for reducing the amount of items when working with External Data, such as an External Data Column based on an External Content Type.

When you’re working with an external content type that has input parameters of the .NET Type System.Nullable<System.Int32>, you may run into the same problems I had.

A sample input parameter for a Read List operation, i.e. from a WCF Service, that has the System.Nullable .NET Type, may look like this:

Initial paramtere properties

If you’d want to add a Comparison filter for this input parameter, you’d probably set it up like this:

Comparison Filter

When you click OK, you’d see an Error message in the Errors and Warning list at the bottom of the page.

Error message with Filter on System.Nullable input parameter

The error reads “The filter field data type System.Nullable<System.Int32> does not match data type System.Int32 on data source element [[Element name]]“.

It seems like SharePoint BCS is unable to cope with Nullable Int .NET data types, which would be odd, as they’ve been around in the .NET Framework since version 2.0.

The solution is to set the Filter Field property of the Filter to <<none>>. Since the Filter Configuration dialog is started from the Element properties panel, the Element to filter is still linked to this filter.

Solution: Set Filter Field to None

Press OK to close the Dialog and press Finish to close the Read List dialog.

Save your changes to the Business Data Connectivity Metadata Store, and you’re done.

Welcome to the new home for my blog!

Welcome all, to morg.nl, the new home for my blog about SharePoint 2010, Office, and all other things connected to business productivity.

This blog used to be on blogspot, hardly being maintained and posted on. But I intend to use this new version of my blog much more.

Follow me on twitter to keep up to date with any new posts on this blog – whenever I publish a new article, it’ll automatically appear on my timeline, complete with a personal shortened URL of the morg.nl domain (oh the vanity!)