Adressing subfolder - and copy contact ?

  • Thread starter Thread starter myicq
  • Start date Start date
M

myicq

I am using SQLView to categorize and group my contacts. But for the
other people in the company I need to populate shared contacts
folders.

I can manually copy from SQLView.. but if I forget to hold ctrl,
Outlook will move, causing all my categories to be lost.

Now I wish to copy via macro. In that connection, I have two
questions:

1) How do I address subfolders with contacts that are NOT below my
default contacts ? This will work, but it's not very clear what is
happening:

Set colcontacts = objNS.Folders(1).Folders(6).Folders(3).Items

I thought I could do something like

Set colcontacs =
objNS.Folders("SQLView\Contacts\Company").Items
but I only get "Object not found"

What is the correct way of addressing subfolders, from the root of
MAPI
Namespace ?


2) How do I copy contacts from one folder to another ? I probably need
to
delete the destination folder first, not to create duplicates.


.. obviously, if there's a sync tool that will take from folder A to
folder B
and check for duplicates, I could use that. But I have only found a
tool
that has default contacts as destination.


Thanks for any help
 
1) Try this:

Set Folder=objNs.Folders("SQLView")
Set Folder=Folder.Folders("Contacts")
Set Folder=Folder.Folders("Company")

2) If you call ContactItem.Copy, a new ContactItem will be returned. Then
cal its Move method and pass the folder object.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Thu, 23 Oct 2008 09:16:01 +0100 schrieb myicq:
 
'Michael Bauer [MVP - Outlook said:
;271922']1) Try this:

Set Folder=objNs.Folders("SQLView")
Set Folder=Folder.Folders("Contacts")
Set Folder=Folder.Folders("Company")
Thanks..
Although that is exactly the same, only in 3 different lines :)

Is there a way to use a path-like notification, lik
\\SQLView\Contacts\Company or similar ? I think I have seen tha
somewhere in a post on Outlook VBA code.

- Torben
 
It's not the same, by using the names you know what folder you're going to
access. Of course, you can write a function that takes the full path as a
parameter; then the function has to split the path to get all of the folder
names.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Fri, 24 Oct 2008 08:26:03 +0100 schrieb myicq:
'Michael Bauer [MVP - Outlook said:
;271922']1) Try this:

Set Folder=objNs.Folders("SQLView")
Set Folder=Folder.Folders("Contacts")
Set Folder=Folder.Folders("Company")
Thanks..
Although that is exactly the same, only in 3 different lines :)

Is there a way to use a path-like notification, like
\\SQLView\Contacts\Company or similar ? I think I have seen that
somewhere in a post on Outlook VBA code.

- Torben.
 
Back
Top