A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , ,

Dynamic result by recipient’s name





 
 
Thread Tools Display Modes
  #1  
Old February 12th 07, 06:23 PM posted to microsoft.public.outlook.program_vba
Pari
external usenet poster
 
Posts: 3
Default Dynamic result by recipient’s name

I have a procedure that expects last name as a parameter; I am sending out
result of that procedure to multiple recipients, I would like to draft the
email in such a way that data that I send to particular recipient shows ONLY
his results.

Example

Table Structure
-----------------------
Employee Last Name Open Calls
A 10
B 5
C 0

Procedure that will return me result
--------------------------------------------------
Givemeopencalls lastname


EMPLOYEE A should receive an email stating “You have 10 Calls open”

EMPLOYEE B should receive an email stating “You have 5 Calls open”

EMPLOYEE C should receive an email stating “You have 0 Calls open”

This whole process I am doing in VB6 and have that exe as a schedule task
running from my machine every day.

Please help

Ads
  #2  
Old February 12th 07, 06:49 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default Dynamic result by recipient’s name

Could you be more specific with the help you need? Are there any particular
issues you're having with the Outlook Object Model? Your business logic is
entirely up to you, but we can help for specific Outlook related stuff.

BTW, running your Outlook code in a Scheduled Task is essentially a
non-starter:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...en-us%3b237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I have a procedure that expects last name as a parameter; I am sending out
result of that procedure to multiple recipients, I would like to draft the
email in such a way that data that I send to particular recipient shows ONLY
his results.

Example

Table Structure
-----------------------
Employee Last Name Open Calls
A 10
B 5
C 0

Procedure that will return me result
--------------------------------------------------
Givemeopencalls lastname


EMPLOYEE A should receive an email stating “You have 10 Calls open”

EMPLOYEE B should receive an email stating “You have 5 Calls open”

EMPLOYEE C should receive an email stating “You have 0 Calls open”

This whole process I am doing in VB6 and have that exe as a schedule task
running from my machine every day.

Please help

  #3  
Old February 12th 07, 07:13 PM posted to microsoft.public.outlook.program_vba
Pari
external usenet poster
 
Posts: 3
Default Dynamic result by recipient’s name

I need to know...is it possible to know the user name (receipient name) from
outlook? I need to pass the receipient's name from the email that was
received and in turn run the procedure that expects a username as a
parameter.

"Eric Legault [MVP - Outlook]" wrote:

Could you be more specific with the help you need? Are there any particular
issues you're having with the Outlook Object Model? Your business logic is
entirely up to you, but we can help for specific Outlook related stuff.

BTW, running your Outlook code in a Scheduled Task is essentially a
non-starter:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...en-us%3b237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I have a procedure that expects last name as a parameter; I am sending out
result of that procedure to multiple recipients, I would like to draft the
email in such a way that data that I send to particular recipient shows ONLY
his results.

Example

Table Structure
-----------------------
Employee Last Name Open Calls
A 10
B 5
C 0

Procedure that will return me result
--------------------------------------------------
Givemeopencalls lastname


EMPLOYEE A should receive an email stating “You have 10 Calls open”

EMPLOYEE B should receive an email stating “You have 5 Calls open”

EMPLOYEE C should receive an email stating “You have 0 Calls open”

This whole process I am doing in VB6 and have that exe as a schedule task
running from my machine every day.

Please help

  #4  
Old February 12th 07, 07:41 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default Dynamic result by recipient’s name

The MailItem.Recipients collection will tell you all that received the
e-mail, but not who the current user is. That requires the
NameSpace.CurrentUser property, but accessing that value from an external
program or script that's automating Outlook will generate a security warning.

You can also use Win32 API calls to get the name of the user logged in to
Windows:

Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA"(ByVal lpBuffer As String, nSize As Long) As Long

Function UserNameWindows() As String

Dim lngLen As Long
Dim strBuffer As String

Const dhcMaxUserName = 255

strBuffer = Space(dhcMaxUserName)
lngLen = dhcMaxUserName
If CBool(GetUserName(strBuffer, lngLen)) Then
UserNameWindows = Left$(strBuffer, lngLen - 1)
Else
UserNameWindows = ""
End If
End Function

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I need to know...is it possible to know the user name (receipient name) from
outlook? I need to pass the receipient's name from the email that was
received and in turn run the procedure that expects a username as a
parameter.

"Eric Legault [MVP - Outlook]" wrote:

Could you be more specific with the help you need? Are there any particular
issues you're having with the Outlook Object Model? Your business logic is
entirely up to you, but we can help for specific Outlook related stuff.

BTW, running your Outlook code in a Scheduled Task is essentially a
non-starter:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...en-us%3b237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I have a procedure that expects last name as a parameter; I am sending out
result of that procedure to multiple recipients, I would like to draft the
email in such a way that data that I send to particular recipient shows ONLY
his results.

Example

Table Structure
-----------------------
Employee Last Name Open Calls
A 10
B 5
C 0

Procedure that will return me result
--------------------------------------------------
Givemeopencalls lastname


EMPLOYEE A should receive an email stating “You have 10 Calls open”

EMPLOYEE B should receive an email stating “You have 5 Calls open”

EMPLOYEE C should receive an email stating “You have 0 Calls open”

This whole process I am doing in VB6 and have that exe as a schedule task
running from my machine every day.

Please help

  #5  
Old February 12th 07, 08:13 PM posted to microsoft.public.outlook.program_vba
Pari
external usenet poster
 
Posts: 3
Default Dynamic result by recipient’s name

Thanks Eric. This I have already tried, this gives me the username of where
the application is running, I am running the application on my machine that
sends out an email to multiple users, I need to know the user name of the
receipient of the email, so that I can show the results for that user. Is
this possible?

"Eric Legault [MVP - Outlook]" wrote:

The MailItem.Recipients collection will tell you all that received the
e-mail, but not who the current user is. That requires the
NameSpace.CurrentUser property, but accessing that value from an external
program or script that's automating Outlook will generate a security warning.

You can also use Win32 API calls to get the name of the user logged in to
Windows:

Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA"(ByVal lpBuffer As String, nSize As Long) As Long

Function UserNameWindows() As String

Dim lngLen As Long
Dim strBuffer As String

Const dhcMaxUserName = 255

strBuffer = Space(dhcMaxUserName)
lngLen = dhcMaxUserName
If CBool(GetUserName(strBuffer, lngLen)) Then
UserNameWindows = Left$(strBuffer, lngLen - 1)
Else
UserNameWindows = ""
End If
End Function

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I need to know...is it possible to know the user name (receipient name) from
outlook? I need to pass the receipient's name from the email that was
received and in turn run the procedure that expects a username as a
parameter.

"Eric Legault [MVP - Outlook]" wrote:

Could you be more specific with the help you need? Are there any particular
issues you're having with the Outlook Object Model? Your business logic is
entirely up to you, but we can help for specific Outlook related stuff.

BTW, running your Outlook code in a Scheduled Task is essentially a
non-starter:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...en-us%3b237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I have a procedure that expects last name as a parameter; I am sending out
result of that procedure to multiple recipients, I would like to draft the
email in such a way that data that I send to particular recipient shows ONLY
his results.

Example

Table Structure
-----------------------
Employee Last Name Open Calls
A 10
B 5
C 0

Procedure that will return me result
--------------------------------------------------
Givemeopencalls lastname


EMPLOYEE A should receive an email stating “You have 10 Calls open”

EMPLOYEE B should receive an email stating “You have 5 Calls open”

EMPLOYEE C should receive an email stating “You have 0 Calls open”

This whole process I am doing in VB6 and have that exe as a schedule task
running from my machine every day.

Please help

  #6  
Old February 12th 07, 09:09 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default Dynamic result by recipient’s name

If you are sending the e-mail, wouldn't you already know the recipients you
are sending the e-mail to?? These users are stored as Recipient objects in
the MailItem.Recipients collection. The Recipient.Name property tells you
what the display name of the Recipient is. The MailItem.To property will
also give you a delimited string containing the display names of the message
recipients.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

Thanks Eric. This I have already tried, this gives me the username of where
the application is running, I am running the application on my machine that
sends out an email to multiple users, I need to know the user name of the
receipient of the email, so that I can show the results for that user. Is
this possible?

"Eric Legault [MVP - Outlook]" wrote:

The MailItem.Recipients collection will tell you all that received the
e-mail, but not who the current user is. That requires the
NameSpace.CurrentUser property, but accessing that value from an external
program or script that's automating Outlook will generate a security warning.

You can also use Win32 API calls to get the name of the user logged in to
Windows:

Private Declare Function GetUserName Lib "advapi32.dll" Alias
"GetUserNameA"(ByVal lpBuffer As String, nSize As Long) As Long

Function UserNameWindows() As String

Dim lngLen As Long
Dim strBuffer As String

Const dhcMaxUserName = 255

strBuffer = Space(dhcMaxUserName)
lngLen = dhcMaxUserName
If CBool(GetUserName(strBuffer, lngLen)) Then
UserNameWindows = Left$(strBuffer, lngLen - 1)
Else
UserNameWindows = ""
End If
End Function

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I need to know...is it possible to know the user name (receipient name) from
outlook? I need to pass the receipient's name from the email that was
received and in turn run the procedure that expects a username as a
parameter.

"Eric Legault [MVP - Outlook]" wrote:

Could you be more specific with the help you need? Are there any particular
issues you're having with the Outlook Object Model? Your business logic is
entirely up to you, but we can help for specific Outlook related stuff.

BTW, running your Outlook code in a Scheduled Task is essentially a
non-starter:

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...en-us%3b237913

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Pari" wrote:

I have a procedure that expects last name as a parameter; I am sending out
result of that procedure to multiple recipients, I would like to draft the
email in such a way that data that I send to particular recipient shows ONLY
his results.

Example

Table Structure
-----------------------
Employee Last Name Open Calls
A 10
B 5
C 0

Procedure that will return me result
--------------------------------------------------
Givemeopencalls lastname


EMPLOYEE A should receive an email stating “You have 10 Calls open”

EMPLOYEE B should receive an email stating “You have 5 Calls open”

EMPLOYEE C should receive an email stating “You have 0 Calls open”

This whole process I am doing in VB6 and have that exe as a schedule task
running from my machine every day.

Please help

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Message could not be displayed in the search result Dan Outlook Express 1 February 10th 07 12:46 PM
Selecting contacts for new mail result in a ; in the To: No Name Brian Outlook - Using Contacts 1 November 9th 06 11:14 PM
Is a dynamic Map to location possible? Angyl Outlook - Using Forms 0 July 5th 06 07:00 PM
embedding dynamic data in signature file don vito Outlook and VBA 3 June 14th 06 07:12 AM
Outlook 2003 Dynamic signatures TheHealingLotus Outlook - General Queries 1 March 9th 06 01:38 PM


All times are GMT +1. The time now is 04:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Mortgage - Remortgages - Pimpin MySpace Profiles - Loans - Free Credit Report