0

I'm using Kentico V10 and I can run the website locally. However, when i try to use the API from a console app, i'm getting the following error.

{"Object type 'cms.class' not found."}

The stackTrace has a call to check license. I'm following this page, and it says you have to add a license for your domain, but what domain is used when you are running from a console app?

https://docs.kentico.com/k10/integrating-3rd-party-systems/using-the-kentico-api-externally

I'm using this code from taken from this page. https://docs.kentico.com/k10/managing-users/user-registration-and-authentication/configuring-single-sign-on

        CMS.DataEngine.CMSApplication.Init();

        string userName = "myuser";

        // Gets the user with the specified user name
        UserInfo userInfo = UserInfoProvider.GetUserInfo(userName);

        // Gets the authentication URL for a specified user and target URL
        string url = AuthenticationHelper.GetUserAuthenticationUrl(userInfo, "SecuredSurvey");

If that was available via the REST API, i'd be happy to get the URL that way, but from what i can see, it's not available.

-Randy

randy
  • 253
  • 4
  • 17
  • 1
    This is not a license exception. Rather it seems something is missing in your setup. Is your connection string correctly setup? Did you install dependencies NuGet package and is it in proper location? – Enn Jun 23 '20 at 20:04
  • Thanks. Turns out it was something in the app.config. I pasted the entire web.config into the app.config. I started back over with a blank config and only added in the connectionstring and it worked. Thanks for the feedback, i just needed someone to tell me that i should work i guess. – randy Jun 23 '20 at 20:55

1 Answers1

0

Kentico has some good documentation on how to use the API in an external application, specifically a console library here.

Very notable steps are:

  1. Connecting to the database; make sure you use the same connection string as in your web.config
  2. Install the Kentico.Libraries NuGet package
  3. Initialize Kentico in your application in the Global.asax file.
  4. Write custom code all day long.
Brenden Kehren
  • 5,919
  • 16
  • 27