Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

scroll between outlook , but only from one sender !


  • Please log in to reply
14 replies to this topic
kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
i tried to find here on this forum for a solution, but i can,t find it

i work with outlook 2003, and i want in the inbox make some actions, but only from a person i choose.
for example if i send 5 times a mail to myself, it comes to my inbox , it has my name as sender, than i want to scroll the emails ( with some minor actions ) but only with my name ( so only 5 times )

i hope i explained it the right way ?

thanks for any response

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
nobody ?

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
i found this on the forum, but it display no text at all in my outlook

ol:=COM_GetActiveObject("Outlook.Application").ActiveInspector.CurrentItem
From:=ol.SenderEmailAddress
MsgBox % Email
return

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
this gives me the sender email address, but only if i opens the email, what code i need for the same, but without opening a email, so only leave outlook open at an given email.( without double click to open the email )

please someone helps me, thx

outlook := ComObjCreate("Outlook.Application")
oitem := Outlook.ActiveInspector.CurrentItem
msgbox % oitem.senderemailaddress

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Outlook provides no way to programmatically select a particular item in the Explorer window :(
That is how you could loop trough these items of current selected Sender and open them.
myOlApp := ComObjActive("Outlook.Application")
myNameSpace := myOlApp.GetNameSpace("MAPI")
myOlExp:=myOlApp.ActiveExplorer
myOlExp.CurrentFolder := myNameSpace.GetDefaultFolder(olFolderInbox:=6)
myOlExp.Activate
Sender:= myOlExp.Selection(1).SenderEmailAddress
myFolder:=myOlExp.Session.GetDefaultFolder(olFolderInbox:=6)
Items:=myfolder.Items
Item:=Items.Find(qry:="[SenderEmailAddress] = """ Sender """")
Loop {
	Item.Display
	KeyWait,Escape,D
	item:=Items.FindNext()
} Until (item.SenderEmailAddress="")
ExitApp
^Escape::Exitapp

with some minor actions

Can you give some examples :?:

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
thanks very much !!!

this is what i wanted to do

:D :D :D :D :D :D :D :D :D

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
is it also possible to change the Flag ( status ) , see example ( red flag )


<!-- m -->http://images.google... ... 29,r:5,s:0<!-- m -->

sinkfaze
  • Moderators
  • 6367 posts
  • Last active:
  • Joined: 18 Mar 2008

Outlook provides no way to programmatically select a particular item in the Explorer window :(


How do you mean? This will loop through the inbox and open emails that contain a particular sender's name:

mail :=	 ComObjActive("Outlook.Application").GetNameSpace("MAPI").GetDefaultFolder[6]
Loop %	mail.Items.Count
{
	if	Instr(mail.Items[A_Index].SenderName,"[color=darkred]<< your sender name here >>[/color]") {
		mail.Items[A_Index].Display()
		Sleep, 3000
		mail.Items[A_Index].Close(1)
	}
}
mail := ""
return

Granted, this is not exactly an easy way (God help you if you have a very large mail folder to search through), but it can be done.

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
i found it !!

had to insert this 2 lines for it !!

flag := myOlExp.Selection(1).FlagStatus

and for showing the flag status

msgbox % flag

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
thanks,

for changing the flag status i only had to insert this line, it,s almost like VBA programming !


myOlExp.Selection(1).FlagStatus := 1




bit by bit i learn more and more

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

How do you mean? This will loop through the inbox and open emails that contain a particular sender's name:

Granted, this is not exactly an easy way (God help you if you have a very large mail folder to search through), but it can be done.

As you already noted this is very slow. For that reason I used Find and FindNext method which is much much faster.

What I meant is that an item cannot be selected in outlook explorer view.

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
what about if i want to read a exchange groupmail, in this situation i can not read the sendername or change the flag !!, does this require some different parameters ??

see pict:
<!-- m -->http://www.filebuzz.... ... remier.jpg<!-- m -->

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
should CDO work ?

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
i tried i visual basic, but no succes

i tried this code but it gives me a error 438, on normal email adresse it gives me the right smtp emailaddress, but with groupmail it gives a error

Option Explicit

Public Sub GetSmtpAddressOfCurrentEmail()
Dim Session As Outlook.NameSpace
Dim currentExplorer As Explorer
Dim Selection As Selection
Dim currentItem As Object
Dim currentMail As MailItem
Dim smtpAddress As String

Set currentExplorer = Application.ActiveExplorer
Set Selection = currentExplorer.Selection

'for all items do...
For Each currentItem In Selection
If currentItem.Class = olMail Then
Set currentMail = currentItem
smtpAddress = GetSmtpAddress(currentMail)
MsgBox "SMTP Address is " & smtpAddress
End If
Next

End Sub
Public Function GetSmtpAddress(mail As MailItem)
On Error GoTo On_Error

GetSmtpAddress = ""

Dim Report As String
Dim Session As Outlook.NameSpace
Set Session = Application.Session

If mail.SenderEmailType <> "EX" Then
GetSmtpAddress = mail.SenderEmailAddress
Else
Dim senderEntryID As String
Dim sender As AddressEntry
Dim PR_SENT_REPRESENTING_ENTRYID As String

PR_SENT_REPRESENTING_ENTRYID = "http://schemas.microsoft.com/mapi/proptag/0x00410102"

senderEntryID = mail.PropertyAccessor.BinaryToString( _
mail.PropertyAccessor.GetProperty( _
PR_SENT_REPRESENTING_ENTRYID))

Set sender = Session.GetAddressEntryFromID(senderEntryID)
If sender Is Nothing Then
Exit Function
End If

If sender.AddressEntryUserType = olExchangeUserAddressEntry Or _
sender.AddressEntryUserType = olExchangeRemoteUserAddressEntry Then

Dim exchangeUser As exchangeUser
Set exchangeUser = sender.GetExchangeUser()

If exchangeUser Is Nothing Then
Exit Function
End If

GetSmtpAddress = exchangeUser.PrimarySmtpAddress
Exit Function
Else
Dim PR_SMTP_ADDRESS
PR_SMTP_ADDRESS = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
GetSmtpAddress = sender.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS)
End If


End If


Exiting:
Exit Function
On_Error:
MsgBox "error=" & Err.Number & " " & Err.Description
Resume Exiting

End Function

kriszty
  • Members
  • 70 posts
  • Last active: Feb 25 2017 01:09 PM
  • Joined: 08 Nov 2010
still not found a solution for this