Solved

Check Profile info

Posted on 2009-06-29
9
246 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 83
code issue 8 100
find a node in VST 2 64
Open a URL with Internet Explorer in a new tab (not a new window) 1 72
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now