How to disable the Pop up of outlook warning when use AddStore.

  • Thread starter Thread starter KAKA
  • Start date Start date
K

KAKA

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNameSpace("MAPI")
objNS.AddStore objFile.Path
 
I am using VB script, and extend MAPI to add. store do this.
But could not get rid of the warning.
Thanks.
 
How exactly are you using Extended MAPI from VBS?
Do you mean the security prompt displayed by OOM or the password prompt that
gets displayed by the password protected PST files?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I use the following code to access PST files(not mounted in Outlook 2000) as
addstore, but it still pop up a mesage box.
Ask me to select one or ten minutes to access outlook. I could not disable it.

---
Sub Main()
strWorkingFolder = WScript.Arguments(0)'GetFileDir("Please select the PST
files folder")
If Not IsNull(strWorkingFolder) And Len(strWorkingFolder)>0 Then
'Get the files from the chosen folder and process all PST files
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWorkingFolder = objFSO.GetFolder(strWorkingFolder)
Set colFiles = objWorkingFolder.Files
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNameSpace("MAPI")
Dim objFile
cntSeries=100000
For Each objFile In colFiles
If UCase(objFSO.GetExtensionName(objFile.Path)) = "PST" Then
strDestination = Mid(objFile.Path,1,InStrRev(objFile.Path,".")-1)
If Not objFSO.FolderExists(strDestination) Then
objFSO.CreateFolder(strDestination)
End If
strLogFile = strDestination & "\ExportLog.txt"
objNS.AddStore objFile.Path
Set objNewFolder = objNS.Folders.GetLast
ProcessFolder objNewFolder
WriteToLog strLogFile,"Processing File " & objFile.Name & "Completed
normally."

'Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objFile = objFSO.CreateTextFile
(Replace(objFile.Path,objFile.Name,"mail.txt" )
'objFile.Close
'Err.Clear
'? why fore remove
objNS.RemoveStore objNewFolder
End If
'Set objFile = Nothing
Next
Set objNewFolder = Nothing
Set objNS = Nothing
MsgBox "All files processed!" & vbCrLf & "Files are located in
subfolders of the selected folder." & vbCrLf & "View the logfile in each PST
files folder to see any errors."
Else
MsgBox "No PST files in the folder selected!"
End If


Set objFolder = Nothing
Set objNewFolder = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Sub
 
Firstly, it is not guaranteed that the last folder in the Namespace.Folders
colelction will be the folder that you have just added.
Secondly, Namespace.AddStore is not blocked. What does ProcessFolder sub do?
What happens if you comment it out?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I use this ProcessFolder to process the added PST file folder to output the
all emails to TXT files. When do this, it pop up the Security guard warning
to ask me how long I will access Outlook. I want to get rid of it, but don't
know how.
 
Yes, I had read this article before.
First, I need to use addStore to mounted PST files to Outlook,
Second, so that I can use MailItem.SaveAs to save mail to TXT files.
Whether is there a way to solve the security guard problem of free tools?
I don't want to use unfree tools or dll.
Thanks.
 
Firstly, AddStore is irrelevant as it does not raise any prompts, it looks
like only SaveAs does in your case.
Secondly, your only other option is to use Extended MAPI (C++/Delphi) to
extract properties one at a time and create a TXT file explicitly in your
code.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Yes. I want collect the sender name it pop the security warning when SaveAs.
Is there another way to solve by vb script?
 
No, all of your options are listed at
http://outlookcode.com/article.aspx?id=52
The only way to avoid the prompts is to either use Extended MAPI (cannot do
that directly in a script, so third party libraies are the only solution),
or run your code in a COM add-in (you can write it in VB6 or any .Net
language), which gives you a trusted version of the Outlook.Application
which does not raise any security prompts.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top