WebDAV to access attached emails

G

Guest

Hi,

Within WebDAV I can use "X-MS-ENUMATTS" and "attachmentfilename" to get
attachment file names. But if the attachment is another email, it doesn't
come with "attachmentfilename".

My question is for attached emails, can I still use "X-MS-ENUMATTS" to get
them? using which property (similar to "attachmentfilename" for attached
files)?
Thanks in advance.

Li
 
K

Kevin Yu [MSFT]

Hi Li,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

PS: microsoft.public.exchange.development is a better newsgroup for you to
ask WebDAV questions. More experienced people will reply to your questions
in that newsgroup. Thanks

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

Hi Li,

I noticed that an MVP Glen Scales has replied to you in anothor thread in
icrosoft.public.exchange2000.development. For convenience, I paste his
reply here. If you are still having questions, please reply to the post,
and I will find more resources for you. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


You should be able to use the CN which should be there wether its a normal
attachment or an embedded message. You might also want to look at using the
PR_ATTACH_METHOD (http://schemas.microsoft.com/mapi/proptag/x37050003) this
will tell you what type of attachment you are dealing with eg for a normal
attachment this should return 1 or for a embedded message it should return
5. If you want to access an attachment that is within the embedded message
then you need to call X-MS-ENUMATTS against the URL of the embedded
message.
Eg Something like this


strURI = "http://servername/Exchange/mailbox/Inbox/item.EML"
set req = createobject("microsoft.xmlhttp")
req.open "X-MS-ENUMATTS", strURI, false, "", ""
req.send


If req.status > 207 Or req.status < 207 Then
wscript.echo "Status: " & req.status
wscript.echo "Status text: " & req.statustext
wscript.echo "Response text: " & req.responsetext
Else
set resDoc = req.responseXML
Set objPropstatNodeList = resDoc.getElementsByTagName("a:propstat")
Set objHrefNodeList = resDoc.getElementsByTagName("a:href")
If objPropstatNodeList.length > 0 Then
wscript.echo objPropstatNodeList.length & " attachments found..."
For i = 0 To (objPropstatNodeList.length -1)
set objPropstatNode = objPropstatNodeList.nextNode
set objHrefNode = objHrefNodeList.nextNode
wscript.echo ""
wscript.echo "Attachment: " & objHrefNode.Text
set objNode =
objPropstatNode.selectSingleNode("a:prop/d:x37050003")
wscript.echo "Attachment Method: " & objNode.Text
set objNode2 = objPropstatNode.selectSingleNode("a:prop/f:cn")
wscript.echo "CN: " & objNode2.Text
if objNode.Text = 5 then
embedattach(objHrefNode.Text)
else
set objNode1 =
objPropstatNode.selectSingleNode("a:prop/d:x3704001f")
wscript.echo "Attachment name: " & objNode1.Text
end if
next
Else
wscript.echo "No file attachments found..."
End If


End If
Set req = Nothing


sub embedattach(objhref)
req.open "X-MS-ENUMATTS", objhref, false, "", ""
req.send
If req.status > 207 Or req.status < 207 Then
wscript.echo "Status: " & req.status
wscript.echo "Status text: " & req.statustext
wscript.echo "Response text: " & req.responsetext
Else
wscript.echo ""
wscript.echo "Embedded Message"
set resDoc1 = req.responseXML
Set objPropstatNodeList1 = resDoc1.getElementsByTagName("a:propstat")
Set objHrefNodeList1 = resDoc1.getElementsByTagName("a:href")
If objPropstatNodeList1.length > 0 Then
wscript.echo objPropstatNodeList1.length & " attachments found..."
For i = 0 To (objPropstatNodeList1.length -1)
set objPropstatNode1 = objPropstatNodeList1.nextNode
set objHrefNode1 = objHrefNodeList1.nextNode
wscript.echo "Attachment: " & objHrefNode1.Text
set objNode =
objPropstatNode1.selectSingleNode("a:prop/d:x37050003")
wscript.echo "Attachment Method: " & objNode.Text
set objNode2 = objPropstatNode1.selectSingleNode("a:prop/f:cn")
wscript.echo "CN: " & objNode2.Text
if objNode.Text = 5 then
embedattach(objHrefNode1.Text)
else
set objNode1 =
objPropstatNode1.selectSingleNode("a:prop/d:x3704001f")
wscript.echo "Attachment name: " & objNode1.Text
end if
next
Else
wscript.echo "No file attachments found..."
End If
End If
end sub


Cheers
Glen
 
G

Guest

Thanks!

Li

Kevin Yu said:
Hi Li,

I noticed that an MVP Glen Scales has replied to you in anothor thread in
icrosoft.public.exchange2000.development. For convenience, I paste his
reply here. If you are still having questions, please reply to the post,
and I will find more resources for you. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


You should be able to use the CN which should be there wether its a normal
attachment or an embedded message. You might also want to look at using the
PR_ATTACH_METHOD (http://schemas.microsoft.com/mapi/proptag/x37050003) this
will tell you what type of attachment you are dealing with eg for a normal
attachment this should return 1 or for a embedded message it should return
5. If you want to access an attachment that is within the embedded message
then you need to call X-MS-ENUMATTS against the URL of the embedded
message.
Eg Something like this


strURI = "http://servername/Exchange/mailbox/Inbox/item.EML"
set req = createobject("microsoft.xmlhttp")
req.open "X-MS-ENUMATTS", strURI, false, "", ""
req.send


If req.status > 207 Or req.status < 207 Then
wscript.echo "Status: " & req.status
wscript.echo "Status text: " & req.statustext
wscript.echo "Response text: " & req.responsetext
Else
set resDoc = req.responseXML
Set objPropstatNodeList = resDoc.getElementsByTagName("a:propstat")
Set objHrefNodeList = resDoc.getElementsByTagName("a:href")
If objPropstatNodeList.length > 0 Then
wscript.echo objPropstatNodeList.length & " attachments found..."
For i = 0 To (objPropstatNodeList.length -1)
set objPropstatNode = objPropstatNodeList.nextNode
set objHrefNode = objHrefNodeList.nextNode
wscript.echo ""
wscript.echo "Attachment: " & objHrefNode.Text
set objNode =
objPropstatNode.selectSingleNode("a:prop/d:x37050003")
wscript.echo "Attachment Method: " & objNode.Text
set objNode2 = objPropstatNode.selectSingleNode("a:prop/f:cn")
wscript.echo "CN: " & objNode2.Text
if objNode.Text = 5 then
embedattach(objHrefNode.Text)
else
set objNode1 =
objPropstatNode.selectSingleNode("a:prop/d:x3704001f")
wscript.echo "Attachment name: " & objNode1.Text
end if
next
Else
wscript.echo "No file attachments found..."
End If


End If
Set req = Nothing


sub embedattach(objhref)
req.open "X-MS-ENUMATTS", objhref, false, "", ""
req.send
If req.status > 207 Or req.status < 207 Then
wscript.echo "Status: " & req.status
wscript.echo "Status text: " & req.statustext
wscript.echo "Response text: " & req.responsetext
Else
wscript.echo ""
wscript.echo "Embedded Message"
set resDoc1 = req.responseXML
Set objPropstatNodeList1 = resDoc1.getElementsByTagName("a:propstat")
Set objHrefNodeList1 = resDoc1.getElementsByTagName("a:href")
If objPropstatNodeList1.length > 0 Then
wscript.echo objPropstatNodeList1.length & " attachments found..."
For i = 0 To (objPropstatNodeList1.length -1)
set objPropstatNode1 = objPropstatNodeList1.nextNode
set objHrefNode1 = objHrefNodeList1.nextNode
wscript.echo "Attachment: " & objHrefNode1.Text
set objNode =
objPropstatNode1.selectSingleNode("a:prop/d:x37050003")
wscript.echo "Attachment Method: " & objNode.Text
set objNode2 = objPropstatNode1.selectSingleNode("a:prop/f:cn")
wscript.echo "CN: " & objNode2.Text
if objNode.Text = 5 then
embedattach(objHrefNode1.Text)
else
set objNode1 =
objPropstatNode1.selectSingleNode("a:prop/d:x3704001f")
wscript.echo "Attachment name: " & objNode1.Text
end if
next
Else
wscript.echo "No file attachments found..."
End If
End If
end sub


Cheers
Glen
 
K

Kevin Yu [MSFT]

You're welcome!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top