XLSM Belgium
New Member
- Joined
- Mar 31, 2017
- Messages
- 9
Hi all,
I have my icloud account linked to my outlook, and all contacts are added to a folder called "contacts"
I can then manually add folders to sort contactitems.
However, when you "move" a contact from the main group to a different folder, it also stays in the main group.
Therefor the main group "Contacts" is a representation of all available contacts in icloud, no matter what subfolder they are assigned to.
I would like to have a separate folder called "Ungrouped", into which all contacts which aren not yet assigned to a group, will be listed.
I wrote this sub:
there are 2 problems with this:
-While it works for finding the ungrouped contactitems, it is very slow.
-the actual moving of the contact does not work. I get an error: "Type mismatch"
I have my icloud account linked to my outlook, and all contacts are added to a folder called "contacts"
I can then manually add folders to sort contactitems.
However, when you "move" a contact from the main group to a different folder, it also stays in the main group.
Therefor the main group "Contacts" is a representation of all available contacts in icloud, no matter what subfolder they are assigned to.
I would like to have a separate folder called "Ungrouped", into which all contacts which aren not yet assigned to a group, will be listed.
I wrote this sub:
VBA Code:
Sub testicloud()
Dim olApp As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olitems As Outlook.Items
Dim olContact As Outlook.ContactItem
Dim olIcloud As Outlook.MAPIFolder
Dim olIcloudKlanten As Outlook.MAPIFolder
Dim olIcloudUngrouped As Outlook.MAPIFolder
Dim obj1 As Object, obj2 As Object
Dim fol As Outlook.MAPIFolder
Dim i As Integer
Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olIcloud = olNS.Folders("iCloud").Folders("Contacts")
Set olIcloudUngrouped = olIcloud.Folders("Ungrouped")
For Each obj1 In olIcloud.Items
For Each fol In olIcloud.Folders
For Each obj2 In fol.Items
If obj1 = obj2 Then GoTo found
Next obj2
Next fol
'contact is not added to any folder, adding it to "ungrouped"
Debug.Print "Adding", obj1.FullName
obj1.move (olIcloudUngrouped)
found:
Next obj1
End Sub
there are 2 problems with this:
-While it works for finding the ungrouped contactitems, it is very slow.
-the actual moving of the contact does not work. I get an error: "Type mismatch"
Last edited: