Create New PST in Jython

Aspose.Email - Create New PST

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

Jython Code

 from aspose-email import Settings

from import MapiMessage

from import NoteColor

from import PersonalStorage

from import FileFormatVersion

from import StandardIpmFolder

from java.util import Date

from java.util import Calendar

class CreatePST:

    def __init__(self):

        dataDir = Settings.dataDir + 'ProgrammingOutlook/WorkingWithOutlookPersonalStorage/CreatePST/'

        # Create an instance of PersonalStorage


        pst = personalStorage.create(dataDir + "sample1.pst", 0)

        # Create a folder at root of pst


        # Add message to newly created folder

        mapi_message = MapiMessage()

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

        print "Created PST successfully."

if __name__ == '__main__':        


Download Running Code

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