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
Hi Guys,
Is it possible to get a template ID by a given template alias?
Many thanks,
Damien
I had a quick look and the FileService has a GetTemplate method with an overload that takes an alias as parameter.
ITemplate Umbraco.Core.Services.FileService.GetTemplate(string alias)
Depending on where you call this from you can access either via :
ApplicationContext.Services.FileService
OR if you're in a SurfaceController
Services.FileService
I haven't tried it myself but its worth a look - here's the link to the relevant FileService page
Don't think there's a way to get the Id without first retrieving the template object though.
HTH
Ver
Hi Veronica,
Thank you so much for this info, sounds like it might be exactly what I need! I'll look into it.
All the best,
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Possible to get a template id by alias
Hi Guys,
Is it possible to get a template ID by a given template alias?
Many thanks,
Damien
I had a quick look and the FileService has a GetTemplate method with an overload that takes an alias as parameter.
Depending on where you call this from you can access either via :
OR if you're in a SurfaceController
I haven't tried it myself but its worth a look - here's the link to the relevant FileService page
Don't think there's a way to get the Id without first retrieving the template object though.
HTH
Ver
Hi Veronica,
Thank you so much for this info, sounds like it might be exactly what I need! I'll look into it.
All the best,
Damien
is working on a reply...