Copied to clipboard

Flag this post as spam?

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


  • Oumarou Dicko 5 posts 85 karma points
    May 27, 2019 @ 14:44
    Oumarou Dicko
    0

    Create page from content template (blueprint) - Cannot run a repository without an ambient scope

    Hello,

    I am trying to create a content page from a content template but it is throwing this exception : System.InvalidOperationException: Cannot run a repository without an ambient scope. This is the code i am using:

    var bluePrints = Services.ContentService.GetBlueprintsForContentTypes(new int[] { 1183 });
    var myBluePrint = bluePrints.FirstOrDefault(b => b.Name == "TestJobPageContentTemplate");
    var content = Services.ContentService.CreateContentFromBlueprint(myBluePrint, "MDS");
    

    I found this issue (https://github.com/umbraco/Umbraco-CMS/issues/4774) on github with the same exception but it was when creating a node from the CMS.

    Thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies