Howto: Get the MIME of an item from a mailbox.


This VBSript sample uses WebDAV to read the mime of a message item and write it to disk.


dim sHREF
dim sUserName 
dim sPassword 
dim sResponse 
dim HttpWebRequest


dim sHREF
dim sUserName 
dim sPassword 
dim sResponse 
dim HttpWebRequest


sHREF = “http://myserver/exchange/Administrator/Inbox/testabcd.EML”  ‘ TODO: change as needed
sUserName = “Administrator”    ‘ TODO: change – needed for Basic Authentication
sPassword = “test”                   ‘  TODO: change – needed for Basic Authentication


set HttpWebRequest = CreateObject(“microsoft.xmlhttp”)
 
‘ TODO: If Windows authentication used, use the line below
‘HttpWebRequest.Open “GET”, sHREF, False 


‘ TODO: If Basic authentication used, use the line below
HttpWebRequest.Open “GET”, sHREF, False, sUserName, sPassword  


HttpWebRequest.setRequestHeader “Content-type:”, “text/xml” ‘ Comment out if not going to Exchange
HttpWebRequest.setRequestHeader “Translate:”, “f”           ‘ Comment out if not going to Exchange   
HttpWebRequest.Send


sResponse  = HttpWebRequest.ResponseText  ‘ Returns as text
   
Set HttpWebRequest = Nothing


‘wscript.echo sResponse                      ‘ write to screen
WriteFileText “c:\test.txt”, sResponse    ‘ write to file


Private Sub WriteFileText(sFilePath, sText)
    Dim objFSO ‘As FileSystemObject
    Dim objTextFile ‘As Object
   
    Const ForReading = 1
    Const ForWriting = 2
    Const ForAppending = 8
   
    Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Set objTextFile = objFSO.CreateTextFile(sFilePath, True)
   
    ‘ Write a line.
    objTextFile.Write (sText)


    objTextFile.Close
    ‘objTextFile.Close


End Sub
 


 

Comments (3)

  1. While Microsoft products follow many RFC guidlines for VCALENDAR/iCAL, it does not mean that they support

  2. While Microsoft products follow many RFC guidlines for VCALENDAR/iCAL, it does not mean that they support

  3. anishjhaveri says:

    Hi,

    I am firing an http request get command for a particular .eml file.

    The response which i will get will have PARTSTAT tag in it from whill i will be able to know the participant status whether accepeted/tentative/declined/needs-action.

    My problem is i always get the PARTSTAT value as "NEEDS-ACTION" even if i accept/decline/tentatively accept.

    I am trying to figure this out since last 10 days but all in vain.

    Please help if you can.

    Thanks,

    Anish