How do I separate inline images and attaches using MAPI? - windows

My program uses MAPI for working with Exchange mailboxes. The problem is if a user fires up Outlook, adds a file as an attachment and also opens Paint, selects a region there, copies it into clipboard and pastes into the message body the resulting message showns two attachments.
More specifically, the program calls IMAPIMessage::GetAttachmentsTable() to retrieve the attachments table and that table contains two objects. Is there a way a program can decide whether the "attachment" is really an attached file or a portion of inline content?

You will need to check whether the HTML body (through the img tag) refers to the attachment, either through img:cid and PT_ATTACH_CONENTS_ID property or though the file name (PR_ATTACH_LONG_FILENAME) or contnet location (PR_ATTACH_COMTENT_LOCATION).

The property you are looking for is PR_RENDERING_POSITION (0x370B0003). A -1 means that the attachment is a "normal" attachment and not in-line. If the value is anything other than -1, then that indicates an in-line attachment and the value is the position in the body that the attachment should be rendered at.
Here is the MSDN page describing it.
EDIT:
Dmitry, I do not agree with your comment. I have HTML email messages with in-line attachments and the PR_RENDERING_POSITION is working as described in the MSDN page I posted.

Related

How to send only one e-mail with mutiple pictures uploaded on power automate?

I'm a bit of a noob regarding power automate and i'm trying to learn.
I've been tasked to create a form and link the information on a sharepoint list in a workgroup. So far, everything work but if a customer choose to upload more than one picture, when the e-mail is sent, if for example 4 pictures are sent, there will be 4 e-mail sent instead of one with the link of the picture in sharepoint.
Can someone help me or point me in the right direction in order to send only one e-mail with the link in the body for all the pictures uploaded?
Here's is a preview of my flow below.
All you have to do is first to iterate the pictures to assemble an HTML string which you can concatenate to include as many pictures you want, then after the iteration finish you can use a single email action to send your message on which you are going to place the HTML string variable that contains the output of the iteration.
I'm adding an screenshot so you can visualize the idea, notice I'm using only one Apply to each action instead of two because I don't know your data structure, however, this should work for nested Loops too, as long as you send the email action after all the loops finish (outside of them).
Edit: It doesn't have to be HTML code, it can be just text if all you want are the links.
I hope this can be of help.

Change Zoom Settings in Outlook via C# VSTO

I want to change the Zoom Percentage of a Mail Item via C# or VB, that doesnt matter. Ive created an Project but its not possible to access the corret variable. Is this even possible?
I dont want to change the Font Size, just the Zoom Percentage while writing an email.
NOT of the Whole Outlook, just of the Mail Item.
thanks <3
You can use the Word object model for changing the zoom level of a particular mail item shown in the inspector window:
Dim Document As Object
'
Set Document = inspector.WordEditor
Document.Windows.Item(1).View.Zoom.Percentage = 200 '200 %
The Inspector.WordEditor property returns the Microsoft Word Document Object Model of the message being displayed. Note, you need to add a COM reference to the Word object model to get access to the Word methods and properties.
You may find the Adjusting Outlook's Zoom Setting in Email article helpful.

Laravel Save Markdown to Database - Don't Understand

I am reluctant to post this, but I am having trouble understanding how markdown actually "saves" to a database.
When I'm creating a migration, I will add columns and specify the type of value (i.e. integer, text, string, etc.) and in the course of operation on the website, users will input different information that is then saved in the DB. No problem there.
I just can't seem to wrap my head around the process for markdown. I've read about saving the HTML or saving the markdown file, rendering at runtime, pros and cons all that.
So, say I use an editor like Tiny MCE which attaches itself to a textarea. When I click "Submit" on the form, how does that operate? How does validation work? Feel free to answer my question directly or offer some resource to help further my understanding. I have an app built on Laravel so I'm guessing I'll need to use a package like https://github.com/GrahamCampbell/Laravel-Markdown along with an editor (i.e. Tiny MCE).
Thanks!
Let's start with a more basic example: StackOverflow. When you are writing/editing a question or answer, you are typing Markdown text into a textarea field. And below that textarea is a preview, which displays the Markdown text converted to HTML.
The way this works (simplified a little) is that StackOverflow uses a JavaScript library to parse the Markdown into HTML. This parsing happens entirely client side (in the browser) and nothing is sent to the server. With each key press in the textarea the preview is updated quickly because there is no back-and-forth with the server.
However, when you submit your question/answer, the HTML in the preview is discarded and the Markdown text from the textarea is forwarded to the StackOverflow server where is is saved to the database. At some point the server also converts the Markdown to HTML so that when another user comes alone and requests to view that question/answer, the document is sent to the user as HTML by the server. I say "at some point" because this is where you have to decide when the conversion happens. You have two options:
If the server converts the HTML when is saves it to the Database, then it will save to two columns, one for the Markdown and one of for the HTML. Later, when a user requests to view the document, the HTML document will be retrieved from the database and returned to the user. However, if a user requests to edit the document, then the Markdown document will be retrieved from the database and returned to the user so that she can edit it.
If the server only stores the Markdown text to the database, then when a user requests to view the document, the Markdown document will be retrieved from the database, converted to HTML and then returned to the user. However, if a user requests to edit the document, then the Markdown document will be retrieved from the database and returned to the user (skipping the conversion step) so that she can edit it.
Note that in either option, the server is doing the conversion to HTML. The only time the conversion happens client-side (in the browser) is for preview. But the "preview" conversion is not used to display the document outside of edit mode or to store the document in the database.
The only difference between something like StackOverflow and TinyMCE is that in TinyMCE the preview is also the editor. Behind the scenes the same process is still happening and when you submit, it is the Markdown which is sent to the server. The HTML used for preview is still discarded.
The primary concern when implementing such a system is that if the Markdown implementation used for preview is dissimilar from the implementation used by the server, the preview may not be very accurate. Therefore, it is generally best to choose two implementations that are very similar or, if available, use the same implementations for both.
It is actually very simple.
Historally, in forums, there used be BBCodes, which are basically pseudo-tags that allow you to format your text in some say. For example [b][/b] used to mean "make this text bold". In Markdown, it happens the exact same thing, but with other characters like *text* or **text**.
This happens so that you only allow your users to use a specific formatting, otherwise if you'd allow to write pure HTML, XSS (cross-site scripting) issues would arise and it's not really a good idea.
You should then save the HTML on the database. You can use, for example, markdown-js which is a Markdown parser that parses Markdown to HTML.
I have seen TinyMCE does not make use of Markdown by default, since it's simple a WYSIWYG editor, however it seems like it also supports a markdown-like formatting.
Laravel-Markdown is a server-side markdown render helper, you can use this on Laravel Blade views. markdown-js is instead client-side, it can be used, for example, to show a preview of what you're writing in real-time.

How can I control the title and summary for comments posted to the user's wall, in a dynamically generated page?

I have many dynamically generated pages, made by the same PHP file, and I'd like the comments that are being submitted to the user's wall have a different title and summary, considering the page they were sent from. Do I need to dynamically generate the meta tags, or is there a way to embed the title and summary in the comments widget script itself?
You will need to do the first thing...dynamically generate the og tag in the head of the document. They must be set that way when sending the HTML response to the browser. They cannot be successfully updated clientside as Facebook linter only looks at the response stream.

How to identify or read nsf mails containing inline image

I am trying to read mails programmatically in VB6. but i am unable to read mails containing inline images or HTML code like hyper link. Can anyone suggest me the way to read this type of mails.
EDIT:
I am not getting any error message but
nsfDocument.GETITEMVALUE("Body")(0) returns only text.
images are not shown.
You may want to try a third party API to help, such as the Midas Rich Text C++ API from Genii Software. http://www.geniisoft.com/showcase.nsf/MidasCPP
Or try the code examples shown on this site to gain access to the Notes Document in HTML form: http://searchdomino.techtarget.com/tip/0,289483,sid4_gci1284906,00.html
The GetItemValue method of the Document class returns rich-text item values as an array of strings, with all rich text styling removed. The "body" field in a Notes email is generally rich text. So, you should look into using the GetFirstItem method, instead. That will return a NotesRichTextItem object (for the body field). From that object, you can access the styling of the text, hyperlinks and file attachments, etc. (I do not believe that you can access in-line images at all via the "back-end" COM classes - I think for that, you will need to drop down to use the C API classes).
Here's a quick sample of how to get a NotesRichTextItem handle:
Dim doc As NotesDocument
Dim rtitem As Variant
... get the document
Set rtitem = doc.GetFirstItem( "Body" )
If rtitem.Type = RICHTEXT Then
.. work with rtItem
End If
Here is the doc page for the NotesRichTextItemClass:
http://publib-b.boulder.ibm.com/lotus/c2359850.nsf/2e73cbb2141acefa85256b8700688cea/dc72d312572a75818525731b004a5294?OpenDocument
And here is a starting point for the C API docs:
http://www14.software.ibm.com/webapp/download/nochargesearch.jsp?k=ALL&S_TACT=104CBW71&status=Active&q=Lotus+%22C+API%22

Resources