Now I seem to have a problem with the Ole does anyone know another solution I am pasting the code I had before
I would greatly appreciate it if someone can help me get this working again any ideas ???
FUNCTION Calendar() AS VOID
// Add event handling code here
/* LOCAL objOL AS OBJECT
LOCAL objNS AS OBJECT
LOCAL objCalendar AS OBJECT
LOCAL objExplorer AS OBJECT
objOL := OleAutoObject{"Outlook.Application"}
objNS := objOL:GetNamespace("MAPI")
objCalendar := objNS:GetDefaultFolder(9)
objExplorer := objCalendar:GetExplorer
objExplorer:Activate()
*/
RETURN
FUNCTION Notes() AS VOID
// Add event handling code here
/*
LOCAL objOL AS OBJECT
LOCAL objNS AS OBJECT
LOCAL objContact AS OBJECT
LOCAL objExplorer AS OBJECT
objOL := OleAutoObject{"Outlook.Application"}
objNS := objOL:GetNamespace("MAPI")
objContact := objNS:GetDefaultFolder(12)
objExplorer := objContact:GetExplorer
objExplorer:Activate()
*/
RETURN
FUNCTION ContactClick() AS VOID
/*
LOCAL oApp AS Microsoft.Office.Interop.Outlook.Application
LOCAL objOL AS OBJECT
LOCAL objNS AS OBJECT
LOCAL objContact AS OBJECT
LOCAL objExplorer AS OBJECT
objOL := OleAutoObject{"Outlook.Application"}
objNS := objOL:GetNamespace("MAPI")
objContact := objNS:GetDefaultFolder(10)
objExplorer := objContact:GetExplorer
objExplorer:Activate()
*/
RETURN
How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
This Code also does not work Hope to hear from someone !!! Thanks
FUNCTION AddOutlookContact() AS VOID
LOCAL outApplication AS Microsoft.Office.Interop.Outlook.Application
*' Get the namespace and the logon.
LOCAL outNamSpace AS Microsoft.Office.Interop.Outlook.NameSpace
*' Create a new contact item.
LOCAL NewContact AS Microsoft.Office.Interop.Outlook.ContactItem
// Create an Outlook application.
// Get the namespace and the logon.
outApplication.GetNamespace("MAPI")
outApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem)
outNamspace.Logon("Outlook",NULL,TRUE,TRUE)
// Set some common properties.
NewContact:FirstName := _OutlookFnamecontact
NewContact:FullName := _OutlookSNamecontact
NewContact:Title := _OutlookFunction
NewContact:Birthday := Convert.ToDateTime("5/4/1969")
NewContact:CompanyName := M_Custname
NewContact:Department := "Development"
* NewContact.Body := "Sample"
*NewContact.FileAs := "Authorcode"
NewContact:Email1Address := _OutlookEmailcontact
NewContact:BusinessTelephoneNumber := _OutlookTel
NewContact:MobileTelephoneNumber := _OutlookMobile
NewContact:MailingAddress := _OutlookEmailcontact
NewContact:Subject := "Contact created from X#"
NewContact:JobTitle := _OutlookFunction
NewContact:Save()
NewContact:Display(TRUE)
*oApp := Nothing
*outNamSpace := Nothing
*NewContact := Nothing
RETURN
LOCAL outApplication AS Microsoft.Office.Interop.Outlook.Application
*' Get the namespace and the logon.
LOCAL outNamSpace AS Microsoft.Office.Interop.Outlook.NameSpace
*' Create a new contact item.
LOCAL NewContact AS Microsoft.Office.Interop.Outlook.ContactItem
// Create an Outlook application.
// Get the namespace and the logon.
outApplication.GetNamespace("MAPI")
outApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem)
outNamspace.Logon("Outlook",NULL,TRUE,TRUE)
// Set some common properties.
NewContact:FirstName := _OutlookFnamecontact
NewContact:FullName := _OutlookSNamecontact
NewContact:Title := _OutlookFunction
NewContact:Birthday := Convert.ToDateTime("5/4/1969")
NewContact:CompanyName := M_Custname
NewContact:Department := "Development"
* NewContact.Body := "Sample"
*NewContact.FileAs := "Authorcode"
NewContact:Email1Address := _OutlookEmailcontact
NewContact:BusinessTelephoneNumber := _OutlookTel
NewContact:MobileTelephoneNumber := _OutlookMobile
NewContact:MailingAddress := _OutlookEmailcontact
NewContact:Subject := "Contact created from X#"
NewContact:JobTitle := _OutlookFunction
NewContact:Save()
NewContact:Display(TRUE)
*oApp := Nothing
*outNamSpace := Nothing
*NewContact := Nothing
RETURN
This Code also does not work Hope to hear from someone !!! Thanks
Please explain what do you mean by "does not work". Do you get a compiler error, a runtime error? When? Does is just not save the contact? Something else fails?
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
How to open Inbox, Calendar, Create Appointment did it with OLE
Hi Raymond,
why do you try with OleAutoObject? This is VO code and AFAIK does not works in X#.
You need to rewrite that code (in a much simpler manner) using the Microsoft.Office.Interop.Outlook library, like the one I have posted to your other message.
Wolfgang
P.S. it does not helps open up more threads for a similar issue. Open up one and wait until someone is able to help you.
why do you try with OleAutoObject? This is VO code and AFAIK does not works in X#.
You need to rewrite that code (in a much simpler manner) using the Microsoft.Office.Interop.Outlook library, like the one I have posted to your other message.
Wolfgang
P.S. it does not helps open up more threads for a similar issue. Open up one and wait until someone is able to help you.
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 open Inbox, Calendar, Create Appointment did it with OLE
Hi Wolfgang,
Thanks for your advise will do in future I sent you a reply regarding the first code you sent me I get a compile error do you know the reason I am using exactly what you did only with more fields.
Thanks
Raymond
Thanks for your advise will do in future I sent you a reply regarding the first code you sent me I get a compile error do you know the reason I am using exactly what you did only with more fields.
Thanks
Raymond
How to open Inbox, Calendar, Create Appointment did it with OLE
In X#, you may use Microsoft.Office.Interop.Outlook.
Example for Outlook Contacts:
USING Microsoft.Office.Interop.Outlook
LOCAL outlook AS Microsoft.Office.Interop.Outlook.Application
LOCAL outlookNS AS Microsoft.Office.Interop.Outlook.NameSpace
outlook := Microsoft.Office.Interop.Outlook.Application{}
outlookNS := outlook:GetNamespace("MAPI")
LOCAL oContactFolder := SELF:outlookNS:PickFolder() AS MAPIFolder
IF oContactFolder == NULL
RETURN
ENDIF
FOREACH oFolderFound AS MAPIFolder IN oContactFolder:Folders
IF oFolderFound:DefaultItemType == Microsoft.Office.Interop.Outlook.OlItemType.olContactItem
//do something
ENDIF
NEXT
George
Example for Outlook Contacts:
USING Microsoft.Office.Interop.Outlook
LOCAL outlook AS Microsoft.Office.Interop.Outlook.Application
LOCAL outlookNS AS Microsoft.Office.Interop.Outlook.NameSpace
outlook := Microsoft.Office.Interop.Outlook.Application{}
outlookNS := outlook:GetNamespace("MAPI")
LOCAL oContactFolder := SELF:outlookNS:PickFolder() AS MAPIFolder
IF oContactFolder == NULL
RETURN
ENDIF
FOREACH oFolderFound AS MAPIFolder IN oContactFolder:Folders
IF oFolderFound:DefaultItemType == Microsoft.Office.Interop.Outlook.OlItemType.olContactItem
//do something
ENDIF
NEXT
George
How to open Inbox, Calendar, Create Appointment did it with OLE
Raymond,
In .Net the recommended way to use com is not to use the oleautoobject class but to use a refernece to the interop library that is created when you add a com reference to your project, or to use a "primary interop assembly", a pre installed interop library that you will find in the first page of add reference dialog.
This approach works much better than the oleautoobject class.
If you look in the turorials in the documentation you should also find an example of how to automate excel that way.
Robert
In .Net the recommended way to use com is not to use the oleautoobject class but to use a refernece to the interop library that is created when you add a com reference to your project, or to use a "primary interop assembly", a pre installed interop library that you will find in the first page of add reference dialog.
This approach works much better than the oleautoobject class.
If you look in the turorials in the documentation you should also find an example of how to automate excel that way.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert
Hi Robert,
Thanks for the Info I will do so.
Thanks
Raymond
Thanks for the Info I will do so.
Thanks
Raymond
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
How to open Inbox, Calendar, Create Appointment did it with OLE
Hi George,
I will try your code and let you know how I get on thanks for your help.
Regards,
Raymond
I will try your code and let you know how I get on thanks for your help.
Regards,
Raymond
How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert
Hello Raymond,
I am finalizing my program to read cells from an Excel spreadsheet. I hope to have it ready tomorrow and I'll publish it here so anyone wanting to do some Office automation should have a good starting point.
Dick
I am finalizing my program to read cells from an Excel spreadsheet. I hope to have it ready tomorrow and I'll publish it here so anyone wanting to do some Office automation should have a good starting point.
Dick