Thanks Glen,
I need to clarify a little more. If it were just getting items from the
inbox I could figure that out. The problem I'm having is I need to copy
all
items in all folders. With CDO and OOM, it just appears you can either
get
items from one of the defined default folders such as inbox, calendar,
contacts etc. The problem is you can create folders from the root or any
where.
Using web dav I can create a query and use the following code,
strQuery = "<?xml version=\"1.0\"?><D:searchrequest xmlns:D = \"DAV:\" >"
+
"<D:sql>SELECT \"DAV:displayname\", ,\"DAV:creationdate\",
\"DAV:parentname\"" +
" FROM scope('DEEP TRAVERSAL OF \"" + strSourceURI + "\"')" +
"WHERE \"DAV:ishidden\" = false AND \"DAV:contentclass\" =
'urn:content-classes:message'" +
"</D:sql></D:searchrequest>";
Can't seem to do that with the CDO or OOM. What I need is a way to either
list all folders so I can traverse through them extracting the messages or
like above have a way to filter different types of items from all folders
for
a user.
I haven't found a way to do this in CDO or OOM.
Thanks.
kris
"Glen Scales [MVP]" wrote:
One mehod that may work is to use copyto in CDO 1.2 this does preserve
the
senttime. Eg I use this piece of code to copy items from a public folder
to
an inbox
set objSession = CreateObject("MAPI.Session")
strProfile = "Servername" & vbLf & "MailboxAlias"
objSession.Logon "",,, False,, True, strProfile
Set objInbox = objSession.Inbox
Set objInfoStore = objSession.GetInfoStore(objSession.Inbox.StoreID)
Set objpubstore = objSession.InfoStores("Public Folders")
messid = "messageid"
set objmessage = objSession.getmessage(messid,objpubStore.id)
set objCopyMessage = objmessage.copyto(objInbox.ID,objInfoStore.ID)
objCopyMessage.Update
Set objCopyMessage = Nothing
objsession.Logoff
Cheers
Glen
"kfrost" <kfrost@discussions.microsoft.com> wrote in message
news:B7D01B51-0351-459F-810A-B6866392DAEA@microsoft.com...
Hello,
First off I understand with webdav you can't use the copy methods to
move
or
copy items to different stores. I did figure out a round about way to
do
this using webdav however, the biggest problem is that the I can't
preserve
the message date on the items. Since my program is technically
creating
new
items in public folder and getting an xml dump from the original
message.
The create date is when the program is ran it's a read only property I
can't
manipulate. (I posted some of the code in the post "Moving mail items
from a
public folder to a General purpose folder.)
So I'm looking for other ideas. You can do this in Outlook so to me
that
means it can be programmatically accomplished. However, looking
through
the
OOM, I can't figure out how to go through and either get a collection
of
folders or setup a query that returns all mail items in all folders
like
you
can with WebDav.
I've started looking at CDO and have yet to come up with anything.
Also, to help understand, my task is to take all a user's emails and
appointments who has left a company and copy these to a public folder.
Any ideas or pointers would be greatly appreciated.