Quote:
quote:Originally posted by stu9820
So... what are you trying to access?
|
I have a problem while executing the following lines of code. Actually in this code I am opening the MS Outlook and selecting each and every items of the inbox items and saving them in the local folder. This particular code I am executing in the asp.net webform
vb as code behind.
The problem is at the line "objApp = New Outlook.Application" it is throwing an exception saying that "Access is denied." What could be the problem? I have added the Ms Outlook com reference also but still it is giving this error.
Code:
Dim objApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Dim objMailItem As Outlook.MailItem
Dim iRow As Integer, i As Integer, j As Integer
objApp = New Outlook.Application
objNameSpace = objApp.GetNamespace(Type:="MAPI")
objMAPIFolder = objNameSpace.GetDefaultFolder(FolderType:=Outlook. OlDefaultFolders.olFolderInbox)
For i = 1 To objMAPIFolder.Items.Count
objMailItem.SaveAs("c:\temp\mmcs\" & objMailItem.Subject & ".msg")
If objMailItem.Attachments.Count <> 0 Then
For j = 1 To objMailItem.Attachments.Count
objMailItem.Attachments.Item(j).SaveAsFile("c:\tem p\mmcs\" & objMailItem.Attachments.Item(j).FileName)
Next j
End If
Next i
Thank you sir
I am promptly waiting for your replay