Outlook instructions from other programs

1 Access to Outlook

2 Email properties

3 Email-drafts

4 Emails in PostOUT

5 Sent emails

6 Received emails

7 Contacts

8 Distributionlist

9 Notes

10 Appointments

11 Meeting requests

12 Tasks

13 Taskrequests

14 Journalitems

15 Post items
1 Access to Outlook
1.1.1 Not loaded: CreateObject
1.1.2 Outlook loaded: Getobject
1.1.3 Load Outlook-VBA-library

1.2 Defaultfolders in Outlook
1.2.1 Inventory of folders

1.3 Standarditems in Outlook
1.3.1 Inventory of standard items

2 VBA commands in Outlook
2.0 Email properties

3 Email-drafts
3.1.1 New email draft
3.1.2.1 to several addresses
3.1.2.2 to several CC-addresses
3.1.2.3 to several BCC-addresses
3.1.3.1 add TO recipients
3.1.3.2 add CC recipients
3.1.3.3 add BCC recipients
3.1.4 add attachments
3.2.1 read
3.2.2 move
3.2.3 delete
3.2.4 adapt
3.3.1 filter and read
3.3.2 filter and move
3.3.3 filter and delete
3.3.4 filter and adapt
3.4.1 find and read
3.4.2 find and move
3.4.3 find and delete
3.4.4 find and adapt

4 Emails in PostOUT
4.1 New email
4.1.1 New email with HTML
4.2.1 read
4.2.2 move
4.2.3 delete
4.2.4 adapt
4.3.1 filter and read
4.3.2 filter and move
4.3.3 filter and delete
4.3.4 filter and adapt
4.4.1 find and read
4.4.2 find and move
4.4.3 find and delete
4.4.4 find and adapt

5 Sent emails
5.1 read
5.2.2 move
5.2.3 delete
5.2.4 adapt
5.3.1 filter and read
5.3.2 filter and move
5.3.3a delete using a loop
5.3.3 filter and delete
5.3.4 filter and adapt
5.4.1 find and read
5.4.2 find and move
5.4.3 find and delete
5.4.4 find and adapt

6 Received emails
6.2.1 read
6.2.2 move
6.2.3 delete
6.2.4 adapt
6.3.1 filter and read
6.3.2 filter and move
6.3.3 filter and delete
6.3.4 filter and adapt
6.4.1 find and read
6.4.2 find and move
6.4.3 find and delete
6.4.4 find and adapt
6.5 save email
6.5.1 first email
6.5.2 all emails
6.6 save attachments
6.6.1 of first email
6.6.2 of all emails
6.6.3 of a specific email
6.7 reply
6.7.1 reply to sender
6.7.2 reply to all recipients

7 Contacts
7.0 Contactitem properties
7.1 New Contact
7.2.1 read
7.2.5 information save as file
7.2.2 move
7.2.3 delete
7.2.4 adapt
7.3.1 filter and read
7.3.2 filter and move
7.3.3 filter and delete
7.3.4 filter and adapt
7.4.1 find and read
7.4.2 find and move
7.4.3 find and delete
7.4.4 find and adapt

8 Distributionlist
8.0 Distributionlist properties
8.1 New distributionlist
8.2.1 read
8.2.2 move
8.2.3 delete
8.2.4 adapt
8.3.1 filter and read
8.3.2 filter and copy
8.3.2 filter and move
8.3.3 filter and delete
8.3.4 filter and adapt
8.4.1 find and read
8.4.2 find and move
8.4.3 find and delete
8.4.4 find and adapt
8.5.1 read 1 contact
8.5.2 read all contacts
8.5.3 add contact
8.5.4 delete contact
8.5.5 delete contact: alt.
8.5.6 filter and delete contact

9 Notes
9.0 Note properties
9.1 New note
9.2.1 read
9.2.2 move
9.2.3 delete
9.2.4 adapt
9.3.1 filter and read
9.3.2 filter and move
9.3.3 filter and delete
9.3.4 filter and adapt
9.4.1 find and read
9.4.2 find and move
9.4.3 find and delete
9.4.4 find and adapt

10 Appointments
10.0 Appointment properties
10.1 New appointment
10.2.1 read
10.2.2 move
10.2.3 delete
10.2.4 adapt
10.3.1 filter and read
10.3.2 filter and move
10.3.3 filter and delete
10.3.4 filter and adapt
10.4.1 find and read
10.4.2 find and move
10.4.3 find and delete
10.4.4 find and adapt
10.4.5 find using several criteria

11 Meeting requests
11.0 Meeting request properties
11.1 New meeting request
11.2.1 read
11.2.2 move
11.2.3 delete
11.2.5 accept tentatively
11.2.6 accept
11.2.7 decline
11.3.1 filter and read
11.3.2 filter and move
11.3.3 filter and delete
11.3.5 filter, accept tentatively
11.3.6 filter and accept
11.3.7 filter and decline
11.3.8 filter and copy
11.4.1 find and read
11.4.2 find and move
11.4.3 find and delete
11.4.5 find, accept tentatively
11.4.6 find and accept
11.4.7 find and decline
11.4.8 find and copy

12 Tasks
12.0 Task properties
12.1 New task
12.2.1 read
12.2.2 move
12.2.3 delete
12.2.4 adapt
12.2.5 find several criteria
12.3.1 filter and read
12.3.2 filter and move
12.3.3 filter and delete
12.3.4 filter and adapt
12.4.1 find and read
12.4.2 find and move
12.4.3 find and delete
12.4.4 find and adapt

13 Taskrequests
13.0 Taskrequest properties
13.1 New taskrequest
13.2.1 read
13.2.2 move
13.2.3 delete
13.2.5 accept tentatively
13.2.6 accept
13.2.7 decline
13.3.1 filter and read
13.3.2 filter and move
13.3.3 filter and delete
13.3.4 filter and adapt
13.3.5 filter, accept tentatively
13.3.6 filter and accept
13.3.7 filter and decline
13.3.8 filter and copy
13.4.1 find and read
13.4.2 find and move
13.4.3 find and delete
13.4.4 find and adapt

14 Journalitems
14.0 Journalitem properties
14.1 New journalitem
14.2.1 read
14.2.2 move
14.2.3 delete
14.2.4 adapt
14.3.1 filter and read
14.3.2 filter and move
14.3.3 filter and delete
14.3.4 filter and adapt
14.4.1 find and read
14.4.2 find and move
14.4.3 find and delete
14.4.4 find and adapt
14.4.5 find

15 Post items
15.0 Postitem properties
15.1 New Post
15.1.1 New Post in specific folder
15.2.1 read
15.2.2 move
15.2.3 delete
15.2.4 adapt
15.3.1 filter and read
15.3.2 filter and move
15.3.3 filter and delete
15.3.4 filter and adapt
15.4.1 find and read
15.4.2 find and move
15.4.3 find and delete
15.4.4 find and adapt
15.4.5 find

1 Access to Outlook

VBA contains 3 methods to gain access to Outlook from another program

1.1.1 Outlook hasn't been loaded: the method CreateObject

with CreateObject("Outlook.Application")
x=.GetNamespace("MAPI").GetDefaultFolder(6).Items.count
End With
Restriction:
'CreateObject' doesn't recognize Outlook typenames, only Outlookconstants.
E.g. the typename of map 'PostIN' is in VBA olFolderInbox; the Outlookconstant for this map is 6.
x=CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.count
Returns an error.

1.1.2 Outlook has been loaded: the method Getobject

With Getobject(,"Outlook.Application")
x=.GetNamespace("MAPI").GetDefaultFolder(6).Items.Count
End With
The method 'GetObject' has the same restrictions to typenames as the method 'CreateObject'.

1.1.3 Load the Outlook-VBA-library

The method 'references': independent whether Outlook has been loaded or not.
manually: VBEditor/ MenuBar / Extra / References / Microsoft Outlook 11.0 Object Library /check
' Outlook 2000
' Outlook 2003
' Outlook 2007
sub referentie()
ThisWorkbook.VBProject.References.AddFromFile "msoutl9.olb"
ThisWorkbook.VBProject.References.AddFromFile "msoutl10.olb"
ThisWorkbook.VBProject.References.AddFromFile "msoutl11.olb"
End sub
After the library has been loaded you can use Outlook as an object
with Outlook
x=.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Count
end with
In this case you can use both Outlook's typenames and Outlookconstants.

The examples in this page use the Method 'CreateObject'.

1.2 Defaultfolders in Outlook

1.2.1 Inventory of defautfolders

' Deleted items (olFolderDeletedItems)
' PostOUT (olFolderOutbox)
' Sent items (olFolderSentItems)
' PostIN (olFolderInbox)
' Calendar (olFolderCalendar)
' Contacts (olfolderContacts)
' Journal (olFolderJournal)
' Notes (olFolderNotes)
' Tasks (olFolderTasks)
' Reminders
' Reminders
' Drafts (olFolderDrafts)
Sub mappen_defaultmappen()
With CreateObject("Outlook.Application").GetNamespace("MAPI")
c01 = .GetDefaultFolder(3).Name
c02 = .GetDefaultFolder(4).Name
c03 = .GetDefaultFolder(5).Name
c04 = .GetDefaultFolder(6).Name
c05 = .GetDefaultFolder(9).Name
c06 = .GetDefaultFolder(10).Name
c07 = .GetDefaultFolder(11).Name
c08 = .GetDefaultFolder(12).Name
c09 = .GetDefaultFolder(13).Name
c10 = .GetDefaultFolder(14).Name
c11 = .GetDefaultFolder(15).Name
c12 = .GetDefaultFolder(16).Name
End With
End Sub

1.3 Standarditems in Outlook

Outlook has a number of standard items
- email
- appointment
- contact
- task
- journal
- note
- 'sticker' (Post-it)
- distributionlist

some items are connected items like
- taskrequest
- meetingrequest

Outlook distinguishes emails according to the folders they are stored in:
- draft email : in folder Drafts GetDefaultFolder(16)
- email : in map PostOUT GetDefaultFolder(4)
- sent email : in map Sent items GetDefaultFolder(5)
- received email : in map PostIN GetDefaultFolder(6)

1.3.1 Inventory of standard items

' email (olMailItem)
' appointment (olAppointmentItem)
' contact/recipient (olContactItem)
' task (olTaskItem)
' journal (olJournalItem)
' note (olNoteItem)
' sticker (olPostItem)
' distributionlist (olDistributionListItem)
Sub items_standarditems()
With CreateObject("Outlook.Application")
.CreateItem(0)
.CreateItem(1)
.CreateItem(2)
.CreateItem(3)
.CreateItem(4)
.CreateItem(5)
.CreateItem(6)
.CreateItem(7)
End With
End Sub

2 VBA commands in Outlook

For every kind of outlookitem all properties will be shown in VBA

For every kind of outlookitem the most common actions will be discussed:

- to create a new item
- to read, adapt, move or delete an exisiting item
- to filter existing items and read, adapt, move or delete those filtered items
- to search for existing items and read, adapt, move or delete the found item(s)

2.0 Email properties

Sub email__properties()
With CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(6).Items(1)
c0 = .Actions.Count
For Each ac In .Actions
d01 = ac.Application
d02 = ac.Class
d03 = ac.CopyLike
d04 = ac.Enabled
d05 = ac.MessageClass
d06 = ac.Name
d07 = ac.Parent
d08 = ac.prefix
d09 = ac.ReplyStyle
d010 = ac.ResponseStyle
d011 = ac.Session
d012 = ac.ShowOn
Next
c01 = .AlternateRecipientAllowed
c02 = .Application
c03 = .Attachments.Count
c04 = .AutoForwarded
c05 = .BCC
c06 = .BillingInformation
c07 = .body
c08 = .Categories
c09 = .CC
c010 = .Class
c011 = .Companies
c012 = .ConversationIndex
c013 = .ConversationTopic
c014 = .CreationTime
c015 = .DeferredDeliveryTime
c016 = .DeleteAfterSubmit
c017 = .entryId
c018 = .ExpiryTime
c019 = .FlagDueBy
c020 = .FlagRequest
c021 = .FlagStatus
C022 = .FormDescription
c023 = .GetInspector
c024 = .HTMLBody
c025 = .Importance
c026 = .LastModificationTime
c027 = .links.Count
c028 = .MessageClass
c029 = .Mileage
c030 = .NoAging
c031 = .OriginatorDeliveryReportRequested
c032 = .OutlookInternalVersion
c033 = .OutlookVersion
c034 = .Parent
c035 = .ReadReceiptRequested
c036 = .ReceivedByEntryID
c037 = .ReceivedByName
c038 = .ReceivedOnBehalfOfEntryID
c039 = .ReceivedOnBehalfOfName
c040 = .ReceivedTime
c041 = .RecipientReassignmentProhibited
c042 = .Recipients.Count
For Each rp In .Recipients
d01 = rp.Name
d02 = rp.address
d03 = rp.Name
Next
c043 = .ReminderOverrideDefault
c044 = .ReminderPlaySound
c045 = .ReminderSet
c046 = .ReminderSoundFile
c047 = .ReminderTime
c048 = .RemoteStatus
c049 = .ReplyRecipientNames
c050 = .ReplyRecipients.Count
c051 = .Saved
c052 = .SaveSentMessageFolder
c053 = .SenderName
c054 = .Sensitivity
c055 = .Sent
c056 = .SentOn
c057 = .sentonbehalfofname
c058 = .Session
c059 = .Size
c060 = .subject
c061 = .Submitted
c062 = .To
c063 = .UnRead
c064 = .UserProperties.Count
c065 = .VotingOptions
c066 = .VotingResponse
End With
End Sub

3 Email-drafts

Email-drafts are the result of 'Save' when making a new email.
The post will be stored automatically in the folder 'Drafts': GetDefaultFolder(16).

3.1.1 New email draft

Sub email_concept_new()
With CreateObject("Outlook.Application").CreateItem(0)
.Subject = "controle"
.To = "snb@forum.eu"
.Save
End With
End Sub

3.1.2.1 New email draft to several addresses

Sub email_concept_new_more_addresses()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "snb@forum.eu;bb@gmail.com;extra@planet.nl"
.Save
End With
End Sub

3.1.2.2 New email draft to several CC-addresses

Sub email_concept_new_more_CCaddresses()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "snb@forum.eu"
.CC = "aaa@webforums.eu;bb@gmail.com;extra@planet.nl"
.Save
End With
End Sub

3.1.2.3 New email draft to several BCC-addresses

Sub email_concept_new_more_BCCaddresses()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "snb@forum.eu"
.BCC = "aaa@webforums.eu;bb@gmail.com;extra@planet.nl"
.Save
End With
End Sub

3.1.3.1 New email draft add recipients

The methode Recipients.Add can only be aplied to existing contacts in the folder Contacts.
Sub email_concept_new_recipients_To_add()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "snb@forum.eu"
.Recipients.Add "aaa@webforums.eu;bb@gmail.com;extra"
.Save
End With
End Sub

3.1.3.2 New email draft add CC recipients

Sub email_concept_new_recipients_CC_add()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "snb@forum.eu"
.Recipients.Add("aaa@webforums.eu;bb@gmail.com;extra").Type = 4
.Save
End With
End Sub

3.1.3.3 New email draft add BCC recipients

Sub email_concept_new_recipients_BCC_add()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "snb@forum.eu"
.Recipients.Add("aaa@webforums.eu;bb@gmail.com;extra").Type = 3
.Save
End With
End Sub

3.1.4 New email draft add attachments

Sub email_concept_attachments_add()
With CreateObject("Outlook.Application").CreateItem(0)
.subject = "controle"
.To = "aaa@webforums.eu"
.attachments.add "E:\OF\bestand1.xls"
.attachments.add "E:\OF\bestand2.xls"
.Save
End With
End Sub

3.2.1 Email draft: read

Sub email_concept_read()
c00 = "controle" 'you can refer to a email draft by its 'subject'.

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items(c00)
c01 = .To
c02 = .subject
c03 = .body
End With
End Sub

3.2.2 Email draft: move to another folder

Sub email_concept_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(16).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

3.2.3 Email draft: delete

Sub email_concept_delete()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items(c00).Delete
End Sub

3.2.4 Email draft: adapt

Sub email_concept_adapt()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items(c00).subject = "new subject"
End Sub
If you want to apply code to several items you can use the 'Filter' method or the 'Find' method

3.3.1 Email drafts: filter and read

Sub email_concepten_filter_read()
c00 = "controle"

For Each it InCreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items.Restrict("[Subject]='" & c00 & "'")
c01 = c01 & "|" & it.body
Next
End Sub

3.3.2 Email drafts: filter and move to another folder

Sub email_concepten_filter_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(16).Items.Restrict("[Subject]='" & c00 & "'")
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

3.3.3 Email drafts: filter and delete

Sub email_concepten_filter_delete()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items.Restrict("[Subject]='" & c00 & "'")
it.Delete
Next
End Sub

3.3.4 Email drafts: filter and adapt

Sub email_concepten_filter_adapt()
c00 = "controle"
c01 = "new subject"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items.Restrict("[Subject]='" & c00 & "'")
With it
.subject = c01
.Save
End With
Next
End Sub

3.4.1 Email draft: find and read

Sub email_concepten_find_read()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items
c01 = .Find("[Subject]='" & c00 & "'").body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

3.4.2 Email drafts: find and move to another folder

Sub email_concepten_find_move()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items
.Find("[Subject]='" & c00 & "'").Move .Application.GetNamespace("MAPI").GetDefaultFolder(3)
Do Until Err.Number <>0
.FindNext.Move .Application.GetNamespace("MAPI").GetDefaultFolder(3)
Loop
End With
End Sub

3.4.3 Email drafts find and delete

Sub email_concepten_find_delete()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items
.Find("[Subject]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

3.4.4 Email drafts find and adapt

Sub email_concepten_find_adapt()
On Error Resume Next

c00 = "controle"
c01 = "new subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(16).Items
With .Find("[Subject]='" & c00 & "'")
.subject = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.subject = c01
.Save
End With
Loop
End With
End Sub

4 Emails in folder PostOUT

Emails are the result of 'Send' when making a new email.
They will be stored automatically in the folder PostOUT: GetDefaultFolder(4) until they have been sent.

4.1 New email

Sub email_new()
With CreateObject("Outlook.Application").CreateItem(0)
.To = "snb@webforums.eu"
.subject = "controle"
.body = "bodytext"
.send
End With
End Sub

4.1.1 New email with HTML

Sub email_new_html()
With CreateObject("Outlook.Application").CreateItem(0)
.To = "snb@webforum.eu"
.subject = "controle blusser A230"
.HTMLBody = "<'a href=""http://office.webforums.eu/"">Office forum"
.Save
End With
End Sub

4.2.1 Email read

You can find an email using its 'subject'
Sub email_read()
c00 = "controle"

c01= CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items(c00).body
End Sub

4.2.2 Email move to another folder

Sub email_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(4).Items(c00).Move .GetDefaultFolder(16)
End With
End Sub

4.2.3 Email delete

Sub email_delete()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items(c00).Delete
End Sub

4.2.4 Email adapt

Sub email_adapt()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items(c00).subject = "new subject"
End Sub

4.3.1 Emails: filter and read

Sub emails_filter_read()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items.Restrict("[Subject]='" & c00 & "'")
c01 = c01 & "|" & it.body
Next
End Sub

4.3.2 Emails: filter and move to another folder

Sub emails_filter_move()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items.Restrict("[Subject]='" & c00 & "'")
it.Move .application.getnamespace("MAPI").GetDefaultFolder(16)
Next
End Sub

4.3.3 Emails: filter and delete

Sub emails_filter_delete()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items.Restrict("[Subject]='" & c00 & "'")
it.Delete
Next
End Sub

4.3.4 Emails: filter and adapt

Sub emails_filter_adapt()
c00 = "controle"
c01 = "new subject"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items.Restrict("[Subject]='" & c00 & "'")
With it
.subject = c01
.Save
end with
Next
End Sub

4.4.1 Emails: find and read

Sub emails_find_read()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items
c01 = .Find("[Subject]='" & c00 & "'").body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

4.4.2 Emails: find and move to another folder

Sub emails_find_move()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(4).Items.Find("[Subject]='" & c00 & "'").Move .GetDefaultFolder(16)
Do Until Err.Number <>0
.GetDefaultFolder(4).Items.FindNext.Move .GetDefaultFolder(16)
Loop
End With
End Sub

4.4.3 Emails: find and delete

Sub emails_find_delete()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items
.Find("[Subject]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

4.4.4 Emails: find and adapt

Sub emails_find_adapt()
On Error Resume Next

c00 = "controle"
c01 = "new subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(4).Items
With .Find("[Subject]='" & c00 & "'")
.subject = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.subject = c01
.Save
End With
Loop
End With
End Sub

5 Sent emails

The folder 'Sent emails' is the result of the sending of all items in folder PostOUT to the mailserver.
All items will be moved automatically to the folder Sent: GetDefaultFolder(5).

5.1 Sent email: read

Sub email_verzonden_read()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items(c00)
c01 = .To & " " & .subject & " " & .body
End With
End Sub

5.2.2 Sent email: move to another folder

Sub email_verzonden_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(5).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

5.2.3 Sent email: delete

Sub email_verzonden_delete()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items(c00).Delete
End Sub

5.2.4 Sent email: adapt

Sub email_verzonden_adapt()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items(c00).subject = "new subject"
End Sub

5.3.1 Sent Emails: filter and read

Sub emails_verzonden_filter_read()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items.Restrict("[Subject]='" & c00 & "'")
c01 = c01 & "|" & it.body
Next
End Sub

5.3.2 Sent Emails: filter and move to another folder

Sub emails_verzonden_filter_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(5).Items.Restrict("[Subject]='" & c00 & "'")
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

5.3.3a Sent emails: delete using a loop

Sub email_verzonden_delete()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items
If it.subject = "controle" Then it.Delete
Next
End Sub

5.3.3 Sent Emails: filter and delete

Sub emails_verzonden_filter_delete()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items.Restrict("[Subject]='" & c00 & "'")
it.Delete
Next
End Sub

5.3.4 Sent Emails: filter and adapt

Sub emails_verzonden_filter_adapt()
c00 = "controle"
c01 = "new subject"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items.Restrict("[Subject]='" & c00 & "'")
With it
.subject = c01
.Save
End With
Next End With
End Sub

5.4.1 Sent Emails: find and read

Sub emails_verzonden_find_read()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items
c01 = .Find("[Subject]='" & c00 & "'").body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

5.4.2 Sent Emails: find and move to another folder

Sub emails_verzonden_find_move()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(5).Items.Find("[Subject]='" & c00 & "'").Move .GetDefaultFolder(3)
Do Until Err.Number <>0
.GetDefaultFolder(5).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

5.4.3 Sent Emails: find and delete

Sub emails_verzonden_find_delete()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items
.Find("[Subject]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

5.4.4 Sent Emails: find and adapt

Sub emails_verzonden_find_adapt()
On Error Resume Next

c00 = "controle"
c01 = "new subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(5).Items
With .Find("[Subject]='" & c00 & "'")
.subject = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.subject = c01
.Save
End With
Loop
End With
End Sub

6 Received emails

Received emails are being stored automatically in folder PostIN: GetDefaultFolder(6).

6.2.1 Received email read

Sub email_ontvangen_read()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00)
c01 = .To & " " & .subject & " " & .body
End With
End Sub

6.2.2 Received email move to another folder

Sub email_ontvangen_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

6.2.3 Received email delete

Sub email_ontvangen_delete()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).Delete
End Sub

6.2.4 Received email adapt

Sub email_ontvangen_adapt()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).subject = "new subject"
End Sub

6.3.1 Received Emails: filter and read

Sub emails_ontvangen_filter_read()
c00 = "controle"

For Each it InWith CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[Subject]='" & c00 & "'")
c01 = c01 & "|" & it.body
Next
End Sub

6.3.2 Received Emails: filter and move to another folder

Sub emails_ontvangen_filter_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(6).Items.Restrict("[Subject]='" & c00 & "'")
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

6.3.3 Received Emails: filter and delete

Sub emails_ontvangen_filter_delete()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[Subject]='" & c00 & "'")
it.Delete
Next
End Sub

6.3.4 Received Emails: filter and adapt

Sub emails_ontvangen_filter_adapt()
c00 = "controle"
c01 = "new subject"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[Subject]='" & c00 & "'")
With it
.subject = c01
.Save
End With
Next End With
End Sub

6.4.1 Received Emails: find and read

Sub emails_ontvangen_find_read()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
c01 = .Find("[Subject]='" & c00 & "'").body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

6.4.2 Received Emails: find and move to another folder

Sub emails_ontvangen_find_move()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items.Find("[Subject]='" & c00 & "'").Move .GetDefaultFolder(3)
Do Until Err.Number <>0
.GetDefaultFolder(6).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

6.4.3 Received Emails: find and delete

Sub emails_ontvangen_find_delete()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
.Find("[Subject]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

6.4.4 Received Emails: find and adapt

Sub emails_ontvangen_find_adapt()
On Error Resume Next

c00 = "controle"
c01 = "new subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
With .Find("[Subject]='" & c00 & "'")
.subject = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.subject = c01
.Save
End With
Loop
End With
End Sub

6.5 Save email

6.5.1 Save first email in PostIn

Sub eerste_ontvangen_email_opslaan()
With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6)
.items(1).SaveAs "G:\OF\" & .items(1).subject & ".msg",3
.items(1).SaveAs "G:\OF\" & .items(1).subject & ".txt",0
End With
End Sub

6.5.2 Save all emails in PostIn

Sub alle_ontvangen_email_opslaan()
With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6)
For Each it in .Items
it.SaveAs "G:\" & it.subject & ".msg"
Next
End With
End Sub

6.6 Save Attachments

6.6.1 Save Attachments of the first email in PostIn

Sub M_snb()
With CreateObject("outlook.application")
For Each it In .GetNamespace("Mapi").GetDefaultFolder(6).Items(0).Attachments
it.SaveAsFile "G:\OF\" & it.Filename
Next
End With
End Sub

6.6.2 Save all attachments of the emails in PostIn

Sub M_snb()
With CreateObject("outlook.application")
For Each it In .GetNamespace("Mapi").GetDefaultFolder(6).Items
For Each it1 In it.attachments
it1.SaveAsFile "G:\OF\" & it1.Filename
Next
Next
End With
End Sub

6.6.3 Save attachments of a specific email in the PostIn

Sub M_snb()
c00="controle"

With CreateObject("outlook.application")
For Each it In .GetNamespace("Mapi").GetDefaultFolder(6).Items(c00).Attachments
it.SaveAsFile "G:\OF\" & it.Filename
Next
End With
End Sub

6.7 Reply

6.7.1 Reply email to sender

Sub M_snb()    
With Application.GetNamespace("MAPI").GetDefaultFolder(6).Items(1).Reply      
.Body = "dit is mijn antwoord"
      .Send
    End With
End Sub

6.7.2 Reply email to all recipients

Sub M_snb()    
With Application.GetNamespace("MAPI").GetDefaultFolder(6).Items(1).ReplyAll      
.Body = "dit is mijn antwoord"
      .Send
    End With
End Sub

7 Contacts

7.0 Contactitem properties

Sub Contact_properties()

' CreateItem (olContactItem)
' CreateItem (2)
' GetDefaultFolder(olFolderContacts)
' GetDefaultFolder(10)
' GetDefaultfolder("Contacts")


With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(1)
c00 = .Account
c01 = .Actions.count
c02 = .Anniversary
c03 = .Application
c04 = .AssistantName
c05 = .AssistantTelephoneNumber
c06 = .Attachments.count
c07 = .BillingInformation
c08 = .Birthday
c09 = .body
c010 = .Business2TelephoneNumber
c011 = .BusinessAddress
c012 = .BusinessAddressCity
c013 = .BusinessAddressCountry
c014 = .BusinessAddressPostalCode
c015 = .BusinessAddressPostOfficeBox
c016 = .BusinessAddressState
c017 = .BusinessAddressStreet
c018 = .BusinessFaxNumber
c019 = .BusinessHomePage
c020 = .BusinessTelephoneNumber
c021 = .CallbackTelephoneNumber
C022 = .CarTelephoneNumber
c023 = .Categories
c024 = .children
c025 = .Class
c026 = .Companies
c027 = .CompanyAndFullName
c028 = .CompanyLastFirstNoSpace
c029 = .CompanyLastFirstSpaceOnly
c030 = .CompanyMainTelephoneNumber
c031 = .CompanyName
c032 = .ComputerNetworkName
c033 = .ConversationIndex
c034 = .ConversationTopic
c035 = .CreationTime
c036 = .CustomerID
c037 = .Department
c038 = .Email1Address
c039 = .Email1AddressType
c040 = .Email1DisplayName
c041 = .Email1EntryID
c042 = .Email2Address
c043 = .Email2AddressType
c044 = .Email2DisplayName
c045 = .Email2EntryID
c046 = .Email3Address
c047 = .Email3AddressType
c048 = .Email3DisplayName
c049 = .Email3EntryID
c050 = .entryId
c051 = .FileAs
c052 = .FirstName
c053 = .FormDescription
c054 = .FTPSite
c055 = .FullName
c056 = .FullNameAndCompany
c057 = .Gender
c058 = .GetInspector
c059 = .GovernmentIDNumber
c060 = .Hobby
c061 = .Home2TelephoneNumber
c062 = .HomeAddress
c063 = .HomeAddressCity
c064 = .HomeAddressCountry
c065 = .HomeAddressPostalcode
c066 = .HomeAddressPostOfficeBox
c067 = .HomeAddressState
c068 = .HomeAddressStreet
c069 = .HomeFaxNumber
c070 = .HomeTelephoneNumber
c071 = .Importance
c072 = .Initials
c073 = .InternetFreeBusyAddress
c074 = .ISDNNumber
c075 = .JobTitle
c076 = .Journal
c077 = .Language
c078 = .LastFirstAndSuffix
c079 = .LastFirstNoSpace
c080 = .LastFirstNoSpaceCompany
c081 = .LastFirstSpaceOnly
c082 = .LastFirstSpaceOnlyCompany
c083 = .LastModificationTime
c084 = .LastName
c085 = .LastNameAndFirstName
c086 = .Links.count
c087 = .MailingAddress
c088 = .MailingAddressCity
c089 = .MailingAddressCountry
c090 = .MailingAddressPostalCode
c091 = .MailingAddressPostOfficeBox
c092 = .MailingAddressState
c093 = .MailingAddressStreet
c094 = .ManagerName
c095 = .MessageClass
c096 = .MiddleName
c097 = .Mileage
c098 = .MobileTelephoneNumber
c099 = .NetMeetingAlias
c0100 = .NetMeetingServer
c0101 = .NickName
c0102 = .NoAging
c0103 = .OfficeLocation
c0104 = .OrganizationalIDNumber
c0105 = .OtherAddress
c0106 = .OtherAddressCity
c0107 = .OtherAddressCountry
c0108 = .OtherAddressPostalCode
c0109 = .OtherAddressPostOfficeBox
c0110 = .OtherAddressState
c0111 = .OtherAddressStreet
c0112 = .OtherFaxNumber
c0113 = .OtherTelephoneNumber
c0114 = .OutlookInternalVersion
c0115 = .OutlookVersion
c0116 = .PagerNumber
c0117 = .Parent
c0118 = .PersonalHomePage
c0119 = .PrimaryTelephoneNumber
c0120 = .Profession
c0121 = .RadioTelephoneNumber
c0122 = .ReferredBy
c0123 = .Saved
c0124 = .SelectedMailingAddress
c0125 = .Sensitivity
c0126 = .Session
c0127 = .Size
c0128 = .Spouse
c0129 = .subject
c0130 = .Suffix
c0131 = .TelexNumber
c0132 = .Title
c0133 = .TTYTDDTelephoneNumber
c0134 = .UnRead
c0135 = .User1
c0136 = .User2
c0137 = .User3
c0138 = .User4
c0139 = .UserCertificate
c0140 = .UserProperties.count
c0141 = .WebPage
c0142 = .YomiCompanyName
c0143 = .YomiFirstName
c0144 = .YomiLastName
End With
End Sub

7.1 New Contact

Sub Contact_new()
With CreateObject("Outlook.Application").CreateItem(2)
.FirstName = "first"
.LastName = "last"
.Email1Address = "snb@forum.eu"
.Save
End With
End Sub

7.2.1 Contact read

Sub Contact_read()
c00 = "Jeroen Spoert" ' = fullname

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
c01 = .FullName & "|" & .Email1Address
End With
End Sub

7.2.5 Contact information save as file

Sub Contact_opslaan_als()
c00 = "Jeroen Spoert"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
.SaveAs "E:\" & .FullName & ".txt", 0
.SaveAs "E:\" & .FullName & ".rtf", 1
.SaveAs "E:\" & .FullName & ".oft", 2
.SaveAs "E:\" & .FullName & ".msg", 3
.SaveAs "E:\" & .FullName & ".vcf", 6
End With
End Sub

7.2.2 Contact move to another folder

Sub Contact_move()
c00 = "Jeroen Spoert"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(10).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

7.2.3 Contact delete

Sub Contact_delete()
c00 = "Jeroen Spoert"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00).Delete
End Sub

7.2.4 Contact adapt

Sub Contact_adapt()
c00 = "Jeroen Spoert"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
.Email2Address = "Jeroen@planeet.eu"
.Save
End With
End Sub

7.3.1 Contacts filter and read

Sub Contacts_filter_read()
c00 = "Jeroen Spoert"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[Fullname]='" & c00 & "'")
c01 = c01 & "|" & it.Email1Address
Next
End Sub

7.3.2 Contacts filter and move to another folder

Sub Contacts_filter_move()
c00 = "Jeroen Spoert"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(10).Items.Restrict("[FullName]='" & c00 & "'")
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

7.3.3 Contacts filter and delete

Sub Contacts_filter_delete()
c00 = "Jeroen Spoert"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[FullName]='" & c00 & "'")
it.Delete
Next
End Sub

7.3.4 Contacts filter and adapt

Sub Contacts_filter_adapt()
c00 = "Bedrijf1"
c01 = "Bedrijf1 BV."

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[CompanyName]='" & c00 & "'")
With it
.CompanyName = c01
.Save
End With
Next
End Sub

7.4.1 Contacts find and read

Sub Contacts_find_read()
On Error Resume Next

c00 = "Bedrijf1"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items
c01 = .Find("[CompanyName]='" & c00 & "'").FullName
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.FullName
Loop
End With
End Sub

7.4.2 Contacts find and move to another folder

Sub Contacts_find_move()
On Error Resume Next

c00 = "Bedrijf1"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(10).Items.Find("[CompanyName]='" & c00 & "'").Move .GetDefaultFolder(3)
Do Until Err.Number <>0
.GetDefaultFolder(10).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

7.4.3 Contacts find and delete

Sub Contacts_find_delete()
On Error Resume Next

c00 = "Bedrijf1"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items
.Find("[CompanyName]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

7.4.4 Contacts find and adapt

Sub Contacts_find_adapt()
On Error Resume Next

c00 = "Bedrijf1"
c01 = "Bedrijf1 BV."

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items
With .Find("[CompanyName]='" & c00 & "'")
.CompanyName = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.CompanyName = c01
.Save
End With
Loop
End With
End Sub

8 Distributionlist

8.0 Distributionlist properties

Sub distributielijst_properties()

' CreateItem(olDistlistItem)
' CreateItem (7)
' GetDefaultFolder(olFolderContacts)
' GetDefaultFolder(10)


c00 = "DL example"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
c01 = .Actions.Count
c02 = .Application
c03 = .Attachments.Count
c04 = .body
c05 = .Categories
c06 = .Class
c07 = .Companies
c08 = .ConversationIndex
c09 = .ConversationTopic
c010 = .DLName
c011 = .entryId
c012 = .FormDescription
c013 = .GetInspector
c014 = .Importance
c015 = .LastModificationTime
c016 = .links.Count
c017 = .MemberCount
c018 = .MessageClass
c019 = .Mileage
c020 = .OutlookInternalVersion
c021 = .OutlookVersion
c022 = .Parent
c023 = .Saved
c024 = .Sensitivity
c025 = .Session
c026 = .Size
c027 = .subject
c028 = .UnRead
c029 = .UserProperties
End With
End Sub

8.1 New distributionlist

Sub distributielijst_new()
With CreateObject("Outlook.Application").CreateItem(7)
.DLName = "DL voorbeeld"
.Save
End With
End Sub

8.2.1 Distributionlist: read

Sub distributielijst_read()
c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
c01 = .DLName & "|" & .MemberCount
End With
End Sub

8.2.2 Distributionlist: move to another folder

Sub distributielijst_move()
c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(10).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

8.2.3 Distributionlist: delete

Sub distributielijst_delete()
c00 = "DL voorbeeld"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00).Delete
End Sub

8.2.4 Distributionlist: adapt

Sub distributielijst_adapt()
c00 = "DL voorbeeld"
c01 = "DL 2e voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
.DLName= c01
.Save
End With
End Sub

8.3.1 Distributionlists: filter and read

Sub distributielijsten_filter_read()
c00 = "DL voorbeeld"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[DLName]='" & c00 & "'")
c01 = c01 & "|" & it.DLName & "_" & it.MemberCount
Next
End Sub

8.3.2 Distributionlists: filter and copy

Sub distributielijsten_filter_kopiëren()
c00 = "DL voorbeeld"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[DLName]='" & c00 & "'")
it.Copy
it.Move CreateObject("Outlook.Application").GetNamespace("MAPI").Folders(2).Folders("distributielijst")
Next
End Sub

8.3.2 Distributionlists: filter and move to another folder

Sub distributielijsten_filter_move()
c00 = "DL voorbeeld"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[DLName]='" & c00 & "'")
it.Move CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(3)
Next
End Sub

8.3.3 Distributionlists: filter and delete

Sub distributielijsten_filter_delete()
c00 = "DL voorbeeld"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[DLName]='" & c00 & "'")
it.Delete
Next
End Sub

8.3.4 Distributionlists: filter and adapt

Sub distributielijsten_filter_adapt()
c00 = "DL voorbeeld"
c01 = "Oude lijst"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[DLName]='" & c00 & "'")
With it
.body = c01
.Save
End With
Next
End Sub

8.4.1 Distributionlists: find and read

Sub distributielijsten_find_read()
On Error Resume Next

c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items
c01 = .Find("[DLName]='" & c00 & "'").body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

8.4.2 Distributionlists: find and move to another folder

Sub distributielijsten_find_move()
On Error Resume Next

c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(10).Items.Find("[DLName]='" & c00 & "'").Move .GetDefaultFolder(3)
Do Until Err.Number <>0
.GetDefaultFolder(10).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

8.4.3 Distributionlists: find and delete

Sub distributielijsten_find_delete()
On Error Resume Next

c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items
.Find("[DLName]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

8.4.4 Distributionlists: find and adapt

Sub distributielijsten_find_adapt()
On Error Resume Next

c00 = "DL voorbeeld"
c01 = "new subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items
With .Find("[DLName]='" & c00 & "'")
.subject = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.subject = c01
.Save
End With
Loop
End With
End Sub

8.5.1 Contact in distributionlist read

Sub distributielijst_read()
c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
If .MemberCount >0 Then
With .GetMember(1)
c01=.Name & "_" & .address & "_" & .AddressEntry
End With
End If
End With
End Sub

8.5.2 Distributionlist: read all contacts

Sub distributielijst_kontaktpersoon_read()
c00 = "DL voorbeeld"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
For j = 1 To .MemberCount
c01 = c01 & "|" & .GetMember(j).Name & "_" & .GetMember(j).Address & "_" & .GetMember(j).AddressEntry
Next
End With
End Sub

8.5.3 Distributionlist: add contact

Alleen bestaande Contacts kunnen aan een distributionlist worden toegevoegd.
Sub distributielijst_adapt_kontaktpersoon_add()
c00 = "DL voorbeeld"
c01 = "K. Franken"

Set c02 = CreateObject("Outlook.Application").CreateItem(0).Recipients
c02.Add c01

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
.AddMembers c02
.Save
End With
End Sub

8.5.4 Distributionlist: delete contact

Sub distributielijst_adapt_kontaktpersoon_delete()
c00 = "DL voorbeeld"
c01 = "K. Franken"

Set c02 = CreateObject("Outlook.Application").CreateItem(0).Recipients
c02.Add c01

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
.RemoveMembers c02
.Save
End With
End Sub

8.5.5 Distributionlist: delete Contact: alternative method

Sub distributielijst_adapt_kontaktpersoon_delete2()
c00 = "DL voorbeeld"
c01 = "anita@planeet.eu"

With CreateObject("outlook.application").GetNamespace("MAPI").GetDefaultFolder(10).Items(c00)
For j = 1 To .MemberCount
If LCase(.GetMember(j).address) = LCase(c01) Then .RemoveMembers .GetMember(j)
Next
.Save
End With
End Sub

8.5.6 Distributionlists: filter and delete contact

Sub distributielijsten_filter_adapt_kontaktpersoon_delete2()
c01 = "anita@planeet.eu"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10).Items.Restrict("[Messageclass]='IPM.DistList'")
Set c02 = CreateObject("Outlook.Application").CreateItem(0).Recipients

For j = 1 To it.MemberCount
If LCase(it.GetMember(j).address) = LCase(c01) Then c02.Add it.GetMember(j)
Next

If c02.Count >0 Then
it.RemoveMembers c02
it.Save
End If
Next
End Sub

9 Notes

9.0 Note properties

Sub note_properties()

' creatitem(5)
' createitem(olNoteItem)
' Getdefaultfolder (12)
' Getdefaultfolder(olFolderNotes)
' GetDefaultfolder("notes")


With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items(1)
c1 = .Application
c2 = .body
c3 = .Categories
c4 = .Class
c5 = .Color
c6 = .CreationTime
c7 = .EntryId
c8 = .GetInspector
c9 = .Height
c10 = .LastModificationTime
c11 = .Left
c12 = .links.Count
c13 = .MessageClass
c14 = .Parent
c15 = .Saved
c16 = .Session
c17 = .Size
c18 = .subject
c19 = .Top
c20 = .Width
End With
End Sub

9.1 New note

Sub note_new()
With CreateObject("Outlook.Application").CreateItem(5)
.body = "controle" & vbLf & "kijk eens"
.Save
End With
End Sub

9.2.1 Note: read

Sub note_read()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items(c00)
If .Class = 44 Then c01 = .body & "|" & .CreationTime
End With
End Sub

9.2.2 Note: move to another folder

Sub note_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(12).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

9.2.3 Note: delete

Sub note_delete()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items(c00).Delete
End Sub

9.2.4 Note: adapt

Sub note_adapt()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items(c00)
.body = "new subject"
.Top = .Top + 30
.Left = .Left + 40
.Height = 2 * .Height
.Width = 2 * .Width
.Color = 2
.Save
End With
End Sub

9.3.1 Notes: filter and read

Sub notes_filter_read()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items
For Each it In .Restrict("[Subject]='" & c00 & "'")
c01 = c01 & "|" & it.body
Next
End With
End Sub

9.3.2 Notes: filter and move to another folder

Sub notes_filter_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(12).Items.Restrict("[Subject]='" & c00 & "'")
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

9.3.3 Notes: filter and delete

Sub notes_filter_delete()
c00 = "controle"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items.Restrict("[Subject]='" & c00 & "'")
it.Delete
Next
End Sub

9.3.4 Notes: filter and adapt

Sub notes_filter_adapt()
c00 = "controle"
c01 = "new subject"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items.Restrict("[Subject]='" & c00 & "'")
With it
.body = c01
.Save
End With
Next
End Sub

9.4.1 Notes: find and read

Sub notes_find_read()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items
c01 = .Find("[Subject]='" & c00 & "'").body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

9.4.2 Notes: find and move to another folder

Sub notes_find_move()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(12).Items.Find("[Subject]='" & c00 & "'").Move .GetDefaultFolder(3)
Do Until Err.Number <>0
.GetDefaultFolder(12).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

9.4.3 Notes: find and delete

Sub notes_find_delete()
On Error Resume Next

c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items
.Find("[Subject]='" & c00 & "'").Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

9.4.4 Notes: find and adapt

Sub notes_find_adapt()
On Error Resume Next

c00 = "controle"
c01 = "new subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(12).Items
With .Find("[Subject]='" & c00 & "'")
.body = c01
.Save
End With

Do Until Err.Number <>0
With .FindNext
.body = c01
.Save
End With
Loop
End With
End Sub

10 Appointments

10.0 Appointment properties

Sub appointment_properties()

'Createitem(1)
'Createitem(olappointment)
'Getdefaultfolder(9)
'Getdefaultfolder(olCalendar)
'Getdefaultfolder("Agenda")


With CreateObject("outlook.application").GetNamespace("MAPI").GetDefaultFolder(9).Items(1)
c00 = .Actions.Count
For jj = 1 To c0
d0 = .Actions(jj).Name
Next
c01 = .Application
c02 = .Attachments.Count
c03 = .BillingInformation
c04 = .body
c05 = .Categories
c06 = .Class
c07 = .Companies
c08 = .ContactNames.Count
c09 = .ConversationIndex
c010 = .ConversationTopic
c011 = .CreationTime
c012 = .Docposted
c013 = .DocPrinted
c014 = .DocRouted
c015 = .DocSaved
c016 = .Duration
c017 = .End
c018 = .entryId
c019 = .FormDescription
c020 = .GetInspector
c021 = .Importance
c022 = .LastModificationTime
c023 = .links.Count
c024 = .Location
c025 = .MeetingStatus
c024 = .MessageClass
c025 = .Mileage
c026 = .NoAging
c027 = .OutlookInternalVersion
c028 = .OutlookVersion
c029 = .Parent
c030 = .Recipients.Count
For jj = 1 To c30
With .Recipients(jj)
d01 = .Name
d02 = .address
d03 = .AddressEntry
End With
Next
c031 = .Saved
c032 = .Sensitivity
c033 = .Session
c034 = .Size
c035 = .start
c036 = .subject
c037 = .Type
c038 = .UnRead
c039 = .UserProperties.Count
End With
End Sub

10.1 New appointment

Sub appointment_new()
With CreateObject("Outlook.Application").CreateItem(1)
.subject = "Annual Meeting"
.Start = DateValue("06-03-2019") + TimeValue("12:30")
.Duration = 45
.Location = "Vergaderzaal C"
.Save
End With
End Sub

10.2.1 Appointment: read

Sub appointment_read()
c00 = "Annual Meeting"

c01=CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items(c00).location
End Sub

10.2.2 Appointment: move to another folder

Sub appointment_adapt()
c00 = "Annual Meeting"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(9).Items(c00).move ..GetDefaultFolder(9)
End With
End Sub

10.2.3 Appointment: delete

Sub appointment_adapt()
c00 = "Annual Meeting"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items(c00).delete
End Sub

10.2.4 Appointment: adapt

Sub appointment_adapt()
c00 = "Annual Meeting"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items(c00)
.start = DateAdd( "d", 4, .start) + DateAdd( "h", 2, .start)
.Save
End With
End Sub

10.3.1 Appointments: filter and read

Sub appointments_filter_read()
c01="Sessie B"
c00 = "[Location]='" & c01 & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items.Restrict(c00)
c02 = c02 & "|" & it.Location & it.start
Next
End Sub

10.3.2 Appointments: filter and move to another folder

Sub appointments_filter_move()
c01="Sessie B"
c00 = "[Location]='" & c01 & "'"

with CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(9).Items.Restrict(c00)
it.move .GetDefaultFolder(3)
Next
End With
End Sub

10.3.3 Appointments: filter and delete

Sub appointments_filter_delete()
c01="Sessie B"
c00 = "[Location]='" & c01 & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items.Restrict(c00)
it.Delete
Next
End Sub

10.3.4 Appointments: filter and adapt

Sub appointments_filter_adapt()
c01="Sessie B"
c02="Room 203"
c00 = "[Location]='" & c01 & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items.Restrict(c00)
it.Location = c02
it.start = DateAdd( "d", 1, it.start)
it.Save
Next
End Sub

10.4.1 Appointments: find and read

Sub appointments_find_read()
On Error Resume Next

c01 = "11-04-2011 9:00"
c00 = "[Start]>='" & format(c01, "ddddd hh:mm") & "' And [Start]<='" & format(DateAdd( "d", 7, c01), "ddddd hh:mm") & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items
c02 = .Find(c00).subject
Do Until Err.Number >0
c02 = c02 & "|" & .FindNext.subject
Loop
End With
End Sub

10.4.2 Appointments: find and move to another folder

Sub appointments_find_move()
On Error Resume Next

c01 = "Sessie B"
c00 = "[Location]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(9).Items.Find(c00).Move .GetDefaultFolder(3)
Do Until Err.Number >0
.GetDefaultFolder(9).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

10.4.3 Appointments: find and delete

Sub appointments_find_delete()
On Error Resume Next

c01 = "Sessie B"
c00 = "[Location]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items
.Find(c00).Delete
Do Until Err.Number >0
.FindNext.Delete
Loop
End With
End Sub

10.4.4 Appointments: find and adapt

Sub appointments_find_adapt()
On Error Resume Next

c01 = "Sessie B"
c02 = "vergaderzaal A"
c00 = "[Location]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items
With .Find(c00)
.Location = c02
.Save
End With

Do Until Err.Number <>0
With .FindNext
.Location = c02
.Save
End With
Loop
End With
End Sub

10.4.5 Appointment: find using several criteria

'.Start
'.Subject
'.End
'.Location
'.timeformat

' find by .start
' find by .start and .subject
' find by .start, .subject and .location

' find by .start, .subject, .end and .location
Sub appointment_find()
On Error Resume Next

c01 = DateValue("06-05-2019") + TimeValue("12:30")
c02 = "onderwerp"
c03 = DateAdd("n", 45, c01)
c04 = "Vergaderzaal C"
c05 = "ddddd h:mm"

c00 = "[Start] ='" & format(c01, c05) & "'"
c00 = "[Start] ='" & format(c01, c05) & "' And [Subject]='" & c02 & "'"
c00 = "[Start] ='" & format(c01, c05) & "' And [Subject]='" & c02 & "' And [Location]='" & c04 & "'"
c00 = "[Start] ='" & format(c01, c05) & "' And [Subject]='" & c02 & "' And [End]='" & format(c03, c05) & "' And [Location]='" & c04 & "'"

MsgBox CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(9).Items.Find(c00).start
End Sub

11 Meeting requests

11.0 Meeting request properties

Sub meetingrequest_properties()

' CreateItem(1)
' Createitem(olAppointmentitem)
' Getdefaultfolder(9)
' Getdefaultfolder(olfolderCalendar)
' Getdefaultfolder("Agenda")


c00 = "Annual meeting"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00)
c00 = .Actions.Count
For jj = 1 To c0
d0 = .Actions(jj).Name
Next
c01 = .Application
c02 = .Attachments.Count
c03 = .AutoForwarded
c04 = .BillingInformation
c05 = .body
c06 = .Categories
c07 = .Class
c08 = .Companies
c09 = .ConversationIndex
c010 = .ConversationTopic
c011 = .CreationTime
c012 = DeferredDeliveryTime
c013 = DeleteAfterSubmit
c014 = .entryId
c015 = .ExpiryTime
c016 = .FlagDueBy
c017 = .FlagRequest
c018 = .FlagStatus
c019 = .FormDescription
c020 = .GetInspector
c021 = .Importance
C022 = .LastModificationTime
c023 = .links.Count
c024 = .MessageClass
c025 = .Mileage
c026 = .NoAging
c027 = .OriginatorDeliveryReportRequested
c028 = .OutlookInternalVersion
c029 = .OutlookVersion
c030 = .Parent
c031 = .ReceivedTime
c032 = .Recipients.Count
For jj = 1 To c32
With .Recipients(jj)
d01 = .Name
d02 = .address
d03 = .AddressEntry
End With
Next
c033 = .ReminderSet
c034 = .ReminderTime
c035 = .ReplyRecipients
c036 = .Saved
c037 = .SaveSentMessageFolder
c038 = .SenderName
c039 = .Sensitivity
c040 = .Sent
c041 = .SentOn
c042 = .Session
c043 = .Size
c044 = .subject
c045 = .Submitted
c046 = .UnRead
c047 = .UserProperties.Count
End With
End Sub

11.1 New meeting request

Sub meeting request_new()
c00="Annual Meeting"
c01 = "Zaal A"
c02 = format(DateAdd( "d", 2, Date) + TimeValue("20:15"), "ddddd hh:mm")
c03 = 55
c04 = "Jeroen Spoert"

With CreateObject("Outlook.Application").CreateItem(1)
.subject = c00
.MeetingStatus = 1
.Location = c01
.start = c02
.Duration = c03
.Recipients.Add c04
.send
End With
End Sub

11.2.1 Meeting request: read

Meeting requests only reside in the folder PostIN: getdefaultfolder(6) getdefaultfolder(olFolderInbox)
Select the request by it's property .Subject
Sub meeting request_read()
c00 = "Annual Meeting"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00)
c01 = .subject & "_" & CreationTime & "_" & .body & "_" & .SenderName & "_" & .Class
End With
End Sub

11.2.2 Meeting request: move to another folder

Sub meeting request_move()
c00 = "Annual Meeting"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

11.2.3 Meeting request: delete

Sub meeting request_delete()
c00 = "Annual Meeting"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).Delete
End Sub

11.2.5 Meeting request: accept tentatively

Sub meeting request_read_voorlopig_accepteren()
c00 = "Annual Meeting"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).GetAssociatedAppointment(True).Respond 2
End Sub

11.2.6 Meeting request: accept

Sub meeting request_read_accepteren()
c00 = "Annual Meeting"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).GetAssociatedAppointment(True).Respond 3
End Sub

11.2.7 Meeting request: decline

Sub meeting request_read_weigeren()
c00 = "Annual Meeting"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).GetAssociatedAppointment(True).Respond 4
End Sub

11.3.1 Meeting requests: filter and read

Sub meeting requests_filter_read()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[MessageClass]='IPM.Schedule.Meeting.Request'")
c01 = c01 & "|" & it.body
Next
End Sub

11.3.2 Meeting requests: filter and move to another folder

Sub meeting requests_filter_move()
With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(6).Items.Restrict("[Class]='53'")
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

11.3.3 Meeting requests: filter and delete

Sub meeting requests_filter_delete()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[Class]='53'")
it.Delete
Next
End Sub

11.3.5 Meeting requests: filter and accept tentatively

Sub meeting requests_filter_voorlopig_accepteren()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[Class]='53'")
it.GetAssociatedAppointment(True).Respond 3
Next
End Sub

11.3.6 Meeting requests: filter and accept

Sub meeting requests_filter_accepteren()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[MessageClass]='IPM.Schedule.Meeting.Request'")
it.GetAssociatedAppointment(True).Respond 2
Next
End Sub

11.3.7 Meeting requests: filter and decline

Sub meeting requests_filter_weigeren()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[Class]='53'")
it.GetAssociatedAppointment(True).Respond 4
Next
End Sub

11.3.8 Meeting requests: filter and copy

Sub meeting requests_filter_kopiëren()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[MessageClass]='IPM.Schedule.Meeting.Request'")
it.Copy
it.Move CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(3)
Next
End Sub

11.4.1 Meeting requests: find and read

Sub meeting requests_find_read()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
c01 = .Find(c00).body
Do Until Err.Number <>0
c01 = c01 & "|" & .FindNext.body
Loop
End With
End Sub

11.4.2 Meeting requests: find and move to another folder

Sub meeting requests_find_move()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items.Find(c00).Move .GetDefaultFolder(3)

Do Until Err.Number <>0
.GetDefaultFolder(6).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

11.4.3 Meeting requests: find and delete

Sub meeting requests_find_delete()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
.Find(c00).Delete

Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

11.4.5 Meeting requests: find and accept tentatively

Sub meeting requests_find_voorlopig_accepteren()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
.Find(c00).GetAssociatedAppointment(True).Respond 3

Do Until Err.Number <>0
.FindNext.GetAssociatedAppointment(True).Respond 3
Loop
End With
End Sub

11.4.6 Meeting requests: find and accept

Sub meeting requests_find_accepteren()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
.Find(c00).GetAssociatedAppointment(True).Respond 2

Do Until Err.Number <>0
.FindNext.GetAssociatedAppointment(True).Respond 2
Loop
End With
End Sub

11.4.7 Meeting requests: find and decline

Sub meeting requests_find_weigeren()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
.Find(c00).GetAssociatedAppointment(True).Respond 4

Do Until Err.Number <>0
.FindNext.GetAssociatedAppointment(True).Respond 4
Loop
End With
End Sub

11.4.8 Meeting requests: find and copy

Sub meeting requests_find_kopiëren()
On Error Resume Next

c01 = "IPM.Schedule.Meeting.Request"
c02 = "Annual Meeting"
c00 = "[MessageClass]='" & c01 & "' And [Subject]='" & c02 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
With .Find(c00)
.Copy .Move CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(3)
End With

Do Until Err.Number <>0
With .FindNext
.Copy
.Move CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(3)
End With
Loop
End With
End Sub

12 Tasks

12.0 Task properties

Sub task_properties()

'Createitem(3)
'Createitem(olTaskItem)
'Getdefaultfolder(13)
'Getdefaultfolder(olFolderTasks)
'Getdefaultfolder("Tasks")


With CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(13).Items(1)
c00 = .Actions.Count
For jj = 1 To c0
d0 = .Actions(jj).Name
Next
c01 = .ActualWork
c02 = .Application
c03 = .Attachments.Count
c04 = .BillingInformation
c05 = .body
c06 = .CardData
c07 = .Categories
c08 = .Class
c09 = .Companies
c010 = .complete
c011 = .ContactNames.Count
c012 = .Contacts
c0013 = .ConversationIndex
c014 = .ConversationTopic
c015 = .CreationTime
c016 = .DateCompleted
c017 = .DelegationState
c018 = .Delegator
c019 = .DueDate
c020 = .entryId
c021 = .FormDescription
C022 = .GetInspector
c023 = .Importance
c024 = .IsRecurring
c025 = .LastModificationTime
c026 = .links.Count
c027 = .MessageClass
c028 = .Mileage
c029 = .NoAging
c030 = .Ordinal
c031 = .OutlookInternalVersion
c032 = .OutlookVersion
c033 = .Owner
c034 = .Ownership
c035 = .Parent
c036 = .PercentComplete
c037 = .Recipients.Count
c038 = .ReminderOverrideDefault
c039 = .ReminderPlaySound
c040 = .ReminderSet
c041 = .ReminderSoundFile
c042 = .ReminderTime
c043 = .ResponseState
c044 = .Role
c045 = .Saved
c046 = .SchedulePlusPriority
c047 = .Sensitivity
c048 = .Session
c049 = .Size
c050 = .StartDate
c051 = .Status
c052 = .StatusOnCompletionRecipients
c053 = .StatusUpdateRecipients
c054 = .subject
c055 = .TeamTask
c056 = .TotalWork
c057 = .UnRead
c058 = .UserProperties.Count
End With
End Sub

12.1 New task

Sub task_new()
With CreateObject("Outlook.Application").CreateItem(3)
c00 = "controle"
c01 = Date
c02 = DateValue("04-05-2019") + TimeValue("08:00:00")

.subject = c00
.StartDate = c01
.ReminderSet = True
.ReminderTime =c02
.Save
End With
End Sub
Vind de taak aan de hand van de eigenschap .Subject

12.2.1 Task: read

Sub task_read()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items(c00)
c01=.startdate & "_" & .Subject & "_" & .Status
End With
End Sub

12.2.2 Task: move to another folder

Sub task_move()
c00 = "controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(13).Items(c00).move .Getdefaultfolder(3)
End With
End Sub

12.2.3 Task: delete

Sub task_delete()
c00 = "controle"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items(c00).delete
End Sub

12.2.4 Task: adapt

Sub task_adapt()
c00 = "controle"
c01 = "New controle"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items(c00)
.subject = c01
.Save
End With
End Sub

12.2.5 Task: find using several criteria

Sub task_find_more_criteria()
c02 = DateValue("15-04-2011")
c01 = "New controle"
c00 = "[StartDate] ='" & format(c02, "ddddd") & "' And [Subject]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items
If Not .Find(c00) Is Nothing Then c03 = .Find(c00).ReminderTime
End With
End Sub

12.3.1 Tasks: filter and read

Sub tasks_filter_read()
c01 = DateValue("11-04-2011")
c00 = "[StartDate] ='" & format(c00, "ddddd") & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items.Restrict(c00)
c02 = c02 & "|" & it.subject
Next
End Sub

12.3.2 Tasks: filter and move to another folder

Sub tasks_filter_move()
c01 = DateValue("11-04-2019")
c00 = "[StartDate] ='" & format(c00, "ddddd") & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(13).Items.Restrict(c00)
it.move .GetDefaultFolder(3)
Next
end with
End Sub

12.3.3 Tasks: filter and delete

Sub tasks_filter_delete()
c01 = DateValue("11-04-2011")
c00 = "[StartDate] ='" & format(c00, "ddddd") & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items.Restrict(c00)
it.Delete
Next
End Sub

12.3.4 Tasks: filter and adapt

Sub tasks_filter_adapt()
c01 = DateValue("11-04-2011")
c00 = "[StartDate] ='" & format(c00, "ddddd") & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items.Restrict(c00)
it.StartDate = DateAdd( "d", -4, it.StartDate)
it.Save
Next
End Sub

12.4.1 Tasks: find and read

Sub tasks_find_read()
On Error Resume Next

c01 = DateValue("11-04-2011")
c00 = "[StartDate] ='" & format(c00, "ddddd") & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items
c02 = .Find(c00).Subject

Do Until err.number<>0
c02 = c02 & "|" & .FindNext.Subject
Loop
End With
End Sub

12.4.2 Tasks: find and move to another folder

Sub tasks_find_move()
On Error Resume Next

c01 = "New controle"
c00 = "[Subject] ='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(13).Items.Find(c00).move .GetDefaultFolder(3)

Do Until err.number<>0
.GetDefaultFolder(13).Items.FindNext.move .GetDefaultFolder(3)
Loop
End With
End Sub

12.4.3 Tasks: find and delete

Sub tasks_find_delete()
On Error Resume Next

c01 = "New controle"
c00 = "[Subject] ='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items
.Find(c00).delete

Do Until err.number<>0
.FindNext.delete
Loop
End With
End Sub

12.4.4 Tasks: find and adapt

Sub tasks_find_adapt()
On Error Resume Next

c01 = "New controle"
c00 = "[Subject] ='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(13).Items
With .Find(c00)
.StartDate = DateAdd( "d", 4, .StartDate)
.Save
End With

Do Until err.number<>0
with .FindNext
.StartDate = DateAdd( "d", 4, .StartDate)
.Save
End With
Loop
End With
End Sub

13 Taskrequests

13.0 Taskrequest properties

Sub taskrequest_properties()

'CreateItem(3)
'CreateItem(olTask)
'GetDefaultFolder(13)
'GetDefaultFolder(olFolderTasks)
'GetDefaultFolder("Tasks")


With CreateObject("outlook.application").GetNamespace("MAPI").GetDefaultFolder(13).Items(1)
c00 = .Actions.Count
For jj = 1 To c0
d0 = .Actions(jj).Name
Next
c01 = .Application
c02 = .Attachments.Count
c03 = .BillingInformation
c04 = .body
c05 = .Categories
c06 = .Class
c07 = .Companies
c08 = .ConversationIndex
c09 = .ConversationTopic
c010 = .CreationTime
c011 = .entryId
c012 = .FormDescription
c013 = .GetInspector
c014 = .Importance
c015 = .LastModificationTime
c016 = .links.Count
c017 = .MessageClass
c018 = .Mileage
c019 = .NoAging
c020 = .OutlookInternalVersion
c021 = .OutlookVersion
C022 = .Parent
c023 = .Saved
c024 = .Sensitivity
c025 = .Session
c026 = .Size
c027 = .subject
c028 = .UnRead
c029 = .UserProperties.Count
End With
End Sub

13.1 New taskrequest

Sub taskrequest_new()
c00 = "controle 7"
c01 = Date +7"
c02 = DateValue(""04-05-2019") + TimeValue("08:00:00"
c03 = "snb@forums.eu"

With CreateObject("Outlook.Application").CreateItem(3)
.assign
.subject = c00
.StartDate = c01
.ReminderSet = True
.ReminderTime = c02
.Recipients.Add c03
.send
End With
End Sub

13.2.1 Taskrequest: read

Sub taskrequest_read()
c00 = "Taskrequest: controle 7"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00)
c01 = .subject & "_" & .CreationTime & "_" & .body & "_" & .Class & "_" & .MessageClass
End With
End Sub

13.2.2 Taskrequest: move to another folder

Sub taskrequest_move()
c00 = "Taskrequest: controle 7"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items(c00).Move .GetDefaultFolder(3)
End With
End Sub

13.2.3 Taskrequest: delete

Sub taskrequest_delete()
c00 = "Taskrequest: controle 7"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).Delete
End Sub

13.2.5 Taskrequest: accept tentatively

Sub taskrequest_read_simple_accepteren()
c00 = "Taskrequest: controle 7"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).GetAssociatedTask(True).Respond 0, False, False
End Sub

13.2.6 Taskrequest: accept

Sub taskrequest_read_accepteren()
c00 = "Taskrequest: controle 7"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).GetAssociatedTask(True).Respond 2, True, True
End Sub

13.2.7 Taskrequest: decline

Sub taskrequest_read_weigeren()
c00 = "Taskrequest: controle 7"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).GetAssociatedTask(True).Respond 3, False, False
End Sub

13.3.1 Taskrequests: filter and read

Sub taskrequests_filter_read()
For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict("[MessageClass]='IPM.TaskRequest'")
c01 = c01 & "|" & it.body
Next
End Sub

13.3.2 Taskrequests: filter and move to another folder

Sub taskrequests_filter_move()
c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(6).Items.Restrict(c00)
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

13.3.3 Taskrequests: filter and delete

Sub taskrequests_filter_delete()
c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict(c00)
it.Delete
Next
End Sub

13.3.4 Taskrequests: filter and adapt

Sub taskrequests_filter_adapt()
c01 = "IPM.TaskRequest"
c02 = "new subject"

c00 = "[MessageClass]='" & c01 &'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict(c00)
With it
.body = c02
.Save
End With
Next
End Sub

13.3.5 Taskrequests: filter and accept tentatively

Sub taskrequests_filter_voorlopig_accepteren()
c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict(c00)
it.GetAssociatedTask(True).Respond 0, False, False
Next
End Sub

13.3.6 Taskrequests: filter and accept

Sub taskrequests_filter_accepteren()
c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict(c00)
it.GetAssociatedTask(True).Respond 2, False, False
Next
End Sub

13.3.7 Taskrequests: filter and decline

Sub taskrequests_filter_weigeren()
c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict(c00)
it.GetAssociatedTask(True).Respond 3, False, False
Next
End Sub

13.3.8 Taskrequests: filter and copy

Sub taskrequests_filter_kopiëren()
c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(6).Items.Restrict(c00)
it.Copy
it.Move .GetDefaultFolder(3)
Next
end with
End Sub

13.4.1 Taskrequests: find and read

Sub taskrequests_find_read()
On Error Resume Next

c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
c02 = .Find(c00).body

Do Until Err.Number <>0
c02 = c02 & "|" & .FindNext.body
Loop
End With
End Sub

13.4.2 Taskrequests: find and move to another folder

Sub taskrequests_find_move()
On Error Resume Next

c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items.Find(c00).Move .GetDefaultFolder(3)

Do Until Err.Number <>0
.GetDefaultFolder(6).Items.FindNext.Move .GetDefaultFolder(3)
Loop
End With
End Sub

13.4.3 Taskrequests: find and delete

Sub taskrequests_find_delete()
On Error Resume Next

c01 = "opdracht"
c00 = "[ConversationTopic]='" & c01 &'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
.Find(c00).Delete

Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

13.4.4 Taskrequests: find and adapt

Sub taskrequests_find_adapt()
On Error Resume Next

c01 = "IPM.TaskRequest"
c00 = "[MessageClass]='" & c01 &'"

c02 = "New Subject"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(6).Items
With .Find(c00)
.body = c02
.Save
End With

Do Until Err.Number <>0
With .FindNext
.body = c02
.Save
End With
Loop
End With
End Sub

14 Journalitems

14.0 Journalitem properties

Sub journalitem_properties()

' CreateItem(4)
' CreateItem(olJournaItem)
' GetDefaultFolder(11)
' GetDefaultFolder(olFolderJournal)
' GetDefaultFolder("Journal")


With CreateObject("outlook.application").GetNamespace("MAPI").GetDefaultFolder(11).Items(1)
c00 = .Actions.Count
For jj = 1 To c00
d0 = .Actions(jj).Name
Next
c01 = .Application
c02 = .Attachments.Count
c03 = .BillingInformation
c04 = .body
c05 = .Categories
c06 = .Class
c07 = .Companies
c08 = .ContactNames.Count
c09 = .ConversationIndex
c010 = .ConversationTopic
c011 = .CreationTime
c012 = .Docposted
c013 = .DocPrinted
c014 = .DocRouted
c015 = .DocSaved
c016 = .Duration
c017 = .End
c018 = .entryId
c019 = .FormDescription
c020 = .GetInspector
c021 = .Importance
C022 = .LastModificationTime
c023 = .links.Count
c024 = .MessageClass
c025 = .Mileage
c026 = .NoAging
c027 = .OutlookInternalVersion
c028 = .OutlookVersion
c029 = .Parent
c030 = .Recipients.Count
For Each rp In .Recipients
d01 = rp.Name
d02 = rp.address
d03 = rp.AddressEntry
Next
c031 = .Saved
c032 = .Sensitivity
c033 = .Session
c034 = .Size
c035 = .start
c036 = .subject
c037 = .Type
.Type = "Letter"
.Type = "Conversation"
.Type = "Document"
.Type = "E-mail Message"
.Type = "Remote Session"
.Type = "Fax"
.Type = "Microsoft Access"
.Type = "Microsoft Excel"
.Type = "Microsoft Word"
.Type = "Microsoft Powerpoint"
.Type = "Note"
.Type = "Phone Call"
.Type = "Task"
.Type = "Task Request"
.Type = "Meeting"
.Type = "Meeting Request"
.Type = "Meeting Response"
.Type = "Meeting Cancellation"
c038 = .UnRead
c039 = .UserProperties.Count
End With
End Sub

14.1 New journalitem

Sub journalitem_new()
c00 = Now
c01 = 15
c02 = 4th journalitem
c03 = "E-mail Message"

With CreateObject("Outlook.Application").CreateItem(4)
.start = format(c00, "ddddd hh:mm")
.Duration = c01
.subject = c02
.Type = c03
.Save
End With
End Sub

14.2.1 Journalitem: read

Sub journalitem_read()
c00 = "4th journalitem"

c01 = CreateObject("outlook.application").GetNamespace("MAPI").GetDefaultFolder(11).Items(c00).Type
End Sub

14.2.2 Journalitem: move to another folder

Sub journalitem_move()
c00 = "4e journalitem"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(11) .Items(c00).move .GetDefaultFolder(3)
End With
End Sub

14.2.3 Journalitem: delete

Sub journalitem_delete()
c00 = "4e journalitem"

CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items(c00).Delete
End Sub

14.2.4 Journalitem: adapt

Sub journalitem_adapt()
c00 = "4e journalitem"
c02 = "Meeting"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items(c00)
.Type = c02
.Save
End With
End Sub

14.3.1 Journalitems: filter and read

Sub journalitems_filter_read()
c01 = "Meeting"
c00 = "[Type]='" & c01 & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items.Restrict(c00)
c02 = c02 & "|" & it.subject
Next
End Sub

14.3.2 Journalitems: filter and move to another folder

Sub journalitems_filter_move()
c01 = "Meeting"
c00 = "[Type]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(11).Items.Restrict(c00)
it.move .GetDefaultFolder(3)
Next
End With
End Sub

14.3.3 Journalitems: filter and delete

Sub journalitems_filter_delete()
c01 = "Meeting"
c00 = "[Type]='" & c01 & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items.Restrict(c00)
it.Delete
Next
End Sub

14.3.4 Journalitems: filter and adapt

Sub journalitems_filter_adapt()
c01 = "Meeting"
c02 = "New tekst"
c00 = "[Type]='" & c01 & "'"

For Each it In CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items.Restrict(c00)
it.subject = c02
it.Save
Next
End Sub

14.4.1 Journalitems: find and read

Sub journalitems_find_read()
On Error Resume Next

c01 = "Meeting"
c00 = "[Type]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items
c02 = .Find(c00).Subject

Do Until Err.Number<>0
c02 = c02 & "|" & .FindNext.Subject
Loop
End With
End Sub

14.4.2 Journalitems: find and move to another folder

Sub journalitems_find_move()
On Error Resume Next

c01 = "Meeting"
c00 = "[Type]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(11).Items.Find(c00).Move .GetDefaultFolder(3)

Do Until Err.Number<>0
.GetDefaultFolder(11).Items.Find(c00).Move .GetDefaultFolder(3)
Loop
End With
End Sub

14.4.3 Journalitems: find and delete

Sub journalitems_find_delete()
On Error Resume Next

c01 = "Meeting"
c00 = "[Type]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items
.Find(c00).Delete
Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

14.4.4 Journalitems: find and adapt

Sub journalitems_find_adapt()
On Error Resume Next

c01 = "Meeting"
c02 = "new subject"
c00 = "[Type]='" & c01 & "'"

With CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items
With .Find(c00)
.Subject = c02
.Save
End With

Do Until err.number<>0
with .FindNext
.Subject =c02
.Save
End With
Loop
End With
End Sub

14.4.5 Journalitem: find

Sub journalitem_find()
On Error Resume Next

c01 = "Meeting"
c00 = [Type] ='" & c01 & "'")

c02 = CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(11).Items.Find(c00).subject
End Sub

15 Post items

15.0 Postitem properties

Sub discussie_properties()

' CreateItem(6)
' CreateItem(olPost)


With CreateObject("outlook.application").GetNamespace("MAPI").GetDefaultFolder(6).Items(1)
c00 = .Actions.Count
For Each ac In .Actions
d0 = ac.Name
Next
c01 = .Application
c02 = .Attachments.Count
c03 = .BillingInformation
c04 = .body
c05 = .Categories
c06 = .Class
c07 = .Companies
c08 = .ConversationIndex
c09 = .ConversationTopic
c010 = .CreationTime
c011 = .entryId
c012 = .ExpiryTime
c013 = .FormDescription
c014 = .GetInspector
c015 = .HTMLBody
c016 = .Importance
c017 = .LastModificationTime
c018 = .links.Count
c019 = .MessageClass
c020 = .Mileage
c021 = .NoAging
C022 = .OutlookInternalVersion
c023 = .OutlookVersion
c024 = .Parent
c025 = .ReceivedTime
c026 = .Saved
c027 = .SenderName
c028 = .Sensitivity
c029 = .SentOn
c030 = .Session
c031 = .Size
c032 = .subject
c033 = .UnRead
c034 = .UserProperties.Count
End With
End Sub

15.1 New Post

Sub discussie_new()
c00 = "New postmen"

With CreateObject("Outlook.application").CreateItem(6)
.Subject = c00
.Save
End With
End Sub

15.1.1 New Post in specific folder

Sub discussie_new_in_specifieke_map()
c00 = "New postmen"

With CreateObject("Outlook.application").CreateItem(6)
.Subject = c00
.Save
.Move .Application.GetNamespace("MAPI").GetDefaultFolder(16)
End With
End Sub

15.2.1 Post: read

Sub discussie_read()
c00 = "New postmen"

c01 = CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00).Class
End Sub

15.2.2 Post: move to another folder

Sub discussie_move()
c00 = "New postmen"

With CreateObject("Outlook.Application").GetNamespace("MAPI")
.GetDefaultFolder(6).Items(c00).Move .GetDefaultFolder(16)
End With
End Sub

15.2.3 Post: delete

Sub discussie_delete()
c00 = "New postmen"

CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(16).Items(c00).Delete
End Sub

15.2.4 Post: adapt

Sub discussie_adapt()
c00 = "New postmen"
c01 = "oud verhaal"

With CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(6).Items(c00)
.Subject = c01
.Save
End With
End Sub

15.3.1 Posts: filter and read

Sub posts_filter_read()
c01 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

For Each it In CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(16).Items.Restrict(c00)
c01 = c01 & "|" & it.SentOn
Next
End Sub

15.3.2 Posts: filter and move to another folder

Sub posts_filter_move()
c00 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

With CreateObject("Outlook.application").GetNamespace("MAPI")
For Each it In .GetDefaultFolder(6).Items.Restrict(c00)
it.Move .GetDefaultFolder(3)
Next
End With
End Sub

15.3.3 Posts: filter and delete

Sub posts_filter_delete()
c00 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

For Each it In CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Restrict(c00)
it.Delete
Next
End Sub

15.3.4 Posts: filter and adapt

Sub posts_filter_adapt()
c00 = "New postmen"
c02 = "New themes"
c00 ="[Subject]='" & c01 & "'"

For Each it In CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(16).Items.Restrict(c00)
it.Subject = c02
it.Save
Next
End Sub

15.4.1 Posts: find and read

Sub posts_find_read()
On Error Resume Next

c01 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

With CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(16).Items
c02 = .Find(c00).Body

Do Until Err.Number <>0
c02 = c02 & "|" & .FindNext.Body
Loop
End With
End Sub

15.4.2 Posts: find and move to another folder

Sub posts_find_move()
On Error Resume Next

c01 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

With CreateObject("Outlook.application").GetNamespace("MAPI")
.GetDefaultFolder(16).Items.Find(c00).Move .GetDefaultFolder(6)

Do Until Err.Number <>0
.GetDefaultFolder(16).Items.FindNext.Move .GetDefaultFolder(6)
Loop
End With
End Sub

15.4.3 Posts: find and delete

Sub posts_find_delete()
On Error Resume Next

c01 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

With CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(16).Items
.Find(c00).Delete

Do Until Err.Number <>0
.FindNext.Delete
Loop
End With
End Sub

15.4.4 Posts: find and adapt

Sub posts_find_adapt()
On Error Resume Next

c01 = "New postmen"
c02 = "New themes"
c00 ="[Subject]='" & c01 & "'"

With CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(16).Items
With .Find(c00)
.Subject = c02
.Save
End With

Do Until Err.Number <>0
With .FindNext
.Subject = c02
.Save
End With
Loop
End With
End Sub

15.4.5 Post: find

Sub discussie_find()
c01 = "New postmen"
c00 ="[Subject]='" & c01 & "'"

c01 = CreateObject("Outlook.application").GetNamespace("MAPI").GetDefaultFolder(6).Items.Find(c00).SentOn
End Sub