Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Add Msg File to PST
WhatsApp
Kapil Soni
11y
18
k
0
0
25
Blog
To Add physical MSG files to PST and generate PST we need to follow below steps:
Add Com library Microsoft.Office.interop.outlook
Create object of COM Object MailItem,Namespace,Application
ns(object of namespace) = app(object of Applciation).GetNamespace("MAPI")
ns.AddStoreEx(newPstFileLocation, OlStoreType.olStoreUnicode)
For Each store As Store In ns.Session.Stores
If store.FilePath = newPstFileLocation Then
newPST = store
End If
Next
Object of MAPI Folder Ex: oFolder
oFolder = newPST.GetRootFolder
.mail = CType(ns.Session.OpenSharedItem(filetobeprocessed), MailItem)
mail.Move(folderInbox)
folderInbox is object of Simple inbox folder and we are adding moving files to folderInbox.
Add msg file to PST
Up Next
Creating Excel File using Interop Services
Ebook Download
View all
Coding Principles
Read by 2.6k people
Download Now!
Learn
View all
Membership not found