none
Creating Add-in for Customised Archiving Action RRS feed

  • Question

  • I am currently working on a project that requires some customised archive actions.

    I have been searching around but didn't find any leads to creating pst files programmatically.

    Hence I'm now wondering if it's possible and if so, are there any known references for me to follow?

    Thanks in advanced.

    Expected requirements for the project:

    - One pst file (with date rules) for one folder


    Sunday, April 1, 2012 6:44 AM

Answers

  • If you're using the Outlook object model you can add a PST file to a running Outlook session. Look at the NameSpace.AddStoreEx() method. You supply a file path for the PST file and specify the type of PST. If it doesn't already exist it will be created.

    --
    Ken Slovak
    [MVP - Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    Reminder Manager, Extended Reminders, Attachment Options
    http://www.slovaktech.com/products.htm
     
     
    "Yang Zhi Xiong" <=?utf-8?B?WWFuZyBaaGkgWGlvbmc=?=> wrote in message news:3bd14aea-df57-4a61-82e4-9f964111d3f3...

    Dear Tom,

    I'm good with the arrangement.

    Thank you for your assistance and hope to hear from you and your team soon.

    My e-mail is yzx92@hotmail.com just in case your team wants to contact me via e-mail.


    Ken Slovak MVP - Outlook
    Wednesday, April 4, 2012 5:06 PM
    Moderator
  • And once you added the PST stores, you should be able to set per-folder archiving options using MAPIFolder.PropertyAccessor.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!

    Wednesday, April 4, 2012 5:37 PM

All replies

  • Hi Yang,

    Thanks for posting in the MSDN Forum.

    I think I'm not aware of your scenario clearly. I'm suppose you want to create a pst file via Outlook PIA, is it right? If it is right, I will tell you that your goal is hard to address. Outlook PIA doesn't provide such kind of function.

    As usual, we are able to use MAPI C++ to create a pst file. This is a reference: http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/0e301df9-db53-450e-b3f0-993426cdee82. I hope it can help you.

    And Would you some me more details about "One pst file (with date rules) for one folder"?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 2, 2012 7:55 AM
    Moderator
  • Dear Tom,

    Thank you for making a response into my query.

    I have read through the MAPI C++ reference that you have attached in your response and to my best understanding it does not really help to achieve my purpose, or rather I would say I'm currently not a C++ person hence I might not get the whole idea of the snippet provided.

    And yes, my initial intention was to work with Outlook PIA (or possibly OOM) but after reading your response it seems that I have to make derivative work from the MAPI C++ reference you have given.

    However to further elaborate my situation that you have probed, the action flow of the said requirement would be:

    1. User clicks on "Archive" button in a ribbon tab (this set of controls belongs to an add-in)
    2. Then my add-in will loop through each folder, find e-mails that are received before certain date, then archive the e-mails found into .pst files based on their folder structures.

    Some examples:

    1. Loop through Folder A, find e-mails that are received before 01-Jan-2012, archive them into the file Folder_A_Archive.pst.
    2. Loop through Folder C, find e-mails that are received before 01-Jan-2012, archive them into the file Folder_C_Archive.pst.

    Any help/references would be greatly appreciated.


    Monday, April 2, 2012 2:04 PM
  • Hi Yang,

    I will involve some experts into this issue to help you due to MAPI C++ is more complex than OOM. There might be some time delay, thanks for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, April 3, 2012 5:25 AM
    Moderator
  • Dear Tom,

    I'm good with the arrangement.

    Thank you for your assistance and hope to hear from you and your team soon.

    My e-mail is yzx92@hotmail.com just in case your team wants to contact me via e-mail.

    Tuesday, April 3, 2012 11:42 AM
  • If you're using the Outlook object model you can add a PST file to a running Outlook session. Look at the NameSpace.AddStoreEx() method. You supply a file path for the PST file and specify the type of PST. If it doesn't already exist it will be created.

    --
    Ken Slovak
    [MVP - Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    Reminder Manager, Extended Reminders, Attachment Options
    http://www.slovaktech.com/products.htm
     
     
    "Yang Zhi Xiong" <=?utf-8?B?WWFuZyBaaGkgWGlvbmc=?=> wrote in message news:3bd14aea-df57-4a61-82e4-9f964111d3f3...

    Dear Tom,

    I'm good with the arrangement.

    Thank you for your assistance and hope to hear from you and your team soon.

    My e-mail is yzx92@hotmail.com just in case your team wants to contact me via e-mail.


    Ken Slovak MVP - Outlook
    Wednesday, April 4, 2012 5:06 PM
    Moderator
  • And once you added the PST stores, you should be able to set per-folder archiving options using MAPIFolder.PropertyAccessor.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!

    Wednesday, April 4, 2012 5:37 PM
  • Dear Ken and Dmitry,

    Your advices seem to be a promising head start for me.

    I will work on them during this coming weekend and update you about the progress again.

    Thank you!

    Wednesday, April 4, 2012 11:46 PM
  • Hi all,

    @Tom: thanks for the attempt to help me clear my doubts.

    @Ken: thanks for providing the right term for me to research on. This in in fact my first project on Outlook add-in hence I'm bad at the terminologies required to work with the OOM. I'm now able to loop through each store to manipulate the folders within them.

    @Dmitry: instead of manipulating the folder's archive properties, I used the Find method to get the 'ReceivedTime' property, then move them to the desired folder in the PST.

    The current state of my project looks good now and would probably be enhanced for more functionality for custom archiving.

    Thanks!




    Saturday, April 7, 2012 5:45 AM