Search code examples
razorumbraco7

Umbraco 7 macro script, get node by id fails


i been trying to get a node by a id with razor in a marco but can't get it to work with all the samples.

My code look like this

@using umbraco.MacroEngines
@inherits umbraco.MacroEngines.DynamicNodeContext

@{
    var temp = Parameter.myFolderId;
    @temp;
    var node = @Library.NodeById(temp);

}

I got the temp's value, but i can't get the node.

i also tried it like this

var node = @Model.NodeById(temp);

The only error Umbraco shows is

Error loading MacroEngine script (file: myfile.cshtml)

I'm kinda new to Umbraco, so i could be a rookie mistake


Solution

  • Found the problem.

    There was a problem with my indexes following this thread