Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET Outlook
I am currently working on an application that can extract items from PST files and save it to a specified location. Right now I am using provided Microsoft.Office.Outlook.Interop to do this.
 
Here is some code that I use to save a contact Item. The code is similar for all the items that I am using.
 
Dim objitem As Object
If TypeOf objItem Is Outlook.ContactItem Then
            'Get out contacts
            ContactItem = CType(objItem, Outlook.ContactItem)
            strSaveName = (ContactItem.FullName.ToString) & ".vcf"
            ContactItem.SaveAs(strFolderPath & "\" & (strSaveName),   Outlook.OlSaveAsType.olVCard)
        End If
 
However when I try to save the item using the SaveAs() method, the security prompt will popup asking me to allow the application to use Outlook for a certain period of time. (1,5,10 min) if I am not wrong. I understand that Outlook redemption can bypass this. How should I do it?
 
Regards,

Adeeb
Posted 21-Aug-12 16:34pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Why don't you ask the guys who made Redemption?? Here's the link[^].
 
After all, they would know the product better than anyone here.
 
If you have specific questions about a 3rd party library, you're best source of information on how to use that library is the manufacturer of it.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I have already tried asking but so far I've had no reply. My email might have gotten lost somewhere. Anyway I have found a dirty walkaround.
 
Basically I have to edit the registry key that controls the ObjectModelGuard. Using VB.net I set it to 0 like so*:
 
regvalue = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Outlook\Security", "ObjectModelGuard", Nothing)
                If regvalue = Nothing Or regvalue = 0 Then
                    My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Outlook\Security", "ObjectModelGuard", 2)
                End If
 

Easy peasy. Outlook redemption is probably safer though but I think this tiny piece of code is worth not going through all the trouble of declaring everything as safeobjects.
 
Regards,
 
Adeeb
 
*Note that this only works for 64 bit computers running Outlook 2010.
 
32 bit computers do not have the Wow6432Node so the registry key to alter will probably be
 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Outlook\Security
 
Also if you are not running Outlook 2010 but 2007 or earlier this key might be in 12.0 (2007) or even 11.0(I don't know what version this is)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 22 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100