Encoded umlauts in file share search results.

If the SharePoint Search Crawler is indexing files on a file share that have german Umlauts (e.g. überprüfungsbedürftig.docx) than you will have problems with produced links, as they will have all of the umlauts encoded.

Encoding special characters in a links makes perfect sense, if you are dealing with a web link. The problem comes with indexing a file share, where the “links” are really only file path. Those paths when encoded make no sense and therefore produce an 404 error.

To fix this you can simply write some javascript code, that intercepts any clicked links that reference a file share and changes the encoded umlauts into their UTF-8 representation.

var linkClick=false;
document.onclick = function(e)
{
    linkClick = true;
    var elemntTagName = e.target.tagName;
    if(elemntTagName=='A' || elemntTagName=='STRONG')
    {
		var targetLink = null;

		if(elemntTagName=='A')
		{
           		var targetLink = e.target.getAttribute("href");
		}
		else if(elemntTagName=='STRONG')
		{
			var targetLink = e.target.parentElement.attributes.getNamedItem("href").value;
		}

		if(targetLink && targetLink.substr(0, 7) === "file://")
		{
			//%C3%BC - ü
			//%C3%9C - Ü
			//%C3%A4 - ä
			//%C3%84 - Ä
			//%C3%B6 - ö
			//%C3%96 - Ö
			var targetLink = targetLink.replace("%C3%BC", "ü").replace("%C3%9C", "Ü").replace("%C3%A4", "ä").replace("%C3%A4", "Ä").replace("%C3%B6", "ö").replace("%C3%96", "Ö");

			window.location.href = targetLink;
		}

        return false;
    }
}

SharePoint Visual Web Part open links in the same window

The Visio Web Part in SharePoint is a great way to display your visio diagrams direstly in SharePoint.

It can also be used for other things, like displaying an interactive diagram with embedded links. This solution gives the user an ability to work with a diagram directly in Visio (no SharePoint knowledge required) and than simply upload the diagram to SharePoint, which displays it to some page for others to see.

This scenario is exactly what I was working on when I encounter a problem with the Visio Web Part.

The problem is that the Visio Web Part displays a clicked link in a context menu and always opens the link in a new window. This was not the behavior that the client wanted. Links should be opened in the same window and with now dropdows.

The solution turned out to be configuring the web part and some custom javascript.

Step 1: Configuring the Visio Web Part

Taken a simple Visio Diagram with test links

Test Visio Links

Test Visio Links

If you click on one of the links insted of directly transferring you to that link you will get a dropdown

Test Visio Links clicked

Test Visio Links clicked

Unfortunately the only fix for this behaviour is to disable of hyperlinks for the entire diagram.

This is possible in the Visio Web Part settings

Disable Hyperlink

Disable Hyperlink

Great, now we don’t have the context menu problem, but we can’t open any links. That is a bit crappy, I wil give you that. To fix this we need some javascript help.

Step 2: Custom javascript

Fortunatly for us we can implement opening links by ourselfes with javascript.

Include the below script in the page with your diagram with Script Editor Web Part for example and you are ready to go.

Deploy-SPSolution: PowerShell cmdlet for SharePoint package deployment

If you have ever done a SharePoint server solution, than you know that the deployment model is a bit specific.

After building a server solution for SharePoint and compiling it, you get a packed cab file with a .wsp extension.

To deploy this file to the SharePoint farm you have to user PowerShell.

This can of course be automated by Visual Studio, but what if you want to deploy the package on a production server where Visual Studio is not present ?

To automatically deploy my solutions and activate it’s features I have built a PowerShell cmlet. You can find the source here: Deploy-SPSolution.ps1.

Remove duplicates on the standard SharePoint search results page

If you don’t know what the “Remove Duplicate Results” feature is, than you can find a great introduction in this great article How “Remove Duplicate Results” works in FAST Search for SharePoint by leonardocsouza.

Suppose now, that you need to set the Remove Duplicate Results setting to false, but you don’t have a Search Center configured on your SharePoint site.

In this case your search reasults are redirected to the standard results page osssearchresults.aspx. This page however cannot be edited. Do you have to set up a Search Center Site just to be able to turn this feature off?

The answer is, as it often happens, depends.

On one hand, a good rule of thumb is to never edit SharePoint core files (if you have an alternative). In this case though we can set the url to our osssearchresults.aspx file on the site collection level. This allows us to use our own version of osssearchresults while leaving the original intact for further use.

On the other hand, if you are trying to customize the search results page, maybe you could use a search center and avoid the risks comming from playing with SharePoint core files.

The osssearchresults.aspx file is on the SharePoint root path under layouts.

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\osssearchresults.aspx

Remove duplicates on the standard SharePoint search results page 1Create a copy

Remove duplicates on the standard SharePoint search results page 2Edit the custom osssearchresults.aspx and find this div

<div class="srch-sitesearchmaintop">
  <SearchWC:CoreResultsWebPart runat="server" ShowActionLinks=false ChromeType="None"/>
</div>

Set the RemoveDuplicates attribute to false

<div class="srch-sitesearchmaintop">
  <SearchWC:CoreResultsWebPart runat="server" ShowActionLinks=false ChromeType="None" RemoveDuplicates="false"/>
</div>

You can find the attributes documentation here

Now navigate to the Search Collection which search results page you want to customize and go into Search Settings

Remove duplicates on the standard SharePoint search results page 3You can change the path to your osssearchresults.aspx file in the filed under “Results page URL”

Remove duplicates on the standard SharePoint search results page 5Change it to the name of your custom page.

Remove duplicates on the standard SharePoint search results page 6Save and go back to your site. The Remove Duplicates feature should now be deactivated.

Hope this helps you guys.

Configurating an external data type in SharePoint 2013 Part 2

This is part two of the series on configuring an external data type in SharePoint 2013. The first part is here.

At this point you should have already finished configuring the external data type, and created a list based on that external data type.

When you are trying to access the list you get an “Access Denied by Business Data Connectivity” error. This is caused by your configuration of your Business Data Connectivity Service. To change that you have to:

1. Go to “Manage service applications” in central administration

2. Click on the “Business Data Connectivity Service”

3. Select your external content type and click “Set object permissions”

4. Give full permissions to All Users(windows)

5. Now you should be able to see your list

Configurating an external data type in SharePoint 2013 Part 1

This is a step by step configuration of an external data type in SharePoint Designer 2013. The first part explains step by step how to create an external data type. The second part shows how to configure the connection for fetching the data from an SQL Server database that is on another server.

So without further ado let’s get to the step by step description:

1. Open SharePoint Designer

2. Go to “External Content Types” and click the “External Content Type” button

3. You will get a window with the new external content type configuration

4. Change the name of the external content type by clicking on it

5. Go to sources configuration

6. Click “Add Connection”

7. For the source type choose SQL Server

8. Specify the database connection properties

9. Now you are ready to connect to the SQL database. Create a table in your database if you haven’t already.

10. Your source connection should now be visible in SharePoint Designer.

11. Now you need to generate the possible operations on the ProjectsTest table. Make a right click on the table an choose “Create All Operations”

12. On the “Operation Properties” screen click next

13. Check if the parameters are configured properly, and if you have no Errors in the “Errors and Warnings” screen.

14. On the “Filter Parameters” screen click next

15. You can now see the defined “External Content Type Operations”

16. Now we can create a new list based on the external content type that we’ve just created. Go to “List and Libraries” and on the ribbon click on “External List”.

17. Pick our external content type and click “OK”
18. Choose a name for out external list and click “OK”

19. If the SQL Server database is on the same server you should see the list.

If the SQL database is on another server, than you will see an “Access Denied by Business Data Connectivity” error. Handling this problem is covered in the next part of this tutorial.