SharePoint24x7 It's all about SharePoint.

12Dec/130

Article – Host-named Site Collections

Posted by Joy

Host header or Host-named?

I know for most of us, at the beginning, these 02 terms, what they are and difference between these 02 are very confusing. I'm writing this to help you understand it very easily.

Prior to SharePoint 2013

With the early releases of SharePoint, when we wanted to create a new Site Collection, we had 2 options to define their URLs:

  1. Rely on physical server name and port combination
  2. Rely on host header paths

Physical server name and port combination

This was the case we used to rely on almost all the developer environments. We ended up having web application URLs attached to the physical server name and port combination, similar to:

Site Collections we created using this approach ended up having URLs similar to:

Host header path

As an alternate, this approach helps us to address some of the issues we faced in the previous approach. With this approach we will create a Web Application by assigning a user-friendly host header such as http://contoso.com. We depend on either local hosts file (in case of development environments) or DNS (in case of staging and production environments) for mapping host header to the server IP and port. With this approach, we can have URLs similar to:

With this approach, we will be able to overcome the main issues we faced with the physical server name and port combination URLs approach. However, what if we want to create site collections with following URLs:

With any of the above 02 approaches, to implement URLs like shown above, we need to create multiple web applications each pointing to above host headers as their starting URL. Because, host headers are assigned for Web Applications and we cannot assign multiple host headers for the same Web Application. Having to creating multiple Web Applications to implement above URLs schema is not going to be a practical solution since:

  • There is a limitation of no of Web Applications which can be hosted in farm
  • Creating lot of Web Applications will introduce additional processing overhead to the farm

With SharePoint 2013

With SharePoint 2013, we can solve the above problem with an approach called Host-named Site Collections. With Host-named Site Collections approach, we can create Site Collections with user-friendly URLs with different domain names within the same Web Application. With Host-named Site Collections approach we can create following Site Collections within the same Web Application:

Now we can have just 01 Web Application, with multiple user-friendly URLs, with different domain names in them as the starting point for Site Collection URLs.

Note: though, it's a very useful approach, creating Host-names Site Collections is little tricky since it can be created only by using Windows PowerShell and cannot be created using SharePoint Central Administration web site.

7Jan/130

Article – Custom Windows PowerShell Scripts and Local Execution Policy

Posted by Joy

Windows PowerShell supports authoring PowerShell scripts and executing them. You can write Windows PowerShell scripts using any text editor and save them with “.ps1” file extension. You may have encountered the following error when you were trying to execute your PowerShell script and this post explains the story behind this error and how to eliminate it.

I have written a very simple PowerShell script which displays “Hello, World..!” and saved into a script file names “Hello.ps1”.

write-host "====================================="
write-host "Hello, World..!"
write-host "====================================="

When I try to execute the script file using Windows PowerShell command line, I get the following error:

PSError

The reason for this is, once Windows PowerShell is configured in your server, it configures the local execution policy of your server to restricted mode to avoid any attackers to come across the network and execute any PowerShell scripts and harm your environment. Which means, no scripts can be executed without signing your scripts with a Public-Private Key pair.

You can retrieve the current mode of the local execution policy by executing following command:

PS C:\> Get-ExecutionPolicy

localexecutionpolicystatus

Following are the different modes of the local execution policy:

  • Restricted – scripts will not execute under this execution policy without signing with a Public-Private Key pair
  • Unrestricted – scripts can execute under this execution policy. However, the scripts which are not signed will continue to prompt for username and password.
  • Bypass – scripts can execute under this execution policy and it will suppress prompting for username and password

Set the execution policy to unrestricted or bypass by using following command:

PS C:\> Set-ExecutionPolicy unrestricted

Now you can run your script files and they will continue to run without complaining.

Important thing to know when we are working with SharePoint is that, installing SharePoint will loosen the execution policy to unrestricted in all the Application servers and Web Front End servers.

4Feb/120

Article – What are the Service Applications that can be partitioned?

Posted by Joy

SharePoint 2010 provides number of enhancements and new features compared to previous version – MOSS 2007. One of the enhancement is Multitenancy. Multitenancy has been greatly enhanced with the SharePoint 2010 release. One of the new features which backups so many other enhancements and new features is Service Application Framework which is the new face of Shared Services Provides in MOSS 2007. Multitenancy in SharePoint 2010 has been greatly enhanced with the introduction of Service Application Framework.

Services Application Framework allows different Web Application to utilize different Service Applications depending on the need. It also provides Service Application partitioning which helps organizations to implement Multitenancy so that each tenant can have it’s own set of Service Applications and tenants will be able to manage the information boundary.

Having said that, the first question come to our mind (rather my mind) is that which Service Applications support this partitioning and storing tenant specific data? Not only me, lot of organizations who are planning to implement Multitenancy will have the same question trying to figure it out which Service Applications provide partitioning and storing tenant specific data.

Here is the answer…

Service Application Name

Can be Partitioned?

Can store Tenant data?

Access Services

No

No

Business Connectivity Services

Yes

Yes

Excel Calculation Service

No

No

FAST Search for SharePoint

No

No

Managed Metadata Service

Yes

Yes

PerformancePoint Services

No

No

PowerPoint Service

No

No

Project Server Service

Yes

Yes

Usage and Health Data Service

No

No

User Profiles Synchronization Service

Yes

Yes

Search Service

Yes

Yes

Subscriptions Settings Service

Yes

Yes

State Service

Yes

No

Web Analytics Service

No

Yes

Word Conversions Service

Yes

No

Word Viewing Service

Yes

No

Visio Graphics Service

Yes

No

Hope this helps you a lot..?

28Dec/110

Enabling Developer Dashboard in SharePoint 2010

Posted by Joy

ASP.NET provides Call Stack and Tracing as wonderful features which helps developers on investigating what is going on page rendering behind the scene. SharePoint being a product which provides bunch of features OOTB which we can use to setup a portal very easily, it hides most of these information.

Back in MOSS 2007, we had to scratch our head thinking where to start our investigation when we get an error in the browser, because that error was not descriptive enough for us to start the investigation.

In SharePoint 2010, we have a nice feature – Developer Dashboard which helps developers to be comfortable when they see an error in the browser.

Enabling Developer Dashboard

Developer Dashboard is a feature targeted for developers (administrators as well) and hence it is disabled by default. We need to enable it using one of the method mentioned below:

  • STSADM
  • PowerShell
  • SharePoint Object Model
STSADM

We still can use STSADM with SharePoint 2010 for administering SharePoint. However, STSADM is more likely to disappear in the next release. Though we can use following STSADM command to enable Developer Dashboard, I strongly recommend to get familiar with PowerShell, if you are not already.

  1. Go to the command prompt and make sure to either set the path to the location of STSADM.EXE or navigate to the bin directory in SharePoint root in your command prompt.
  2. Issue the following command in the command prompt:STSADM -o setproperty -pn developer-dashboard -pv ondemand

The above command will enable the Developer Dashboard in On Demand mode.

PowerShell
  1. Go to Start –> All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell
  2. Issue the following command in the management shell:$devdash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
    $devdash.DisplayLevel = ‘OnDemand’;
    $devdash.TraceEnabled = $true;
    $devdash.Update()

The above command will enable the Developer Dashboard in On Demand mode.

SharePoint Object Model
  1. Create a Console Application, Windows Application or Web Site and add a reference to the Microsoft.SharePoint.dll assembly.
  2. Add using Microsoft.SharePoint.Administration namespace reference at the top of the code (C#) file.
  3. Add the following code into your code (C#) file to enable Developer Dashboard:SPWebService svc = SPContext.Current.Site.WebApplication.WebService;
    svc.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.OnDemand;
    svc.DeveloperDashboardSettings.Update();

The above command will enable the Developer Dashboard in On Demand mode.

I have used On Demand as the setting for Display Level of the Developer Dashboard and following are the other options we can specify:

  1. On – Enable the Developer Dashboard all the times
  2. Off – Disable the Developer Dashboard
  3. OnDemand – Enable the Developer Dashboard but will be displayed on demand.

When you enable Developer Dashboard in On Demand mode, following icon will be displayed next to your login name.

Capture1

On click of the Developer Dashboard icon, page will be reloaded and Developer Dashboard will be displayed at the bottom of the page as shown below:

Capture2

If you have also used TraceEnabled = $true switch with PowerShell, then you will see a link says “Show or hide additional tracing information …” at the end of the Developer Dashboard which allows you to show/ hide ASP.NET Tracing information as shown below:

Capture3

Isn’t this a awesome feature for you to get started your investigation exercise? Have a closer look at what Developer Dashboard offers you and it will help you in numbers of ways.

3Nov/113

Fix it – Configuring Object Cache service

Posted by Joy

If you are using Web Content Management (WCM) solutions implemented with SharePoint 2010 Publishing Infrastructure features, you will notice following Critical error in your server Event Log.

Capture9

What does it mean and how do you fix this?

This error is generated by SharePoint’s Object Cache service. In order to get rid of this error, you will have to configure Object Cache service.

What is Object Cache service?

Object Cache is a very powerful built-in service in SharePoint 2010 Publishing Infrastructure which instructs every Web Front End (WFE) to cache object properties in order to boost the performance. This reduces the load on SQL Server tremendously by reducing number of round trips required to retrieve same data from the content databases. In scenarios where you have Web Content Management solutions which go through less content changes, by configuring Object Cache, you can reduce the latency and increase the throughput.

Configuring Object Cache is all about configuring User Policies for each and every Web Applications. Object Cache is configured at the Web Application level and you need to have 02 AD user accounts for configuring Portal Super User and Portal Super Reader. Portal Super User account has full control and Portal Super Reader account has full read-only access.

Let us begin the configuration.

Task 1 – Create required AD accounts

You need to create 02 service accounts in order to configure Portal Super User and Portal Super Reader. Go to Active Directory and create 02 service accounts.

I already have 02 service accounts created named, SP_ObjectCacheUser and SP_ObjectCacheReader.

Capture1

Task 2 – Configure Object Cache User Accounts using CA

Initial configuration done using CA.

  1. Fire up the SharePoint 2010 Central Administration site by navigating to Start –> All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Central Administration.
  2. Select Manage web applications link from the Application Management group.
  3. Select the web application you are planning to configure Object Cache. In my environment, for this demo, I’m selecting SharePoint – 80 web application.
  4. Click the User Policy from the Policy group in the ribbon.
    Capture2
  5. Click Add Users link in the Policy for Web Application dialog box.
    Capture3
  6. Select (All Zones) for the Select the Zone field in the Add Users dialog box and click Next > button.
    Capture4
  7. Enter the Portal Super User account for the Choose Users field and select Full Control from the Choose Permissions section and click Finish. In my demo, I have configured SP_ObjectCacheUser as the Portal Super User.
    Capture5
  8. Click Add Users link again in the Policy for Web Application dialog box.
  9. Select (All Zones) for the Select the Zone field in the Add Users dialog box and click Next > button.
  10. Enter the Portal Super Reader account for the Choose Users field and select Full Read from the Choose Permissions section and click Finish. In my demo, I have configured SP_ObjectCacheReader as the Portal Super Read.
    Capture6
  11. Policy for Web Application dialog box now will look following.
    Capture7

Task 3 – Committing configuration changes using PowerShell

Final step is to commit configuration changes using PowerShell.

  1. Fire up SharePoint 2010 Management Shell by navigating to Start –> All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell.
  2. Enter the following PowerShell commands to update the settings. Change the Web Application name placeholder depending on the name of the Web Application.$wa = Get-SPWebApplication – Identity “SharePoint – 80
    $wa.Properties[“portalsuperuseraccount”] = “CONTOSO\SP_ObjectCacheUser
    $wa.Properties[“portalsuperreaderaccount”] = “CONTOSO\SP_ObjectCacheReader
    $wa.Update()

    Capture8

Now you will not see the earlier Critical error in your server Event Log as well as you will experience a reduced latency and an improved throughput.

10Oct/112

Article – Configuring Forms-based Authentication in SharePoint 2010

Posted by Joy

Configuring Form-based authentication has been always challenging in SharePoint products and technologies since its early releases. With the introduction of SharePoint 2010, it became simpler but little confusing to most of developers & administrators. I’m going to quickly go through how to configure forms-based authentication in SharePoint 2010 using a SQL Server based user store.

Note: Authentication in SharePoint can be configured only at the Web Application level. Web Application is the boundary for configuring authentication in SharePoint. Even before creating a new web application using CA, you need to decide what type of authentication you are planning to use within the web application. Changing authentication mode later might be difficult and error prone than expected.

Note: To configure form-based authentication, new claims-based authentication mode needs to be configured for the web application. In SharePoint 2010 form-based authentication is implemented using claims-based authentication and using classic mode authenticating to implement form-based authentication is not supported by Microsoft.

Configuring form-based authentication has several phases:

  1. Provisioning and configuring a custom user store
  2. Populating the user store with users and roles
  3. Creating a new Web Application
  4. Configuring STS, CA & FBA Web Application
  5. Test to see whether FBA works

Phase 1: Provisioning and configuring a user store

Task 1: Provisioning and configuring a custom user store

I’m going to use very simple script provided by Microsoft Visual Studio SDK to create a very simple user store to store all the users and roles information.

  1. Fire up Visual Studio Command Prompt (2010) by navigating to Start -> All Programs -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt (2010).
  2. Enter aspnet_regsql and wait until it starts ASP.NET SQL Server Setup Wizard.
    Capture1
  3. Click Next in the Welcome to the ASP.NET SQL Server Setup Wizard page.
  4. Select Configure SQL Server for application services option from the Select a Setup Option page.
    Capture2
  5. In the Select the Server and Database page, enter name of the SQL Server for the Server: field. Select the appropriate authentication mode for the database server (In my case Windows authentication). And if you want to specify a database name, replace <default> with the name of your choice for the Database: field. Leaving Database: field with <default> will always create a database named aspnetdb. Click Next after you enter all the details.
    Capture3
  6. Click Next in the Confirm Your Settings page to start the configuration.
  7. After few seconds, you will get the “The database has been created or modified.” page. Click Finish to quit the wizard.
  8. Exit the Visual Studio Command Prompt (2010).

Task 2: Verify the existence of custom user store

  1. Fire up Microsoft SQL Server Management Studio by navigating to Start -> All Programs -> Microsoft SQL Server 2008 R2 -> SQL Server Management Studio.
  2. Connect to the correct SQL Server using Connect to Server dialog box.
  3. Expand Databases folder and verify the existence of the database aspnetdb.
    Capture4

Task 3: Configuring database access to CA and AppPool user accounts

In order to CA and Web Applications to being able to communicate with the custom user store (aspnetdb database), we need to grant access to SharePoint Farm account and AppPool account. In my environment, I have 02 accounts names SP_Farm and SP_AppPool which I have configured to run SharePoint Farm and AppPools respectively. You need to find out the name of the service accounts for SharePoint Farm Service Account and Application Pool Service Account you configured while you are setting up SharePoint. Once you identify them, perform following instructions to grant right permissions to the database:

  1. Expand Database folder in SQL Server Management Studio.
  2. Expand aspnetdb database.
  3. Expand Security folder and then Users folder.
  4. Right-click Users folder and select New User…
    Capture5
  5. In the Database User – New dialog box, enter name of the farm user for the User name: field and name of the login for the Login name: field.
  6. From the Database role membership: list select the following database Role Members:
  1. aspnet_Membership_FullAccess
  2. aspnet_Personalization_FullAccess
  3. aspnet_Profile_FullAccess
  4. aspnet_Roles_FullAccess
  5. aspnet_WebEvent_FullAccess
    Capture6
  • Select OK to add the user to the database.
  • Repeat steps 4 through 7 for granting SharePoint AppPool service account as well.

Phase 2: Populating the user store with users and roles

Next we need to get some sample users in to the new user store we created by using a role provider. Easiest way to do this is using a Visual Studio ASP.NET Web Site.

Task 1: Creating Users and Roles in custom user store

  1. Fire up Microsoft Visual Studio 2010 by navigating to Start -> All Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010.
  2. Select File -> New -> Web Site…
  3. Select the language of your choice. Select ASP.NET Web Site project template. Provide a project name and click OK.
    Capture7
  4. Double-click web.config from the Solution Explorer and replace <connectionStrings /> with the following:
    <connectionStrings>
        <clear/>
        <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;Integrated Security=True"/>
    </connectionStrings>
  5. Make sure to change the highlighted connection string as per your environment to point to the new user store created.
  6. Save web.config file.
  7. Select the ASP.NET Configuration option from the Solution Explorer to open the ASP.NET Web Site Administration Tool.
    Capture8
    Capture9
  8. Go to Provider tab and click “Select a single provider for all site management data” link. Click the link “Test” in front of “AspNetSqlProvider” and make sure you receive a successful response message “Successfully established a connection to the database.”.
  9. Navigate to Security tab. Click “Select authentication type” link from Users section. Change the selection to “From the internet” and click Done.
  10. Select “Enable roles” link from the Roles section to enable role management.
  11. Select “Create user” link from Users section to create required number of users in the user store.
    Capture10
    Capture23
  12. Select “Create or Manage roles” link from Roles section to create roles. Enter Admins for the New role name: field and click Add Role. Add another role named Users following same steps.
    Capture12
  13. Select Manage for the Admins role and search for the Admin user and make sure he is a member of the Admins role. Repeat the same steps to include Sam and Joy users as a member of Users role.
    Capture13
    Capture14
    Capture15

Use steps 11 through 13 to setup the required users and groups in your user store depending on the requirement.

Phase 3: Creating a new Web Application

After we setup our custom user store with the required users and groups, we can start wiring it to the web application.

Task 1: Creating a Web Application to support FBA

  1. Fire up the SharePoint 2010 Central Administration site.
  2. Select Manage web applications from Application Management section.
  3. Click New from the Contribute group of the ribbon to create a new web application.
  4. In the Create New Web Application dialog, select Claims Based Authentication as the option for Authentication. Provide a meaningful name for the Name and provide a valid port for the Port in the IIS Web Site section.
    Capture16
    Capture17
  5. Move down to Claims Authentication Types section and select Enable Forms Based Authentication (FBA) and provide following for Membership and Role providers: (these information can be obtained from machine.config file).
  1. ASP.NET Membership provider name: AspNetSqlMembershipProvider
  2. ASP.NET Role manager name: AspNetSqlRoleProvider
    Capture18
  • Go down to section Sing In Page URL section and if you wish you can configure a custom Sign in page instead of using built-in sign in page. I will use the built-in sign in page for this demo.
    Capture19
  • Leave rest of the fields as it is and click OK to create the new web application.
  • After a few seconds/ minutes, you will get the Application Created dialog box confirming web application creation. Click the link “Create Site Collection” to create a new Site Collection in this new web application.
  • Give a Title and Description in the Title and Description section.
  • Select Team Site template from the Template Selection section.
  • Specify the Farm Administrator name for the Primary Site Collection Administrator field for being able to login using Windows Authentication. I provided my farm administrator account CONTOSO\Administrator for the same.
  • Click OK to create the Site Collection.
  • Click OK to navigate away from the Top-Level Site Successfully Created dialog box.

Task 2: Verify that the new Site Collection can be access using Windows Authentication

Before we proceed, let’s make sure that we can login and access the new site collection using Windows Authentication since we selected both the options while we were creating the Web Application.

  1. Enter the URL of the new Site Collection. In my case, http://teamserver:8080
  2. You will be taken to the default sign in page.
    Capture20
  3. Select Windows Authentication from the drop down and make sure you get access to the new site collection we just created.

Phase 4: Configuring Security Token Service, CA & FBA Web Application

We need to configure Membership provider for Security Token Service in order to FBA to work properly using Claims based authentication in SharePoint 2010.

Task 1: Configuring STS

  1. Fire up the IIS Manager by navigating to Start -> Administrative Tools -> Internet Information Services (IIS) Manager.
  2. Expand the IIS Server and expand the Sites folder.
  3. Expand SharePoint Web Services Web Site.
  4. Right-click SecurityTokenServiceApplication web site and select Explore.
    Capture21
  5. Open the web.config file.
  6. Go to the end of the file and locate the </system.net> element. Just after the </system.net> element, copy the following configuration elements:
    <system.web>
        <membership>
            <providers>
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
            </providers>
        </membership>
        <roleManager>
            <providers>
                <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </roleManager>
    </system.web>
    <connectionStrings>
        <clear/>
        <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;Integrated Security=True"/>
    </connectionStrings>
  7. Save the changes to web.config file.

Task 2: Configuring FBA Web Application

  1. Fire up the IIS Manager by navigating to Start -> Administrative Tools -> Internet Information Services (IIS) Manager.
  2. Expand the IIS Server and expand the Sites folder.
  3. Right-click FBA enabled web application you created earlier in Phase 3 and select Explore. In my example, FBA Web Site – 8080.
    Capture27
  4. Open the web.config file.
  5. Locate the <membership defaultProvider="i"> element and within <providers> </providers> add the following just below existing content:
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
  6. Just underneath the Membership provider, locate the <roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false"> element and within <providers> </providers> add the following just below existing content:
    <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  7. Finally, locate the </system.web> element and just underneath that, add the following:
    <connectionStrings>
        <clear/>
        <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;Integrated Security=True"/>
    </connectionStrings>
  8. Save the changes to the web.config file.

Task 3: Configure CA – Optional

  1. Fire up the IIS Manager by navigating to Start -> Administrative Tools -> Internet Information Services (IIS) Manager.
  2. Expand the IIS Server and expand the Sites folder.
  3. Right-click SharePoint Central Administration v4 site and select Explore.
  4. Open the web.config file.
  5. Search for <roleManager></roleManager> and <membership></membership> elements and you will typically see a set of empty elements for the same. Replace those empty elements with the following:
    <membership>
        <providers>
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
        </providers>
    </membership>
    <roleManager>
        <providers>
            <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
    </roleManager>
  6. And just underneath the </system.web> element, enter the following:
    <connectionStrings>
        <clear/>
        <add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;Integrated Security=True"/>
    </connectionStrings>
  7. Save the changes to web.config file.

Phase 5: Test to see whether FBA works

Before we test to see whether FBA works, we need to make sure Windows Authentication works as earlier and grant access to one of the Forms based user account to site.

Task 1: Verify that the new Site Collection can be access using Windows Authentication

  1. Enter the URL of the new Site Collection. In my case, http://teamserver:8080
  2. You will be taken to the default sign in page.
  3. Select Windows Authentication from the drop down and make sure you get access to the new site collection we just created.

Task 2: Grand access to Forms based users

  1. While you are logged in as Administrator using Windows Authentication, select Site Actions -> Site Permissions.
  2. Select Grant Permissions from the Grant group in the ribbon.
  3. In the Grant Permissions dialog box, select the Browse button.
    Capture22
  4. In the Select People and Groups – Webpage Dialog, enter forms based user name in the Find field and click Search button. I’m searching for Joy user which I created earlier in Phase 2.
  5. You will see Joy user comes under User: Forms Auth category. Select the user and click Add -> button and click OK.
    Capture24
  6. Select the Contribute group from the Grant Permission dialog box and click OK.

Task 3: Test to see whether we can login using FBA

  1. Open a new browser window and enter the URL of the new Site Collection. In my case, http://teamserver:8080
  2. You will be taken to the default sign in page.
  3. Select Forms Authentication from the drop down and it will take you to a sign in page in which you can enter user name and password.
  4. Enter user name and password for the forms user and click Sign In button.
    Capture25
  5. Wow, you have now logged in as Joy who is a forms based user.
    Capture26

Closing Note: It’s going be bit difficult when you configure Forms-based Authentication for the first time but once you have experience doing it few times, you will not face any issues.

4Jun/110

SharePoint Saturday is coming to Sri Lanka

Posted by Joy

SharePoint Saturday Sri Lanka

SharePoint Saturday Sri Lanka

I was in Singapore last year for presenting at SEA SharePoint Conference and I met Michael Noel & Alpesh Nakar and few other members who are part of SharePoint Saturday. We discussed the possibility of having a SharePoint Saturday in Sri Lanka and Michael liked it to have during Mango seasonJ.

Finaly we are having our first SharePoint Saturday in Sri Lanka and it's happening on 11th June. I'm delighted to present a session there even with the very tight schedule I'm having right now. More importantly, I'm delighted to present while my employer - Virtusa Pvt. Ltd. also sponsoring for the event.

What is SharePoint Saturday SL?

SharePoint Saturday SL is an educational, informative & lively day filled with sessions from respected SharePoint professionals & MVPs, covering a wide variety of SharePoint-orientated topics. SharePoint Saturday is FREE, open to the public and is your local chance to immerse yourself in SharePoint!

When is SharePoint Saturday SL?

June 11, 2011 Saturday

Where is SharePoint Saturday SL?

Informatics Institute of Technology,
57, Ramakrishna Road,
Colombo 06,
Sri Lanka.

You can find more information about the event from the official site: http://www.sharepointsaturday.org/srilanka/default.aspx also don't forget to check on the schedule: http://www.sharepointsaturday.org/srilanka/Pages/schedule.aspx and the speakers who are presenting: http://www.sharepointsaturday.org/srilanka/Pages/speakers.aspx

16Apr/110

Article – Business Connectivity Services (BCS) Part IV – Creating an External List

Posted by Joy

Last article demonstrated how to create an External Content Type (ECT) using SharePoint Designer 2010 and set various options such as Limit Filter and Wildcards.

In this section, we will use the same ECT we created earlier and combine it with External List concept to surface the Employee data coming from the LOB system.

There are multiple ways of creating an External List and connecting it with an existing ECT to surface data within SharePoint. I will discuss the 02 most popular mechanisms.

Creating an External List using SharePoint Designer 2010

This is the easiest way in which you can create an External List and connect it with an ECT at the same time. Let's create an External List using SharePoint Designer 2010.

Exercise 1 – Open an existing ECT

Let's open the NorthwindEmployees ECT we created last time.

  1. Fire-up SharePoint Designer 2010 by navigating to Start -> All Programs -> SharePoint -> Microsoft SharePoint Designer 2010.
  2. Click Open Site to bring up Open Site dialog box.
  3. Enter the URL of the SharePoint site we created the ECT for Site name: and click Open.
  4. Select the External Content Types from the Site Objects pane and wait until it retrieves all the existing External Content Types. After a few seconds, you will see the ECT we created last time.

    NorthwindEmployees ECT

    NorthwindEmployees ECT

  5. Click the NorthwindEmployees ECT from the right-hand side External Content Types pane to open the ECT and its properties.

    ECT Summary Page

    ECT Summary Page

Exercise 2 – Creating an External List using SharePoint Designer 2010

  1. Observe the ribbon and its options for the ECT.
  2. From the Lists & Forms group in the ribbon click Create Lists & Forms button.

    Ribbon for ECT

    Ribbon for ECT

  3. Create Lists & Forms for Northwind Employees dialog box will show up for you to configure the new External List. Provide a name for the new External List by filing List Name: field. I provided "Employees List" for this example.
  4. Optionally you can select Create InfoPath Forms check-box to generate InfoPath for all the list view pages (Read List.aspx, DispForm.aspx, etc…) instead of creating ASP.NET pages.

    Creating the External List

    Creating the External List

  5. Click OK to create the External List. After few seconds, you will see the section External Lists in the ECT summary page with the new External List we created.

    Creating the External List

    Creating the External List

Creating an External List using Web Browser

This way we can create the External List by using standard web browser application and using options in the SharePoint site.

  1. Open your web browser and navigate to the SharePoint site which we created the ECT.
  2. Select Site Actions -> More Options… to open Create dialog box.
  3. Select the External List from the List Templates section and click Create button.

    Creating the External List

    Creating the External List

  4. Provide a name for the External List by filling Name: field. I provided "Northwind Staff" for this exercise.

    Creating the External List

    Creating the External List

  5. In the Data source configuration section, click "Select External Content Type" button to browse all the ECTs available in the current site collection.

    Select the ECT

    Select the ECT

  6. Select the Northwind Employees ECT from the External Content Type Picker dialog box and click OK.

    Browse for the ECT

    Browse for the ECT

  7. Now you will see that Data source configuration is filled with the ECT information automatically and click Create button to create the External List.

    Creating the External List

    Creating the External List

View LOB data using the External List

Now that we have created an External List, or may be 02 if you tried both the options, it's time to look at the way it surfaces external data within SharePoint. It's very easy to do that.

  1. From the Quick Launch, select the name of the list you created.
  2. Try viewing individual Employee items, updating Employee records, deleting Employees records and inserting new Employee records using SharePoint External List.
External Data coming through the ECT & External List

External Data coming through the ECT & External List

Displaying an item with InfoPath Form

Displaying an item with InfoPath Form

Editing an item with InfoPath Form

Editing an item with InfoPath Form

Inserting a new item with InfoPath Form

Inserting a new item with InfoPath Form

14Mar/112

Article – Business Connectivity Services (BCS) Part III – Creating an External Content Type (ECT)

Posted by Joy

Here you get the long awaiting Part III of my BCS article series. Having discussed what BCS is, terminology and the solution types, it's time to create a simple solution. Let's create a simple solution which brings/ surfaces data coming from a SQL Server database within in a SharePoint site.

Scenario

Northwind has implemented an intranet portal using SharePoint Server 2010 and it is becoming very popular among the business users/ information workers. One of the business users has learnt about the powerful capabilities of SharePoint 2010 release in the area of integrating with legacy systems. He sends an official email to the IT department of Northwind inquiring about the possibility of integrating their LOB system with SharePoint so that they can manage their Contacts, Prospects, Leads, etc… efficiently using their intranet postal interface.

Solution

IT Manager has realized the importance of the request and now he needs to deliver the solution using BCS which is part of SharePoint 2010. IT Manager decided to develop a simple solution using SharePoint Designer 2010 to make it simple and fast for both business users and the developers.

I navigated to SQL Server Management Studio (Start -> All Programs -> Microsoft SQL Server 2008 R2 -> SQL Server Management Studio) and expanded the Databases node. I further expanded the Northwind database and its Tables folder to see all the tables available.

As the 1st step, I decided to provide access to Employees data available in Northwind database using SharePoint 2010 site. I executed the following SQL statement to see all the data available in the Employee table:

Employees data in SQL Server

Employees data in SQL Server

Let's develop our 1st BCS solution to integrate Employees data into a SharePoint 2010 site.

Exercise 1 – Creating an External Content Type (ECT)

  1. Fire-up SharePoint Designer 2010 by navigating to Start -> All Programs -> SharePoint -> Microsoft SharePoint Designer 2010.
  2. Click Open Site to bring up Open Site dialog box.

    Opening your SharePoint site in SPD 2010

    Opening your SharePoint site in SPD 2010

  3. Enter the URL of the SharePoint site for Site name: and click Open.
  4. Select the External Content Types from the Site Objects pane and wait until it retrieves all the existing External Content Types.

    External Content Types in SharePoint

    External Content Types in SharePoint

  5. Select the right-side panel to activate the Ribbon menu options and click the External Content Type from the New group in the ribbon.

    Creating a new ECT

    Creating a new ECT

  6. You will get the New external content type tab/ page and that's where you will configure your External Content Type to communicate with the Northwind database.
  7. Let's first fill the details for the External Content Type Information section. Place cursor for the Name and provide a meaningful name for the External Content Type.

    External Content Type Information

    External Content Type Information

  8. Press Tab to navigate to next field and you will see Display Name is populated automatically based on the Name field. Place the cursor and change the Display Name if you wish. I gave a space in-between to read as "Northwind Employees" which is easy to read.
    External Content Type Information

    External Content Type Information

    External Content Type Information

    External Content Type Information

  9. Select an appropriate option for the Office Item Type. If you are planning to surface data within Office applications such as Outlook you need to specify the Office Item Type. If you have no plan to surface data inside Office applications you can keep the default value which is Generic List for the Office Item Type. You can use Appointment as the Office Item Type if the underlying data coming from the LOB system need be shown in the Calendar pane in Outlook. If you are brining data which can be shown in the Contacts pane in the Outlook such as Employees, Customers, Students, Dealers, etc… then you can use Contact as the Office Item Type.

    Select Office Item Type

    Select Office Item Type

  10. For this demo select the Contact as the Office Item Type.
  11. Next select whether you want to have the Offline Sync for external list Enabled or Disabled. For this demo, keep the default value which is Enabled.
  12. After finishing the defining External Content Type Information, your screen will look something similar to the following.

    Creating a new ECT

    Creating a new ECT

Exercise 2 – Defining External Content Type Operations

  1. Click the link Click here to discover external data sources and define operations link in the External Content Types Operations section to define the external system information and the operations.

    Defining External System Information

    Defining External System Information

  2. You will be taken to the Operations Designer for the Northwind Employees External Content Type. Click the Add Connection button to bring the External Data Source Type Selection dialog box.
    ECT Operations Designer

    ECT Operations Designer

    Data Source Type Selection

    Data Source Type Selection

  3. Select SQL Server as the Data Source Type and click OK to bring up the SQL Server Connection dialog box.
  4. Fill up the SQL Server Connection dialog box as shown below by providing Connection Properties and click OK:
    1. Database Server: - provide the name of the SQL Server. In my case, I'm providing (local) since the database is hosted in my local machine.
    2. Database Name: - provide the name of the database. In this demo we are connecting to Northwind database.
    3. Authentication – select what authentication mode to be used. Select Connect with User's Identity for this demo and other options for this are:
      1. Connect with User's Identity – this will take the currently logged-on user's identity for the authenticating to the external system.
      2. Connect with Impersonated Windows Identity – this allows us to have a common windows account setup for authenticating to the external system and all the requests goes through this account just like using a Service Account.
      3. Connect with Impersonated Custom Identity – this helps us to setup Secure Store Services (SSS) and configure Single-Sign-On to authenticate to the external system. With SSS, we can create and configure different Secure Store Target Applications and map the login credentials between SharePoint and the external system. If we are going to this option, make sure to create and configure the Secure Store Target Application beforehand and provide the Target Application ID for the Secure Store Application ID: field.
  5. Defining SQL Server Connection

    Defining SQL Server Connection

  6. Data Source Explorer will show up Northwind data source and expand it to see all 03 possible way of communicating with the external system:  
    1. Tables – allows us to directly connect with a table object in SQL Server.
    2. View – allows us to connect with a view instead of a table.
    3. Routines – allows us to connect with a Stored Procedure in SQL Server instead of a table.

      Data Source Explorer

      Data Source Explorer

  7. Expand the Tables node and then you will see all the tables from the Northwind database. Expand Employees table and then Columns node to see how SharePoint Designer 2010 has retrieved schema information from the underlying database system.

    Data Source Explorer Expanded

    Data Source Explorer Expanded

  8. Right-click the Employees table and select Create All Operations to fire up the All Operations wizard. This wizard will guide us on configuring what information we need to bring to SharePoint and how they get mapped to Office properties if we have decided to do so, etc… If you don't wish to provide all the CRUD-Create, Read, Update, Delete operations to the external system through SharePoint, you need to select the appropriate options from the below screen. If you want to provide only the Read operations, generate only Read Item and Read List operations.

    Generating CRUD Operations

    Generating CRUD Operations

  9. Click Next in the welcome page of the All Operations wizard.
  10. Parameters Configuration page will show up next and as the 1st step we need to select what are the columns we need to bring into SharePoint. Best practice is to avoid all the optional data fields and select only the mandatory fields to minimize the performance issues. As you can see below, I have selected the fields which are interest to my demo and make sure you double-check with your requirement.

    Selecting Fields for ECT

    Selecting Fields for ECT

  11. Next we need to setup properties for each column and select the column from the left-side Data Source Elements pane and set the properties from the right-side Properties pane. Select the LastName from the Data Source Elements and change the Display Name:, Office Property: & Show In Picker: properties.

    Setting Properties for Fields

    Setting Properties for Fields

  12. Repeat the same for the rest of the fields except selecting the option Show In Picker:. Leave Show In Picker: as unchecked.
  13. Click Next to bring up the Filter Parameters Configuration page. Click Add Filter Parameter to add a filter.

    Filter Parameters Configuration

    Filter Parameters Configuration

  14. As a best practice, we will add a Limit filter to limit the no of records travels from the external system to SharePoint. Select the newly added filter from the left-hand side Filter Parameters pane and click (Click to Add) from the Properties pane to configure the Filter:. This will brings up the Filter Configuration dialog box. Provide a name for the New Filter field. Select Limit for the Filter Type: and click OK.
    Setting up Filter Parameter

    Setting up Filter Parameter

    Setting up Filter Parameter

    Setting up Filter Parameter

  15. Once you are back in the Filter Parameter Configuration screen, give a value to Default Value: to provide a default value to the Limit filter and press Tab. I gave 100 and you can provide a reasonable value.

    Setting up Filter Parameter

    Setting up Filter Parameter

  16. Next, let's add a Wildcard filter parameter to provide users with wildcard searching capability against Last Name value. Click Add Filter Parameter button again and select the LastName for the Data Source Element: from the Properties pane. Click (Click to Add) link to configure the Filter:. Configure the Filter: as shown in the following screen and click OK.

    Setting up Wildcard Parameter

    Setting up Wildcard Parameter

  17. Click Finish to finish the Filter Parameter Configuration wizard.
  18. When you are back in Operation Designer, you can see External Content Type Operations section has 05 operations generated for us to use.

    External Content Type Operations

    External Content Type Operations

  19. Click Save to save the External Content Type to the Site Collection.

    Save the ECT

    Save the ECT

  20. Verify that the new External Content Type is created by navigating back to External Content Types form the Site Objects pane.

    After Creating the ECT

    After Creating the ECT

Now that we have created and configured our External Content Type to communicate with Employee data in Northwind database in SQL Server and we are ready to integrate it with SharePoint 2010 site.

In my next article, I will discuss the process of creating an External List and how to surface Employee data within SharePoint site coming via NorthwindEmployees External Content Type.