|
| Author |
Message |
Maury Markowitz
Joined: 14 Feb 2008 Posts: 12
|
Posted: Thu Feb 14, 2008 4:49 pm Post subject: Accessing attachments through ODBC? Any ODBC/Exchange gurus? |
|
|
I have created a public folder to act as a "drop box" for incoming messages
that need to be readable by anyone in the company. Some of these messages are
automated reports that are generated by 3rd parties. I'd like to access these
files, preferably via ODBC.
I have linked to the appropriate folder, and I see that my test message has
a boolean set for "Has Attachments". However I don't see any obvious way to
get at the attachments. Is there a way to do this?
Maury
Archived from group: microsoft>public>exchange>development |
|
| Back to top |
|
 |
Henning Krause [MVP - Exc
Joined: 05 Aug 2007 Posts: 142
|
Posted: Fri Feb 15, 2008 2:32 am Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
Hello,
perhaps this will help you:
http://gsexdev.blogspot.com/2005/08/mailbox-attachment-auditing-script.html
Kind regards,
Henning Krause
"Maury Markowitz" wrote in
message @microsoft.com...
>I have created a public folder to act as a "drop box" for incoming messages
> that need to be readable by anyone in the company. Some of these messages
> are
> automated reports that are generated by 3rd parties. I'd like to access
> these
> files, preferably via ODBC.
>
> I have linked to the appropriate folder, and I see that my test message
> has
> a boolean set for "Has Attachments". However I don't see any obvious way
> to
> get at the attachments. Is there a way to do this?
>
> Maury |
|
| Back to top |
|
 |
Maury Markowitz
Joined: 14 Feb 2008 Posts: 12
|
Posted: Thu Feb 14, 2008 6:04 pm Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
"Henning Krause [MVP - Exchange]" wrote:
> perhaps this will help you:
> http://gsexdev.blogspot.com/2005/08/mailbox-attachment-auditing-script.html
Well unfortunately I know nothing about DataShape so I can't really make
heads or tails of it.
I'm currently looking over the CDO interface, which seems to work the same
way my brain does. But even though I Referenced it in my VBA (Access)
project, every attempt to refer to objects inside fails. For instance...
Dim Fldr As CDO.Folder
Complains about the user-defined-type not existing.
I also tried the WebDAV approach, as outlined in a message you posted some
time ago (2006), but the problem is that it appears the resulting attachments
will not easily be saved (Access VBA with no .net).
Maury |
|
| Back to top |
|
 |
Henning Krause [MVP - Exc
Joined: 05 Aug 2007 Posts: 142
|
Posted: Fri Feb 15, 2008 3:10 am Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
Hello,
you can download Cdo from the Microsoft website. See here for more infos on
this: http://blogs.msdn.com/dgoldman/archive/2006/06/19/636996.aspx
Kind regards,
Henning Krause
"Maury Markowitz" wrote in
message @microsoft.com...
> "Henning Krause [MVP - Exchange]" wrote:
>
>> perhaps this will help you:
>> http://gsexdev.blogspot.com/2005/08/mailbox-attachment-auditing-script.html
>
> Well unfortunately I know nothing about DataShape so I can't really make
> heads or tails of it.
>
> I'm currently looking over the CDO interface, which seems to work the same
> way my brain does. But even though I Referenced it in my VBA (Access)
> project, every attempt to refer to objects inside fails. For instance...
>
> Dim Fldr As CDO.Folder
>
> Complains about the user-defined-type not existing.
>
> I also tried the WebDAV approach, as outlined in a message you posted some
> time ago (2006), but the problem is that it appears the resulting
> attachments
> will not easily be saved (Access VBA with no .net).
>
> Maury |
|
| Back to top |
|
 |
Maury Markowitz
Joined: 14 Feb 2008 Posts: 12
|
Posted: Thu Feb 14, 2008 6:29 pm Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
"Henning Krause [MVP - Exchange]" wrote:
> you can download Cdo from the Microsoft website. See here for more infos on
> this: http://blogs.msdn.com/dgoldman/archive/2006/06/19/636996.aspx
Well I'm just looking for the first thing that (a) works and (b) I can
understand. DAV seems to be working so far. Here's what I have...
uri = "http://myserver/public/myfolder/MyTest.eml/"
' Create the XMLHTTP object and use the URI, false=async
Set req = CreateObject("microsoft.xmlhttp")
req.Open "X-MS-ENUMATTS", uri, False
' send and receive it
req.send
Set resDoc = req.responseXML
' use the DOM to get the elements we need, the (0) means
' "first item in the array", which is fine if we assume only one
attachment
fname =
resDoc.getElementsByTagName("e:attachmentfilename")(0).firstChild.Text
uri = resDoc.getElementsByTagName("a:href")(0).firstChild.Text
So far so good, I have both the original filename (useful) as well as the URI.
So now I need to retreive the file and save it out to disk. Reading over a
previous thread of yours (from 2006), this might be difficult in VBA?
Maury |
|
| Back to top |
|
 |
Henning Krause [MVP - Exc
Joined: 05 Aug 2007 Posts: 142
|
Posted: Fri Feb 15, 2008 3:51 am Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
Hello,
the thing is that XmlHttp is fine for transferring xml or plain text. But it
may be difficult to get the binary stream.
You can get the data of the attachment from the responseStream property of
the Xmltttprequest instance. You'll get an object which is of type IStream.
Now you need a stream to a file on the disk. I don't know if VBA can give
you this.
Kind regards,
Henning Krause
"Maury Markowitz" wrote in
message @microsoft.com...
> "Henning Krause [MVP - Exchange]" wrote:
>
>> you can download Cdo from the Microsoft website. See here for more infos
>> on
>> this: http://blogs.msdn.com/dgoldman/archive/2006/06/19/636996.aspx
>
> Well I'm just looking for the first thing that (a) works and (b) I can
> understand. DAV seems to be working so far. Here's what I have...
>
> uri = "http://myserver/public/myfolder/MyTest.eml/"
>
> ' Create the XMLHTTP object and use the URI, false=async
> Set req = CreateObject("microsoft.xmlhttp")
> req.Open "X-MS-ENUMATTS", uri, False
>
> ' send and receive it
> req.send
> Set resDoc = req.responseXML
>
> ' use the DOM to get the elements we need, the (0) means
> ' "first item in the array", which is fine if we assume only one
> attachment
> fname =
> resDoc.getElementsByTagName("e:attachmentfilename")(0).firstChild.Text
> uri = resDoc.getElementsByTagName("a:href")(0).firstChild.Text
>
> So far so good, I have both the original filename (useful) as well as the
> URI.
>
> So now I need to retreive the file and save it out to disk. Reading over a
> previous thread of yours (from 2006), this might be difficult in VBA?
>
> Maury |
|
| Back to top |
|
 |
Maury Markowitz
Joined: 14 Feb 2008 Posts: 12
|
Posted: Thu Feb 14, 2008 7:01 pm Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
"Henning Krause [MVP - Exchange]" wrote:
Perhaps I am overthinking this? Is there some easy way to do this that
everyone uses? Surely scraping files from a folder is a common need?
Maury |
|
| Back to top |
|
 |
Henning Krause [MVP - Exc
Joined: 05 Aug 2007 Posts: 142
|
Posted: Sat Feb 16, 2008 2:12 am Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
Hi,
most people don't use VBScript or VBA to do this kind of stuff...
Kind regards,
Henning
"Maury Markowitz" wrote in
message @microsoft.com...
> "Henning Krause [MVP - Exchange]" wrote:
>
> Perhaps I am overthinking this? Is there some easy way to do this that
> everyone uses? Surely scraping files from a folder is a common need?
>
> Maury |
|
| Back to top |
|
 |
Maury Markowitz
Joined: 14 Feb 2008 Posts: 12
|
Posted: Tue Feb 19, 2008 12:13 pm Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
"Henning Krause [MVP - Exchange]" wrote:
> most people don't use VBScript or VBA to do this kind of stuff...
Well, what would be the normal solution?
Maury |
|
| Back to top |
|
 |
Henning Krause [MVP - Exc
Joined: 05 Aug 2007 Posts: 142
|
Posted: Mon Feb 25, 2008 2:36 am Post subject: Re: Accessing attachments through ODBC? Any ODBC/Exchange gu |
|
|
Hi,
if you use a language like Visual Basic or C++ or C# you can easily work
with binary data.
Perhaps there are ActiveX controls available which you can use to deal with
the data from VBA.
Kind regards,
Henning Krause
"Maury Markowitz" wrote in
message @microsoft.com...
> "Henning Krause [MVP - Exchange]" wrote:
>> most people don't use VBScript or VBA to do this kind of stuff...
>
> Well, what would be the normal solution?
>
> Maury
|
|
| Back to top |
|
 |
|