Alex
Guest
|
Posted:
Thu Sep 29, 2005 12:58 am Post subject:
Tasks |
|
|
Hello,
I am trying to create a new Task from a C# program.
I want to create the new task, let the user enter values in a stadard
Outlook Form, and then process the informatioin.
If the form is shown as non-Modal, then I don't have access to the user
information, which makes sense.
So I display the form in a Modal mode, and then I have access to the info
once the users saves the task. However,
the form stays open. (It blinks once, so it looks like there is another copy
of it behind it, which there isn't.)
Any idea how to display a Modal task form and not have it stay up?
Here is the code:
{
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();
Outlook.NameSpace oNS = oApp.GetNamespace( "MAPI" );
Outlook.TaskItemClass oTask = (Outlook.TaskItemClass)oApp.CreateItem(
Outlook.OlItemType.olTaskItem );
oTask.Display( true );
// oTask.Subject = "Task1";
// oTask.StartDate = DateTime.Now;
// oTask.DueDate = DateTime.Now.AddDays(7);
// oTask.Save();
MessageBox.Show( oTask.Subject );
// I tried to close the form manually, but that doesn't seem to have any
affect.
oTask.Close( Outlook.OlInspectorClose.olDiscard );
oTask = null;
oApp = null;
GC.WaitForPendingFinalizers();
GC.Collect();
}
I've also tried using the Outlook._TaskItem interface, and get the same
result.
TIA
Alex
|
|
Henning Krause [MVP - Exc
Guest
|
Posted:
Thu Sep 29, 2005 4:58 pm Post subject:
Re: Tasks |
|
|
Hello,
it should be possible to open the form modeless. But before calling
oTask.Display(), attach an event handler to the oTask.Close event and
process the results when that event is called.
Greetings,
Henning Krause
MVP - Exchange
http://www.infinitec.de
"Alex" <Alex.Avid@newsgroups.nospam> wrote in message
news:ubF5XgHxFHA.3400@TK2MSFTNGP14.phx.gbl...
| Quote: | Hello,
I am trying to create a new Task from a C# program.
I want to create the new task, let the user enter values in a stadard
Outlook Form, and then process the informatioin.
If the form is shown as non-Modal, then I don't have access to the user
information, which makes sense.
So I display the form in a Modal mode, and then I have access to the info
once the users saves the task. However,
the form stays open. (It blinks once, so it looks like there is another
copy of it behind it, which there isn't.)
Any idea how to display a Modal task form and not have it stay up?
Here is the code:
{
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();
Outlook.NameSpace oNS = oApp.GetNamespace( "MAPI" );
Outlook.TaskItemClass oTask = (Outlook.TaskItemClass)oApp.CreateItem(
Outlook.OlItemType.olTaskItem );
oTask.Display( true );
// oTask.Subject = "Task1";
// oTask.StartDate = DateTime.Now;
// oTask.DueDate = DateTime.Now.AddDays(7);
// oTask.Save();
MessageBox.Show( oTask.Subject );
// I tried to close the form manually, but that doesn't seem to have any
affect.
oTask.Close( Outlook.OlInspectorClose.olDiscard );
oTask = null;
oApp = null;
GC.WaitForPendingFinalizers();
GC.Collect();
}
I've also tried using the Outlook._TaskItem interface, and get the same
result.
TIA
Alex
|
|
|