lundi 20 avril 2015

XML reading is not working in my ASP CLASSIC code - Load file returns FALSE

In my outlook 2013 I created a function that saves the sender, subject and domain name in variables. These variables are then transferred/created into an XML file which all works.

Though the next thing I want to achieve is to read the XML files variables and use them on my web page. The reading however does not work, it returns nothing.

The Outlook 2013 macro creates the XML file on a server, and it also ends up there (checked it). The ASP file is located on the same server of the XML file in the same folder.

My code is as follows:

The XML file that is created (with a xml extension)

    <Subject>I am awesome</Subject>

The ASP code that should read, and output the XML values. (did the output in a table for now)

<!DOCTYPE html>
    <meta charset="utf-8">
    <TITLE>Send mails</TITLE>



        Set xmlDOM = Server.CreateObject("MSXML2.DOMDocument")
        xmlDOM.async = False
        xmlDOM.setProperty "ServerHTTPRequest", True

        Test =  xmlDOM.Load("MyXMLFile.xml")
        response.write (Test)

        Set itemList = XMLDom.SelectNodes("Mail2Memo")

        For Each itemAttrib In itemList
           newReceiver =itemAttrib.SelectSingleNode("Receiver").text
           newDomain =itemAttrib.SelectSingleNode("Domain").text
           newSubject =itemAttrib.SelectSingleNode("Subject").text

        Set xmlDOM = Nothing
        Set itemList = Nothing



This code just returns an empty web page for some reason.. The test variable that I have build in (to see what goes wrong) returns the value FALSE, so I am guessing the XML file isn't picked up?

By the way, in the Outlook VBA I added the Microsoft XML, 3.0 as reference

Anyone has a clue what I am doing wrong here?

Aucun commentaire:

Enregistrer un commentaire