I am able to select default templates in the creation of SharePoint sites but I am unaware on how to create a template from an existing site and use it for the creation of a new site?
This basically consists of following steps:
- Save site as a template in Solutions Gallery
- Download the site template from solutions gallery to a file.
- Upload the site template file to solution gallery
You may find these links helpful:
It seems you talk about site collection template and not site template. Moreover, you will avoid many of SharePoint problems creating a web from a template (not supported if publication activated; export as template fails if one of the url in template is "#"; import fails if news webpart user...). I cannot understan why it is not easier to create a web template to reuse, it is one of the best SharePoint feature but it is hell to implement.
So: use backup-restore functions; in powershell, Backup-SPSite ... and Restore-SPSite. In C#, you can find the equivalent, but finding the right access rights level for the user on database and so on is quite sport.