How to enable “Hey Cortana” with Windows Phone 8.1 Update in Australia

Currently only USA and UK Windows Phones can access Cortana Beta. Some other countries such as Australia have access to Cortana Alpha. The “Hey Cortana” feature which allows you to start Cortana listening by simply saying “Hey Cortana” is not included in the Alpha and we have to wait patiently for the Beta. There is always the option to opt in to the Developer Preview and get the latest goodies, but if you’d prefer to keep your phone on a stable build and still get access to the “Hey Cortana” feature here’s a quick way to acheive it. In a nutshell you can change your phones region to UK just long enough to enable “Hey Cortana” and then switch your region back. After doing this “Hey Cortana” says it’s disabled in the settings but seems to keep working fine.

Here’s how to do it:

Settings | System

I’ve you are in Australia you should see that Region currently says Australia, English (Australia) and Speech is set to English (United Kingdom)

enable-hey-cortana-australia-windows-phone-cameron-dwyer (1)

Open the Region setting (it should currently be set similar to below)

enable-hey-cortana-australia-windows-phone-cameron-dwyer (2)

Change the Country/Region from Australia to United Kingdom and then press the restart phone button that appears once you change the Country/Region

enable-hey-cortana-australia-windows-phone-cameron-dwyer (3)

When your phone restarts go to Settings | System. Hey Cortana will still show as disabled

enable-hey-cortana-australia-windows-phone-cameron-dwyer (4)

Open the Hey Cortana settings you should now be able to switch this feature on.

enable-hey-cortana-australia-windows-phone-cameron-dwyer (6)

Continue on to setup (train) Cortana. You will only be able to do this while your Country/Region is set to United Kingdom, once we switch it back to Australia you will loose the ability to retrain.

enable-hey-cortana-australia-windows-phone-cameron-dwyer (7)

enable-hey-cortana-australia-windows-phone-cameron-dwyer (8)

enable-hey-cortana-australia-windows-phone-cameron-dwyer (9)

Once you’ve completed the Cortana training you should be back at the settings screen.

enable-hey-cortana-australia-windows-phone-cameron-dwyer (10)

Now your region will be set to United Kingdom, English (Australia)

enable-hey-cortana-australia-windows-phone-cameron-dwyer (11)

Now lets change the Region | Country/Region back to Australia. Select the restart phone button when it becomes available.

enable-hey-cortana-australia-windows-phone-cameron-dwyer (12)

Once your phone restarts go to Settings | System. You should find that Hey Cortana is disabled.

enable-hey-cortana-australia-windows-phone-cameron-dwyer (13)

enable-hey-cortana-australia-windows-phone-cameron-dwyer (14)

But if you say “Hey Cortana” either while you phone screen is on (or even if you phone is locked with screen off), Cortana will respond by turning the screen on and making a beep sound. Cortana is now listening for your command.

enable-hey-cortana-australia-windows-phone-cameron-dwyer (15)

SharePoint CAML query examples of working with People and Groups

Some of the more elegant and powerful solution built with SharePoint have some level of personalization for the user. Here are some example CAML queries that allow you to query a SharePoint list and return items where the current user is listed in a Person column or explicitly in a Person/Groups column and even if they a a member of a group in a Person/Groups column. First let’s give our examples a bit of context. Here’s a SharePoint list of Projects where each project has:

  • Status (Choice column with valid values of Open, Closed, Cancelled)
  • Project Manager (single valued Person column – no groups allowed)
  • Project Team (multi value Person/Group column – People allowed explicitly and/or Groups allowed)

sharepoint-office365-people-group-caml-cameron-dwyer-02-list-data   And the column definitions: sharepoint-office365-people-group-caml-cameron-dwyer-01-list-columns   Now here’s some of the things you might want to do when querying this list and the CAML to achieve it.

Where current user is in a single values Person/Groups column

This will give us all items where the current user is in the Project Manager column


<Where>

<Eq>

<FieldRef Name='Project_x0020_Manager'/>

<Value Type='Integer'>

<UserID Type='Integer'/>

</Value>

</Eq>

</Where>

Where current user is a member of a groups that is listed in a person/groups column (that allows single or multiple values)

This will give us all items where the current user is a member of a group listed in the Project Team column. Note: it will not give you items where the user is listed explicitly by name in the Project Team column.


<Where>

<Membership Type='CurrentUserGroups'>

<FieldRef Name='Project_x0020_Team'/>

</Membership>

</Where>

Where current user may be named explicitly or may be a member of a group listed in a person/groups column (that allows single or multiple values)

This will give us all items where the current user is either listed explicitly by name or is a member of a group listed in the Project Team column.


<Where>

<Or>

<Membership Type='CurrentUserGroups'>

<FieldRef Name='Project_x0020_Team'/>

</Membership>

<Includes>

<FieldRef Name='Project_x0020_Team'/>

<Value Type='Integer'>

<UserID Type='Integer'/>

</Value>

</Includes>

</Or>

</Where>

Combining Item Metadata with User/Groups Column Queries

This will give us all items: Where the Project Status (choice type) column has a status of “Open” AND Where current user may be named explicitly or may be a member of a group listed in the “Project Team” person/groups column (that allows single or multiple values) OR Where current user is explicitly named in the single value “Project Manager” Person/Groups column


<Where>

<And>

<Eq>

<FieldRef Name='Project_x0020_Status' />

<Value Type='Choice'>Open</Value>

</Eq>

<Or>

<Eq>

<FieldRef Name='Project_x0020_Manager' />

<Value Type='Integer'>

<UserID Type='Integer' />

</Value>

</Eq>

<Or>

<Membership Type='CurrentUserGroups'>

<FieldRef Name='Project_x0020_Team'/>

</Membership>

<Includes>

<FieldRef Name='Project_x0020_Team'/>

<Value Type='Integer'>

<UserID Type='Integer'/>

</Value>

</Includes>

</Or>

</Or>

</And>

</Where>

How to: Enable outlining (collapsible statement blocks) for C# code in Visual Studio

I’m often modifying existing C# code in Visual Studio and find myself trying to line up opening and closing braces and trying to figure out what level of nesting I’m currently at. It’s easy when the block fits on a single screen without scrolling, but dive into some complex logic where you’ve got plenty of nested if, else, switch, try, catch blocks it’s easy to get disoriented scrolling up and down trying to figure out the logic.

Yes I can hear the code purists begging me to restructure the code and encapsulate logic away into smaller more focused methods. I don’t disagree, it fact that might be the reason I’m looking at the code in the first place, but I need to understand the logic before I start pulling it apart.

Whatever the reason I’m sure you’ve all been in the situation, why can’t I just collapse this  switch block, or if block? Wouldn’t that make things simple? Luckily the solution to this problem is simple – there’s a free Visual Studio Extension called C# Outline and it’s available for Visual Studio 2010, 2012, 2013 & 2015.

This nifty extension provides outlining (expand/collapse) for all block elements that use curly braces { }; Just like you get out-of-the-box for classes and methods It’s simple and a massive time saver.

cameron-dwyer-csharp-visual-studio-outline-collapse-blocks

How to fix frequent WebDav “path not valid” errors

After experiencing some intermittent “path not valid” and very frustrating errors trying to open different types of files from my SharePoint server I’d had enough. I had to know what was going on.

Here’s the behaviour I was seeing. I had used a certain machine to edit SharePoint files in applications such as WordPad and Paint in the past so I just jumped on it and tried to open a file from SharePoint in MS Paint and it would just keep failing with “path not valid”. I tried the same file from another machine and it worked fine. So back the first machine with the error and I tried images from other directories on the same server, they all failed with “path not valid”. I then started trying to open different file types with different applications. What I found was quite surprising (to me anyway). I was able to successfully open a .txt file from SharePoint in WordPad and from that point on my original image files that failed to open in Paint started working fine.

Now I already knew that WebDav had a few dependencies and that the WebClient service had to be running, but I had initially dismissed this as a possible cause as I knew I’d been working fine with WebDav on this machine only a couple of days prior… it turned out this was a bad assumption to make.

What I wasn’t expecting was that there are some actions you can do that will start the WebClient service if it’s not already running. As I discovered, one of those actions it to use WordPad to try and open a file on a UNC path. A bit of digging around also revealed that putting a UNC path in Windows Explorer will cause the WebClient service to start as well.

Here’s the proof:

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-01-stop-webclient-service

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-02-open-with-paint

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-03-invalid-path-errort

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-04-web-client-not-running

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-05-open-with-wordpad

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-06-open-with-wordpad-successful

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-07-webclienbt-service-started

Now trying to open the original image file (that failed) in Paint works fine.

webdav-path-not-valid-sharepoint-fix-cameron-dwyer-08-open-sharepoint-photo-in-paint

So I learned my lesson, even though it’s something I thought I already knew. If you are making use of WebDav MAKE SURE the WebClient service is set with a startup type of “Automatic”.

 

Further reading:

https://www.myotherpcisacloud.com/post/2012/11/13/Sometimes-I-Can-Access-the-WebDAV-Share-Sometimes-I-Cant!.aspx

Office Lens: The simple and free way to create an Outlook Contact from a business card

I’ve found Office Lens to be an awesome app for Windows Phone. Recently the app was enhanced to allow for the specific task of scanning business cards.

So how does it work? Simply fire up the free Office Lens app on your Windows Phone and tell it you want to scan a business card. Take the photo (scan) and save it to OneNote. Here’s what I ended up with when I scanned my own business card.

office-lense-scan-business-cards-cameron-dwyer-01-onenote

In OneNote (either directly on the phone or back on your PC – once OneNote syncs) you get the full picture of the business card at the bottom of the OneNote page, but it creates a section of formatted text above the image which extracts the main details from the business card and creates hyperlinks to call, email or open website addresses. Pretty cool.

The awesomeness doesn’t stop there. Embedded in the OneNote page is a .vcf file “BizCard”.

office-lense-scan-business-cards-cameron-dwyer-01-open-business-card

Click on the “BizCard” file and a full Outlook Contact profile is composed with all the details filled out ready to save.

office-lense-scan-business-cards-cameron-dwyer-03-create-new-outlook-contact-from-business-card

The screenshots above are from OneNote Desktop on my PC, but you get similar functionality directly on your phone. You can see the “BizCard” link and pressing it composes a new contact directly on your phone with all the details filled out which you can then edit/change before saving. Now that is really cool.

I’m looking forward to the next SharePoint Conference when I come home at the end of the day with a wad of business cards in my pocket.

Here’s an official article about the feature

http://blogs.office.com/2014/12/08/office-lens-gets-networking-scan-business-cards-onenote-contacts-outlook

You can download the Office Lens Windows Phone app for free from the Windows Phone Store.

Fix SharePoint Performance Issue with ‘Open in Explorer’ & opening non-Office File Types

I was recently working with documents stored in SharePoint (Office 365 to be exact) and was seeing poor performance when trying to open file types with applications other than Office. At first I just put it down to a slow connection to Office 365, but I quickly realised that accessing files from Office 365 via alternate means (CSOM, Web Services) was much faster. I also found that the ‘Open with Explorer’ function (available on the Library ribbon as shown below) was slow to open.

cameron-dwyer-sharepoint-webdav-open-explorer-performance-issue-fix-01-open-with-explorer

 

cameron-dwyer-sharepoint-webdav-open-explorer-performance-issue-fix-02-explorer-webdav-view

In both scenarios I saw the performance issue (1) Opening non-Office files from SharePoint, and (2) Using the Open in Explorer function, the underlying technology that is performing the communication is WebDAV. WebDAV is the layer that makes it possible for applications that were not designed to work with SharePoint to.. well.. work with SharePoint I guess! WebDAV is actually a standard and isn’t SharePoint specific but I won’t go into that here. Suffice to say I’d isolated my issue down to being a performance issue related to WebDAV.

Now I knew what I was troubleshooting, the answer was readily available. Here’s the official KB of a known issue with WebDAV and the auto-detect settings option in Internet Explorer http://support.microsoft.com/kb/2445570

This was the fix for me:

In Internet Explorer, open Internet Options

cameron-dwyer-sharepoint-webdav-open-explorer-performance-issue-fix-03-internet-options

Select Connections | LAN Settings

cameron-dwyer-sharepoint-webdav-open-explorer-performance-issue-fix-04-connections-lan-settings

Uncheck ‘Automatically detect settings’

cameron-dwyer-sharepoint-webdav-open-explorer-performance-issue-fix-05-automatically-detect-settings

That’s it. After making this change I could go back to SharePoint and the SharePoint Library ‘Open in Explorer’ action was 4x faster than it had been. I was also getting much faster opening times of my non-Office files.

How to install/enable the WebClient (WebDAV) Service on Windows Server 2012 to open/edit SharePoint files

Are you having trouble opening/editing files stored in SharePoint, especially non Office files on Windows Server 2012?

By default the WebClient service is not installed on Windows Server 2012. Without this service running, opening/editing of non-Office files stored in SharePoint is very restricted.

To enable the WebClient service in Windows 2012 follow these steps:

Start Server Manager | Manage | Add Roles and Features

cameron-dwyer-windows-add-webclient-webdav-support-01-Add-Roles-And-Features

Select Installation Type of Role based or feature based installation

cameron-dwyer-windows-add-webclient-webdav-support-02-Role-or-feature-based-install

Choose the server to install the feature on (in my case I’m running server manager locally on the server I want to install the WebClient service on)

cameron-dwyer-windows-add-webclient-webdav-support-03-select-server

Just click Next to skip over Server Roles (it’s a feature we want to enable not a role)

cameron-dwyer-windows-add-webclient-webdav-support-04-skip-server-roles

Expand the User Interfaces and Infrastructure feature. By default this feature is partially installed. We need the Desktop Experience component of this feature. The WebClient is bundled with this component. According to Microsoft it is only possible to install the WebClient by enabling the entire Desktop experience and WebClient is not available on it’s own (https://social.technet.microsoft.com/Forums/windowsserver/en-US/e4ac654f-6d75-431d-baff-2f9dd511980a/installing-webclient-service-without-desktop-experience?forum=winserverTS)

cameron-dwyer-windows-add-webclient-webdav-support-05-enable-desktop-experience

Check Desktop Experience and you will be prompted to also install the pre-requisite Ink and Handwriting Services. Click Add Features.

cameron-dwyer-windows-add-webclient-webdav-support-06-enable-ink-handwriting-services

 

This change required a server restart for me (and the feature installation continued after the restart) so check the option to have the server automatically restart if required.

cameron-dwyer-windows-add-webclient-webdav-support-07-confirm-restart

Click Install and your server should restart and the feature installation will complete once the server comes back up.

cameron-dwyer-windows-add-webclient-webdav-support-08-installation-finished

Now check the Windows Services and ensure WebClient is present and running

cameron-dwyer-windows-add-webclient-webdav-support-09-verify-webclient-service-running

 

Further Resources/Reading

https://social.technet.microsoft.com/Forums/windowsserver/en-US/e4ac654f-6d75-431d-baff-2f9dd511980a/installing-webclient-service-without-desktop-experience?forum=winserverTS

https://social.technet.microsoft.com/Forums/windowsserver/en-US/33ad6fc9-8d8b-40b9-b9a3-a253f9ae37d1/webclient-service-on-windows-server-2012-webdav-client?forum=winserver8gen

Getting Started: What are .ps1 files and how do you use them?

What is a .ps1 file?

powershell-ps1-cameron-dwyerIf you want to save a series of PowerShell commands in a file so you can run them again later then you effectively creating a PowerShell script. This is simply a text file with a .ps1 extension. The file contains a series of PowerShell commands, with each command appearing on a separate line.

Why would you use a .ps1 file?

When working with SharePoint I find that most of the time to achieve something useful I’m writing several lines of PowerShell with the result of each line feeding into subsequent lines. The scripts often end up resembling source code more than traditional command line input. So using .ps1 files work well, you simply write up the commands and then execute the .ps1 file to run all the commands, make changes re-run until you end up with a script that does what you want and you’ve ironed all the bugs out.

Saving your commands to a .ps1 file also makes them portable in that you can take the file onto another computer (another SharePoint server) and execute the same .ps1 file on it. By making use of input variables, input files, and prompting for user input you can craft .ps1 files that perform common functions and you can get a lot of reuse without having to change the commands within the .ps1 file.

How do you run a .ps1 file?

You can’t just double-click on a .ps1 file in Windows Explorer to run it. The most common way to run the .ps1 file in from a PowerShell Command window. The syntax differs a bit from the old command line.

You can either specify the entire path to the file such as:

c:\temp\myscript.ps1

Or if the current directory in the PowerShell window is set to the directory containing the .ps1 file you can use the .\ shortcut to execute the script:

.\myscript.ps1

That’s it for a very basic intro to .ps1 files, happy scripting!

More out-of-the-box ways to get Email into SharePoint (2013 and Office 365)

This is a continuation of an article I wrote back at the beginning of 2012 Five out-of-the-box ways to get Email into SharePoint. Since then we have seen the launch of SharePoint 2013 and also more widespread adoption of Office 365 (SharePoint Online). These more recent versions of SharePoint have introduced new ways of getting email into SharePoint and that’s what we will explore in the article.

Option 6 – Site Mailboxes

The Site Mailbox concept introduced in SharePoint 2013 promised a lot and sounded like it could be the primary option to go for when trying to integrate email and SharePoint. Rather than reproduce existing content here’s an article I wrote dedicated to SharePoint 2013 Site Mailboxes.

Pros

  • Site Mailboxes provide a consolidated view of site content stored within SharePoint and Exchange from within Microsoft Outlook
  • Minimal change with a familiar drag & drop process to the left navigation of Outlook. Allowing the capture of emails or email attachments into SharePoint and Exchange
  • Convenient access to SharePoint content from within Microsoft Outlook using a familiar metaphor of folders on the left navigation of Outlook.
  • Ability to include a Site Mailbox as an email recipient (e.g. cc’d) for saving emails into a Site Mailbox – Inbox
  • Ability to ‘Forward’ a link to a document within a Site Mailbox or drag/drop multiple documents into an email message.
  • Lifecycle Retention policies can be applied at a Site Mailbox level behind the scenes
    Management and Compliance: Site Mailboxes can be part of eDiscovery Search Scopes.
  • Minimal change for the end users and therefore greater user adoption and promotion of enterprise content management best practices
  • Less reliance on the IT Department once the SharePoint and Exchange environment have been configured for Site Mailboxes
  • More efficient means to support the business with records management initiatives
  • Streamlined provisioning and deployment of Site Mailboxes to end users based on security permissions within a SharePoint Site
  • Email content is retained within Microsoft Exchange while documents are retained within SharePoint

Cons

  • Setting up the environment to support Site Mailboxes involves installing and configuring software on both the Exchange and SharePoint servers and setting up trust relationships and having all communication over SSL.
  • Probably the biggest drawback is that you are not actually getting email into SharePoint. The email is stored in Exchange. This means you can’t treat it as a SharePoint object and include it as part of a business process. E.g. include it a part of a workflow, add metadata columns to email and build a SharePoint business process around it. I will add quickly that you can drag/drop email directly to a Document Library and this will get the email into SharePoint as an msg file.
  • You must be running SharePoint 2013, Exchange 2013 and Outlook 2013 to get access to Site Mailbox functionality
  • Very limited features on drag/drop of attachments to SharePoint document libraries – basically no support for metadata of any kind (no content type selection, no columns to complete, no validation of mandatory column, can’t rename files on upload, no support for versioning)
  • Viewing of SharePoint content is very limited. You are provided more with a file type view of content rather than a SharePoint view. You can’t show SharePoint columns in the Outlook view, you just get the filename, last modified, size, and checkout status.
  • Maximum of 10 Site Mailboxes can be added to Outlook

 

Further reading

https://camerondwyer.wordpress.com/2013/03/20/guide-to-setting-up-sharepoint-site-mailboxes-on-sharepoint-2013-and-exchange-2013/

https://camerondwyer.wordpress.com/2013/02/13/white-paper-sharepoint-2013-site-mailboxes/

http://blogs.technet.com/b/exchange/archive/2012/08/22/site-mailboxes-in-the-new-office.aspx

http://office.microsoft.com/en-001/sharepoint-help/overview-use-a-site-mailbox-to-collaborate-with-your-team-HA103927690.aspx

http://office.microsoft.com/en-001/office365-suite-help/prepare-for-using-site-mailboxes-in-office-365-HA103834109.aspx

 

Option 7 – Drag/Drop to SharePoint via Desktop

SharePoint 2013 provided the new capability of being able to drag and drop files from your computer directly into a SharePoint document library open in a browser window. Combine this with the ability to turn Outlook messages into msg files by dragging them of of Outlook onto the desktop and we have a fairly simple 2 step process.

Step 1: Drag email from Outlook and drop to the desktop

drag-drop-email-outlook-to-sharepoint-office365-drag-to-desktop-cameron-dwyer

Step 2: Drag email from the desktop and drop into SharePoint

drag-drop-email-outlook-to-sharepoint-office365-drag-to-sharepoint-cameron-dwyer

Thanks goes to Liz who posted a comment on this blog letting me know of this technique.

Pros

  • The email is stored in msg format so it can be opened back up in Outlook without loss of data or email integrity.
  • Once your windows are setup for source (Outlook) and destination (SharePoint) the drag drop is quite simple
  • No configuration or setup required and will work with any SharePoint 2013 document library
  • Can move multiple email at once
  • Can move attachments off email to SharePoint using same technique
  • Can save the the root of the SharePoint library or to a subfolder (just have the library open to the folder before the drag drop)
  • Will work with older versions of Outlook
  • Transfer happens in the background (SharePoint web browser provides progress bar)

Cons

  • Getting the Outlook and SharePoint windows accessible and seeing the desktop behind them to be able to execute the drag drop can be a bit fiddly so lends itself more to doing the transfers in batches rather than just ad-hoc when new email arrives.
  • No email attributes get captured/promoted to SharePoint columns

 

Further Reading

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2012/07/16/how-to-drag-and-drop-files-into-sharepoint-2013-document-libraries.aspx

http://office.microsoft.com/en-us/office365-sharepoint-online-enterprise-help/upload-files-to-a-library-HA102803549.aspx

 

Option 8 – Save or Drag/Drop to a OneDrive Synced Location

OneDrive for Business is essentially a synchronization tool that lets you take a copy of a SharePoint library locally onto your machine. The document library appears in Windows Explorer as a folder with the documents appearing as files within the folder. Subfolders within a library are also supported. The nice thing about OneDrive is that it’s a 2 way sync. Any additional files you add to the local sync folder will get transferred up to SharePoint.

Step 1: Browse to your library in SharePoint and click on the sync button to have the SharePoint library sync’d via OneDrive to your local machine.

bulk-upload-folder-structure-sharepoint-cameron-dwyer-onedrive-sync-button

After the sync has completed the SharePoint library (and it’s content including any folder structure) is now represented as a folder structure that you can easily get to through Windows Explorer.

bulk-upload-folder-structure-sharepoint-cameron-dwyer-onedrive-local-library

Step 2: You can now open an Email in Outlook and choose to Save As and choose the OneDrive local folder as the save location. Alternatively you can open the OneDrive folder in Windows Explorer and drag/drop multiple emails directly from Outlook to the OneDrive folder. OneDrive will automatically upload these emails to SharePoint in the background.

Pros

    • The email is stored in msg format so it can be opened back up in Outlook without loss of data or email integrity.
      • Can move multiple email at once
      • Can move attachments off email to SharePoint using same technique
      • Can save the the root of the SharePoint library or to a subfolder (just have the library open to the folder before the drag drop)
      • Transfer happens in the background

Cons

  • Whole library must be synced locally which may mean a lot of files/data on the local machine that you don’t need or want
  • Using email Save As is tedious, drag and drop to OneDrive open in Explorer window is much nicer but it’s fiddly to get the windows visible to achieve the drag/drop so probably works better transferring in batches rather than as new email arrives.
  • No email attributes get captured/promoted to SharePoint columns

 

Further Reading

http://office.microsoft.com/en-001/sharepoint-help/sync-libraries-using-onedrive-for-business-HA103425074.aspx

https://camerondwyer.wordpress.com/2014/06/04/how-to-bulk-uploadcopy-a-folder-structure-and-files-to-sharepoint/

Beware SharePoint 2013 Search Results and the ListUrl Property

beware-caution-sharepointI was recently looking into the results returned by SharePoint 2013 under the scenario of alternate access mappings. Essentially this boils down to the same SharePoint content being available on different host URLs.

Here’s an example:

I can have a single site which I initially create on http://ourintranet, through the magic of alternate access mappings I can make the same SharePoint site also accessible on http://extranet.mycompany.com

SharePoint serves up exactly the same content irrespective of the URL host the user come in on. In the address bar of the users browser, the host portion of the URL remains constant as they navigate through the site e.g. if the user came in on http://extranet.mycompany.com they would not be switched over to the http://ourintranet host at any time.

These alternate access mappings carry across to search as well. The way this works is that the search processes will crawl the SharePoint site and index content based on one of the URLs (either http://ourintranet or http://extranet.mycompany.com, best practice is to use the access mapping of the default zone). When search results are requested the SharePoint server will find the matching results in it’s search index and then apply alternate access mappings to any of the URLs being returned so that even though the content was crawled and indexed with the URLs starting with http://ourintranet, if a user comes in on the http://extranet.mycompany.com URL and performs a search, then all search results will also use the http://extranet.mycompany.com access mapping.

Now to the issue with the ListUrl property being returned by search. This property simply misses the whole alternate access mapping transformation when the search results are returned and the value is read straight from the search index. Therefore the ListUrl property is fixed with the URL host that the search crawler is configured with. This means that when a user comes in on http://extranet.mycompany.com and performs a search, the ListUrl property will give back a result starting with http://ourintranet. Obviously this is not good and your users may not even have access to the content via the different access mapping.

Here’s an environment demonstrating the problem.

The initial site collection is created on http://vs-server38:83

01-sharepoint-aam-listurl-search-results-cameron-dwyer-site-collections

 

The site collection is then extended (which creates the alternate access mapping) http://vs-server38:84

02-sharepoint-aam-listurl-search-results-cameron-dwyer-extended-to-new-port

 

Through a browser we can now access the same site on http://vs-server38:83

03-sharepoint-aam-listurl-search-results-cameron-dwyer-port-83

 

or on http://vs-server38:84

04-sharepoint-aam-listurl-search-results-cameron-dwyer-port-84

 

The search content source is configured to crawl the content based on the default http://vs-server38:83 URL.

05-sharepoint-aam-listurl-search-results-cameron-dwyer-search-content-source-for-crawl

The screenshot below shows the results of performing a search query (via PowerShell) on the URL http://vs-server38:83. As you can see all URLs returned begin with http://vs-server38:83

06-sharepoint-aam-listurl-search-results-cameron-dwyer-search-results-on-port-83

 

This screenshot performs exactly the same search query only it uses the alternate access mapping of http://vs-server38:84. This time the issue is evident. The Path, OriginalPath and SiteName properties all return URLs that have been mapped to the alternate access URL I used. Note the ListUrl property still returns the http://vs-server38:83 based URL.

07-sharepoint-aam-listurl-search-results-cameron-dwyer-search-results-on-port-84

 

Delving further, each managed search property has a property called UseAAMMapping that seems to be the flag that tells SharePoint that the property contains a URL and need to apply alternate access mapping transformation when results are returned. Looking at the UseAAMMapping property through PowerShell we can see that the ListUrl property does not have this flag set while the other URL based properties (that work correctly) do have this flag set.

08-sharepoint-aam-listurl-search-results-cameron-dwyer-listurl-useaammapping-false

Follow

Get every new post delivered to your Inbox.

Join 123 other followers

%d bloggers like this: