0

I wanted to get the global search center url which is set in the Search Service Application.Is there any direct api access to get the search center url ?

-Sharath

  • What version of SharePoint? And what type of code are you looking for? C#? Javascript? COM, SOM? – Robert Lindgren Jul 10 '13 at 8:33
1

Assuming 2013 and Powershell:

$ssa = Get-SPEnterpriseSearchServiceApplication
$ssa.SearchCenterUrl
  • Thanks, yes it for 2013 version. I was looking for c# version.On digging further looks I was looking how SharePoint does it internally and looks like they are building and caching it (Found in Microsoft.Office.Server.Search.WebControls.SearchCommon --> BuildSearchCenterUrl) – Sharath Chandra Jul 10 '13 at 9:08
  • Yes I should guess on something like that, since on Site Collection level you can use a token to point at the SearchCenterUrl – Robert Lindgren Jul 10 '13 at 9:11
0

Thanks, yes it for 2013 version. I was looking for c# version.On digging further looks I was looking how SharePoint does it internally and looks like they are building and caching it (Found in Microsoft.Office.Server.Search.WebControls.SearchCommon --> BuildSearchCenterUrl). So used the similar thing

SPServiceContext svcContext = SPServiceContext.Current;
if (svcContext != null)
{
    SearchServiceApplicationProxy proxy =     svcContext.GetDefaultProxy(typeof(SearchServiceApplicationProxy)) as     SearchServiceApplicationProxy;
    searchCenterUrl = proxy.GetSearchServiceApplicationInfo().SearchCenterUrl;
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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