Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Caley 14 posts 125 karma points
    Aug 03, 2023 @ 15:09
    Caley
    0

    Custom Property Editor from Tutorial

    Hi

    I'm following the tutorial from the docs on how to create a custom property editor

    I have made it to the last part – part 4 and more specific the section "Setup ApiController routes"

    Unfortunately it seems that the page haven't been updated to use dotnet core. When I compile the project, I get errors about the namespaces:

    using Umbraco.Web.WebApi;
    using Umbraco.Web.Editors;
    using Umbraco.Core.Persistence;
    using Umbraco.Core.Scoping;
    

    I have tried searching around in the forum to see if there was anyone who have tried the same as me, but no luck.

    I'm a newbie in building my own stuff in dotnet and right here, i'm pretty stuck! :)

    Can anyone help me with updating the code or point me in the right direction about how to do it?

    Any help is appreciated :)

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 03, 2023 @ 15:31
    Huw Reddick
    0

    That step should probably be

    using Umbraco.Cms.Web.BackOffice.Controllers;
    using Umbraco.Cms.Web.Common.Attributes;
    
    namespace My.Controllers
    {
        [PluginController("My")]
        public class PersonApiController : UmbracoAuthorizedJsonController
        {
            // we will add a method here later
        }
    }
    
  • Caley 14 posts 125 karma points
    Aug 04, 2023 @ 07:15
    Caley
    0

    Thanks Huw!

    Unfortunately it now results in the error "The type or namespace name 'Web' does not exist in the namespace 'Umbraco'"

    I have no clue why or what to do, can you help me out?

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 04, 2023 @ 07:33
    Huw Reddick
    0

    What exact version of Umbraco are you using?

  • Caley 14 posts 125 karma points
    Aug 04, 2023 @ 07:41
    Caley
    0

    Im using Umbraco 12.0.1

    And the file is located in ~/App_Code/PersonApiController.cs

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 04, 2023 @ 08:01
    Huw Reddick
    0

    Are you using Visual Studio?

    If so does your project look similar to this

    enter image description here

  • Caley 14 posts 125 karma points
    Aug 04, 2023 @ 08:08
    Caley
    0

    I am using VS Code

    And my project looks like this

    enter image description here

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 04, 2023 @ 09:06
    Huw Reddick
    0

    Mmmm, can't see any reason it wouldn't work, the code i posted is definitely correct, I just tested in 12.0.1

  • Caley 14 posts 125 karma points
    Aug 04, 2023 @ 10:39
    Caley
    0

    Well – now i I tried on a fresh 12.0.1 and now I get no errors.

    Thanks Huw :)

Please Sign in or register to post replies

Write your reply to:

Draft