![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello
I need a Vbscript that copy all the contacts from a specified public folder (public folder\all public folder\custom contact) to a local folder. I've tried with many different script but none of them works.....i dont know how to get it works... Thanks in advance for any help. Stefano |
Ads |
#2
|
|||
|
|||
![]()
What in particular didn't work? If you already have it 90% done, there's no point in starting over.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Cecco" wrote in message ... Hello I need a Vbscript that copy all the contacts from a specified public folder (public folder\all public folder\custom contact) to a local folder. I've tried with many different script but none of them works.....i dont know how to get it works... Thanks in advance for any help. Stefano |
#3
|
|||
|
|||
![]()
I've tried with so many differente scripts, i think it better to create a
brand new one. i dont know exactly how to make in vbs this tasks. 1. the script will get the public folder thath contains the contact. 2. for each contact in this folder 2.1 copy each contact to local folder any idea on how to accomplish this? Regards Stefano "Sue Mosher [MVP-Outlook]" ha scritto nel messaggio ... What in particular didn't work? If you already have it 90% done, there's no point in starting over. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Cecco" wrote in message ... Hello I need a Vbscript that copy all the contacts from a specified public folder (public folder\all public folder\custom contact) to a local folder. I've tried with many different script but none of them works.....i dont know how to get it works... Thanks in advance for any help. Stefano |
#4
|
|||
|
|||
![]()
I've created a macro for this purpose...
************************************************** ************************ Sub Copia() Dim myOlApp As New Outlook.Application Dim myNameSpace As Outlook.NameSpace Dim myContactsFolder As Outlook.MAPIFolder Dim myNewFolder As Outlook.MAPIFolder Dim mytrashfolder As Outlook.MAPIFolder Dim myrashcont As Outlook.MAPIFolder Set myNameSpace = myOlApp.GetNamespace("MAPI") Set myContactsFolder = myNameSpace.GetDefaultFolder(olFolderContacts) Set mysync = myContactsFolder.Folders.Item("BUSINESS CONTACT") mysync.Delete Set mypubContact = myNameSpace.GetDefaultFolder(olPublicFoldersAllPub licFolders).Folders.Item("BUSINESS CONTACT") Set myNewFolder = mypubContact.CopyTo(myContactsFolder) 'Sleep 2000 'Set mytrash = myNameSpace.GetDefaultFolder(olFolderDeletedItems) 'Set mytrashcont = mytrash.Folders("BUSINESS CONTACT") 'mytrashcont.Delete End Sub ************************************************** ************************ With this macro the contacts are copied to a subfolder called BUSINESS CONTACT under my contacts folder.....now the problem is... since i delete the old contact stored in the BUSINESS CONTACT folder.....these old items are stored to my deleted item folder and i cannot delete it correctly ( it's the commented part of the script ) "Cecco" ha scritto nel messaggio ... I've tried with so many differente scripts, i think it better to create a brand new one. i dont know exactly how to make in vbs this tasks. 1. the script will get the public folder thath contains the contact. 2. for each contact in this folder 2.1 copy each contact to local folder any idea on how to accomplish this? Regards Stefano "Sue Mosher [MVP-Outlook]" ha scritto nel messaggio ... What in particular didn't work? If you already have it 90% done, there's no point in starting over. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Cecco" wrote in message ... Hello I need a Vbscript that copy all the contacts from a specified public folder (public folder\all public folder\custom contact) to a local folder. I've tried with many different script but none of them works.....i dont know how to get it works... Thanks in advance for any help. Stefano |
#5
|
|||
|
|||
![]()
This may be your problem:
Set myNewFolder = mypubContact.CopyTo(myContactsFolder) As the Help topic for the CopyTo method states: Copies the current folder in its entirety to the destination folder. Returns a MAPIFolder object that represents the new copy. In other words, that statement creates a replica of the public folder as a new sub folder under the mypubContact folder that contains a replica of the Contacts folder from your mailbox. Is that what you want? If not, then you need to iterate the items in myPubContact using a For Each ... Next loop and copy each item to the target folder (myContactsFolder), e.g: For Each itm in mypubContact.Items Set copy = itm.Copy copy.Move myContactsFolder Next now the problem is... since i delete the old contact stored in the BUSINESS CONTACT folder.....these old items are stored to my deleted item folder and i cannot delete it correctly ( it's the commented part of the script ) 'Set mytrash = myNameSpace.GetDefaultFolder(olFolderDeletedItems) 'Set mytrashcont = mytrash.Folders("BUSINESS CONTACT") 'mytrashcont.Delete What happens when you run that code? -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Cecco" wrote in message ... I've created a macro for this purpose... ************************************************** ************************ Sub Copia() Dim myOlApp As New Outlook.Application Dim myNameSpace As Outlook.NameSpace Dim myContactsFolder As Outlook.MAPIFolder Dim myNewFolder As Outlook.MAPIFolder Dim mytrashfolder As Outlook.MAPIFolder Dim myrashcont As Outlook.MAPIFolder Set myNameSpace = myOlApp.GetNamespace("MAPI") Set myContactsFolder = myNameSpace.GetDefaultFolder(olFolderContacts) Set mysync = myContactsFolder.Folders.Item("BUSINESS CONTACT") mysync.Delete Set mypubContact = myNameSpace.GetDefaultFolder(olPublicFoldersAllPub licFolders).Folders.Item("BUSINESS CONTACT") Set myNewFolder = mypubContact.CopyTo(myContactsFolder) 'Sleep 2000 'Set mytrash = myNameSpace.GetDefaultFolder(olFolderDeletedItems) 'Set mytrashcont = mytrash.Folders("BUSINESS CONTACT") 'mytrashcont.Delete End Sub ************************************************** ************************ With this macro the contacts are copied to a subfolder called BUSINESS CONTACT under my contacts folder.....now the problem is... since i delete the old contact stored in the BUSINESS CONTACT folder.....these old items are stored to my deleted item folder and i cannot delete it correctly ( it's the commented part of the script ) "Cecco" ha scritto nel messaggio ... I've tried with so many differente scripts, i think it better to create a brand new one. i dont know exactly how to make in vbs this tasks. 1. the script will get the public folder thath contains the contact. 2. for each contact in this folder 2.1 copy each contact to local folder any idea on how to accomplish this? Regards Stefano "Sue Mosher [MVP-Outlook]" ha scritto nel messaggio ... What in particular didn't work? If you already have it 90% done, there's no point in starting over. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Cecco" wrote in message ... Hello I need a Vbscript that copy all the contacts from a specified public folder (public folder\all public folder\custom contact) to a local folder. I've tried with many different script but none of them works.....i dont know how to get it works... Thanks in advance for any help. Stefano |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Copy single message to public folder | MFH | Outlook and VBA | 3 | June 9th 06 08:09 AM |
Contact in public folder defaults to local contact folder | Alison | Outlook - Using Contacts | 8 | May 30th 06 04:32 AM |
How i export/copy/move messages in a public folder outlook 2003? | Olatunde R. Adeniran | Outlook - Using Contacts | 1 | May 3rd 06 06:51 PM |
Copy of Outlook 2002 appointment sent to Public Folder calendar gets to another calendar | QH | Outlook - Calandaring | 1 | February 2nd 06 02:45 PM |
Copy useful news to local folder | kei | Outlook Express | 3 | January 21st 06 12:37 AM |