Hi Li,
I noticed that an MVP Glen Scales has replied to you in anothor thread in
icrosoft.public .exchange2000.d evelopment. 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_METHO D (
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("m icrosoft.xmlhtt p")
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.responsetex t
Else
set resDoc = req.responseXML
Set objPropstatNode List = resDoc.getEleme ntsByTagName("a :propstat")
Set objHrefNodeList = resDoc.getEleme ntsByTagName("a :href")
If objPropstatNode List.length > 0 Then
wscript.echo objPropstatNode List.length & " attachments found..."
For i = 0 To (objPropstatNod eList.length -1)
set objPropstatNode = objPropstatNode List.nextNode
set objHrefNode = objHrefNodeList .nextNode
wscript.echo ""
wscript.echo "Attachment : " & objHrefNode.Tex t
set objNode =
objPropstatNode .selectSingleNo de("a:prop/d:x37050003")
wscript.echo "Attachment Method: " & objNode.Text
set objNode2 = objPropstatNode .selectSingleNo de("a:prop/f:cn")
wscript.echo "CN: " & objNode2.Text
if objNode.Text = 5 then
embedattach(obj HrefNode.Text)
else
set objNode1 =
objPropstatNode .selectSingleNo de("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(obj href)
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.responsetex t
Else
wscript.echo ""
wscript.echo "Embedded Message"
set resDoc1 = req.responseXML
Set objPropstatNode List1 = resDoc1.getElem entsByTagName(" a:propstat")
Set objHrefNodeList 1 = resDoc1.getElem entsByTagName(" a:href")
If objPropstatNode List1.length > 0 Then
wscript.echo objPropstatNode List1.length & " attachments found..."
For i = 0 To (objPropstatNod eList1.length -1)
set objPropstatNode 1 = objPropstatNode List1.nextNode
set objHrefNode1 = objHrefNodeList 1.nextNode
wscript.echo "Attachment : " & objHrefNode1.Te xt
set objNode =
objPropstatNode 1.selectSingleN ode("a:prop/d:x37050003")
wscript.echo "Attachment Method: " & objNode.Text
set objNode2 = objPropstatNode 1.selectSingleN ode("a:prop/f:cn")
wscript.echo "CN: " & objNode2.Text
if objNode.Text = 5 then
embedattach(obj HrefNode1.Text)
else
set objNode1 =
objPropstatNode 1.selectSingleN ode("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