The OFT file is an MSG file with a different class GUID. The MSG file is an OLE Storage (IStorage) file.
Since the MSG file format is documented , you can create an MSG file with a CLSID {0006F046-0000-0000-C000-000000000046} instead of from {00020D0B-0000-0000-C000-000000000046}.
You can also use Redemption - its RDO family of objects can be used in the service, you just need to make sure that Outlook is installed with the appropriate bitness (Redemption uses the MAPI system installed by Outlook, and not the Outlook object model, which cannot be used in the service).
VB script:
set Session = CreateObject("Redemption.RDOSession") set Msg = Session.CreateMessageFromMsgFile("c:\Temp\TestMsg.msg") Msg.Body = "This is a test template" Msg.Subject = "Template" Msg.Save Msg.SaveAs "c:\Temp\TestTemplate.oft", olTemplate
C # (from the top of the head):
Redemption.RDOSession rSession = new Redemption.RDOSession(); Redemption.RDOMail Msg = rSession.CreateMessageFromMsgFile("c:\Temp\TestMsg.msg"); Msg.Body = "This is a test template"; Msg.Subject = "Template"; Msg.Save(); Msg.SaveAs("c:\Temp\TestTemplate.oft", Redemption.rdoSaveAsType.olTemplate);
source share