FUNCTION AddNewContact() AS VOID
LOCAL oApp AS Microsoft.Office.Interop.Outlook.Application
oApp := CreateObject(Outlook.Application)
LOCAL oNs AS Microsoft.Office.Interop.Outlook.NameSpace
oNs = oApp.GetNamespace("MAPI")
oNs.Logon()
LOCAL oItem AS Outlook.ContactItem
oItem = oApp.CreateItem(OlItemType.olContactItem)
oItem.FullName := _OutlookSNamecontact
oItem.CompanyName := M_Custname
oItem.Email1Address := _OutlookEmailcontact
oItem.JobTitle := _OutlookFunction
oItem.HomeAddress := "Europe Germany"
oItem.BusinessAddress := "Europe Germany"
oItem.Email1Address := _OutlookEmailcontact
oItem.Save()
RETURN
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??
Hi Raymond,
your code has ever worked?
On my machine, the following code creates a contact:
as you can see here:
Wolfgang
your code has ever worked?
On my machine, the following code creates a contact:
Code: Select all
local oApp as Microsoft.Office.Interop.Outlook.Application
local oItem as _ContactItem
oApp := Microsoft.Office.Interop.Outlook.Application{}
oItem := oApp.CreateItem( OlItemType.olContactItem )
oItem.FullName := "Raymond Nathan Warner"
oItem.Save()
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??
HI Wolfgang,
Thank you so much for your help I tried to do the same with your code and have this as a result I am pasting this in here.
This is the error message I get when I compile this code
error XS0266: Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Outlook._ContactItem'. An explicit conversion exists (are you missing a cast?) 150,10 Ray_Outlook.prg FormApp6
FUNCTION AddNewContact() AS VOID
LOCAL oApp AS Microsoft.Office.Interop.Outlook.Application
LOCAL oItem AS _ContactItem
oApp := Microsoft.Office.Interop.Outlook.Application{}
oItem := oApp.CreateItem( OlItemType.olContactItem )
oItem.FirstName := _OutlookFnamecontact
oItem.FullName := _OutlookSNamecontact
oItem.Title := _OutlookFunction
oItem.Birthday := Convert.ToDateTime("5/4/1969")
oItem.CompanyName := M_Custname
oItem.Department := "Development"
* NewContact.Body := "Sample"
*NewContact.FileAs := "Authorcode"
oItem.Email1Address := _OutlookEmailcontact
oItem.BusinessTelephoneNumber := _OutlookTel
oItem.MobileTelephoneNumber := _OutlookMobile
oItem.MailingAddress := _OutlookEmailcontact
oItem.Subject := "Contact created from X#"
oItem.JobTitle := _OutlookFunction
*oItem.FullName := "Raymond Nathan Warner"
oItem.Save()
RETURN
Thank you so much for your help I tried to do the same with your code and have this as a result I am pasting this in here.
This is the error message I get when I compile this code
error XS0266: Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Outlook._ContactItem'. An explicit conversion exists (are you missing a cast?) 150,10 Ray_Outlook.prg FormApp6
FUNCTION AddNewContact() AS VOID
LOCAL oApp AS Microsoft.Office.Interop.Outlook.Application
LOCAL oItem AS _ContactItem
oApp := Microsoft.Office.Interop.Outlook.Application{}
oItem := oApp.CreateItem( OlItemType.olContactItem )
oItem.FirstName := _OutlookFnamecontact
oItem.FullName := _OutlookSNamecontact
oItem.Title := _OutlookFunction
oItem.Birthday := Convert.ToDateTime("5/4/1969")
oItem.CompanyName := M_Custname
oItem.Department := "Development"
* NewContact.Body := "Sample"
*NewContact.FileAs := "Authorcode"
oItem.Email1Address := _OutlookEmailcontact
oItem.BusinessTelephoneNumber := _OutlookTel
oItem.MobileTelephoneNumber := _OutlookMobile
oItem.MailingAddress := _OutlookEmailcontact
oItem.Subject := "Contact created from X#"
oItem.JobTitle := _OutlookFunction
*oItem.FullName := "Raymond Nathan Warner"
oItem.Save()
RETURN
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??
Hi Raymond,
I have to check tomorrow morning.
It is strange - on my machine it compiles without any error. Maybe this is my version of the MSOutl.dll.
WOlfgang
I have to check tomorrow morning.
It is strange - on my machine it compiles without any error. Maybe this is my version of the MSOutl.dll.
WOlfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??Hi
Hi Wolfgang
I tried other possibilities but all in vain I hope you come up with a solution I cannot use my other modules for Outlook until I solve this one. The only thing that works currently Outlook is to send a mail.
Thanks and Regards,
Raymond
I tried other possibilities but all in vain I hope you come up with a solution I cannot use my other modules for Outlook until I solve this one. The only thing that works currently Outlook is to send a mail.
Thanks and Regards,
Raymond
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??Hi
Hi Wolfgang
I tried other possibilities but all in vain I hope you come up with a solution I cannot use my other modules for Outlook until I solve this one. The only thing that works currently Outlook is to send a mail.
Thanks and Regards,
Raymond
I tried other possibilities but all in vain I hope you come up with a solution I cannot use my other modules for Outlook until I solve this one. The only thing that works currently Outlook is to send a mail.
Thanks and Regards,
Raymond
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??Hi
Hi Raymond,
only to make it sure: I cannot come up with a solution. I can only help you to find your solution.
I have attached a working sample as XIDE export file to this message, and included also the Outlook interop library that I have generated from my installed Outlook 2010.
Maybe you are including the wrong library/DLL in your application.
Wolfgang
only to make it sure: I cannot come up with a solution. I can only help you to find your solution.
I have attached a working sample as XIDE export file to this message, and included also the Outlook interop library that I have generated from my installed Outlook 2010.
Maybe you are including the wrong library/DLL in your application.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
How to create a Contact in Outlook 32 Bit I tried Can anyone help please ??
Raymond, at which line does the error point to? I don't think it is pointing to a line inside the code you posted, or is it?rn@warner-it.com wrote:HI Wolfgang,
Thank you so much for your help I tried to do the same with your code and have this as a result I am pasting this in here.
This is the error message I get when I compile this code
error XS0266: Cannot implicitly convert type 'object' to 'Microsoft.Office.Interop.Outlook._ContactItem'. An explicit conversion exists (are you missing a cast?) 150,10 Ray_Outlook.prg FormApp6
FUNCTION AddNewContact() AS VOID
LOCAL oApp AS Microsoft.Office.Interop.Outlook.Application
LOCAL oItem AS _ContactItem
oApp := Microsoft.Office.Interop.Outlook.Application{}
oItem := oApp.CreateItem( OlItemType.olContactItem )
oItem.FirstName := _OutlookFnamecontact
oItem.FullName := _OutlookSNamecontact
oItem.Title := _OutlookFunction
oItem.Birthday := Convert.ToDateTime("5/4/1969")
oItem.CompanyName := M_Custname
oItem.Department := "Development"
* NewContact.Body := "Sample"
*NewContact.FileAs := "Authorcode"
oItem.Email1Address := _OutlookEmailcontact
oItem.BusinessTelephoneNumber := _OutlookTel
oItem.MobileTelephoneNumber := _OutlookMobile
oItem.MailingAddress := _OutlookEmailcontact
oItem.Subject := "Contact created from X#"
oItem.JobTitle := _OutlookFunction
*oItem.FullName := "Raymond Nathan Warner"
oItem.Save()
RETURN
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu