title: Lack of Permission in Interop.Outlook when sending Email
body: <p>I have an asp.net application in C# running IIS 7 on Windows 7.</p>
  
  <p>An email is sent out when a certain event occurs, driven by the client user.</p>
  
  <p>The code is as below: I am using Outlook Interop instead of Exchange SMTP server since the smtpClient is being blocked by McAfee and I am not allowed to change McAfee settings.</p>
  
  <p>We have enterprise license for Office including Outlook, so licensing is not an issue.</p>
  
  <p>When trying to send an email, following error is thrown:</p>
  
  <blockquote>
    <p>System.Runtime.InteropServices.COMException (0x80030005): You don't
    have appropriate permission to perform this operation. at
    Microsoft.Office.Interop.Outlook.ApplicationClass.CreateItem(OlItemType
    ItemType) at  in &lt;.cs file name>.</p>
  </blockquote>
  
  <p>IIS application pool is using NetworkService as ProcessModel identity. 
  I also checked DCOMCNFG and it has Network service as an authorized user with appropriate permissions.</p>
  
  <p>How can I fix this?</p>
  
  <pre><code>    using outlook = Microsoft.Office.Interop.Outlook;
  
      outlook.Application olkApp1 = new outlook.Application();
  
              outlook.MailItem olkMail1 = (outlook.MailItem)olkApp1.CreateItem(outlook.OlItemType.olMailItem);
              outlook.Accounts accounts = olkApp1.Session.Accounts;
              foreach (outlook.Account account in accounts)
              {
                  if (account.SmtpAddress == "")
                  {
                      olkMail1.To = toEmail;
                      if (ccEmail != null)
                      {
                          olkMail1.CC = ccEmail;
                      }
                      olkMail1.Subject = subjEmail;
                      olkMail1.Body = bodyEmail;
                      //olkMail1.Attachments.Add(filePath, outlook.OlAttachmentType.olByValue, 1, "attachment");
                      olkMail1.Save();
                      olkMail1.SendUsingAccount = account;
                      ((outlook._MailItem)olkMail1).Send();
  </code></pre>