API Questions on Kentico API.
Version 6.x > API > How to invoke Kentico API from external application View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
emanuele.firmani-aduno-gruppe - 5/15/2012 2:08:29 AM
   
How to invoke Kentico API from external application
I’d like to use the class SearchIndexInfoProvider to retrieve the list of searched items from a client application I’m developing (I need it for monitoring purposes).
Is there any way to retrieve the given website informations by passing the connection string and the website name?

A workaround is to create a webservice retrieving such information, and invoking it from my application. The problem is that I would have to create such webservice for each of our websites running on Kentico.

Many thanks
Regards
Emanuele Firmani

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 5/15/2012 2:30:09 AM
   
RE:How to invoke Kentico API from external application
Hello,

Please see our documentation: Using API and cms controls outside cms project.

I hope it will help.

Best regards,
Helena Grulichova

User avatar
Certified Developer v7
Certified  Developer v7
emanuele.firmani-aduno-gruppe - 5/15/2012 3:52:31 AM
   
RE:How to invoke Kentico API from external application
I get the following exception:

Method 'GetSearchDocument' in type 'CMS.SiteProvider.SearchIndexInfo' from assembly 'CMS.SiteProvider, Version=5.5.3789.9808, Culture=neutral, PublicKeyToken=834b12a258f213f9' does not have an implementation.

I'm using version v5.5.3789.
What's wrong? I added all dlls that I found in the website.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 5/15/2012 6:52:58 AM
   
RE:How to invoke Kentico API from external application
Hello,

the documentation for version 5.5 is here: Using API and cms controls outside cms project.

Do you GetSearchDocument in your code? It is really not implemented in CMS.SiteProvider.SearchIndexInfo. When do you get the error message? Is there a line in the code which fires the error?

Did you rebuild the solution when you added the new references?

Best regards,
Helena Grulichova

User avatar
Certified Developer v7
Certified  Developer v7
emanuele.firmani-aduno-gruppe - 5/15/2012 7:08:07 AM
   
RE:How to invoke Kentico API from external application
I added the code line
CMS.CMSHelper.CMSContext.Init();

Exception at CMS.CMSHelper.CMSContext.Init():
The type initializer for 'CMS.CMSHelper.CMSContext' threw an exception.

Inner exception:
Method 'GetSearchDocument' in type 'CMS.SiteProvider.UserInfo' from assembly 'CMS.SiteProvider, Version=5.5.3789.9808, Culture=neutral, PublicKeyToken=834b12a258f213f9' does not have an implementation.
StackTrace " at CMS.CMSHelper.CMSContext..cctor()" string


User avatar
Certified Developer v7
Certified  Developer v7
emanuele.firmani-aduno-gruppe - 5/15/2012 7:09:30 AM
   
RE:How to invoke Kentico API from external application
Here is my piece of code:


var indexes = SearchIndexInfoProvider.GetSearchIndexes(null, null);
if (indexes != null)
{
foreach (DataTable table in indexes.Tables)
{
foreach (DataRow row in table.Rows)
{
//create a reindex task for that search index
SearchIndexInfo searchIndexInfo = SearchIndexInfoProvider.GetSearchIndexInfo(Convert.ToInt32(row.ItemArray[0])); //row.ItemArray[0] is the SearchIndex ID
if (searchIndexInfo != null)
{
output += "- " + searchIndexInfo.IndexDisplayName + ": ";
output += searchIndexInfo.NumberOfIndexedItems.ToString(Utils.FORMAT_COUNT); }
}
}
}

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 5/16/2012 2:55:40 AM
   
RE:How to invoke Kentico API from external application
Hello,

Can you double check that you added all .dll-s to the external project?

Can you send the external project to us (support@kentico.com) so that we can inspect it? Thank you in advance.

Best regards,
Helena Grulichova