I am trying to write a script. I need to find out what the senders email
address is. what is the property that I would use in a script for this?
I see the reciepiant info, but not the from or senders property.
Thanks
Bruce
VB.Net
This work but you need change few things : Item(play with number becuse
number represent folder wher you work with mail's)
Imports System.Reflection
Imports Outlook
Module Module1
Sub Main()
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application()
' Get Mapi NameSpace.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNS.Logon("Outlook", "", False, True) ' TODO:
Dim k, i, d As Integer
Dim oItems1, personal As Object
Dim strBody As String
' Ispisuje sve root foldere
For k = 1 To oNS.Folders.Count
oItems1 = oNS.Folders.Item(k)
'Console.WriteLine(oItems1.name)
Next
'Ispisuje sve foldere unutar Personal foldera
For k = 1 To oNS.Folders.GetFirst.Folders.Count
oItems1 = oNS.Folders.Item(2).Folders.Item(k)
'Console.WriteLine(oItems1.name)
Next
oItems1 = oNS.Folders.Item(2).Folders.Item(11).Folders.Item(3)
'Console.WriteLine(oItems1.name)
' Get Messages collection of Inbox.
Dim oInbox As Outlook.MAPIFolder =
oNS.Folders.Item(2).Folders.Item(11).Folders.Item(3)
Dim oItems = oInbox.Items
Dim oMsg As Outlook.MailItem
'Prolazi sve mailove u odredenom folderu i izvlaci email adrese
posiljatelja
For i = 1 To oItems.Count
oMsg = oItems.Item(i)
Dim Reply = oItems(i).Reply
Dim Recipients = Reply.Recipients.Item(1)
Dim Address = Trim(Recipients.Address)
'Console.WriteLine(i)
Console.WriteLine(Address)
'Console.WriteLine(oMsg.SenderName)
'Console.WriteLine(oMsg.Subject)
'Console.WriteLine(oMsg.ReceivedTime
'strBody = oMsg.Body
'Console.WriteLine(strBody)
'Console.WriteLine("-------------------------------------------------------------")
Next
'Broj mailova u odredenom folderu
'Console.WriteLine("Total : " & oItems.Count)
oApp = Nothing
oNS = Nothing
oItems = Nothing
oMsg = Nothing
End Sub
End Module