?
Solved

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

Posted on 2010-11-08
6
Medium Priority
?
940 Views
Last Modified: 2013-11-16
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?
0
Comment
Question by:marketware
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 34093137
No clue, but a different approach: send a mail with a Meeting invitation. It is more or less standardized for all Mail environments.
0
 

Author Comment

by:marketware
ID: 34094568
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

0
 

Accepted Solution

by:
marketware earned 0 total points
ID: 34238665
I solved the problem.  It seems that when I changed the "refresh" of the DevExpress.XtraScheduler control to be performed on a Worker thread it caused groupwise to blow up every time I attempted a new appointment, etc.

Problem Solved I removed the refresh from occuring on a background thread.

bob
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 34239756
Well done! Now collect your (own) points... :-))
0
 

Author Closing Comment

by:marketware
ID: 34299429
FYI.  Groupwise does not play well with background threads.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Suggested Courses
Course of the Month9 days, 2 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question