I have made a few HTML files which I intend to use as either email templates or schemas.
When I run this code:
var t = "Not found!";
SPSecurity.RunWithElevatedPrivileges(() =>
{
using (var site = new SPSite(spSite.ID))
{
var web = site.RootWeb;
var file = web.GetFile("/_layouts/email/" + template + ".html");
t = Encoding.Default.GetString(file.OpenBinary());
}
});
return t;
my method returns this error: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Is it not possible to get files from /_layouts/ when not logged in?