We help IT Professionals succeed at work.
Get Started

Server.CreateObject Failed MAPI.Session

SPinckney asked
Last Modified: 2011-10-03
I get the error:

Server.CreateObject Failed
Line 28:

Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

Line 28 is Set objSession = Server.CreateObject("MAPI.Session")

   CONST strServer     = "xxxxxxx"
   CONST strMailbox    = "xxxxxxxx"
   Dim objSession
   Dim objMessages
   Dim objOneMessage
   Dim objInfoStores
   Dim objInfoStore
   Dim objTopFolder
   Dim objFolders
   Dim objSubFolder
   Dim objTargetFolder
   Dim strProfileInfo
   Dim i
   Dim bstrPublicRootID

   strProfileInfo = strServer & vblf & strMailbox
   Set objSession = Server.CreateObject("MAPI.Session")
   objSession.Logon , , , False, , True, strProfileInfo
   Set objInfoStores = objSession.InfoStores
   For i = 1 To objInfoStores.Count
      If objInfoStores.Item(i)= "Public Folders" Then
         Set objInfoStore=objInfoStores.Item(i)
         Exit For
      End If

   bstrPublicRootID = objInfoStore.Fields.Item( &H66310102 ).Value
   Set objTopFolder = objSession.GetFolder(bstrPublicRootID, _
   Set objFolders = objTopFolder.Folders
   Set objFolder = objFolders.GetFirst()
    Do Until objFolder.Name = "Internet Newsgroups"
      Set objFolder=objFolders.GetNext()
   Set objMessages = objFolder.Messages
   For Each objOneMessage in objMessages
      Response.Write("objOneMessage.Subject = " & _
                     objOneMessage.Subject & "<br>")
      Response.Write("objOneMessage.Text = " & _
                     objOneMessage.Text & "<br>")
   Set objOneMessage = Nothing
   Set objMessages = Nothing
   Set objFolder = Nothing
   Set objTopFolder = Nothing
   Set objSession = Nothing
Watch Question
Rounded IT Consultant / Projects manager / Cloud Consultant / IT Planning
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE