FAST Search in SharePoint

February 21, 2014

Document sharing is a key benefit of SharePoint. But what good is this feature if you can’t find the document you are looking for? Fortunately, another benefit of SharePoint is the ability to utilize FAST Search.

The key advantages of FAST over out of box SharePoint search that I want to highlight are refinement and sorting.

Enabling the Deep Refiner property on any managed property allows you to drill down on specific attributes associated with a document. This is very useful when you know exactly what you are searching for.

Enabling the Sort property on any managed property does exactly what you would think it would do, indicates whether this property will be sortable or not.

An example of a simple search query to find all documents in which the Company is RefineCo would be:


And an example of a more complex search query to find all documents in which Company is RefineCo and Author is John Doe would be:

and(Company:"RefineCo", Author:"John Doe")

(There are certain keywords reserved in FQL that you can see here: FAST Query Language (FQL) syntax reference)

Code Example:

SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.GetContext(this.Web.Site));

KeywordQuery query = new KeywordQuery(proxy);

query.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default;
query.QueryText = "company:refineco";
query.ResultTypes |= ResultType.RelevantResults;
query.TrimDuplicates = false;
query.EnableStemming = true;
query.EnableFQL = true;
query.SortList.Add("company", SortDirection.Ascending);

One quirk with KeywordQuery and FAST is ensuring that the KeywordQuery.QueryText is in lowercase. Otherwise, you will likely get a “Property doesn’t exist or is used in a manner inconsistent with schema settings” error.

Similarly, when adding managed properties to the KeywordQuery.SortList, they too need to be in lowercase. However, unlike with KeywordQuery.QueryText throwing an exception if it is not in lowercase, SortList will just simply not sort the results. Thus, making you think that sorting is broken and hacking together your own sort functionality after the search executes, which I regretfully did. All credit for solving this goes to Shaun.

How to Keep Employees Engaged in the Company Intranet

February 13, 2014

As a company, your intranet can be a powerful corporate tool or a stagnant place that employees visit when they must.  If properly structured, your intranet can become a place to encourage the growth of your corporate culture as well as increase your employee’s engagement in both the company and their day to day jobs.  When using a platform like SharePoint, your intranet can become the place to get information as well as a solution that solves everyday business problems.

There are a number of ways to encourage employee engagement in the intranet:

1.       Keeping your content fresh.  Publishing regular news stories regarding the current
accomplishments and on goings of the company will help to keep your employees informed as well as provide them with a sense of pride and ownership in those accomplishments.  This requires commitment to continually seek out and write stories.

2.       Contests, Polls, and Trivia. Contests can range from a photography contest to allowing employees to submit news articles or ideas, to company trivia based on past articles or events.  Contests don’t need to have extrinsic reward, but can encourage participation through recognition on the intranet.  Contests that work great at one company may not garner the interest at another.  Insight into the interests of your employees as well as your company’s culture will help form a vision for keeping the intranet exciting.

3.       Tools.  Tools can range from simple tools like displaying the weather and company related stock information, to more sophisticated tools like a floor plan module that allows employees to quickly find and visually see where others are located in the office, or a visual organizational chart.  Tools will reinforce a vision of the intranet as where to go for information, but will typically require a small investment.

4.       Solutions.  When using a platform like SharePoint, a number of solutions can be introduced to your intranet to solve everyday business problems.  Some of the solutions we have created in the past for clients include a vacation request system that allows employees to request and track their vacation in a year, an on-board and off-board solution that helps facilitate the right information to the right people at the right time, and a document management solution that has helped encourage one of the highest adoption rates for document management that I have seen in my career.  Solutions require the most investment, but transform your intranet from a place to get information to the place for collaboration and work.

However, these do not come without a balance of vision, commitment, and an investment.  A large investment that lacks vision and commitment will not guarantee a successful intranet.  Likewise, a great vision, without the proper investment or commitment will soon run out of momentum.

ASP.NET Output Caching in SharePoint

February 6, 2014

So you’re developing your web parts and web sites and everything is working perfectly; a little slow, but, otherwise fine.  In comes the idea of caching.  Caching should speed up your web site’s performance considerably.

In my case this was all too easy to implement since I’m developing in SharePoint.  Simply go to the site collection output cache settings and enable.  Everything seems to run fine when testing it until you give it to the end users.  All of a sudden users are seeing other users’ data.  Not good.  At least SharePoint is good enough to cache a different page per set of user rights.

The fix?

Post Cache Substitution

If you want to do simple post cache substitution SharePoint provides you with the PostCacheSubstitutionText class. It’s quite limited in what it can do, but, more importantly it gives an example of how to do post cache substitution.  The PostCacheSubstitution class shows how to inject string data into the ASP.Net HttpResponse.

The basics of it are as follows:

  1. Create a regular control to use in a .NET web page / SharePoint page.
  2. Create a helper class that handles the caching callbacks.
  3. Implement your controls render function.

Here’s an example:

public class MySubstitutionControl : UserControl
 protected override void Render(HtmlTextWriter output)
 MySubstitutionHelper helper = new MySubstitutionHelper();

 protected string PostCacheRender()
 return "<div><p>This was created post cache!</p></div>";

internal class  MySubstitutionHelper
 internal void RegisterSubstitutionCallback(HttpContext context)
 HttpResponseSubstitutionCallback callback = new HttpResponseSubstitutionCallback(this.SubstitutionCallback);

 internal string SubstitutionCallback(HttpContext context)
 MySubstitutionControl control = new MySubstitutionControl();
 return control.PostCacheRender();

And, based on my limited knowledge of ASP.NET internals here’s how it works:

  • The initial page render renders our control. However, since IsForPostCacheSubstitution is false it calls the helper method which instead renders a special substitution tag in place of our control into the page.
  • The page gets cached.
  • The ASP.NET engine then looks for said special substitution tags after loading the page from the cache. It then runs the Substitution callback which instantiates our control and returns what should actually be rendered.
  • The ASP.NET engine then replaces the substitution tag with what we want.

For more information:

Page Output Caching:
SharePoint Output Caching:

How To Determine if Microsoft SharePoint Online Is For Me?

February 2, 2014

We hear the story time and time again: business likes SharePoint; company does not have adequate IT infrastructure to host it themselves; business looks to the cloud to alleviate cost of ownership, internal infrastructure growth, and updates/upgrades that typically come with an on-premise installation. The business is correct in making these assumptions and moving in this direction. Here are some points that may help you decide whether the cloud is for you:

Are you building a public website?
If you are looking to build a public website, then the cloud is a great choice. Whether you decide to do a hosted solution with a provider, or Microsoft’s SharePoint Online, there really is no difference. Your organization will still save at least $10,000.00 on infrastructure costs, and a whole of headaches that come from maintaining the infrastructure. But if you really think about it, if your organization wants to build a simple public website, or what we call a brochure site, with no portal login, no tools; just neatly arranged graphics and content, then SharePoint Online is definitely the cheapest way to go.

However, if you are planning to build a portal, a self-service tool, or any integration whatsoever, then SharePoint Online is certainly \BF{not} a good choice, as this platform does not support third-party integrations very well.

Are you building an intranet?
Intranets are fairly complicated beasts. The cloud is an option, but now we need to look at the difference between a hosted platform (such as the service offered by RefineCo) vs. Microsoft SharePoint Online. A hosted platform supports Site-to-Site VPN, and therefore, any integration you need with any internal system you may already be running at your office. Popular ones are Maximo and Dynamics, and some less popular ones are PPDM systems that energy companies use to manage and sync well information. Microsoft SharePoint Online will not integrate with this system, and at the time of the publishing of this document, will not support a Site-To-Site VPN. So, integrations are out. A hosted platform will support all integration scenarios. Another scenario to consider is the data footprint. If you have huge images that are constantly uploaded, or a massive volume of documents that are constantly being changed, then an off-premise option is likely a bad idea: not only will it be slow, you will pay huge costs for bandwidth and data transfer. In those scenarios the only viable option today is your very own shiny SharePoint installation in your office.

Are you building a portal?
More and more organizations will simply add portal features to their intranet project to gain both solutions in one installation. This is actually what we recommend. But if you are an organization that likes to keep things separate, or simply have different business needs for the portal solution than your intranet, then you face the same considerations as the intranet users. You see, a portal is kind of like an intranet for external users, so the same business functions will apply: will your users need access to data that comes from other systems? Will your users be using a lot of data (i.e. watching videos, downloading composite drawings or images, etc…). If you have even a remote yes then Microsoft SharePoint Online is out, and likely a hosted solution is not a good fit either.

Now that we have looked at some business-level considerations for choosing the cloud, you have a better idea what questions to ask your IT department, or depending on your size, your IT guy.

There is one last cloud-scenario that we did not discuss: what if you are already using SharePoint Online or a hosted solution, and you want to add third-party integrations or start offering video to your users? In most cases you may want a SharePoint vendor to come in and look at your installation to inform you what can be done and what the cost impact is. After all it is possible to perform a batch-import of external data into SharePoint Online! But the technical complexities and security considerations often outweigh the benefit of keeping the off-premise option. In such cases, if the solution was built using Microsoft-recommended deployment practices, then you can simply migrate the entire thing to your own on-premise installation in under a week!