Getting _MailItem interface from IRDOMail - outlook

I've an Outlook plug-in. I'm using Redemption.
Specifically, I'm using IRDOMail::Move in order to move an email item from one folder to another (redemption is the only method I've found that work with all storages). I now have a need to get back a hold to the Outlook's _MailItem interface, while I only have a pointer to the redemption object. It appears Redemption works with MAPI (it is derived from), and what I need is the Outlook interface.
Thanks.

Use RDOMail.EntryID property to reopen the message as Outlook.MailItem using Namespace.GetItemFromID

IRDOMAIL::MAPIOBJECT will give you the underlying MAPI object. Perhaps you can use that not somehow navigate to the Outlook interface.
Redemption uses MAPI yes and it also aims to be a be a full replacement for CDO 1.21

Related

Need to create VSTO UserProperties with MS Graph

We have an add in that works with user properties set as Outlook.OlUserPropertyType.olInteger
I have been asked to integrate that with MSGraph.
According to this post if user properties are created in a VSTO add in this can be accessed through MS Graph but how can I go the other way? I need to use Outlook extended properties but I am not sure how
So far I am not sure how to add extended properties and how to pick them up in a VSTO add in
You need to use the GUID for dealing with user properties. See How do I retrieve Extended Properties from a Calendar Event using MS Graph? for more information. For example:
https://graph.microsoft.com/v1.0/me/events('AAMkADU4MzkxN2RmLTdiZDAtNDIwYS04NjQzLTUzNzMyMjM0Y2VkNQBGAAAAAABGjw0ByCaySL6aUxJmew3qBwDwiT27qO5xT6RMWiWBhwRzAAAADIqqAAAYpSJ8f1CATrNsRrtUbquzAAEOAONsAAA=')?$expand=singleValueExtendedProperties($filter=id%20eq%20'String%20{00020329-0000-0000-C000-000000000046}%20Name%20MyCustomData')
User properties are twofold: their definition is stored in a special blob (you can see its definition in MFCMAPI or OutlookSpy (I am its author) - click IMessage button) and their value is stored as a regular named MAPI property (see the OutlookSpy screenshot in Eugene's answer). The blob format is documented, but parsing or (even worse) creating it is a major pain. If you don't need the property to be present in the MailItem.UserProperties collection, you can read or set its value using MailItem.PropertyAccessor.GetProperty/SetProperty by the property DSL name (also shown by OutlookSpy). To read or set the value using Graph, you can use the link in your question.

Is it possible to embed an Outlook .msg into an application using OLE?

If you have some application with an ordinary HWND, is it possible to embed an Outlook email .msg file into the window using OLE?
It appears that, after opening an Outlook message using OpenSharedItem, you can successfully QueryInterface for IOleObject. But after that, I can't seem to successfully call any IOleObject methods.
Thanks for any input.
MSG file format is well-described in MSDN. So, you can read the content without any third-party components or interfaces. To display the content (I guess the message body) you can use any web browser (for example, WebView2). The message body (HTMLBody) is represented by a regular web page. Most probably you will also need attached files that are used in the body.
Another possible alternative to use Extended MAPI for getting item properties. For example, you can use any third-party components for simplifying the work - Redemption.

get attachment id from redemption or RDO MAil

I'm developping an outlook addIn using C# and I need to get attachment id from redemption or RDO MAil.
how's that?
Thank you
Outlook attachments (unlike messages) do not have unique ids since they only exist in the context of their parent messages.
PR_ATTACH_NUM property is used to open attachments - http://msdn.microsoft.com/en-us/library/office/cc841969.aspx.
But that property is not guaranteed to stay the same when a message is opened. More than that, the value of the PR_ATTACH_NUM property can differ depending on whether you retrieve it from the attachment table or from the attachment itself. Below is example from OutlookSpy (I am its author):
What exactly are you trying to do?
I was trying to replace attachment with a link in async callback method and I needed to detect which attachment to replace.
I used as flag the contentID of the Interop.Redemption.RDOAttachment Object and it worked fine, Thank you .

Disable Images, ActiveX Etc in VB6 WebBrowser control using DLCTL_NO_

Like the title says, i want to disable images, and ActiveX Controls in the vb6 webbrowser control using DLCTL_NO_RUNACTIVEXCTLS and DLCTL_NO_DLACTIVEXCTLS
Microsoft talk about it here: http://msdn.microsoft.com/en-us/library/aa741313.aspx
But i dont see any way to access IDispatch::Invoke from the vb6 application.
Any help would be greatly appreciated.
I do not think VB6 let you to add the ambient properties. Try host the ActiveX in another container (e.g. an ActiveX host written by yourself - but I do not know how much time you want to invest to declare VB-friendly OLE interfaces and implement them - or use another ActiveX like the one at http://www.codeproject.com/KB/atl/vbmhwb.aspx instead.
You don't access IDispatch::Invoke in VB6, you just write you method and IDispatch is automagically implemented.
Public Function DlControl() As Long
DlControl = DLCTL_NO_DLACTIVEXCTLS Or ...
End FUnction
Then just open Tools->Procedure Attributes and for DlControl function open Advanced and assign Procedure ID to -5512 (DISPID_AMBIENT_DLCONTROL). That's first part.
Second part is to set the client site to you custom implementation of IOleClientSite. You'll need a custom typelib, try Edanmo's OLELIB for declaration of these interfaces.
Here is a delphi sample how to hook your implementation of IOleClientSite. Apparently you'll alse have to call OnAmbientPropertyChange at some point.

Creating a new email message using the default email program

How can I programatically open a new message window in the default email client (such as Outlook) using Windows API calls? I will need to include an attachment and would prefer to specify the default message body in 'rich text' (ie. not plain) format.
The ShellExecute solution is good for simple messages without attachments, but if you want more control over the process, you may try the MAPI; in particular, see the MAPISendMail function and the MapiMessage structure.
For even more complex needs, there's the extended MAPI, but I didn't find any documentation about it on the MSDN. However this seems to be a good wrapper around the extended MAPI.
I think you can do this using the ShellExecute. An attachment should be used as parameter: something like this but I don't remember for sure: "mailto:email#something?subject=subject&body=body&attachment=..."

Resources