0
votes

Ok as the name stated Umbraco 4 Fileservice, but I dont think FileService works on umbraco 4.

I have an Umbraco 4 project where I need to get all my templates, I need to extract their name, aliases, parent template and the content for personal use, but I dont know how to get all of them, in Umbraco 6 and 7 it was easy using FileService but I am on Umbraco 4.

I hope somebody here can help me to do this in Umbraco 4, because I really need to get all those templates, not only templates but also some items like macroscripts.

(please dont advise about creating packages I dont want to use that)

Thanks a lot

1
I believe uSync can export that for you (if you can find the old V4 version). - Jannik Anker
Thanks, I want my own version for some reason - user5002462
"Some reason"? Excellent. - Jannik Anker
Example: I dont have ftp / server access to the live site (umbraco 4), so I dont want to install any packages that might break the site, so only solution is to insert some script on one of the master pages. Another reason, I want to enhance my skills on manipulating the backend of umbraco 4 so I can use it later. Too many reason so I will call it instead as "some reason" - user5002462
If you need a sorting function you're also writing your own? :) uSync is one of the most popular packages for Umbraco now and it's doing awesome job with transfering content of sites between instances. You can also check Umbraco Courier which is a commercial package and it's also available for older Umbraco versions (it costs 99 EUR per domain): our.umbraco.org/projects/umbraco-pro/umbraco-courier-2. If you want to do it in "hardcore way", go with pure SQL queries ;) - Marcin Zajkowski

1 Answers

0
votes

If you can't/won't use uSync, you'll need to write your own code to do it. The FileService was introduced in 6 I think, so it doesn't work in 4.

To get all of the templates in code, you would do something like this:

var templates = umbraco.cms.businesslogic.template.Template.GetAllAsList();

foreach (var item in templates)
{
    //template alias
    item.Alias;
    //parent id
    item.ParentId;
    //the path to the master file so you can get using system.io
    item.TemplateFilePath;
    //the name of the template
    item.Text;
}