title: Microsoft Office Interop Outlook working on local visual studio and not working on iis server
body: <pre><code>Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
  Microsoft.Office.Interop.Outlook.MAPIFolder inboxFolder = null;
  oApp = new Microsoft.Office.Interop.Outlook.Application();
  
  Microsoft.Office.Interop.Outlook.NameSpace oNS = oApp.GetNamespace("MAPI");
  var lst = new List&lt;Msg&gt;();
  oNS.Logon("support@**.com", "*****", false, true);
  inboxFolder = oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
  for (int counter = 1; counter &lt;= inboxFolder.Items.Count; counter++)
  {
      dynamic item = inboxFolder.Items[counter];
      item = (Microsoft.Office.Interop.Outlook.MailItem)inboxFolder.Items[counter];
      var msg = new Msg();
      msg.subject = item.Subject;
      msg.senderName = item.SenderName;
      msg.body = item.Body;
      if (item.UnRead == true)
      {
          lst.Add(msg);
      }
  }
  return View(lst.ToList());
  </code></pre>