How to get an item's UDI without hitting the database?
Hi,
Trying to find how to get an items unique identifier - used to be an integer but now an Umbraco formatted string e.g. umb://document/4fed18d8c5e34d5e88cfff3a5b457bf2
I have an Author/Content set up and store the Author as a ContentPicker2 - which stores the item as the new UDI. However, I now have an Examine index set up to look at my Author property.
On the Author Profile page, I use this Examine Index to find the content attributed to that Author. How can I find the UDI of the Author's page to then pass to Examine?
Please let me know if what you propose requires a trip to the database as I'd prefer to avoid as many of those as possible!
I needed to do this on an APIController perceptive, discovered this today that seems to format the UDI properly, including getting rid of those pesky dashes from the guid
IPublishedContent page = _helper.UmbracoContext.ContentCache.GetById(1156);
var udi = new GuidUdi("document", Model.Content.GetKey());
How to get an item's UDI without hitting the database?
Hi,
Trying to find how to get an items unique identifier - used to be an integer but now an Umbraco formatted string e.g.
umb://document/4fed18d8c5e34d5e88cfff3a5b457bf2
I have an Author/Content set up and store the Author as a ContentPicker2 - which stores the item as the new UDI. However, I now have an Examine index set up to look at my Author property.
On the Author Profile page, I use this Examine Index to find the content attributed to that Author. How can I find the UDI of the Author's page to then pass to Examine?
Please let me know if what you propose requires a trip to the database as I'd prefer to avoid as many of those as possible!
Thanks Simon
Hi Simon
Past days this code helped me a lot to get udi of iPublishedContent:
Thanks Alex - great solution!
I needed to do this on an APIController perceptive, discovered this today that seems to format the UDI properly, including getting rid of those pesky dashes from the guid
Ref: https://our.umbraco.org/apidocs/csharp/api/Umbraco.Core.GuidUdi.html
Hi,
Here is how I do it
is working on a reply...