A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to get Microsoft.Office.Interop.Outlook.TaskItem from the IUnknown (C#)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 3rd 07, 04:24 PM 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#)

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)
{
????
}

Ads
  #2  
Old April 3rd 07, 05:07 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to get Microsoft.Office.Interop.Outlook.TaskItem from the IUnknown (C#)

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 Options
http://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)
{
????
}


  #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.).

  #4  
Old April 4th 07, 08:26 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#)

I know, this concrete problem (get TaskRequestUpdateItem attachment as
TaskItem) can be solved like this:
Outlook.TaskRequestUpdateItem item;
....
Outlook.Attachments atts = item.Attachments;
Outlook.Attachment att = atts[1];

att.SaveAsFile("F:\\111.oft");
Outlook.TaskItem task =
(Outlook.TaskItem)ThisApplication.OlApp.CreateItem FromTemplate("F:\
\111.oft", Type.Missing);

but I don't like this way for some reason.
The way with wrapping IUnknown with the OOM interface is pleasant to
me much more.

  #5  
Old April 4th 07, 02:43 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to get Microsoft.Office.Interop.Outlook.TaskItem from the IUnknown (C#)

That's the way I'd do it, using a save to file.

You might want to post in the microsoft.public.win32.programmer.messaging
group with this question. It's not strictly a MAPI question, which is what
the group is for, but it's sufficiently close that the MAPI experts there
may be able to help better than we can here.

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


"Godandag" wrote in message
ups.com...
I know, this concrete problem (get TaskRequestUpdateItem attachment as
TaskItem) can be solved like this:
Outlook.TaskRequestUpdateItem item;
....
Outlook.Attachments atts = item.Attachments;
Outlook.Attachment att = atts[1];

att.SaveAsFile("F:\\111.oft");
Outlook.TaskItem task =
(Outlook.TaskItem)ThisApplication.OlApp.CreateItem FromTemplate("F:\
\111.oft", Type.Missing);

but I don't like this way for some reason.
The way with wrapping IUnknown with the OOM interface is pleasant to
me much more.


  #6  
Old April 5th 07, 09:39 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 4 Сав, 16:43, "Ken Slovak - [MVP - Outlook]"
wrote:
That's the way I'd do it, using a save to file.

You might want to post in the microsoft.public.win32.programmer.messaging
group with this question. It's not strictly a MAPI question, which is what
the group is for, but it's sufficiently close that the MAPI experts there
may be able to help better than we can here.

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

ups.com...

I know, this concrete problem (get TaskRequestUpdateItem attachment as
TaskItem) can be solved like this:
Outlook.TaskRequestUpdateItem item;
....
Outlook.Attachments atts = item.Attachments;
Outlook.Attachment att = atts[1];


att.SaveAsFile("F:\\111.oft");
Outlook.TaskItem task =
(Outlook.TaskItem)ThisApplication.OlApp.CreateItem FromTemplate("F:\
\111.oft", Type.Missing);


but I don't like this way for some reason.
The way with wrapping IUnknown with the OOM interface is pleasant to
me much more.


Thank you, Ken.
I'll try to post in the microsoft.public.win32.programmer.messaging


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C:\Program Files\Microsoft Office\custom11.prf ? Office/Outlook 20 bhall Outlook - Installation 0 December 15th 06 08:42 PM
Transfer Contacts Microsoft Office 2000 to Office for Mac 2004 Alfred Esmeijer Outlook - Using Contacts 1 November 27th 06 02:57 PM
TaskItem and AppointmentItem formated body razvantim Outlook and VBA 10 November 10th 06 07:55 PM
Msdn help for Microsoft.Office.Interop.Outlook members DavidE Add-ins for Outlook 0 August 9th 06 07:45 AM
Contact "subfolders" in Microsoft Outlook in Microsoft Office 2003 Rhonda Outlook - Using Contacts 2 July 12th 06 05:07 AM


All times are GMT +1. The time now is 11:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright Љ2004-2024 Outlook Banter.
The comments are property of their posters.