Re: Read inboxes of various mailboxes on Exchange Server
- From: "Frank" <Frank@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 9 Jun 2005 13:30:02 -0700
Thanks again! I put in the REQUEST as you indicated:
<?xml version="1.0" encoding="utf-8" ?>
<a:propfind xmlns:a="DAV:">
<a:prop>
<hasattachments xmlns="urn:schemas:httpmail:" />
</a:prop>
</a:propfind>
I believe this is supposed to give me the "hasattachments" property values
for all the emails in my inbox for the "urn:schemas:httpmail" namespace
correct? When I send this in, I receive back this XML which looks like it
failed:
<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:a="DAV:">
<a:response>
<a:href>http://flspexuser02/exchange/nlopes/Inbox/</a:href>
<a:propstat>
<a:status>HTTP/1.1 404 Resource Not Found</a:status>
<a:prop>
<hasattachments/>
</a:prop>
</a:propstat>
</a:response>
I'm not sure why I get the "HTTP/1.1 404 Resource Not Found" error. The
status of sending the HTTP request comes back with a valid 207. My code is
as follows (where oReq is the XMLHTTP object, sURL is my exhange server
address, and the oDOMreq is the XML above):
oReq.Open "PROPFIND", sURL, False, sUserName, sPassword
' Set the Content-Type header to "text/xml".
oReq.setRequestHeader "Content-Type", "text/xml"
' Send the request
oReq.Send oDOMreq
Any ideas what I'm doing wrong? Also, just for testing/learning, is it
possible to use the method PROPFIND to request the "hasattachment" property
for ONLY the unread emails? I know now how to use the WHERE clause for this
(thanks to your previous reply), when used with a SEARCH method (not the
PROPFIND). Is it possible to combine the two into one call? Again, I know
this can be done with the SEARCH and WHERE clause. I just wanted to learn
more about the PROPFIND is only used to "find out what properties may exist
for a particular namespace"? The site
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_webdav_propfind.asp
is of little help and not too many examples that make sense to me.
Thank you again!
"Henning Krause [MVP - Exhange]" wrote:
> Hello,
>
> the DAV: is only one of many namespaces. urn:schemas:httpmail is another. So
> to access this property you do a PROPFIND with this body:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <a:propfind xmlns:a="DAV:">
> <a:prop>
> <hasattachments xmlns="urn:schemas:httpmail:" />
> </a:prop>
> </a:propfind>
>
> Here is a list of of the WebDAV scheme used by exchange:
> http://msdn.microsoft.com/library/en-us/e2k3/e2k3/wss_references_contentclasses.asp
>
> To select only unread mails, you must include a WHERE clause in your query:
>
> WHERE "urn:schemas:httpmail:read" = FALSE
>
> To get the attachments, you must use the propietary X-MS-ENUMATTS method
> (http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_webdav_x-ms-enumatts.asp).
>
> And look into this:
> http://msdn.microsoft.com/library/en-us/e2k3/e2k3/wss_references_webdav.asp,
> its the WebDAV reference from Microsoft.
>
> Greetings,
> Henning Krause [MVP - Exchange]
> ==========================
> Visit my website: http://www.infinitec.de
> Try my free Exchange Explorer: Mistaya
> (http://www.infinitec.de/software/mistaya.aspx)
>
>
> "Frank" <Frank@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:48DBEA9E-ECE5-4E43-BF43-2A0A74E4843A@xxxxxxxxxxxxxxxx
> > Thank you very much! Your reply was extremely helpful and I was
> > successful
> > at sending a query to our Exchange Server to return back data I needed.
> > I'm
> > still learning some of the properties (if that is what they are called) to
> > used in the SELECT statement for obtaining the fields I needed.
> >
> > I also downloaded your Mistaya program and found it very helpful to see
> > all
> > the regions and fields that I can obtain when peforming my SELECT query.
> > Is
> > it correct for me to say that I can't always use DAV: region (i.e. use the
> > DAV:propertyname) in my search to get everything from an email? I see
> > that
> > to check if an email "has attachments", I needed to search on something
> > like
> > "urn:schemas:httpmail:hasattachments" which brings back True or False. I
> > did
> > not see a "subject" or "hasattachments", etc... for the properties listed
> > under DAV.
> >
> > Also I could NOT find how to find out how many attachments an email has or
> > how to retrieve them using WebDAV. Do you have any examples/links where
> > they
> > show how to retrieve all the attachments an email has using WebDAV and
> > Visual
> > Basic 6 (or vbscript that I can translate)?
> >
> > Thank you again for your time.
> >
> > Frank
> >
> > "Henning Krause [MVP - Exhange]" wrote:
> >
> >> Hello,
> >>
> >> you can do this with WebDAV.
> >>
> >> If you have more than one Exchange server, you must first determine the
> >> correct Exchange Server. See
> >> http://infinitec.de/exchange/howtos/getmailboxurl.aspx on how to this.
> >>
> >> If you have only one server, you can skip that part and access the
> >> Mailbox
> >> via http://myserver/exchange/<alias>
> >>
> >> If you have multiple languages, then the path of your inbox folder
> >> differs.
> >> In this case do a PROPFIND on the mailbox root and retrieve the property
> >> "urn:schemas:httpmail:inbox". This property contains the url to the inbox
> >> folde. (See
> >> http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_exch2k_getting_well-known_mailbox_folder_urls.asp
> >> for more on this topic, including an example).
> >>
> >> Now that you have the URL, do a SEARCH on that folder (see
> >> http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_exch2k_search_tasks.asp)
> >> and get the emails you need.
> >>
> >> You say you have all the username/password credentials... You really
> >> don't
> >> need them. There are two possible ways around this: Grant a special user
> >> account the rights "Send As" and "Receive As" on the mailbox store. This
> >> way
> >> the useraccount you are using has full access to all mailboxes.
> >>
> >> The other way is to use the administrative root. Use an administrator
> >> account and instead of the urls above, use this one:
> >> http://server/exadmin/admin/<full-dns-name>/MBX/<alias>
> >>
> >> This url circumvents MAPI access checks and you also have full access to
> >> the
> >> mailbox.
> >>
> >> This is far better than to have a ton of passwords lying around.
> >>
> >> Greetings,
> >> Henning Krause [MVP - Exchange]
> >> ==========================
> >> Visit my website: http://www.infinitec.de
> >> Try my free Exchange Explorer: Mistaya
> >> (http://www.infinitec.de/software/mistaya.aspx)
> >>
> >>
> >> "Frank" <Frank@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> >> news:E3E6BC54-2ACB-4003-B38A-A14D3C3C9F7C@xxxxxxxxxxxxxxxx
> >> >I need to create a program in VB6 that read the UNREAD emails located in
> >> >the
> >> > inbox of several mailboxes. I've been given a list of the mailboxes
> >> > names,
> >> > alias, username/password. Basically I need to loop through each
> >> > mailbox
> >> > and
> >> > read all the UNREAD email items in the INBOX. For each email I need to
> >> > know
> >> > the email subject, message body, recipients, sender, and obtain any
> >> > attachments. This program will NOT be running on the same machine as
> >> > Exchange Server.
> >> >
> >> > I've been reading many articles on using CDO, CDOEx, recordsets with
> >> > ADO,
> >> > and using WebDAV. Any help, suggestions, or code examples/links would
> >> > be
> >> > greatly appreciated.
> >> >
> >> > Thank you very much for your time,
> >> >
> >> > Frank
> >>
> >>
> >>
>
>
>
.
- Follow-Ups:
- Re: Read inboxes of various mailboxes on Exchange Server
- From: Henning Krause [MVP - Exhange]
- Re: Read inboxes of various mailboxes on Exchange Server
- References:
- Read inboxes of various mailboxes on Exchange Server
- From: Frank
- Re: Read inboxes of various mailboxes on Exchange Server
- From: Henning Krause [MVP - Exhange]
- Re: Read inboxes of various mailboxes on Exchange Server
- From: Frank
- Re: Read inboxes of various mailboxes on Exchange Server
- From: Henning Krause [MVP - Exhange]
- Read inboxes of various mailboxes on Exchange Server
- Prev by Date: Re: Customizing OWA 2003
- Next by Date: Re: Read inboxes of various mailboxes on Exchange Server
- Previous by thread: Re: Read inboxes of various mailboxes on Exchange Server
- Next by thread: Re: Read inboxes of various mailboxes on Exchange Server
- Index(es):
Relevant Pages
|