1

I would like to add filter based on Usage Location for AU or NZ. However the following result only return the record where UsageLocation is NZ

{searchboxquery} contentclass=spspeople -UsageLocation -eq 'AU' OR -UsageLocation -eq 'NZ'

If I removed Usage location from NZ, it will return all users from Usage Location from AU. enter image description here

So I am trying to figure out to return all users from both AU and NZ usage location.

3 Answers 3

2

Unfortunately, in SharePoint search, there is no crawled property called UsageLocation.

This is the full list of properties return for the spspeople. However, many of these are not searchable via KQL anyway Also, many of these properties will be empty.

  • AADObjectID
  • AboutMe
  • AccountName
  • CombinedName
  • CombinedUserProfileNames
  • contentclass
  • ContentExcludeFromSummaries
  • ContentsHidden
  • ContentSource
  • CrawledProperties
  • Culture
  • Description
  • DocId
  • DocumentSignature
  • FallbackLanguage
  • FileExtension
  • Filename
  • FirstName
  • GeoLocationSource
  • HierarchyUrl
  • HostingPartition
  • IndexDocId
  • Interests
  • InternalFileType
  • IsContainer
  • IsDocument
  • IsExternalContent
  • LastModifiedTime
  • LastName
  • LevelsToTop
  • ListId
  • MobilePhone
  • NonDocument
  • OriginalPath
  • ows_MetadataFacetInfo
  • owsmetadatafacetinfo
  • owstaxidmetadataalltagsinfo
  • owstaxIdSPShInterests
  • owstaxIdSPShPastProjects
  • owstaxIdSPShResponsibility
  • owstaxIdSPShSchool
  • owstaxIdSPShSkills
  • PartitionId
  • PastProjects
  • Path
  • PeopleKeywords
  • PhoneNumber
  • PictureURL
  • piSearchResultId
  • PreferredName
  • PrivacyIndicator
  • ProfileName
  • Pronunciations
  • Rank
  • RankingWeightLow
  • RankingWeightName
  • RenderTemplateId
  • Responsibilities
  • ResultTypeId
  • ResultTypeIdList
  • Schools
  • ServiceApplicationID
  • SipAddress
  • SiteId
  • SitePath
  • Size
  • Skills
  • SPS-HideFromAddressLists
  • SPS-UserType
  • Tags
  • Title
  • UniqueId
  • UrlZone
  • UserName
  • UserProfile_GUID
  • WebId
  • WorkEmail
  • WorkPhone

GeoLocationSource is not what you want. There is also BaseOfficeLocation, but it's not searchable.

So, unless, you manually populate one of these properties for all user profiles, there is no way you will be able to search people by their location.

5
  • Thanks Denis. Yes the UsageLocation is currently implement in our environment. The KQL query above only return the second condition which is NZ. If I remove the second condition it will return all user from AU. What I am trying to figure out is KQL query to return users from both location AU and NZ.
    – Supermode
    Commented Mar 6, 2022 at 13:04
  • Maybe a silly question, but why is there - (minus) sign before UsageLocation? Commented Mar 6, 2022 at 15:46
  • should the query be more like {searchboxquery} contentclass=spspeople AND (UsageLocation=AU UsageLocation=NZ)? I am not sure if -eq is part of the valid syntax in KQL. Where did you find -eq used? Commented Mar 6, 2022 at 15:50
  • Thank you @Denis. I have attached my screenshot above to display users using -UsageLocation -eq 'AU' and worked fine which return the correct results. I tried your suggested solution in comment above unfortunately it return null value
    – Supermode
    Commented Mar 6, 2022 at 21:54
  • I see. and what about the minus sign and the -eq. Where did you encounter this syntax? Did you find this syntax in some article? Commented Mar 6, 2022 at 21:59
0

Try this: {searchboxquery} contentclass=spspeople (UsageLocation:AU OR UsageLocation:NZ)

KQL Syntax Referemce

1
  • thank you Louie. I tried it return 0 results
    – Supermode
    Commented Mar 8, 2022 at 22:48
0

In your Query Builder above, were you able to locate UsageLocation or a variant of the managed property from your Property filter dropdown? If you haven't tried, yet,

  1. click on the Property filter dropdown
  2. select --Show all managed properties-- Query builder - Property filter
  3. scroll through the list of managed properties and make sure that UsageLocation is there
  4. Once you have located it, select it
  5. From the comparison operator, select Contains Comparison operator
  6. From the select value dropdown, select Manual value enter image description here
  7. In the textbox that appears, type NZ
  8. Click Add property filter
  9. Then click Test query

Your results should appear in the SEARCH RESULTS PREVIEW textbox on the right. If on bullet item 3 above, you don't see UsageLocation or anything similar to it, you may have to manually create the managed property. Here's an article from SharePointMaven on how to go about it:https://sharepointmaven.com/how-to-create-a-managed-property-in-sharepoint-online/

It is a multi-step process and depending on whether you're on-prem or SP Online, you may have to wait until the next crawl cycle occurs. Luckily, if you're on-prem, you can force a full crawl. With SP Online, you will have to wait.

I hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.