Solved

Check Profile info

Posted on 2009-06-29
9
248 Views
Last Modified: 2012-05-07
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.
0
Comment
Question by:EddieShipman
  • 6
  • 3
9 Comments
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24736374
OL  ???
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24736442
Outlook
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24736448
Sorry, I posted the same message to the Outlook VBA newsgroup and forgot to change it for this
Delphi TA.
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
LVL 26

Accepted Solution

by:
EddieShipman earned 0 total points
ID: 24738298
OK found the answer based on a 7ry 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;

Open in new window

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24739491
hehe,
i guess you're better that you thought yourself ...
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24740679
Yeah, I was surprised I found the post.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24980731
congrats on your top position ...

EddieShipman-Aced.png
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24981660
LOL, what happened to 1-4???
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 24981688
Look at the bottom, that's where they are:
overall.png
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Working with hours 3 58
Installshield for Embarcadero EX 10.1 Berlin 4 42
Twebbrowser add css to the header 3 25
Delphi problems to abort a printjob 9 20
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question