Avatar of marketware
marketware

asked on 

Why can't I create this appointment in Groupwise using c#?

Here is the simple code I'm using:

            //Create a New Appointment
            GroupwareTypeLibrary.Appointment10 appt;

            try
            {
                appt = (GroupwareTypeLibrary.Appointment10)groupwiseAccount.WorkFolder.Messages.Add(gwAppointment, egwDraft, _missing);
               
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Could not create Appointment item:\r\n\r\n" + ex.Message);
                return;
            }

I get the following error when adding the appointment:

Object does not match target type.

Any ideas why this doesn't work?
Lotus IBMC#GroupwareNovell NetwareExchange

Avatar of undefined
Last Comment
marketware
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

No clue, but a different approach: send a mail with a Meeting invitation. It is more or less standardized for all Mail environments.
Avatar of marketware
marketware

ASKER

Here is what I am trying to do:  Create a new appointment with date, time, subject, etc. and then display the appointment using tokens.  My code is below and it seems to work fine (in a separate .cs file) but when used in my main application it gives the error: "Object does not match target type" on the following line.

appt = (GroupwareTypeLibrary.Appointment10)groupwiseAccount.WorkFolder.Messages.Add(gwAppointment, egwDraft, _missing);

This is really weird.  Why wouldn't it work in my main app all things being equal?  I cut/pasted the code in the main app to produce the code below.  And what really blows me away is that this was working before and now poof!  it doen't.

Thanks.

bob
      public static void Test()
        {
            GroupwareTypeLibrary.Application groupwiseApp;
            GroupwareTypeLibrary.Account groupwiseAccount;

            object gwAppointment = "GW.MESSAGE.APPOINTMENT";
            object _missing = System.Reflection.Missing.Value;
            object egwDraft = 4;
            string mypassword = "abc123";

            groupwiseApp = new GroupwareTypeLibrary.Application();
            groupwiseAccount = groupwiseApp.Login("", "", mypassword, 0, _missing);

            //Create a New Appointment
            GroupwareTypeLibrary.Appointment10 appt;

            try
            {
                appt = (GroupwareTypeLibrary.Appointment10)groupwiseAccount.WorkFolder.Messages.Add(gwAppointment, egwDraft, _missing);

            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Could not create Appointment item:\r\n\r\n" + ex.Message);
                return;
            }

            appt.StartDate = DateTime.Now;
            appt.EndDate = DateTime.Now.AddMinutes(30);

            appt.AlarmSet = false;
            appt.Subject.PlainText = "This is the Subject";

            string messageID = appt.MessageID.ToString();
            string RetString;

            string cmdOpenMessage = "ItemOpen(\"" + messageID + "\")";

            GroupWiseCommander.GWCommander gwc = new GroupWiseCommander.GWCommander();
            gwc.Execute(cmdOpenMessage, out RetString);

            return;

}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of marketware
marketware

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Well done! Now collect your (own) points... :-))
Avatar of marketware
marketware

ASKER

FYI.  Groupwise does not play well with background threads.
Exchange
Exchange

Exchange is the server side of a collaborative application product that is part of the Microsoft Server infrastructure. Exchange's major features include email, calendaring, contacts and tasks, support for mobile and web-based access to information, and support for data storage.

213K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo