View Single Post
  #3  
Old April 4th 07, 07:33 AM posted to microsoft.public.outlook.program_addins
Godandag
external usenet poster
 
Posts: 8
Default How to get Microsoft.Office.Interop.Outlook.TaskItem from the IUnknown (C#)

On 3 Сав, 19:07, "Ken Slovak - [MVP - Outlook]"
wrote:
If you already have a task item why are you going through hoops to get
another instance of the same task item that way? Why not just copy the
passed task item or create a new one or use NameSpace.GetItemFromID() to
retrieve another instance of the task item if you can get its EntryID
property?

--
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

"Godandag" wrote in message

oups.com...

Hi all.


In other words, how to implement the method GetTaskFromIntPtr in the
code below?


using Outlook = Microsoft.Office.Interop.Outlook;


...


public void Method1(Outlook.TaskItem task)
{
IntPtr ptr = Marshal.GetIUnknownForObject(task.MAPIOBJECT);
Outlook.TaskItem task1 = GetTaskFromIntPtr(ptr); //
GetTaskFromIntPtr - ?
}


public Outlook.TaskItem GetTaskFromIntPtr(IntPtr)
{
????
}


Hello Ken!
It is only sample. Actually, I'm trying to get updated TaskItem from
TaskRequestUpdateItem. I assume, that TaskItem is in the
olEmbeddeditem attachment of TaskRequestUpdateItem. The sequence of
operations is:

1) Get the attachment of TaskRequestUpdateItem
2) Get the PR_ATTACH_DATA_OBJ of attachment (using Extended MAPI,
IMAPIProp.OpenProperty) - so I have an IntPtr of the attachment
object. I am almost assured that there is a TaskItem. But how to wrap
it with Outlook.TaskItem interface I don't know.

I need exactly OOM Outlook.TaskItem interface (not IMessage etc.).

Ads