home | get Sue’s code | forums | share code | registration

More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

share code 09-Feb-2010 07:17

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

Code level: intermediate    Code area: Basic Outlook Printer Friendly Version
Title: Contacts as XML
Description: VBA Script that generates a simple XML document in the same format as an Access XML export.
Date: 03-Mar-2003  09:02
Code level: intermediate
Code area: Basic Outlook
Posted by: Randy Haben
Body:
All 17comments
Page [ 1 2 Next >>  
  10-Mar-2003  16:21   
I have tried the code above but it errors out on the line "Set Folder = Folder.Folders.Item(2)". The error I receive is "Array Index out of bounds." What would be causing thsi?

 
  11-Mar-2003  19:41   
In the context of the above code, Folder.Folders.Item(2) would refer to the 2nd subfolder under the default Contacts folder. If you want to work with contacts in your Contacts folder, you don't need that statement.
  11-Jun-2003  10:36   
I apologize. I didn't sanitize the code veru well before posting it. There is another extraneous line. You can delete the assignment to objAppointment -- it was experimental. Also, it's good practice (though not strictly necessary) to Set all object variables to Nothing when you're finished with them. This explicitly releases the associated object interfaces.
  29-Aug-2003  04:28   
Once you've exported as XML - how do you get it back into Outlook?
  08-Sep-2003  21:38   
You'd need to write a reverse routine to map XML elements to Outlook fields. Or see if Access or Excel can handle the XML file, then import from there.
  11-Aug-2004  16:49   
For another example of exporting contacts to XML, see http://www.topxml.com/snippetcentral/main.asp?view=viewsnippet&lang=xml&id=v20020414223234 (Thanks to Outlook MVP Jessie Louise McClennan for the link)
  17-Mar-2005  04:40   
can anyone help me in importing custom fields in contacts usign xml
  17-Mar-2005  08:27   
Sumit, instead of Item.propname for a built-in field, you'd use Item.UserProperties("propname") for a custom field. See http://www.outlookcode.com/d/propsyntax.htm
  05-Aug-2005  14:02   
If you wanted to do the same thing with Tasks, how would you change the above code?
  08-Aug-2005  08:56   
YOu would get the Tasks folder instead of the Contacts folder in your GetDefaultFolder expression and set the arguments for the PrintXMLElement statements to use the TaskItem properties that you want to export.
Page [ 1 2 Next >>  
Post your comment



name        email