I've created my first custom Umbraco 5.1 solution. At this point I have a content item ("homepage") with a custom template which has a custom partial macro on it. Now how do I load an entity using the Umbraco
helper? I've tried adding several HiveId
constructions using a Uri
, however I keep getting the same error:
Parameter 'other' must be of type Guid to convert to a Guid CLR type, but it is 'Uri', with value: xxx
Macro partial:
@inherits PartialViewMacroPage @using Umbraco.Cms.Web @using Umbraco.Cms.Web.Macros @using Umbraco.Framework @{ //All these fail with the same error message... //Based on name: var p = Umbraco.GetContentById( new HiveId( new Uri("content://Homepage"))); //Based on path var p = Umbraco.GetContentById( new HiveId( new Uri("content://p__nhibernate/v__guid/5a4abe489a2e47858bd2a0580180b683"))); //With custom Hive provider (I've added this using a custom tree/section and products show up, so the hive provider works) var p = Umbraco.GetContentById( new HiveId( new Uri("custom://products/1"))); }
Why are you creating a Uri?
The
HiveId
accepts a string parameter which you can use instead. So doesUmbraco.GetContentById(string id)
I am Umbraco 5 certified and we never used the
Uri
overload of theHiveId
constructor.Also where are you getting your HiveId from?