?
Solved

A Script to Copy Contacts Within Outlook?

Posted on 2003-03-14
5
Medium Priority
?
648 Views
Last Modified: 2007-12-19
Within our company, we keep a main contact book in outlook's public folders for all of our employees to access and several of our guys have palms/cell phones that synch with outlook. In order to synch, they copy all of the contacts over from the main address book into their personal contacts folder and synch with that.  We have had a problem several times with some of our not-so-computer-savvy users...rather than COPYING from the primary contact folder into their own, they are cutting and pasting..which obviously can mess up quite a few things for a lot of other people.  I am trying to find out how to write, or find an existing script that will copy the contacts from one contact folder to another for them so we can avoid this problem altogether. I created a script previously that copies some of our finance files over to the server for backup automatically but I'm not familiar with the internal workings of the outlook files..etc..

Can anyone point me in the right direction??

Cheers,
Jamie K.
0
Comment
Question by:jamie_k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Accepted Solution

by:
rjcpjc earned 152 total points
ID: 8141255
You would need to work with the Outlook object model to get at that data. What version of Outlook? If Outlook 2000 or 2002 you can use VBA do this.
0
 
LVL 4

Assisted Solution

by:mesch
mesch earned 148 total points
ID: 8146039
Hey Jamie

this sample demonstrates how to copy ContactItems from the public folder (Public Folder/All Public Folders/Global Contacts)to a users default contact folder. I wrote that in a simple Outlook form, which can be accessed through the action menu of the Global Contacts folder:

Option Explicit


Const olFolderContacts = 10

Sub CommandButton1_Click()

Dim scrFolder, desFolder, oNS, oContactItem, otmpContactItem

Set oNS = Application.GetNameSpace("MAPI")
'-- set source folder object
Set scrFolder = oNS.Folders("Public Folders").Folders("All Public Folders").Folders("Global Contacts")
'-- set destination folder object (default contact folder of users mailbox)
Set desFolder = oNS.GetDefaultFolder(olFolderContacts)
'Copy all ContactItems from source to destination folder
For Each oContactItem In scrFolder.Items
  Set otmpContactItem = oContactItem.Copy
  otmpContactItem.Move desFolder
  Set otmpContactItem = Nothing
Next

'-- clean up memory
Set desFolder = Nothing
Set scrFolder = Nothing
Set oNS = Nothing
End Sub

</norbert>
0
 

Expert Comment

by:shawnbausch
ID: 13283456
Hi,

I am looking for something exactly along the lines of what your sample script addresses - but I am new to forms.  Can you please share some additional info on how to attach this script to a form and run it?  I can create a form and publish it...

Thanks,

Shawn
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Mailbox Overload?
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question