Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Tue, 19 Feb 2008 07:28:01 -0800,    group: microsoft.public.exchange.development        back       


Downloading attachments, some progress...   
Quick refresher: I'm being sent a number of files in e-mail which is directed 
to a public folder. I need to extract the attachments once a day.

I have made some progress. I have figured out how to open the folder using 
ODBC and made queries against the message list, picking out the correct 
messages; ones received today from particular addresses. This, as expected, 
returns a single message "row".

I am now trying to retrieve the attachment. I am going to try to use WebDAV 
to get it, because that seems to be the only one that works on any of these 
machines. Here is what I do...

   rstEmails.Open "SELECT * FROM theTable WHERE [From] LIKE 
'%@thesender.com' AND [Has Attachments]=True AND [Received]>=#" & date & "# 
AND [Received]<#" & DateAdd("d", 1, date) & "#", conn, adOpenStatic, 
adLockReadOnly

    ' use the subject to create an URI
    Subject = Trim(rstEmails!Subject)
    Subject = Replace(Subject, " ", "%20")
    Uri = "http://x4.ourdomain.com/public/theFolder/" & Subject & ".eml"

    Set req = CreateObject("microsoft.xmlhttp")
    req.Open "X-MS-ENUMATTS", Uri, False

    req.send
    Set ret = req.responseXML

    fname = 
ret.getElementsByTagName("e:attachmentfilename")(0).FirstChild.Text

When I try this code against a test file that I sent to the folder, 
everything works fine and I get the file back. However, when I try this 
against a real message, I get nothing in 
ret.getElementsByTagName("e:attachmentfilename"), and looking at the ret 
object itself, I see that the childNodes is zero length, which I assume is 
not correct. Yes, the test file and real file both have a file attachment -- 
which is why the WHERE works.

The only difference I can see is that the "Message.Class" for the message I 
sent is "IPM.Note", whereas the real one came in as "IPM.Post". Would this 
make a difference?

Maury
date: Tue, 19 Feb 2008 07:28:01 -0800   author:   Maury Markowitz

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us