Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
var udi = Udi.Parse(test); var page = Services.ContentService.GetById(Guid.Parse("ac0a00738fbb43d3b6ebd01928d61051")); string teee = page.GetValue("CarDetailsTitle").ToString();
Hi,
Why would you need to convert the UDI to a Guid? You can just do a getbyid with a UDI.
-Joep
Actually, in order to use the ContentService/MediaService, you can't just pass in a UDI, you need to convert it to a GuidUdi first. See: UDI and ContentService / GetValue<>
new GuidUdi(new Uri(thisUDIAsString)).Guid
For anyone who lands here searching for how to get the UDI you can do the following:
var udi = new GuidUdi(node.ContentType.ItemType.ToString(), node.Key);
Otherwise, you can simply use the UmbracoHelper to get published content:
var page = Umbraco.Web.Composing.Current.UmbracoHelper.Content(int Id);
Please note there are method overrides for Content so you can get Content by:
I hope that helps.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
From UDI to Guid
Hi,
Why would you need to convert the UDI to a Guid? You can just do a getbyid with a UDI.
-Joep
Actually, in order to use the ContentService/MediaService, you can't just pass in a UDI, you need to convert it to a GuidUdi first. See: UDI and ContentService / GetValue<>
new GuidUdi(new Uri(thisUDIAsString)).Guid
For anyone who lands here searching for how to get the UDI you can do the following:
Otherwise, you can simply use the UmbracoHelper to get published content:
Please note there are method overrides for Content so you can get Content by:
I hope that helps.
is working on a reply...