Click here to Skip to main content
15,886,014 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

VB
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

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.
 
Share this answer
 
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*:

VB
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)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900