Using Enterprise Search to Build a Product Catalog Site

If you are interested on learning how SharePoint 2013’s Enterprise Search can help you build a product-centric web site check this post series out:

How to set up a product-centric website in SharePoint Server 2013

It uses search out of the box features to build a “Contoso” web site based on a product catalog created and managed on a different site collection.

The series of blog posts by Bella Engen guides you through the sites configuration, data load, site navigation, web parts configuration and refiners placement.

The posts are very interesting and mix information on the features used and steps to configure but it lacks some configuration information and support material.

On Stage 2, the metadata configuration was complicated in my case and the data load into the product catalog site is very confusing. In my case, after I’ve created the Product Catalog site collection I went to the Products list and I couldn’t find the Item Category column on the list.

ProductSite02

After I’ve added the Item Category site column to the Products list, I had to go to the Metadata Management  Tool and create a new group to be associated with my site collection.

ProductSite03

With the group created, I’ve created the Product Hierarchy term set.

ProductSite04

ProductSite05

Back to the Product list, I had to associate the Item Category field with my term set:

ProductSite06a ProductSite06b

At the point, I was ready to run the powershell scripts. I’d recommend you to download the script files from this zip file and execute it  instead of the script Bella provided.

Please edit file file InputParameters.ps1 and provide values for the following variables:

  • $productCatalogSiteCollectionURL : Complete URL for your product catalog site collection.
  • $CatalogInpFile : Path to the products.txt file. If you keep the structure from the zip file you don’t need to change this variable.
  • $TaxonomyInpFile : Path to the taxonomy.csv file. If you keep the structure from the zip file you don’t need to change this variable.
  • $termStoreName : Name of your Term Store.
  • $termSetName : Name of your Term Set.

After the configuration is done, execute the powershell script in order:

  • 1CreateSiteColumns.ps1
  • 2ImportListContent.ps1
  • 3ImportTaxonomy.ps1
  • 4LinkListContentWithTaxonomy.ps1

On Stage 6, she doesn’t provide the master page and page layouts templates which doesn’t change the steps you can do but doesn’t make your local experience as cool and fancy as you see on the posts.

Overall, a very good reference if you want to understand the out of the box search capabilities to create dynamic sites based on search.

See you,

Amadeu.

Showing/Hiding the Ribbon Based on Permissions

I’ve got a task to check why the ribbon was not being displayed for a user with full control on a page on a SharePoint 2010 Publishing site.

Requirements-wise the request made total sense: the user with full control permissions on a page should be able to see the ribbon, check the page out, edit the page, check it back in and publish it. During my tests I noticed the master page had a SPSecurityTrimmedControl control around the ribbon. This control was preventing to ribbon to be shown for the user because it was configure to only show it for users with ManageWeb permissions.

<SharePoint:SPSecurityTrimmedControl
ID=”TrimRibbon”
PermissionsString=”ManageWeb”
runat=”server”>

Checking the list of SPBasePermissions values for the PermissionString property I was able to find the permission I wanted to use: EditListItems. This way all users with permissions to edit items/pages can see the ribbon.

When I changed the SPSecurityTrimmedControl control to use the EditListItems permission and published the master page, the user was still not seeing the ribbon.

After a couple of tests using different permissions, I found an article by Infowise explaining  the details of the SPSecurityTrimmedControl control and the usage of the PermissionContext property. This property controls the scope of the PermissionString property and by default is uses CurrentSite. Some of the values of the SPBasePermissions are scoped to the List or List Item.

In order to my permission check to work, I had to add the PermissionString property to the SPSecurityTrimmedControl control using the CurrentItem value:

<SharePoint:SPSecurityTrimmedControl
ID=”TrimRibbon”
PermissionsString=”EditListItems”
PermissionString=”CurrentItem”
runat=”server”>

After this change, the user was able to see the ribbon on the pages he had full control permission on and the site admins are still able to see it.

 

During my research, I also found this other article explaining a little bit more of the SPSecurityTrimmedControl control. Worth to check it out.

 

 

See you,

Amadeu.

 

Developing for SharePoint Using Visual Studio 2012 – Tech Ed North America

I just watched the video Developing and Managing SharePoint Solutions with Microsoft Visual Studio from Tech Ed North America 2012.

Jay Schmelzer covered the following topics (I also put my opinions about each topic):

  • Web Development versus Sharepoint Development: He stated that on VS2012 what you can do for web development can also be done for SharePoint development. That is really a great achievement for the SharePoint developers.
  • Simplified SharePoint project types: I was really very confusing on VS2010. Why would you create a project for an event handler instead of having a SharePoint and add the event handler to it??
  • Creating SharePoint lists using Visual Studio 2012: That is a cool feature demonstrated by Jay on this video. VS2012 can create the list and support most of the list configurations available. And best of all, no XML involved.
  • Creating Visual Web Parts for Sandboxed Solutions: Now it is part of Visual Studio 2012. If you use Visual Studio 2010, you should use the Visual Studio SharePoint Power Tools.
  • Better integration with the SharePoint Content Database: I didn’t see it much, even though he mentioned it a bunch of times. The only time it really showed knowledge of the content database was when he deployed the list for the second time and VS2012 told him there was a conflict. I was expecting something smarter in the way intellisense works to help you figure out list names, field names, available content types, etc.
  • Using the JavaScript Client Object Model and JQuery: No news here. I was expecting something more from VS2012 on this matter but no
  • Page inspector on IE – Developer Tools (F12): No news here. He just showed what already exists. No VS2012 related feature and by the way, Chrome Developer Tools is much better!
  • Retract is automatic after stopping the debug: That is new and it is also configurable.
  • Deployment config, pre and post deployment steps: All this stuff already exists on VS2010.
  • Less features created on projects: Finally!
  • Manifest file: You can edit it and also have schema completion.
  • Feature dependency: Already existed on VS2010.
  • Deploy to Office 365: Cool feature.

 

He also talked about 2 interesting topics by the end of the session:

Unit test for SharePoint– fake classes: they are going to provide those classes to allow developers to right unit test for SharePoint solutions in a less painful way than what is out there now.

LightSwitch: rapid business application development tool now integrated with SharePoint lists.

 

My rating for the session would be 3 out of 5 because no great/new topics were covered in depth on this session and I was expecting more from VS2012.

 

You can watch other videos from Tech Ed North America 2012 at Channel 9:

http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012

 

 

See you,

Amadeu.

Deploy Content Files to SharePoint Using SharePoint.DesignFactory.ContentFiles

I’ve been working with SharePoint 2010 for different projects and teams for a while and one thing that has been always a challenge is the source control and publishing process on content items (such as JavaScript, images and CSS files).

Visual Studio SharePoint projects allow us to create modules to deploy these kind of files but it has a big drawback. When you do it, the files are deployed as “file definitions” – ghostable on the libraries. If a user customize the files, any new deployment will not update the instance on your site, only the file definition. If you want to see the updated version of the file you should go to SharePoint Designer and reset the specific file to its definition.

This is pretty bad and makes lots of people confused on why the file wasn’t updated.

I was trying to find a solution for this issue when a found a blog post by Serge van den Oever explaining the installation of a very interesting extension to Visual Studio 2010 to solve this issue. It is called SharePoint.DesignFactory.ContentFiles.

The extension allows you to:

  • deploy content files from your Visual Studio to your local machine using the SharePoint API or to remote machines using the SharePoint client API.
  • map folders on your solution to document libraries and special folders on a SharePoint site so you can deploy files to different locations.
  • deploy files checking them out, in, publishing and approving it.
  • deploy only files that have changed since the last deployment.
  • customize the commands to deploy your solution – check documentation for details.

To install it follow the steps on the article SharePoint.DesignFactory.ContentFiles – Installation. The extension was built using the NuGet tool for Visual Studio. You need to have NuGet installed on your Visual Studio before running the extension. It also needs the MME extension to allow the tool to create custom menus on the project and items right-click menu.

After the installation, your Visual Studio project should contain some extra items:

  • _MachineConfiguration folder: this folder contains Powershell scripts to tell the extension where to deploy the files. By default it will look for a script called default.ps1, then for one with the machine name or for a custom one if specified when the deploy command is called.
  • _Tools folder: this folder contains batch files, Powershell scripts, reference DLLs ,documentation and other support files used by the extension.
  • Mappings.xml: file used to map folders from the Visual Studio project to the document libraries on the SharePoint site.
  • packages.config: Nuget configuration file to tell it to load the extension.

The installation worked just fine for me. I had only to check and tweak a few items to make it work.

After the installation is done, just check if you have a DLL named VSMenuManager.SharePoint.DesignFactory.ContentFiles.dll on your solution folder.

Edit the mappings.xml file to make sure you have all mapped folders created on your Visual Studio project otherwise the deployment will fail.

Create a copy of the Sample.ps1 file on the _MachineConfiguration folder with the name Default.ps1. Configure it with your machine’s web application URL and the settings for the deployment type (object model or client object model), user name, password and claims authentication usage.

After that just add the files you want to deploy to the folders and deploy all files to your web application. The output window can show you the progress of the deployment:

The documentation provides a very good insight on how to use and configure the extension and can be very useful. It can be found under the _Tools\Documentation folder.

If you need to create custom Configurations to deploy to different environments you can do that by following the steps on the Configuration part of the documentation.

In order to get my custom configurations to work I had to edit the Deploy.cmd and the Redeploy.cmd to accept thew configuration name as a parameter.

I added the %1 parameter by the end of line 2 on both files and it worked just fine.

You should test and see how much easier is to deploy content files to SharePoint 2010!

Thanks Serge! The SharePoint.DesignFactory.ContentFiles is really awesome!!!

See you,

Amadeu.