2017-03-28 1 views
0

IIS에서 asp.net 웹 사이트를 통해 Outlook에서 메일 첨부 파일을 열려고하면이 오류가 발생합니다. IIS USR 및 네트워크에 DCOMCnfg에서 Microsoft OutLook 구성 요소로의 전체 사용 권한을 할당하지만 아무런 효과가 없습니다.구성 요소에 대한 COM 클래스 팩터 리를 가져 오지 못했습니다. 접근이 금지되어있다. HRESULT : 0x80070005 E_ACCESSDENIED

CLSID가 {0006F03A-0000-0000-C000-000000000046} 인 구성 요소의 COM 클래스 팩터 리를 검색하는 데 다음 오류로 인해 실패했습니다 : 80070005 액세스가 거부되었습니다. (HRESULT 예외 : 0x80070005 (E_ACCESSDENIED)).

using System; 
using Outlook = Microsoft.Office.Interop.Outlook; 

// Create the Outlook application. 
       Outlook.Application oApp = new Outlook.Application(); 
       // Create a new mail item. 
       Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); 
       // Set HTMLBody. 
       //add the body of the email 
       oMsg.HTMLBody = "Hello, This is test for sending pdf attachment using OutLook"; 
       //Add an attachment. 
       String sDisplayName = "MyAttachment"; 
       int iPosition = (int)oMsg.Body.Length + 1; 
       int iAttachType = (int)Outlook.OlAttachmentType.olByValue; 
       //now attached the file 
       Outlook.Attachment oAttach = oMsg.Attachments.Add(Server.MapPath("~/TestSendFile.pdf"), iAttachType, iPosition, sDisplayName); 
       //Subject line 
       oMsg.Subject = "Your Subject will go here."; 
       // Add a recipient. 
       Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients; 
       // Change the recipient in the next line if necessary. 
       Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("[email protected]"); 
       oRecip.Resolve(); 
       // Send. 

       oMsg.Display(); 

답변

2

Outlook 개체 모델 (다른 Office 응용 프로그램과 마찬가지로)은 IIS와 같은 서비스에서 사용할 수 없습니다. 그 이상의 메시지가 표시되면 서버쪽에 아무도 볼 수없는 메시지가 표시됩니다. 이 랩 확장 MAPI와 -

당신은

  1. Exchange Web Services

  2. 확장 MAPI (C++ 또는 델파이)

  3. Redemption (Exchange 사서함의 경우)를 사용할 수 있습니다 RDO family of objects은 서비스에서 사용할 수 있습니다. C#을 비롯한 모든 언어에서 사용할 수 있습니다.

당신이 클라이언트 측에 메시지를 표시하려는 경우, 당신의 선택은

  1. 흔한 URL -
  2. 를 사용하여 Outlook 개체 모델 클라이언트에서 HTML 또는 첨부 파일을 허용하지 않습니다 사이드 자바 스크립트. 귀하의 사이트는 신뢰할 수 있어야하며 IE에서 COM을 사용할 수 있습니다.
  3. EML (MIME) 파일 생성 및 링크 제공 - Outlook이 브라우저에서 열어서 표시합니다.
+0

안녕하세요 드미트리 씨, 제발 실례 나 링크를 보여 주시겠습니까? 내 localhost 사이트에서이 시도하고 모든 가능한 오른쪽 있지만 동일한 오류가 할당됩니다. 가능하다면 매우 감사 할 것입니다. – Ammad

+0

예를 들면? 위의 6 가지 옵션 중 어느 것입니까? –

관련 문제