A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

backup outlook tasks



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 27th 06, 04:02 PM posted to microsoft.public.outlook.program_vba
vonClausowitz
external usenet poster
 
Posts: 29
Default backup outlook tasks

Hi All,

I would like to make a backup of my outlook tasks without using the
export as .pst.
I just want a VBA macro that will make a copy of all my outlook tasks
as xml data or to a format
like access or so.

Marco

  #2  
Old June 27th 06, 10:41 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default backup outlook tasks

Here's some code that outputs e-mails to XML; this can be quickly modified
for Task items:

Sub CopyEmailsToXml()
Dim dirLocation As String
dirLocation = InputBox("Please enter an absolute directory location and
filename (e.g., c:\temp\myContacts.xml). The exported XML file will be
written to this location.")
If dirLocation = Null Or Len(dirLocation) = 0 Then
Exit Sub
End If
Dim xmlDoc As DOMDocument
Dim xmlNode As IXMLDOMNode
Dim xmlEmails As IXMLDOMNode
Dim xmlPi As IXMLDOMProcessingInstruction
Set xmlDoc = New DOMDocument

Set xmlPi = xmlDoc.createProcessingInstruction("xml", "version=""1.0""")
Set xmlNode = xmlDoc.appendChild(xmlPi)
Set xmlEmails = xmlDoc.createElement("emails")
Set xmlNode = xmlDoc.appendChild(xmlEmails)

Dim objApplication As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objEmails As Outlook.MAPIFolder
Dim objEmail As Outlook.MailItem
Dim emailIndex As Integer

Set objApplication = CreateObject("Outlook.Application")
Set objNameSpace = objApplication.GetNamespace("MAPI")
Set objEmails = objNameSpace.PickFolder
' Todo: Add code to check to see if objEmails is valid

Dim xmlEmail As IXMLDOMNode
Dim xmlText As IXMLDOMText

For emailIndex = 1 To objEmails.Items.Count
Set objEmail = objEmails.Items.Item(emailIndex)
Set xmlEmail = xmlDoc.createElement("email")

Set xmlNode = xmlDoc.createElement("sender")
Set xmlText =
xmlNode.appendChild(xmlDoc.createTextNode(objEmail .SenderName))
Set xmlNode = xmlEmail.appendChild(xmlNode)

Set xmlNode = xmlDoc.createElement("receivedtime")
Set xmlText =
xmlNode.appendChild(xmlDoc.createTextNode(objEmail .ReceivedTime))
Set xmlNode = xmlEmail.appendChild(xmlNode)

Set xmlNode = xmlDoc.createElement("subject")
Set xmlText =
xmlNode.appendChild(xmlDoc.createTextNode(objEmail .Subject))
Set xmlNode = xmlEmail.appendChild(xmlNode)

Set xmlNode = xmlDoc.createElement("message")
Set xmlText =
xmlNode.appendChild(xmlDoc.createTextNode(objEmail .Body))
Set xmlNode = xmlEmail.appendChild(xmlNode)

Set xmlNode = xmlDoc.createElement("htmlmessage")
Set xmlText =
xmlNode.appendChild(xmlDoc.createTextNode(objEmail .HTMLBody))
Set xmlNode = xmlEmail.appendChild(xmlNode)

Set xmlEmail = xmlEmails.appendChild(xmlEmail)
Next

xmlDoc.Save (dirLocation)
MsgBox "Outlook E-Mail Items exported to XML"
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"vonClausowitz" wrote:

Hi All,

I would like to make a backup of my outlook tasks without using the
export as .pst.
I just want a VBA macro that will make a copy of all my outlook tasks
as xml data or to a format
like access or so.

Marco


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup your Outlook calendar, address book, notes, tasks...etc online, synchronize it across several locations, and get web access to all these data! [email protected] Outlook - Calandaring 1 April 14th 06 06:31 PM
BACKUP TOOL INSTALLED BUT CANNOT BACKUP! solon Outlook - Installation 4 April 13th 06 11:49 AM
Copy Mail Files to Backup and Import from Backup Folder datakop Outlook Express 1 April 6th 06 05:31 AM
outlook pf backup topwath Add-ins for Outlook 4 February 25th 06 11:49 PM
Best Backup to CD for Outlook? Chad Harris Outlook - General Queries 6 February 23rd 06 09:02 AM


All times are GMT +1. The time now is 03:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.