Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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.
0
EddieShipman
Asked:
EddieShipman
  • 6
  • 3
1 Solution
 
Geert GruwezOracle dbaCommented:
OL  ???
0
 
EddieShipmanAuthor Commented:
Outlook
0
 
EddieShipmanAuthor Commented:
Sorry, I posted the same message to the Outlook VBA newsgroup and forgot to change it for this
Delphi TA.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
EddieShipmanAuthor Commented:
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
 
Geert GruwezOracle dbaCommented:
hehe,
i guess you're better that you thought yourself ...
0
 
EddieShipmanAuthor Commented:
Yeah, I was surprised I found the post.
0
 
Geert GruwezOracle dbaCommented:
congrats on your top position ...

EddieShipman-Aced.png
0
 
EddieShipmanAuthor Commented:
LOL, what happened to 1-4???
0
 
EddieShipmanAuthor Commented:
Look at the bottom, that's where they are:
overall.png
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now