SharePoint 2013: Linking a SPWeb Object to a Hashtag

Metadata is not new to SharePoint. The Managed Metadata have been introduced in SharePoint 2010 and are -of course- an important part of SharePoint 2013. However, Hastags are new to SharePoint. As part of SPWeb Objects, they got introduced in SharePoint 2013 as a part of the new social features.

Both are very helpful in collaborative scenarios. Let’s have a look at an example. There is a team that is currently working on a software documentation. This team uses a SharePoint 2013 workspace based on the TeamSite template. To be able to tag the team’s documents a new term (e.g. ProjectXYZ) has been created in the Central Administration. The project’s tag is defined like this:

SPWeb Object

Now the team is able to tag their documents. All documents that are marked with the tag ‘ProjectXYZ’ belong to the team’s current project. If the team adds a new document to the team’s library, the document gets tagged automatically. This is done by adding a Managed Metadata field to the library and assigning a default value to this field.


After an incremental crawl the team’s documents can be found.


Now the team decides to create a source for an internal communication. They decide to use a Discussion Board for the team communication. To be able to tag the team’s discussions with the project’s metadata, a column needs to be added to the discussion board:


Now a team member starts the first discussion like this:


Because of the field ‘Enterprise Keywords’ that has been added to the discussion board, each discussion can be assigned to the team’s current project now.

But what happens if a team member posts information outside of the team’s workspace that belongs to the project’s context? For example: a team member creates a news like this …


… and other team members or colleagues are following the newly created hashtag #CustomerXYZ. The first thing that happens is: the newly created hashtag gets added to the hastags list in Central Administration:


Although #CustomerXYZ is not the same as ProjectXYZ, both have a contextual connection. ProjectXYZ is a project that is related to #CustomerXYZ.

If  a member of the project team starts a search with the keyword ProjectXYZ the results look like this:


The team’s document and the team’s discussion are found – that’s expected. But it would be helpful for the team to get search results for items tagged with #CustomerXYZ too. A search for #CustomerXYZ shows this:


What the project team needs is a link of their team site to the hastag #CustomerXYZ. One way to establish this kind of linking is to use a new feature of SharePoint 2013: the indexed properties of a SPWeb object (I already created a post on this). To link a hashtag to a SPWeb object a new indexed property needs to be created in the web’s property bag.

Here is how to do this by code:


After the indexed properties have been created a new crawl is required. After the crawl has been completed the team’s web is linked with the hashtag #CustomerXYZ.

If someone enters #CustomerXYZ as a search query the team’s web is now found in the search results too:


Adding indexed properties to a SPWeb object can be done by code (as shown in the screenshot above). It can also be done using a SharePoint Solution that can be found on Codeplex: SharePoint Property Bag Settings 2013. By the way: a SPList object can now also have index properties!

Oliver Wirkus was a speaker at ESPC13.  Check out Oliver’s blog for more insightful blogs!

For more SharePoint content from Oliver and other SharePoint specialists check out our resource centre!

Share this on...

Rate this Post: