Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Reading Outlook Mailbox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reading Outlook Mailbox

    Hi,

    Have created a little application that reads emailed orders from Amazon and converts them into a database record (so they can be reported etc). I do it by copying and pasting the email into a working window and processing it. This has to be done one at a time.

    I have managed to read Eudora MBX files directly with Alpha5 (there basically text files with a seperator for each message), but was wondering if any body had a experience with doing the same with outlook.

    Would like to be able to read the messages in a particular mailbox directly so they can be stripped out rather than having to cut and paste each message individually.

    Outlook stores all the mailboxes in a .pst file, Eudora, rather helpfully stores each mailbox in a seperate .mbx file (much easier to interpret).
    Chris Tanti
    Technical Support

    Nuance & Fathom Ltd - The data-driven marketing agency

    #2
    Originally posted by Chris.Tanti
    [...] Outlook ... Would like to be able to read the messages in a particular mailbox directly so they can be stripped out rather than having to cut and paste each message individually.
    Chris, did you found a solution?
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

    Comment


      #3
      I have not used this yet. I will be soon though. Thought I would pass it along in case you had not seen it.

      http://www.geniusatwork.nl/


      Regards,

      Jeff

      Comment


        #4
        Originally posted by jkletrovets
        I have not used this yet. I will be soon though. Thought I would pass it along in case you had not seen it.

        http://www.geniusatwork.nl/

        Regards,

        Jeff
        Thanks Jeff,

        I've seen your contribution already in another thread. I'm more interested in a direct way from A5 with Xbasic. There must be a way to do that.
        Marcel

        I hear and I forget. I see and I remember. I do and I understand.
        ---- Confusius ----

        Comment


          #5
          Hi Marcel

          I just ran across this:

          "A more flexible and recommended method for connecting Outlook to a database is ActiveX Data Objects (ADO), the programming interface for OLE DB database technology, which allows you to connect to virtually any kind of data source. ADO 2.0 is included with Office 2000 and downloadable for earlier versions of Outlook. Later versions of Office come with later versions of ADO.
          If you want to synchronize data between Outlook items and database records, you might link the Outlook item and the database record through a custom ID field on the Outlook item that has a counterpart in the database, both holding the same values. See Developer information about the calendar changes in Outlook 2003 Service Pack 2 and later versions about changes related to the EntryID in appointments that may make it a poor choice for this kind of linking.

          My book, Microsoft Outlook Programming - Jumpstart for Administrators, Developers, and Power Users, includes practical examples for connecting to Access and SQL Server databases with both DSN and DSN-less connections, populating a combo box from a database table, and using a database to generate a sequential unique ID. You can download the sample code from the get Sue's code link below."

          It came from here:

          http://www.outlookcode.com/d/database.htm

          Sounds like it is indeed possible. I will be digging into this fairly soon myself so I hope there is an elegant solution out there.

          Regards,

          Jeff

          Comment


            #6
            How about this:

            Code:
            'Date Created: 14-Apr-2006 05:57:19 PM
            'Last Updated: 14-Apr-2006 05:57:19 PM
            'Created By  : Marcel Kollenaar
            'Updated By  : Marcel Kollenaar
            
            dim myOlApp as P
            dim myNameSpace as P
            dim myFolder as P
            constant olFolderInbox = 6
            myOlApp = ole.GetObject("","Outlook.Application")
            myNameSpace = myOlApp.GetNameSpace("MAPI")
            myFolder= myNameSpace.GetDefaultFolder(olFolderInbox)
            myFolder.Display()
            end
            This starts Outlook and shows your FolderIn. This is the first step [...]

            The next step is to cycle through the emails and get the text. :)
            Last edited by Marcel Kollenaar; 04-14-2006, 12:04 PM.
            Marcel

            I hear and I forget. I see and I remember. I do and I understand.
            ---- Confusius ----

            Comment


              #7
              Well now,

              How cool is that!

              I ran across this too.

              http://support.microsoft.com/?kbid=275262

              Thanks Marcel - that will definitely get me where I want to go quicker.

              Regards,

              Jeff

              Comment


                #8
                Well, accessing the Outlook Calendar with the Jet Engine is also cool. Can't wait to see your Xbasic steps on this.

                The problem with Outlook is that it has no Macro Recorder as Word and Excel has. In outlook you have to conquer every line of code. If you once know how the objects want to be handled from within A5 it's easy.

                BTW, thanks for the links, nice information and a lot of it can be rewritten for Xbasic. :D
                Last edited by Marcel Kollenaar; 04-14-2006, 12:26 PM.
                Marcel

                I hear and I forget. I see and I remember. I do and I understand.
                ---- Confusius ----

                Comment


                  #9
                  Ok, now with a loop!

                  Code:
                  'Last Updated: 14-Apr-2006 09:05:43 PM
                  'Created By  : Marcel Kollenaar
                  'Updated By  : Marcel Kollenaar
                  
                  '// Purpose: Xbasic example how to save the message body text from the FolderInbox
                  '//          to C:\MailItems\Message_n.txt (Where n = 1 to items count)
                  
                  dim myOlApp as P
                  dim myNameSpace as P
                  dim myFolder as P
                  dim ItemCount as N
                  dim i as N
                  dim Path as C
                  
                  constant olFolderInbox = 6
                  constant olTXT = 0
                  
                  myOlApp = ole.GetObject("","Outlook.Application")
                  myNameSpace = myOlApp.GetNameSpace("MAPI")
                  myFolder= myNameSpace.GetDefaultFolder(olFolderInbox)
                  
                  ItemCount = myFolder.items.count
                  
                  '// Create folder C:\MailItems\
                  
                  Path  = "C:\MailItems\\"
                  file.dir_create_recurse(Path)
                  
                  '// Loop through the messages in the FolderInbox
                  '// and save the body text to a text file.
                  
                  for i = 1 to ItemCount
                  	myFolder.items(i).SaveAs(Path + "Message_" + alltrim(str(i)) + ".txt", olTXT)
                  next i
                  
                  delete myOlApp
                  delete myNameSpace
                  delete myFolder
                  
                  end 'of script
                  Marcel

                  I hear and I forget. I see and I remember. I do and I understand.
                  ---- Confusius ----

                  Comment


                    #10
                    That is great! I can't wait to play with it more.

                    I definitely will be digging deeper into this in about a week (have to go out of town next week). I am fairly new to Alpha but I am continually amazed at how great it is and the power available from the basic user interface tools, the genies and from xbasic. Since I am a newbie, I have not been able to help a lot yet on this board. I look forward to giving back as my knowledge increases. I certainly have gained a bunch of knoweledge by just reading this board (and Alpha help files/tutorials) since I purchased Alpha. I don't get the folks that criticize it. It is one nice piece of software! And the help here is awesome.

                    You have definitely helped me Marcel. I might have been able to get there -but you sure paved a pretty smooth on ramp.

                    I'll be sure to post some examples of my trials when I get back. Thanks again.

                    Regards,

                    Jeff

                    Comment


                      #11
                      ADO Connection

                      Greetings Marcel

                      Below is an ADO connection string that works with Outlook for directly reading the data. I am interested in the contact folder primarily so that is what I worked with here. If you have a "standard" installation - You should just need to change the path to your Outlook pst folder in the connection string and hopefully everything will work.

                      Please note this is just my first step too. The next for me is to read the data to a temp table or array that can be used for a look up. I "borrowed" almost all of the code from the A5 help file.

                      I am open to any and all suggestions about enhancing the data retrieval from Outlook. For my needs, the ability to talk to Outlook is going to be fantastic.

                      Best regards,

                      Jeff

                      Code:
                      'Date Created: 28-Apr-2006 01:02:58 AM
                      'Last Updated: 28-Apr-2006 01:05:03 AM
                      'Created By  : Jeff Kletrovets
                      'Updated By  : Jeff Kletrovets
                      ' Code to connect to Outlook via ADO and return last names
                      
                      
                      dim connString as C
                      dim conn as ole::adodb.connection
                      connString="Provider=Microsoft.JET.OLEDB.4.0;Exchange 4.0;MAPILEVEL=Outlook Address Book;PROFILE=Outlook;TABLETYPE=1;DATABASE=C:\Documents and Settings\Jeff Kletrovets\Local Settings\Application Data\Microsoft\Outlook;;Persist Security Info=False"
                      conn.open(connString)
                      
                      ' Create record set
                      rs = conn.Execute("select * from contacts order by last")
                      
                      ' Read the last names into a list and display
                      dim LastnameList as c = ""
                      while .not. rs.Eof()
                          LastnameList = LastnameList + rs.fields.item(1).value + crlf()
                          rs.MoveNext()
                      end while
                      ui_msg_box("Lastnames",LastnameList)
                       
                      ' Close the record set
                      rs.close()
                      ' Close the ADO connection
                      conn.close()

                      Comment


                        #12
                        Hello again...

                        Well, it looks as if you might not need to enter the directory info for your pst. It seems you can create a temp folder in something like c:\temp and just use that.

                        Regards,

                        Jeff

                        Comment


                          #13
                          Here's one more example that reads the inbox. Notice the differences in the connection string. The MAPILEVEL is different and the TABLETYPE also.


                          There is some more info on these settings here:

                          http://msdn.microsoft.com/library/de...olexcoutlk.asp


                          *****************************
                          Code:
                          'Date Created: 28-Apr-2006 02:55:43 AM
                          'Last Updated: 28-Apr-2006 02:55:43 AM
                          'Created By  : Jeff Kletrovets
                          'Updated By  : Jeff Kletrovets
                          dim connString as C
                          dim conn as ole::adodb.connection
                          connString="Provider=Microsoft.JET.OLEDB.4.0;Exchange 4.0;MAPILEVEL=Personal Folders|;PROFILE=Outlook;TABLETYPE=0;DATABASE=C:\temp;;Persist Security Info=False"
                          
                          conn.open(connString)
                          
                          rs=conn.Execute("select * from Inbox")
                          
                          ' display who message is from and subject line
                          dim MessageList as c = ""
                          while .not. rs.Eof()
                              MessageList = MessageList + rs.fields.item(4).value +"   "+rs.fields.item(3).value + crlf()
                              rs.MoveNext()
                          end while
                          
                          ui_msg_box("Email Subject",MessageList)
                          
                          rs.close()
                          
                          conn.close()

                          Comment


                            #14
                            Hi Jeff,

                            This is very nice code. I've seen this code at Microsoft but I didn't related it to Alpha Five in the way you did. I even saw examples how to use it from VBA macros in Word.

                            You are the man. I'll keep this precious code in a safe place.

                            Last edited by Marcel Kollenaar; 04-28-2006, 10:08 AM.
                            Marcel

                            I hear and I forget. I see and I remember. I do and I understand.
                            ---- Confusius ----

                            Comment


                              #15
                              Thanks Marcel.

                              I am excited to use it as well!

                              Regards,

                              Jeff

                              Comment

                              Working...
                              X