Search in exchange public folder
Hi all. I have sharepoint 2013 and exchange 2010. After configuring search and crawling public folders all works fine, but some links were broken. after googling and reading logs i found that some links was double encoded and given bed request. Looks like "+" encoded to "%2" and after "%2" to "%252". I add some filters in iis like UrlScan, but it didn't work. Firewall turned off. I will very thankful for any ideas to fix it.
  • Edited by V.Tuev Wednesday, February 26, 2014 6:56 AM
February 25th, 2014 7:21am

Hi,
For this issue, I'm trying to involve someone familiar with this topic to further look at it.
Thanks,

Free Windows Admin Tool Kit Click here and download it now
February 26th, 2014 7:25am

Hi V.Tuev,

i check our back log seems that you may need to do this : 

Edit the Item_CommonItem_Body.html Added:

 If(ctx.CurrentItem.Path.match("faccexch11.facc.co.at/OWA"))
{
               ctx.CurrentItem.Path = ctx.CurrentItem.Path.replace(/%2E/g, ".");
               ctx.CurrentItem.Path = ctx.CurrentItem.Path.replace(/%25/g, "%");
} 

these are the steps that we tried,

To workaround the issue the search display template Item_CommonItem_Body.html (which is valid for basically all search results / item-types as you can read here -> http://technet.microsoft.com/en-us/library/jj944947.aspx) has to be customized to remove the encoding before further processing takes place and the URLs can finally get correctly rendered.

Here are the required steps:
1. On the site collection with your search center go to Site settings page and browse to the Master pages and page layouts gallery.
2. Open the Display Templates and then Search folder.
3. To create a backup/copy select Item_CommonItem_Body.html and choose Download a Copy from the item drop-down menu.
4. Edit the Item_CommonItem_Body.html file using a text editor of your choice.
5. The following highlighted lines have to be added at the beginning of the file:
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> 
<head>
<title>Common Item Body</title>

<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:MasterPageDescription msdt:dt="string">Displays the inline result body elements that are common to all results.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
<mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
<mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor'</mso:ManagedPropertyMapping>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>
<body>
    <div id="Item_CommonItem_Body">
<!--#_
               If(ctx.CurrentItem.Path.match("faccexch11.facc.co.at/OWA"))
{
               ctx.CurrentItem.Path = ctx.CurrentItem.Path.replace(/%2E/g, ".");
               ctx.CurrentItem.Path = ctx.CurrentItem.Path.replace(/%25/g, "%");
}
        var id = ctx.CurrentItem.csr_id;
        var title = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "Title");
               .

6. Upload the modified .html file to the same gallery & folder where you downloaded the file.
Now after clearing the internet browser cache and issuing a query which contains results from an Exchange public folder you should be able to successfully open the OWA-URL. 

February 26th, 2014 9:33am

Thanks for answer.

After 6 step i got display error instread of results:
'If' is undefined (CoreRender: ~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_CommonItem_Body.js). Reverting changes allowed to see search results.

But problem still remained. Maybe we missed something?

Free Windows Admin Tool Kit Click here and download it now
February 26th, 2014 11:30am

hi V.Tuev,

inside the 'if' statement, you already change the path right? if not please have a check your OWA address.

February 27th, 2014 4:06am

Thanks for answer.

Which type of path i must add in 'lf'? Now i have like "owa.domainname.dz/owa".

Free Windows Admin Tool Kit Click here and download it now
February 27th, 2014 7:07am

Hi V.Tuev,

if i may ask, you already use that path correct?

you may try to use the path that your company OWA use.

February 27th, 2014 7:17am

Thanks for answer.

Yes, is correct path to my company OWA. I try to "owa.domainname.dz/owa" and "https://owa.domainname.dz/owa" but error remains.

Free Windows Admin Tool Kit Click here and download it now
February 27th, 2014 8:38am

Hi V.Tuev,

please have a check and try to clear the browsing cache also, as the last step,

if should this steps already done, then please upload the html to us, and we will try to check it out for you.

you may also open a ticket to our support so that we can have a remote and direct troubleshooting to your environment.http://support.microsoft.com/

February 28th, 2014 4:02am

Thanks for answer.

I checked all twice. No results.

It's my html:

<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> 
<head>
<title>Common Item Body</title>

<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:MasterPageDescription msdt:dt="string">Displays the inline result body elements that are common to all results.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
<mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
<mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor'</mso:ManagedPropertyMapping>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>
<body>
    <div id="Item_CommonItem_Body">
<!--#_
 If(ctx.CurrentItem.Path.match("mycompanyowa/owa"))
{
               ctx.CurrentItem.Path = ctx.CurrentItem.Path.replace(/%2E/g, ".");
               ctx.CurrentItem.Path = ctx.CurrentItem.Path.replace(/%25/g, "%");
} 
        var id = ctx.CurrentItem.csr_id;
        var title = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "Title");
        if ($isEmptyString(title)) {title = $htmlEncode(ctx.CurrentItem.Title)}
        var appAttribs = "";
        if (!$isEmptyString(ctx.CurrentItem.csr_OpenApp)) { appAttribs += "openApp=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenApp) + "\"" }; 
        if (!$isEmptyString(ctx.CurrentItem.csr_OpenControl)) { appAttribs += " openControl=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenControl) + "\"" };
        var showHoverPanelCallback = ctx.currentItem_ShowHoverPanelCallback;
        if (Srch.U.n(showHoverPanelCallback)) {
            var itemId = id + Srch.U.Ids.item;
            var hoverId = id + Srch.U.Ids.hover;
            var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
            showHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
        }
		var displayPath = Srch.U.getHighlightedProperty(id, ctx.CurrentItem, "Path");
		if ($isEmptyString(displayPath)) {displayPath = $htmlEncode(ctx.CurrentItem.Path)} 
		var url = ctx.CurrentItem.csr_Path;
		if($isEmptyString(url)){
			var useWACUrl = !$isEmptyString(ctx.CurrentItem.ServerRedirectedURL);
			if(ctx.ScriptApplicationManager && ctx.ScriptApplicationManager.states){
				useWACUrl = (useWACUrl && !ctx.ScriptApplicationManager.states.openDocumentsInClient);
			}
			if(useWACUrl)
			{
				url = ctx.CurrentItem.ServerRedirectedURL;
			} else {
				url = ctx.CurrentItem.Path;
			}		
		}
		ctx.CurrentItem.csr_Path = url;
		var pathLength = ctx.CurrentItem.csr_PathLength;
		if(!pathLength) {pathLength = Srch.U.pathTruncationLength}

        var maxTitleLengthInChars = Srch.U.titleTruncationLength;
        var termsToUse = 2;
        if(ctx.CurrentItem.csr_PreviewImage != null)
        {
            maxTitleLengthInChars = Srch.U.titleTruncationLengthWithPreview;
            termsToUse = 1;
        }

		var clickType = ctx.CurrentItem.csr_ClickType;
		if(!clickType) {clickType = "Result"}        
_#-->				
		<div id="_#= $htmlEncode(id + Srch.U.Ids.body) =#_" class="ms-srch-item-body" onclick="_#= showHoverPanelCallback =#_">
<!--#_
            if (!$isEmptyString(ctx.CurrentItem.csr_Icon)) {
_#-->
                <div class="ms-srch-item-icon">	
                    <img id="_#= $htmlEncode(id + Srch.U.Ids.icon) =#_" onload="this.style.display='inline'" src="_#= $urlHtmlEncode(ctx.CurrentItem.csr_Icon) =#_" />
                </div>
<!--#_
            }
            var titleHtml = String.format('<a clicktype="{0}" id="{1}" href="{2}" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{6}</a>',
					                      $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title), 
                                          showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));
_#-->       
            <div id="_#= $htmlEncode(id + Srch.U.Ids.title) =#_" class="ms-srch-item-title"> 
                <h3 class="ms-srch-ellipsis">
					_#= titleHtml =#_
				</h3>
			</div>
<!--#_ 
			if (!$isEmptyString(ctx.CurrentItem.HitHighlightedSummary)) { 
_#-->
				<div id="_#= $htmlEncode(id + Srch.U.Ids.summary) =#_" class="ms-srch-item-summary">_#= Srch.U.processHHXML(ctx.CurrentItem.HitHighlightedSummary) =#_</div>
<!--#_ 
			}
			var truncatedUrl = Srch.U.truncateHighlightedUrl(displayPath, pathLength);
_#-->
			<div id="_#= $htmlEncode(id + Srch.U.Ids.path) =#_" tabindex="0" class="ms-srch-item-path" title="_#= $htmlEncode(ctx.CurrentItem.Path) =#_" onblur="Srch.U.restorePath(this, '_#= $scriptEncode(truncatedUrl) =#_', '_#= $scriptEncode(ctx.CurrentItem.Path) =#_')" onclick="Srch.U.selectPath('_#= $scriptEncode(ctx.CurrentItem.Path) =#_', this)" onkeydown="Srch.U.setPath(event, this, '_#= $scriptEncode(ctx.CurrentItem.Path) =#_', '_#= $scriptEncode(truncatedUrl) =#_')" >
				_#= truncatedUrl =#_
			</div>
		</div>
<!--#_
		if (!$isEmptyString(ctx.CurrentItem.csr_PreviewImage)) 
        {
            var altText = Srch.Res.item_Alt_Preview;
            if(!$isEmptyString(ctx.CurrentItem.csr_PreviewImageAltText)){
                altText = ctx.CurrentItem.csr_PreviewImageAltText;
            }

            var onloadJS = "var container = $get('" + $scriptEncode(id + Srch.U.Ids.preview) + "'); if(container){container.style.display = 'inline-block';}" +
                           "var path = $get('" + $scriptEncode(id + Srch.U.Ids.path) + "'); if (path) { Srch.U.ensureCSSClassNameExist(path, 'ms-srch-item-preview-path');}" +
                           "var body = $get('" + $scriptEncode(id + Srch.U.Ids.body) + "'); if (body) { Srch.U.ensureCSSClassNameExist(body, 'ms-srch-item-summaryPreview');}";

            var previewHtml = String.format('<a clicktype="{0}" href="{1}" class="ms-srch-item-previewLink" {2}><img class="ms-srch-item-preview" src="{3}" alt="{4}" onload="{5}" /></a>', 
                                        $htmlEncode(clickType), $urlHtmlEncode(url), appAttribs, $urlHtmlEncode(ctx.CurrentItem.csr_PreviewImage), $htmlEncode(altText), onloadJS);
_#-->       
            <div id="_#= $htmlEncode(id + Srch.U.Ids.preview) =#_"  class="ms-srch-item-previewContainer"> 
			    _#= previewHtml =#_
            </div>
<!--#_
		}
_#-->
	</div>
</body>
</html>

Free Windows Admin Tool Kit Click here and download it now
February 28th, 2014 11:34am

Hi V.Tuev, 

we tried to compare your code in our lab boxes with our code, and its quite the same.

but the issue is not reproducible in our lab box. 

please have a try to do these steps:

http://blogs.msdn.com/b/jamesway/archive/2011/05/23/sharepoint-2010-clearing-the-configuration-cache.aspx

if should the issue persist after that, i think you may need to open a ticket to check if should all the settings are already in place.

http://support.microsoft.com

March 12th, 2014 6:31am

This seems to be the answer to my problem as well.  However, my Item_CommonItem_Body file is in javascript, not html.  Could you please provide the code I could use to paste in the file?
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2015 7:24pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics