Replacing the PST header

Posted by Ajayk3 under C# on 10/2/2015 | Points: 10 | Views : 1174 | Status : [Member] | Replies : 3
Hi Friends,

Is it possible that i can remove the header of my PST file(Outlook file) and put my own header (Let's say take the header information from any other PST file).

Actually my requirement is like

1) Let's say i have one corrupted PST file due to incorrect header information

2) I take this file and just replace the header information so that it get's auto corrected.

Any Hint will be really appreciated. From where i have to start?




Responses

Posted by: Rajnilari2015 on: 10/5/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
1
Down
You should be able to do it by using PropertyAccessor object (https://msdn.microsoft.com/en-us/library/office/ff862751.aspx )
e.g.
Outlook.MailItem m = default(Outlook.MailItem);

Outlook.PropertyAccessor pa = default(Outlook.PropertyAccessor);
m = Application.CreateItem(olMailItem);
m.Subject = "Test " + DateAndTime.Now;
m.Body = m.Subject;
pa = m.PropertyAccessor;
pa.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/NewProp", "TestValue");

If you look at the received message's header, you'll see that it contains a property named NewProp with value TestValue
More over, you can look into this discussion http://www.outlookcode.com/threads.aspx?forumid=5&messageid=27515 for more explanation.

Hope this will give you a right gear to get the speed.

Thanks

--
Thanks & Regards,
RNA Team

Ajayk3, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Crniranjanraj on: 10/4/2015 [Member] Starter | Points: 25

Up
0
Down
Bro, U can try playing with Outlook.PropertyAccessor. Here is something http://stackoverflow.com/questions/21627836/setting-custom-header-in-outlook-mailitem

Ajayk3, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Crniranjanraj on: 10/4/2015 [Member] Starter | Points: 25

Up
0
Down
Here is another http://www.outlookcode.com/threads.aspx?forumid=5&messageid=27515

Ajayk3, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response