M
Munsifali Rashid
Hi,
I've built a webservice in C# that can add public folders to Exchange.
There's also a component built in VB6 which references the Outlook 10 (XP)
DLL, so I can change the default form being used to post to a public folder.
The component works fine when instantiated from a Windows script, but when
using it from COM Interop in an ASP.NET web application it errors when
trying to execute oNs.GetNameSpace("MAPI").
The error it throws up is 'ActiveX cant create object'. This sounds like a
permissions issue, so I changed web.config and IIS to make the ASP.NET web
application impersonate the administrator account, but without any luck.
A sample of my VB6 code:
(The project references cdo.dll and msoutl.olb)
Public Function UpdateFolder()
'Declare variables
Dim objSession As New MAPI.Session
Dim oFolderA As Outlook.mapiFolder
Dim oFolderTmp As Outlook.mapiFolder
Dim oFolderB As MAPI.Folder
Dim oOutlook As New Outlook.Application
Dim oNs As Outlook.NameSpace
Dim tmpFolder As Outlook.mapiFolder
'Get items from Outlook
Set oNs = oOutlook.GetNamespace("MAPI")
'More stuff here, but taken out to keep this example short.
'The line above is where it hangs.
End Function
The DLL is referenced in my Web Application, and is called using the
following:
Project1.Class1 Obj = new Project1.Class1();
Obj.UpdateFolder();
The VB6 component uses MAPI which I know can't be used from ASP.NET due to
issues with threading, but I don't think this is causing it, as it's all in
the VB6 component (which was built to get around the problem of it not
working in .net).
If this can't be done, then I might have to write a Windows service, which
is called by the webservice, and invokes the VB6 component method to change
the default form. Or maybe find a way of executing a Windows Script from
ASP.NET (something which I've had no joy with so far). Both these methods
are long ways of doing it, and which I'd like to avoid if possible.
Any help is appreciated. Cheers.
Mun
I've built a webservice in C# that can add public folders to Exchange.
There's also a component built in VB6 which references the Outlook 10 (XP)
DLL, so I can change the default form being used to post to a public folder.
The component works fine when instantiated from a Windows script, but when
using it from COM Interop in an ASP.NET web application it errors when
trying to execute oNs.GetNameSpace("MAPI").
The error it throws up is 'ActiveX cant create object'. This sounds like a
permissions issue, so I changed web.config and IIS to make the ASP.NET web
application impersonate the administrator account, but without any luck.
A sample of my VB6 code:
(The project references cdo.dll and msoutl.olb)
Public Function UpdateFolder()
'Declare variables
Dim objSession As New MAPI.Session
Dim oFolderA As Outlook.mapiFolder
Dim oFolderTmp As Outlook.mapiFolder
Dim oFolderB As MAPI.Folder
Dim oOutlook As New Outlook.Application
Dim oNs As Outlook.NameSpace
Dim tmpFolder As Outlook.mapiFolder
'Get items from Outlook
Set oNs = oOutlook.GetNamespace("MAPI")
'More stuff here, but taken out to keep this example short.
'The line above is where it hangs.
End Function
The DLL is referenced in my Web Application, and is called using the
following:
Project1.Class1 Obj = new Project1.Class1();
Obj.UpdateFolder();
The VB6 component uses MAPI which I know can't be used from ASP.NET due to
issues with threading, but I don't think this is causing it, as it's all in
the VB6 component (which was built to get around the problem of it not
working in .net).
If this can't be done, then I might have to write a Windows service, which
is called by the webservice, and invokes the VB6 component method to change
the default form. Or maybe find a way of executing a Windows Script from
ASP.NET (something which I've had no joy with so far). Both these methods
are long ways of doing it, and which I'd like to avoid if possible.
Any help is appreciated. Cheers.
Mun