Converting a VB.Net Console Application to a Web Service

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: kls_kumar (klskumar_at_discussions.microsoft.com)
Date: 03/16/05


Date: Wed, 16 Mar 2005 13:31:08 -0800

Hi All,

  I wrote a sample application to extract the messages and attachments from
a .pst file using VB.Net which is working fine. Now i am trying to web
service enable this and when i added an operation in .asmx File

<WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _
    Public Function extractPST(ByVal fileName As String) As String
        Dim readPST As ReadPST
        readPST = New ReadPST
        readPST.readPST(fileName)
        Return "success"
    End Function

 And i have a class ReadPST.vb which has the code

Sub readPST(ByVal fileName As String)
        Dim i As Integer
        Dim objOutlook As New Outlook.Application
        ' Dim objNS As Outlook.NameSpace = objOutlook.Session
        Dim myNameSpace As Outlook.NameSpace = objOutlook.GetNamespace("MAPI")
        'Dim file As New System.IO.StreamWriter("c:\test.html")
        ' Add the .pst File to the Name Space
        myNameSpace.AddStore(fileName)
        ...........

  And when i tried to debug the code i am getting a 500 Error at the Line
 Dim myNameSpace As Outlook.NameSpace = objOutlook.GetNamespace("MAPI")

  How can i resolve this..

Thanks a lot
Sateesh

  



Relevant Pages