Announcement
Collapse
No announcement yet.
Adressen aus Outlook auslesen
Collapse
X
-
Hallo,<P>
ich habe eine Prozedur geschrieben, die Adressen
aus Outlook ausliest und in ein StringGrid schreibt.
Ich habe die Funktionalität unter Windows NT 4 und
Windows 2000 mit den Outlook-Versionen Outlook 97
und Outlook 2000 getestet und es schien alles okay
zu sein.
Nun taucht bei einem Bekannten, welcher diese Prozedur
benutzt (Windows 2000 / Outlook 2000) folgende Fehlermeldung
auf (wobei das Programm abbricht):
<B>Die Methode FirstName wird vom Automatisierungsprozess
nicht unterstützt.</B>
Für einen kurzen Hinweis, bezgl. der Fehlerursache und eine
Hilfestellung bezgl. der Fehlerbehebung wäre ich sehr dankbar.
MfG,
Andreas Siegner.<P>
Anbei der Quellcode:
<B>{Kontakte(Adressen) aus Outlook auslesen}</B>
<PRE>
procedure TESOLForm.RefreshOLAdr;
var
DefNamespace : Outlook8.NameSpace;
Contacts : Outlook8.MAPIFolder;
ItemColl : Outlook8.Items;
aContact : OleVariant;
iCnt, I : Integer;
begin
OutlookApplication1.Connect;
DefNameSpace := OutlookApplication1.GetNamespace('MAPI');
Contacts := DefNameSpace.GetDefaultFolder(olFolderContacts);
ItemColl := Contacts.Items;
I := 0;
for iCnt := 1 to ItemColl.Count do
begin
aContact := ItemColl.Item(iCnt);
if (aContact.LastModificationTime > OL_ES_Adr_AenderDat) then
begin
Inc(I);
with StringGrid2 do
begin
RowCount := I + 1;
Rows[I].Clear;
Cells[1, I] := IntToStr(iCnt);
Cells[2, I] := aContact.FirstName;
Cells[3, I] := aContact.LastName;
Cells[4, I] := aContact.HomeAddressStreet;
Cells[5, I] := aContact.HomeAddressPostalCode;
Cells[6, I] := aContact.HomeAddressCity;
Cells[7, I] := aContact.BusinessTelephoneNumber;
Cells[8, I] := '(Memo)';
Cells[9, I] := aContact.LastModificationTime;
end;
end;
end;
OutlookApplication1.Disconnect;
end;
</PRE>
-
Hallo,
> aContact := ItemColl.Item(iCnt);
man müsste nochmals im Kleingedruckten nachlesen, ob in jedem Fall ein Interface-Zeiger auf eine ContactItem-Objektinstanz zurückgeliefert wird. Der Rückgriff auf _DContactItem anstelle OleVariant für aContact sollte diese Frage schnell beantworten
Comment
Comment