Create New PST in Ruby

Aspose.Email - Create New PST

To Create new PST using Aspose.Email Java for Ruby, simply invoke CreatePST module. Here you can see example code.

Ruby Code

 data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

\# Create an instance of PersonalStorage

pst = Rjb::import('').create(data_dir + "sample1.pst", 0)

\# Create a folder at root of pst


\# Add message to newly created folder

mapi_message = Rjb::import('')

pst.getRootFolder().getSubFolder("myInbox").addMessage(mapi_message.fromFile(data_dir + "Message.msg"))

puts "Created PST successfully."

Download Running Code

Download Create New PST (Aspose.Email) from any of the below mentioned social coding sites: