I am having real problems with CDO/MAPI work within ASP.NET. I am trying to log onto the impersonated users mailbox and add appointments etc there. I literally can't do it no matter what I do. I don't get an error untill I try to access the inbox or an item of the field collection. Everything seems to be pointing me towards a problem with authentication but I can't see the problem for the life of me. Has anyone got any code they know works that I can have a look at - I must be doing SOMETHING but can't see what.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
WindowsIdentity.Impersonate(CType(User.Identity, WindowsIdentity).Token)
Dim objSession As MAPI.Session
'Dim objFolder As MAPI.Folder
Dim objStore As MAPI.InfoStore
objSession = New MAPI.Session
objSession.Logon(ProfileInfo:="Ronaldinho" & vbLf & "priley", newsession:=True, showdialog:=False)
'objSession.Logon()
'objstore = Server.CreateObject("MAPI.InfoStore"
'explore(objSession.infostores)
Response.Write(Request.ServerVariables("LOGON_USER"
& objSession.CurrentUser.name)
Response.Flush()
Response.Write("<br/>" & objSession.Application & "<br/>"
For Each objStore In objSession.InfoStores
Response.Write(objStore.Name)
Dim bstrPublicRootID = objStore.Fields.Item(&H66310102).Value '<---- this is currently where I am getting a [Collaboration Data Objects - [MAPI_E_FAILONEPROVIDER(8004011D)]] error
Dim objTopFolder = objSession.GetFolder(bstrPublicRootID, _
objStore.ID)
Dim objFolders = objTopFolder.Folders
Dim objFolder = objFolders.GetFirst()
Response.Write(objfolder.name)
Next
objSession.Logoff()
End If
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
WindowsIdentity.Impersonate(CType(User.Identity, WindowsIdentity).Token)
Dim objSession As MAPI.Session
'Dim objFolder As MAPI.Folder
Dim objStore As MAPI.InfoStore
objSession = New MAPI.Session
objSession.Logon(ProfileInfo:="Ronaldinho" & vbLf & "priley", newsession:=True, showdialog:=False)
'objSession.Logon()
'objstore = Server.CreateObject("MAPI.InfoStore"
'explore(objSession.infostores)
Response.Write(Request.ServerVariables("LOGON_USER"
Response.Flush()
Response.Write("<br/>" & objSession.Application & "<br/>"
For Each objStore In objSession.InfoStores
Response.Write(objStore.Name)
Dim bstrPublicRootID = objStore.Fields.Item(&H66310102).Value '<---- this is currently where I am getting a [Collaboration Data Objects - [MAPI_E_FAILONEPROVIDER(8004011D)]] error
Dim objTopFolder = objSession.GetFolder(bstrPublicRootID, _
objStore.ID)
Dim objFolders = objTopFolder.Folders
Dim objFolder = objFolders.GetFirst()
Response.Write(objfolder.name)
Next
objSession.Logoff()
End If
End Sub