Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Keyword search programmatically with query variable from user

$
0
0

Hi,

I can use this query text on a content search web part, and get get results but when doing this programmatically, I get no results. How do I write the query if I want to get office from the logged in user?

Content search query:

contentclass:sts_listitem ContentType:"News Location" owstaxIdTargetLocation:{User.Office} 

Programmatically:
keywordquery.QueryText = "contentclass:sts_listitem ContentType:\"News Location\" owstaxIdTargetLocation:{User.Office}";


Viewing all articles
Browse latest Browse all 7589

Trending Articles