Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: How to create AppointmentItem in inbox (Outlook 2002)

Geek News

How to create AppointmentItem in inbox (Outlook 2002)
"Galois" <GaloisE[ at ]gmail.com> 4/18/2006 9:56:58 PM
I'm trying to create an AppointmentItem in the Inbox, so the user could
choose if to accept invitation or not, but Outlook 2002 refuses to do
so.

Anyone knows how to do that?

Code sample, C# (doesn't work - keeps a copy in the Draft folder & and
places the appointment in the calendar), open Outlook before running
this code:

using System;
using System.IO;
using System.Net;

namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Outlook.ApplicationClass app
= new Outlook.ApplicationClass();
Outlook.NameSpace session
= app.GetNamespace("MAPI");
session.Logon(null, null, null, null);

Outlook.MAPIFolder inbox
= session.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderInbox);

Outlook.AppointmentItem item
= (Outlook.AppointmentItem)inbox.Items.Add
(Outlook.OlItemType.olAppointmentItem);
item.Subject = "Subject";
item.Body = "Body";
item.Location = "Location";
item.ReminderSet = false;

item.Move(inbox);
item.Close(Outlook.OlInspectorClose.olSave);

session.Logoff();
}
}
}

Re: How to create AppointmentItem in inbox (Outlook 2002)
Rog <rog_21[ at ]yahoo.com> 4/18/2006 10:02:38 PM
Instead of an AppointmentItem try MeetingItem.
rog

Galois wrote:
[Quoted Text]
> I'm trying to create an AppointmentItem in the Inbox, so the user could
> choose if to accept invitation or not, but Outlook 2002 refuses to do
> so.
>
> Anyone knows how to do that?
>
> Code sample, C# (doesn't work - keeps a copy in the Draft folder & and
> places the appointment in the calendar), open Outlook before running
> this code:
>
> using System;
> using System.IO;
> using System.Net;
>
> namespace ConsoleApplication1
> {
> class Class1
> {
> [STAThread]
> static void Main(string[] args)
> {
> Outlook.ApplicationClass app
> = new Outlook.ApplicationClass();
> Outlook.NameSpace session
> = app.GetNamespace("MAPI");
> session.Logon(null, null, null, null);
>
> Outlook.MAPIFolder inbox
> = session.GetDefaultFolder
> (Outlook.OlDefaultFolders.olFolderInbox);
>
> Outlook.AppointmentItem item
> = (Outlook.AppointmentItem)inbox.Items.Add
> (Outlook.OlItemType.olAppointmentItem);
> item.Subject = "Subject";
> item.Body = "Body";
> item.Location = "Location";
> item.ReminderSet = false;
>
> item.Move(inbox);
> item.Close(Outlook.OlInspectorClose.olSave);
>
> session.Logoff();
> }
> }
> }
>
Re: How to create AppointmentItem in inbox (Outlook 2002)
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> 4/27/2006 7:01:53 AM
Even then, a meeting request that has not been sent and received is not going to have Accept and Reject buttons.

Why not create a message with an iCalendar attachment? Or just display the appointment directly to the user without making them open it first?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Rog" <rog_21[ at ]yahoo.com> wrote in message news:%234$OrPzYGHA.3704[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> Instead of an AppointmentItem try MeetingItem.
> rog
>
> Galois wrote:
>> I'm trying to create an AppointmentItem in the Inbox, so the user could
>> choose if to accept invitation or not, but Outlook 2002 refuses to do
>> so.
>>
>> Anyone knows how to do that?
>>
>> Code sample, C# (doesn't work - keeps a copy in the Draft folder & and
>> places the appointment in the calendar), open Outlook before running
>> this code:
>>
>> using System;
>> using System.IO;
>> using System.Net;
>>
>> namespace ConsoleApplication1
>> {
>> class Class1
>> {
>> [STAThread]
>> static void Main(string[] args)
>> {
>> Outlook.ApplicationClass app
>> = new Outlook.ApplicationClass();
>> Outlook.NameSpace session
>> = app.GetNamespace("MAPI");
>> session.Logon(null, null, null, null);
>>
>> Outlook.MAPIFolder inbox
>> = session.GetDefaultFolder
>> (Outlook.OlDefaultFolders.olFolderInbox);
>>
>> Outlook.AppointmentItem item
>> = (Outlook.AppointmentItem)inbox.Items.Add
>> (Outlook.OlItemType.olAppointmentItem);
>> item.Subject = "Subject";
>> item.Body = "Body";
>> item.Location = "Location";
>> item.ReminderSet = false;
>>
>> item.Move(inbox);
>> item.Close(Outlook.OlInspectorClose.olSave);
>>
>> session.Logoff();
>> }
>> }
>> }
>>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net