-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIMAP-fix.vbs
64 lines (46 loc) · 1.41 KB
/
IMAP-fix.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
' Geïmporteerde IMAP structuur vervangen door IPF.Note
' © 2023 Jan Boezeman voor Microsoft M365 Support
Dim i
MsgBox "Maak alle Outlook items zichtbaar na IMAP-import", vbInfo+vbSystemModal, "IMAP-fix"
Call FolderSelect()
Public Sub FolderSelect()
Dim objOutlook
Set objOutlook = CreateObject("Outlook.Application")
Dim F, Folders
Set F = objOutlook.Session.PickFolder
If Not F Is Nothing Then
Dim Result
Result = MsgBox("Wilt u alle onderliggende mappen ook repareren?", vbYesNo+vbDefaultButton2+vbSystemModal, "Alle mappen?")
i = 0
FixIMAPFolder(F)
If Result = 6 Then
Set Folders = F.Folders
LoopFolders Folders
End If
Result = MsgBox("Klaar!" & vbNewLine & i & " map(pen) zijn hersteld.", vbInfo+vbSystemModal, "IMAP mappen hersteld")
Set F = Nothing
Set Folders = Nothing
Set objOutlook = Nothing
End If
End Sub
Private Sub LoopFolders(Folders)
Dim F
For Each F In Folders
FixIMAPFolder(F)
LoopFolders F.Folders
Next
End Sub
Private Sub FixIMAPFolder(F)
Dim oPA, PropName, Value, FolderType
PropName = "http://schemas.microsoft.com/mapi/proptag/0x3613001E"
Value = "IPF.Note"
On Error Resume Next
Set oPA = F.PropertyAccessor
FolderType = oPA.GetProperty(PropName)
'MsgBox (F.Name & " - " & FolderType)
If FolderType = "IPF.Imap" Then
oPA.SetProperty PropName, Value
i = i + 1
End If
Set oPA = Nothing
End Sub