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

Check Profile info



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 29th 09, 02:36 PM posted to microsoft.public.outlook.program_vba
MB34
external usenet poster
 
Posts: 15
Default Check Profile info

I need to know how to check, when the OL Object is instantiated, the
default profile's email address.
We want to check to see if the email of the user logged into our
application is the same as the one in
the default profile in OL.

(I am using Delphi but can translate the VBA, if needed)
Ads
  #2  
Old June 29th 09, 06:43 PM posted to microsoft.public.outlook.program_vba
MB34
external usenet poster
 
Posts: 15
Default Check Profile info

On Jun 29, 8:36*am, MB34 wrote:
I need to know how to check, when the OL Object is instantiated, the
default profile's email address.
We want to check to see if the email of the user logged into our
application is the same as the one in
the default profile in OL.

(I am using Delphi but can translate the VBA, if needed)


OK, found the answer based on a 7yr old post of mine on DelphiPages:

uses ..., Outlook2000, MAPIDefs, MAPIUtil;

var
pmOutlook: _Application;
NameSpace: _NameSpace;
DefaultUser: Recipient;
_AddressEntry: AddressEntry;
pProp: PSPropValue;
MP: IMAPIProp;
strAddress: String;
begin
try
pmOutlook := GetActiveOleObject('outlook.application') as
_Application;
except
try
pmOutlook := CreateOleObject('outlook.application') as
_Application;
except
on e:EOleSysError do
ShowMessage('Cannot Load Outlook:' + E.Message);
end;
end;
try
Namespace := pmOutlook.GetNamespace('MAPI');
MAPIInitialize(nil);
try
DefaultUser := NameSpace.CurrentUser;
if DefaultUser.Address '' then
begin
_AddressEntry := DefaultUser.AddressEntry;
MP:= IUnknown(_AddressEntry.MAPIOBJECT) as IMailUser;
if S_OK = HrGetOneProp(MP, $39FE001E, pProp) then
begin
strAddress:=pProp.Value.lpszA;
MAPIFreeBuffer(pProp);
end;
ListBox1.Items.Add(_AddressEntry.Name + ' : ' + strAddress);
Application.ProcessMessages;
end; {if}
finally
MAPIUninitialize;
end;
finally
pmOutlook.Application.Quit;
pmOutlook := Unassigned;
Namespace := Unassigned;
DefaultUser := Unassigned;
_AddressEntry := Unassigned;
end;
end;
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Outlook Signature error during spell check Text marked with "Do not check spelling or grammar" was skipped. John Peters Outlook - General Queries 0 September 25th 07 07:48 PM
How to check if a user has outlook profile created from c# .Net Raj Outlook - Using Forms 3 September 18th 07 02:54 PM
What info is stored in the Outlook Profile? Al Dykes Outlook - General Queries 1 January 4th 07 04:30 PM
Outlook express can't spell check. It says to check later. Harold Outlook - General Queries 2 September 8th 06 10:56 PM
Need to transfer info from one user profile to another tom Outlook - General Queries 3 May 30th 06 09:12 PM


All times are GMT +1. The time now is 04:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.