メッセージを個人用フォルダにアーカイブするために使用するVBAスクリプトがあります。通常のメッセージではうまく動作しますが、暗号化されたメッセージに遭遇するたびに、「あなたのデジタルID名は、基礎となるセキュリティシステムでは見つかりません」というランタイムエラーが発生します。メッセージを移動するVBAスクリプトは暗号化されたメッセージを処理できません
暗号化されたメッセージを移動するようにコードを調整するにはどうすればよいですか?
Public Sub MoveToArchive()
Dim objOutlook As Outlook.Application
Dim objSourceNamespace As Outlook.NameSpace
Dim objDestNamespace As Outlook.NameSpace
Dim objSourceFolder As Outlook.MAPIFolder
Dim objDestFolder As Outlook.MAPIFolder
Dim objVariant As Variant
Dim lngMovedMailItems As Long
Dim intCount As Integer
Dim strDestFolder As String
' Create an object for the Outlook application.
Set objOutlook = Application
' Retrieve an object for the MAPI namespace.
Set objSourceNamespace = objOutlook.GetNamespace("MAPI")
Set objDestNamespace = objOutlook.GetNamespace("MAPI")
' Retrieve a folder object for the source folder.
Set objSourceFolder = objSourceNamespace.Folders("Mailbox - Me").Folders("Deleted Items")
Set objDestFolder = objDestNamespace.Folders("Archive - Current Year").Folders("Deleted Items")
' Loop through the items in the folder. NOTE: This has to
' be done backwards; if you process forwards you have to
' re-run the macro an inverese exponential number of times.
For intCount = objSourceFolder.Items.Count To 1 Step -1
' Retrieve an object from the folder.
'Debug.Print objSourceFolder.Items.Item(intCount)
Set objVariant = objSourceFolder.Items.Item(intCount)
' Allow the system to process. (Helps you to cancel the
' macro, or continue to use Outlook in the background.)
DoEvents
' Filter objects for emails or meeting requests.
If objVariant.Class = olMail Or objVariant.Class = olMeetingRequest Then
' This is optional, but it helps me to see in the
' debug window where the macro is currently at.
' Debug.Print objVariant.SentOn
' Move the object to the destination folder.
objVariant.Move objDestFolder
' Just for curiousity, I like to see the number
' of items that were moved when the macro completes.
lngMovedMailItems = lngMovedMailItems + 1
End If
Next
' Display the number of items that were moved.
' MsgBox "Moved " & lngMovedMailItems & " messages(s)."
End Sub
私は自己署名したマクロを持っていますが、私にとっては次のエラーが出ます: '実行時エラー '-2147217663(80040f01)':このデジタル署名された電子メールには領収書要求があり、 UIレスモード。 – user1537366