Pass a query variable to modern search page

%3CLINGO-SUB%20id%3D%22lingo-sub-60755%22%20slang%3D%22en-US%22%3EPass%20a%20query%20variable%20to%20modern%20search%20page%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-60755%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20custom%20landing%20page%20that%20we%20created%20for%20our%20Office%20365%20site.%20%26nbsp%3BIt%20uses%20the%20classic%20view%20and%20web%20parts.%20%26nbsp%3BWe%20have%20a%20search%20box%20web%20part%20that%20we%20use%20to%20send%20the%20query%20to%20a%20custom%20search%20results%20page.%20%26nbsp%3BThis%20custom%20search%20results%20page%20is%20only%20returning%20sites%2C%20groups%2C%20and%20blogs.%20%26nbsp%3BWorks%20fairly%20well%2C%20except%20it%20doesn't%20return%20private%20groups%20that%20the%20user%20is%20a%20member%20of.%20%26nbsp%3BThis%20may%20be%20a%20limitation%20that%20won't%20be%20fixed%20for%20the%20classic%20search.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20an%20alternative%2C%20I%20thought%20maybe%20I%20could%20pass%20the%20query%20to%20the%20modern%20search%20page%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2F_layouts%2F15%2Fsharepoint.aspx%3Fq%3D%7Bquery%7D%26amp%3Bv%3Dsearch%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2F_layouts%2F15%2Fsharepoint.aspx%3Fq%3D%7Bquery%7D%26amp%3Bv%3Dsearch%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can't%20seem%20to%20figure%20out%20how%20to%20pass%20the%20value%20of%20the%20query%20box.%20%26nbsp%3BI've%20tried%20%7BSearchQueryBox%7D%2C%20%7BSearchTerms%7D%2C%20%7BQueryString%7D%2C%20nothing%20seems%20to%20work.%20%26nbsp%3BIt%20doesn't%20subsitute%20the%20variable%2C%20it%20just%20puts%20the%20literal%20%7BText%7D%20into%20the%20search%20results.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20it%20goes%20to%20the%20page%2C%20it%20automatically%20passes%20%26amp%3Bk%3D%3CSEARCH%20term%3D%22%22%3E%2C%20but%20k%20isn't%20recognized%20by%20modern%20view%2C%20it%20is%20looking%20for%20q.%20%26nbsp%3B%7Burlcontext%7D%20variable%20works%2C%20but%20that%20doens't%20help%20me.%3C%2FSEARCH%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-60755%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Contributor

We have a custom landing page that we created for our Office 365 site.  It uses the classic view and web parts.  We have a search box web part that we use to send the query to a custom search results page.  This custom search results page is only returning sites, groups, and blogs.  Works fairly well, except it doesn't return private groups that the user is a member of.  This may be a limitation that won't be fixed for the classic search.

 

As an alternative, I thought maybe I could pass the query to the modern search page 

https://tenant.sharepoint.com/_layouts/15/sharepoint.aspx?q={query}&v=search

 

I can't seem to figure out how to pass the value of the query box.  I've tried {SearchQueryBox}, {SearchTerms}, {QueryString}, nothing seems to work.  It doesn't subsitute the variable, it just puts the literal {Text} into the search results.

 

When it goes to the page, it automatically passes &k=<search term>, but k isn't recognized by modern view, it is looking for q.  {urlcontext} variable works, but that doens't help me.

 

Any ideas?

0 Replies