Creating an accepted meeting item. [Outlook.Appointment]

J

Joe

Hi all,

i have a requirement to create an Appointment item as a Meeting Item
with an Attendee and it should be in the Meeting accepted state. thats
while deleting or moving it the the Attendee should be notified
automatically.

now the problems i face is .. Outlook is giving a ugly warning. saying
"A program is trying to Access your Contacts. allow it for 1 minute
etc.. " how could i avoid this..

then again if i create it will say .. "Invitations have not been send
for this meeting."
how do i manually set the send status..

to effect all these i ve the following code..

newAcceptedAppointmentItem.Recipients.Add("Attendee<[email protected]>");
newAcceptedAppointmentItem.MeetingStatus =
Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
newAcceptedAppointmentItem.ResponseRequested = false;

i m using c# ..

Please do help ..

thanks in advance..

Joe
 
K

Ken Slovak - [MVP - Outlook]

What version of Outlook and what version of VS are you using? Are you using
VSTO or a shared addin?

In general you must derive any Outlook objects from the Application object
passed to you in the OnConnection event handler or the VSTO Startup event
handler. Even so, with some versions of Outlook that is not trusted because
it's a .NET COM addin and therefore not actually running in-process with
Outlook.

In those cases your options are listed at
http://www.outlookcode.com/d/sec.htm.

Some properties of items cannot be set by using the Outlook object model.
The only way to set them at all is to use a MAPI interface such as Extended
MAPI (C++ or Delphi only and not supported for .NET use). Otherwise you have
to use an Extended MAPI wrapper such as Redemption
(www.dimastr.com/redemption) and when you create the items set all those
such properties before the first time the item is saved. Once saved they
become read-only.

I'm not at all sure that you can do what you've been tasked to do.
 
J

Joe

hi Ken

thanks for the reply..

i ve used Shared Addin project and ve used VS2005.

i just want the to create a Fully Accepted Appointment in code.. and
it shouldnt ve any security alerts .. i am using Outlook 2002 to
develp my addin
and it supports for all the later versions of Outlook..

Please do give some more inputs

thanks

Joe
 
K

Ken Slovak - [MVP - Outlook]

I don't think you can do what you want, simulate an accepted appointment
using the Outlook object model. In fact I know that you can't. So the only
option is Extended MAPI in unmanaged code or one of the COM MAPI wrappers
such as Redemption.

That's also one of the workarounds for the security. I pointed out the link
for information about the security to you also.
 
J

Joe

Hi

i had been trying to fix the security warning. but in vain..

here is my code..

private void RunMailScript(Outlook.MAPIFolder outboxFolder,
Outlook._MailItem cancelMail)
{
string entryId;
Outlook._MailItem newCancelMail;
entryId = cancelMail.EntryID;
outlookNameSpace =
objOutlookApplication.GetNamespace("mapi");
newCancelMail =
(Outlook._MailItem)outlookNameSpace.GetItemFromID(entryId,
Missing.Value);
newCancelMail.To = "(e-mail address removed)";
newCancelMail.Subject = "Cancelled !" +
AppointmentItem.Subject;
newCancelMail.Body = movedAppointmentItem.Body;
newCancelMail.SaveSentMessageFolder = outboxFolder;
newCancelMail.Send();

newCancelMail = null;
outlookNameSpace = null;
}

i m not able to get the entryId of the mail item which is created
before calling this method.
entryId is null. and GetItemFromID takes two parameters !!
[entryIdStore] wats should be the value for that ?

i create the mailItem here:
cancelMail =
(Outlook._MailItem)objOutlookApplication.CreateItem(Outlook.OlItemType.olMailItem);

please do help !!

thanks in advance !!

Joe Augustine

I don't think you can do what you want, simulate an accepted appointment
using the Outlook object model. In fact I know that you can't. So the only
option is Extended MAPI in unmanaged code or one of the COM MAPI wrappers
such as Redemption.

That's also one of the workarounds for the security. I pointed out the link
for information about the security to you also.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm


thanks for the reply..
i ve used Shared Addin project and ve used VS2005.
i just want the to create a Fully Accepted Appointment in code.. and
it shouldnt ve any security alerts .. i am using Outlook 2002 to
develp my addin
and it supports for all the later versions of Outlook..
Please do give some more inputs

Joe
 
K

Ken Slovak - [MVP - Outlook]

No Outlook item has an EntryID property until it's saved for the first time.

StoreID is an optional argument. You can supply
System.Reflection.Missing.Value or you can get item.Parent, which is the
parent folder where a saved item is stored and use item.Parent.StoreID.
 
J

Joe

Hi ken

thanks for the reply. .

i ve done wat u told.. i still continue to get the warning ..

please have a look at my code..

objOutlookApplication =
OutlookInstanceHolder.applicationInstance;
outlookNameSpace =
objOutlookApplication.GetNamespace("mapi");

//Log on by using a dialog box to
choose the profile.

outlookNameSpace.Logon(Missing.Value, Missing.Value, true, true);

Outlook.MAPIFolder outboxFolder =
outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);

Outlook._MailItem cancelMail ;
cancelMail=
(Outlook._MailItem)objOutlookApplication.CreateItem(Outlook.OlItemType.olMailItem);
cancelMail.To =
"(e-mail address removed)";
cancelMail.Subject = "Cancelled !"
+ Subject;
cancelMail.Body = Body;
cancelMail.Save();

string entryId;
Outlook._MailItem newCancelMail;
entryId = cancelMail.EntryID;
Outlook.MAPIFolder draftsFolder =
outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
newCancelMail =
(Outlook._MailItem)outlookNameSpace.GetItemFromID(entryId,
draftsFolder.StoreID);

newCancelMail.SaveSentMessageFolder = outboxFolder;
newCancelMail.Send();

newCancelMail = null;
outlookNameSpace = null;
outboxFolder = null;
draftsFolder = null;
cancelMail = null;
here the entryId is not null.

please do help ..

thankz

Joe Augustine

No Outlook item has an EntryID property until it's saved for the first time.

StoreID is an optional argument. You can supply
System.Reflection.Missing.Value or you can get item.Parent, which is the
parent folder where a saved item is stored and use item.Parent.StoreID.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm




i had been trying to fix the security warning. but in vain..
here is my code..
private void RunMailScript(Outlook.MAPIFolder outboxFolder,
Outlook._MailItem cancelMail)
{
string entryId;
Outlook._MailItem newCancelMail;
entryId = cancelMail.EntryID;
outlookNameSpace =
objOutlookApplication.GetNamespace("mapi");
newCancelMail =
(Outlook._MailItem)outlookNameSpace.GetItemFromID(entryId,
Missing.Value);
newCancelMail.To = "(e-mail address removed)";
newCancelMail.Subject = "Cancelled !" +
AppointmentItem.Subject;
newCancelMail.Body = movedAppointmentItem.Body;
newCancelMail.SaveSentMessageFolder = outboxFolder;
newCancelMail.Send();
newCancelMail = null;
outlookNameSpace = null;
}
i m not able to get the entryId of the mail item which is created
before calling this method.
entryId is null. and GetItemFromID takes two parameters !!
[entryIdStore] wats should be the value for that ?
i create the mailItem here:
cancelMail =
(Outlook._MailItem)objOutlookApplication.CreateItem(Outlook.OlItemType.olMa­ilItem);
please do help !!
thanks in advance !!
Joe Augustine- Hide quoted text -

- Show quoted text -
 
K

Ken Slovak - [MVP - Outlook]

This code is not running in a COM addin? That would explain the security
warning.

See http://www.outlookcode.com/d/sec.htm for your options with regard to the
security.






Hi ken

thanks for the reply. .

i ve done wat u told.. i still continue to get the warning ..

please have a look at my code..

objOutlookApplication =
OutlookInstanceHolder.applicationInstance;
outlookNameSpace =
objOutlookApplication.GetNamespace("mapi");

//Log on by using a dialog box to
choose the profile.

outlookNameSpace.Logon(Missing.Value, Missing.Value, true, true);

Outlook.MAPIFolder outboxFolder =
outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);

Outlook._MailItem cancelMail ;
cancelMail=
(Outlook._MailItem)objOutlookApplication.CreateItem(Outlook.OlItemType.olMailItem);
cancelMail.To =
"(e-mail address removed)";
cancelMail.Subject = "Cancelled !"
+ Subject;
cancelMail.Body = Body;
cancelMail.Save();

string entryId;
Outlook._MailItem newCancelMail;
entryId = cancelMail.EntryID;
Outlook.MAPIFolder draftsFolder =
outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
newCancelMail =
(Outlook._MailItem)outlookNameSpace.GetItemFromID(entryId,
draftsFolder.StoreID);

newCancelMail.SaveSentMessageFolder = outboxFolder;
newCancelMail.Send();

newCancelMail = null;
outlookNameSpace = null;
outboxFolder = null;
draftsFolder = null;
cancelMail = null;
here the entryId is not null.

please do help ..

thankz

Joe Augustine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top