Results 1 to 6 of 6

Thread: asp.net / vb.net dope why o why outlook

  1. #1

    Thread Starter
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    asp.net / vb.net dope why o why outlook

    Trying to send Outlook tasks from asp/vb.net web app and I have this:

    VB Code:
    1. Imports Microsoft.Office.Interop.Outlook
    2. Public Class WebForm1
    3.     Inherits System.Web.UI.Page
    4.  
    5. #Region " Web Form Designer Generated Code "
    6.  
    7.     'This call is required by the Web Form Designer.
    8.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    9.  
    10.     End Sub
    11.     Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    12.  
    13.     'NOTE: The following placeholder declaration is required by the Web Form Designer.
    14.     'Do not delete or move it.
    15.     Private designerPlaceholderDeclaration As System.Object
    16.  
    17.     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    18.         'CODEGEN: This method call is required by the Web Form Designer
    19.         'Do not modify it using the code editor.
    20.         InitializeComponent()
    21.     End Sub
    22.  
    23. #End Region
    24.  
    25.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    26.         'Put user code to initialize the page here
    27.     End Sub
    28.  
    29.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    30.         Dim objOutlook As Microsoft.Office.Interop.Outlook.Application
    31.         Dim objTask As TaskItem
    32.         objOutlook = New Microsoft.Office.Interop.Outlook.Application
    33.         objTask = objOutlook.CreateItem(OlItemType.olTaskItem)
    34.         objTask.Recipients.Add("ssmith")
    35.         objTask.Subject = "Test"
    36.         objTask.Body = "This is the body"
    37.         objTask.Assign()
    38.         objTask.Send()
    39.  
    40.     End Sub
    41. End Class

    But right when i say objOutlook = New....

    I get an error:

    Code:
    Exception Details: System.UnauthorizedAccessException: Access is denied. 
    
    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 
    
    To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
    I tried everything...What the hell is this error. What file????!?!?!?
    I tried to go to the reference itself:
    C:\Program Files\Microsoft Office\OFFICE11\MSLOut.olb
    I right clicked and added every frigging user in our company ...still no luck...gave them write permissions and everytihng...

    I need to get this to work so badly please guys help!!!!

    Just need to send outlook tasks from asp.net/vb.net to a user.

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449
    Hi,

    Did you try giving permissions for the Outlook .pst file ?

    Cheers,
    NTG
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  3. #3

    Thread Starter
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    Originally posted by ntg
    Hi,

    Did you try giving permissions for the Outlook .pst file ?

    Cheers,
    NTG
    How where ? Which PST ? Mine locally ???

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by jhermiz
    How where ? Which PST ? Mine locally ???
    This:

    To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

  5. #5

    Thread Starter
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    Originally posted by mendhak
    This:
    I have read this already, this doesnt help at all.

    What file??? Where ???? Locally ???? What does PST have to do with sending tasks????


  6. #6
    Addicted Member corwin_ranger's Avatar
    Join Date
    Sep 2004
    Location
    CT
    Posts
    198
    OK.

    Here's an important question to ask yourself as it realtes to this issue. Is Outlook running stand-alone or is it connected to an Exchange Server?

    If it's running stand-alone, then the ASP account will need access to the file. These permissions are set on the actual .pst file (This is the file that contains all the Outlook folder when you run in this mode. If that account doesn't have write permissions to this file then it can't do anything with it. Since a task is an object in that file, if you can't write to the file, you can't create the task. The permissions are set from inside the OS. If you don't know how to do this, find someone who does.

    If Outlook is connected to an Exchange Server, then the ASP account will need access to the mailbox on the server that you want to create tasks in. This can only be done by a sysadmin, AND the ASP account will need to be a domain account to be given the appropriate permissions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width