Gravatar for

Question by cmgutmanis, Apr 13, 2015 11:52 AM

Accessing coveo config parameters programmatically


I'm probably missing something simple here but have been trying in vain to retrieve values from the coveo.SearchProvider.config file programmatically and have had no luck.

Basically I'm trying to do something like

var certPath = Sitecore.Configuration.Settings.GetSetting("SearchCertificatePath");

I've also tried things like

   var certPath = "Sitecore.Configuration.Settings.GetSetting("contentSearch.configuration.defaultIndexConfiguration.SearchCertificatePath");

and have been unable to retrieve anything there either. I'd really like to avoid duplicating this value in appSettings or a dedicated sitecore Settings element if at all possible but also need to be able to retrieve this value from code.

Any help would be greatly appreciated. Thanks!

1 Reply
Gravatar for

Answer by Vincent Séguin, Apr 13, 2015 11:54 AM


You could use the ContentSearchManager to retrieve the current Sitecore index, then access the index configuration and cast it into a CoveoIndexConfiguration (which is located in Coveo.Framework.dll, you will need to reference it).

Then you can have access to all the attributes of the config :)

Gravatar for

Comment by cmgutmanis, Apr 13, 2015 3:05 PM

This looks like just what I needed, thank you!

Ask a question