Create New PST in Python

Aspose.Email - Create New PST

To Create New PST using Aspose.Email Java for Python, Use following code.

Python Code

\# Create an instance of PersonalStorage

personalStorage = self.PersonalStorage

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

\# Create a folder at root of pst


\# Add message to newly created folder

mapi_message = self.MapiMessage

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

print "Created PST successfully."

Download Running Code

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