fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert

How to open Inbox, Calendar, Create Appointment did it with OLE 2 months 2 weeks ago #8234

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
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

Please Log in or Create an account to join the conversation.

This Code also does not work Hope to hear from someone !!! Thanks 2 months 2 weeks ago #8235

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
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

Please Log in or Create an account to join the conversation.

This Code also does not work Hope to hear from someone !!! Thanks 2 months 2 weeks ago #8237

  Chris's Avatar Chris Offline Posts: 1181
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?
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLE 2 months 2 weeks ago #8240

  wriedmann's Avatar wriedmann Away Posts: 1573
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.
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLE 2 months 2 weeks ago #8242

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
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

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLE 2 months 2 weeks ago #8264

  George's Avatar George Offline Posts: 91
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

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLE 2 months 2 weeks ago #8265

  robert's Avatar robert Offline Posts: 1004
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
XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert 2 months 2 weeks ago #8267

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
Hi Robert,
Thanks for the Info I will do so.

Thanks
Raymond

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLE 2 months 2 weeks ago #8268

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
Hi George,
I will try your code and let you know how I get on thanks for your help.

Regards,
Raymond

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert 2 months 2 weeks ago #8290

  ic2's Avatar ic2 Offline Posts: 499
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

Please Log in or Create an account to join the conversation.

How to open Inbox, Calendar, Create Appointment did it with OLEHi RFobert 2 months 2 weeks ago #8308

  rn@warner-it.com's Avatar Topic Author rn@warner-it.com Offline Posts: 27
HI Dick,
Thanks for the Info will look forward to your examples.

Thanks
Raymond

Please Log in or Create an account to join the conversation.

  • Page:
  • 1