2017-02-17 1 views
0

표준 Outlook 필드 (범주/가장 중요한 것은 ConversationID를 포함하여/to/subject/date 포함)가 포함 된 모든 전자 메일을 Excel/csv로 추출해야합니다. MS 오피스 2016을 사용 중입니다. Exchange 서버의 버전에 대해서는 알지 못합니다. 1) 표준 수출 마스터 3를 통해 MS 액세스로 데이터를 내보낼) 표준 전망 인터페이스 2를 통해 데이터를 수출) 직접ConversationID를 사용하여 Outlook Express에서 대용량 내보내기 Outlook

를 MS Exchange의 MS PowerBI에 데이터를 추출 :

는 내 사서함에 그렇게 할 수있는 몇 가지 방법을 시도 3의 경우

내가 ConversationID를 얻을 수 없습니다 (PowerBI 추출물은 신분증을 가지고 있지만 ConversationID하지 않았다)

가 지금은 어떻게 든 MAPI를 통해 추출되어야 함을 이해하지만, 나는이에 완전히 문맹 해요 이야기. 일부 검색 트랜센드처럼, 그것을 위해 특별한 소프트웨어를 사용하는 것이 좋습니다,하지만 하나의 사용자 : 내가 직접 Excel로 데이터를 얻을 수 VBA 코드를 발견

에 대해 분명히 너무 비싸다 그러나 그것은 나를 위해 작동하지 않습니다 : 또한 http://www.tek-tips.com/viewthread.cfm?qid=1739523 ConversationID 란 무엇입니까? - 주제에서 intrested 인 다른 사람들에게 도움이 될 수 있습니다. https://www.meridiandiscovery.com/how-to/e-mail-conversation-index-metadata-computer-forensics/

+0

기존 코드에서 정확히 작동하지 않는 것은 무엇입니까? –

+0

이 부분에 대한 실행 중에 '사용자 정의 유형이 정의되지 않았습니다'라는 오류가 발생했습니다. 'Public ns As Outlook.Namespace' @DmitryStreblechenko –

+0

이는 단순히 Outlook을 프로젝트 참조에 추가하지 않았 음을 의미합니다. –

답변

0

다음은 시작하기위한 몇 가지 샘플 코드입니다. 귀하의 질문과 유사합니다. 코드는 댓글을 달았지만 질문 할 수 있습니다.

Option Explicit 

Public Sub getEmails() 
On Error GoTo errhand: 

    'Create outlook objects and select a folder 
    Dim outlook  As Object: Set outlook = CreateObject("Outlook.Application") 
    Dim ns   As Object: Set ns = outlook.GetNameSpace("MAPI") 

    'This option open a new window for you to select which folder you want to work with 
    Dim olFolder As Object: Set olFolder = ns.pickFolder 
    Dim emailCount As Long: emailCount = olFolder.Items.Count 
    Dim i   As Long 
    Dim myArray  As Variant 
    Dim item  As Object 

    ReDim myArray(4, (emailCount - 1)) 

    For i = 1 To emailCount 
     Set item = olFolder.Items(i) 
     '43 is olMailItem, only consider this type of email message 
     'I'm assuming you only want items with a conversationID 
     'Change the logic here to suite your specific needs 
     If item.Class = 43 And item.ConversationID <> vbNullString Then 
      'Using an array to write to excel in one go 
      myArray(0, i - 1) = item.Subject 
      myArray(1, i - 1) = item.SenderName 
      myArray(2, i - 1) = item.To 
      myArray(3, i - 1) = item.CreationTime 
      myArray(4, i - 1) = item.ConversationID 
     End If 
    Next 

    'Adding headers, then writing the data to excel 
    With ActiveSheet 
     .Range("A1") = "Subject" 
     .Range("B1") = "From" 
     .Range("C1") = "To" 
     .Range("D1") = "Created" 
     .Range("E1") = "ConversationID" 
     .Range("A2:E" & (emailCount + 1)).Value = TransposeArray(myArray) 
    End With 

    Exit Sub 

errhand: 
    Debug.Print Err.Number, Err.Description 
End Sub 

'This function is used to bypass the limitation of - 
'application.worksheetfunction.transpose 
'If you have too much data added to an array you'll get a type mismatch 
'Found here - http://bettersolutions.com/vba/arrays/transposing.htm 
Public Function TransposeArray(myArray As Variant) As Variant 
    Dim X   As Long 
    Dim Y   As Long 
    Dim Xupper  As Long: Xupper = UBound(myArray, 2) 
    Dim Yupper  As Long: Yupper = UBound(myArray, 1) 
    Dim tempArray As Variant 

    ReDim tempArray(Xupper, Yupper) 

    For X = 0 To Xupper 
     For Y = 0 To Yupper 
      tempArray(X, Y) = myArray(Y, X) 
     Next 
    Next 

    TransposeArray = tempArray 
End Function 
+0

작동하지만 1) "보낸"또는 전체 사서함을 사용하려고하면받은 편지함 폴더에서만 작동합니다. 2) 대화 ID는 충분하지 않습니다 (첫 번째 "기본"34 기호 "실제로 convID 나를 맞는 것입니다,하지만 전체 길이 ConvID,"기본 "문자열 만 표시하지 않습니다. 길이 호기심을 호소 함 –

+0

실례로 다행입니다. 귀하의 필요에 맞게 조정할 수 있습니다. 닫힌 것으로 표시하십시오 –

+0

완전하게 작동했습니다. 여전히 categoryID는 전체 길이가 아니지만 제 특정 작업 –

관련 문제