Hello!
Op.system: Windows 8.1
and the newest Lazarus.
I want to create a new contact to Outlook. The code is working when I type the strint to the code.
Like that:
myContact.FullName := 'Full name';
But is not worknig when I want give from a String type (TStringList).
myContact.FullName := ContactsFullName.Strings[1];
My code:
procedure AddAddressInDistributionList;
const
olFolderContacts = $0000000A;
var
myOlApp, myNameSpace, myContact : OleVariant;
begin
//Connect to outlook
myOlApp := CreateOleObject('Outlook.Application');
myNameSpace:=myOlApp.GetNameSpace('MAPI');
//Get root contacts folder
ContactsFolder := myNameSpace.GetDefaultFolder(olFolderContacts);
//Create the new Contact
myContact:=myOlApp.CreateItem(ContactsFolder.Folders.Count);
myContact.FullName := ContactsFullName.Strings[1];
.
.
.
end;
I have never coded COMOBJ before that, so I would really appreciate any assistance.