Creating a BCS Content Source using PowerShell

You can use the following command to create a content source to crawl a Business Data Connectivity Service (BDCS).

$lobSystems = @("LOBSystemName1","LOBSystemNameInstance1") 
New-SPEnterpriseSearchCrawlContentSource -name "My Content Source Name" -searchapplication "My Search Service Application Name" -Type Business -LOBSystemSet $lobSystems

If the LOBSystemName is not correct the content source gets created but the model you want to search is not checked.

To figure out the right values for the LOBSystemName and LOBSystemInstanceName look no further than the bdcm file in your solution. Open the .bdcm file in notepad and use the Name attributes of the LobSystem and LobSystemInstance nodes.


Creating a BCS Content Source using PowerShell

ULS Viewer stops working

If ULS Viewer suddenly stops reading from the ULS log, the quick fix is to move all the log files to another folder. Except for the last log file which Explorer will anyway prevent you from moving.

The issue is most probably because one or more files in the folder are not in the right format and trip up ULS Viewer.

Some have reported the *upgrade.log files as the culprit. Deleting them didn’t fix it for me so I just deleted all the files.

PS: If your a SharePoint dev and your not using the ULS Viewer from Microsoft (no not the one from CodePlex). Do yourself a favour and give it a try.

ULS Viewer stops working

FBA Custom Sign In Page returns 401 Unauthorized error

If you’ve built a custom sign in page in SharePoint 2010 but keep getting a 401 Unauthorized error instead of the sign in page then you’ve most probably deployed the solution package to a single web application.

To resolve the issue the solution needs to be deployed to all applications and not restricted to a single web application.

i.e. When calling Install-SPSolution don’t include the -WebApplication parameter.

Edit: Another instance when you will see the 401 Unauthorized error is when your not inheriting from the correct base page. It should not be the layoutsbasepage.

Another tip if you see the following error in your ULS log:
Request for security token failed with exception: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Object reference not set to an instance of an object. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo.ValidateFormsAuthProviderNames(Uri context, String membershipProvider, String roleProvider)
at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo.SetProviderNames(RequestSecurityToken request)
at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo..ctor(IClaimsIdentity identity, RequestSecurityToken request, Boolean initializeForActor)
at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.SPRequestInfo..ctor(IClaimsPrincipal principal, RequestSecurityToken request)
at Microsoft.SharePoint.IdentityModel.SPSecurityTokenService.GetTokenLifetime(Lifetime requestLifetime)
at Microsoft.IdentityModel.SecurityTokenService.SecurityTokenService.Issue(IClaimsPrincipal principal, RequestSecurityToken r...).

That means your using a name that has not been setup as an AAM. I was using http://localhost and it always kept failing. Changing the request url to the actual name of the server (in my case http://mosswfe1) fixed it.

Note to myself: References for creating a Custom Sign In Page
Creating a Custom Login Page for FBA in SharePoint 2010
Creating a Custom Login Page for SharePoint 2010
How to create custom login page for SharePoint 2010 form based authentication (FBA)

FBA Custom Sign In Page returns 401 Unauthorized error

FBA Configuration Manager for SharePoint 2010

Setting up forms based authentication in SharePoint 2010 requires making changes in three web.config files.

This utility allows you to perform the update in a single click and was inspired by the configuration manager that Steve Peschka released.

I’ve taken a different approach to Steve’s, instead of using a feature and a timer job I directly update the config files in the local machine. To update the other machines in the farm you can use the included PowerShell script.

The utility makes a back-up of all of the web.configs before updating them. I’ve also included the sample membership and role providers that Steve provided.

The PowerShell script to perform the update uses the same engine as the UI.

function global:Get-ScriptDirectory()
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path

$webApp = Get-SPWebApplication http://localhost:9191
$settingsPath = Join-Path (Get-ScriptDirectory) "SqlMembershipConfig.xml"
$settings = Get-Content $settingsPath
$scriptDir = Get-ScriptDirectory
$assemblyPath = Join-Path $scriptDir "FBA.dll"
Add-Type -Path $assemblyPath
[FBA.ConfigureMembershipProvider]::Configure($webApp, "Default", $settings)

The source code and release packages are available in CodePlex:

FBA Configuration Manager for SharePoint 2010

Installing Office Web Apps on Windows 7

If you haven’t heard of Office Web Apps before it’s basically Word, Excel, PowerPoint and OneNote running inside a browser. It lets you edit documents right within the browser.

A bit of history
You can be forgiven to think that this is all new. The truth is that a skunkworks team within Microsoft built a version of this (code-name NetDocs) way back in 2000 (even before .NET was launched). It is believed that Steven Sinofsky (now head of Windows 7, previously head of Microsoft Office) managed to get this project killed off. Many years down the line Google snagged a lot of the guys from that original team (including the guy who Ballmer threw a chair at).

Back to the Article
Right. Back to our installation. The key document that you need to follow is this Deploy Office Web Apps guide on TechNet.

– The SharePoint 2010 beta needs to be installed
– The documents must be created with the new Office 2010 beta application in order to be editable (you can view all documents but to edit them in the browser you need to at least open and save the .docx using the latest beta of Word/Excel)

1. Download Office Web Apps from the download centre (here is the direct link). If you couldn’t figure it out the English version is the one named WcServer_en-us.exe

2. Extract the installation and edit the config.xml in order to allow installing on Windows 7. To do this run the following command from the command prompt.

WcServer_en-us.exe /exctact:C:\WCServer

If you have installed SharePoint 2010 on your Windows 7 you will be familiar with what this does.

Now you need to edit the config.xml in extract location and add the following line to \Files\Setup\config.xml just like you did for the SharePoint 2010 install.

<Setting Id="AllowWindowsClientInstall" Value="True"/>

That is it. Run setup.exe and follow the rest of the guide in the Deploy Office Web Apps article and you will be able to edit Office documents from within the browser in no time.

NB: I did not have to run any of the PowerShell scripts as the features were all activated. I simply created a new Web Application and uploaded some documents and was able to edit in the browser.



Installing Office Web Apps on Windows 7

Installing SharePoint Server 2010 on Windows 7

Here’s a quick summary of how I installed the public beta of SharePoint Server 2010.

Minimum Requirements:
– Windows 7 64 bit: What this means is that your workstation needs to be 64 bit and you need to have the 64 bit version of Windows 7 installed.

The key document that you need to follow for installing on Windows 7 is this article: Setting Up the Development Environment for SharePoint Server

Key Notes:
– This was installed on Windows 7 Build 7100
– I had UAC turned off
– I already had Visual Studio 2010 Beta before installing SharePoint
– You need to manually download and install the pre-requisites for SharePoint 2010
– You need to extract the setup (using /extract), change an xml file before being able to run setup on Windows 7.

Minor Deviation:
The only part of the guide that I was forced to skip was #5 of ‘Step 3: Install SharePoint’

The reason was that the install for the SQL Server patch kept asking for the other files in the multi-part zip. (Remember to unzip the file even though it has a .exe extension)

Excluding the download times it took about 30 minutes to install SharePoint server on my Dell XPS laptop which has 4GB of RAM.

Although there is no guide published yet I was able to install Office Web Apps on my laptop as well, that guide will follow next.

Installing SharePoint Server 2010 on Windows 7