getselecteddataasync() not working in outlook read mode in outlook addin - outlook

How can I select a text in reading mode in outlook to be used by an add-in?
In compose mode, I used getselecteddataasync() API for getting the selected text.However, this API has a limitation that it does not work in read mode.
Looking for a similar one in read mode.
Other option could be to use the body API as referenced here:
https://dev.outlook.com/reference/addins/1.1/Office.context.mailbox.item.html#bod
y
Using this, whole body will be selected. I can use regEx and hashTags but that is not what i want. I want to know what text has been selected in reading mode.
I am using HTML and JS for coding this addin.

I don't think you have another option then playing with regEx and hashTags on the string you get from :
Office.context.mailbox.item.body.getAsync
Look here:
https://social.msdn.microsoft.com/Forums/office/en-US/b51a8873-ce77-418c-bd27-e2f29b277e4d/itemgetselecteddataasync-is-undefined-doesnt-exist-mail-apps?forum=appsforoffice
This outlook add in API limited in many things...
Good Luck

Related

How do you access content in a word document? (like Grammarly does)

I want to create a program that works like an autocomplete box for Microsoft Word. For that, I need some way of reading the contents of the page and getting the positions of words. I know that Microsoft has made a Javascript API for creating plugins in the form of side panes, but that's not what I'm after.
Grammarly manages to read the contents of the document and even underline specific words.
Maybe they have some agreement with Microsoft? Or could they be using some hacky solution? I did try to use win32api with both Python and C++ but didn't succeed.

Read parameters from Outlook 365 Add-In manifest

Is it possible to get the parameters from the Outlook 365 add-in manifest programmatically (like version number or maybe resources)? I've searched all over the internet, but haven't found any way to do it yet :(
Some background: I need some information to be available at run-time from the manifest settings (the customers are expected to install the add-in via manifest and it is to be tailored for each customer with some special data).
Thanks in advance!
The manifest file is only consumed by the client (i.e. Outlook or Word) for the purposes of rendering that add-in (i.e. the URL, buttons to display, minimum requirements, etc.). There are currently no APIs that expose manifest data to the add-in instance itself.
One idea: what if you put the special data as something encoded in the start URL? That way you could read it back out via JavaScript, simply by looking at what parameter got passed in to you. Would that work?

Possible to include an image in the meta data in code? VS 2013

I would like to be able to include a screenshot of a control inside my code, this way making control identification easier for new members on my team, is such a thing possible?
Maybe even the ability to just have the image on a network share with the path in a comment, and then have a plugin that when hovering over the link brings up the image?
EDIT (More detail):
I'm creating a test project, the application under test has over 1000 controls, some of them are similar in name and purpose, this can make it difficult at times for developers to reuse the API I am creating because the control name is simply not enough for quick identification of the control in use.
I use the word API very loosely too, none of this stuff will be consumed in web services, and it will always be white box with developers including a project reference and have direct access to the source code.
For every form in my application (The test one), I have a controls.cs file where all the controls for that form in the application under test are listed - This is where I want the hover to screenshot ability in the control definitions.
Another sure factor is that all developers will be using VS2013 (For now the base version), later this could be update 1 or 2.
As the initial author and senior developer on this project, these hover / image references (in the code) will be as useful to me personally as any 3rd party developers, or any later developers to join the initiative.
Thanks again, and I added a bounty!
I believe you can use Whole Tomato's free SourceLinks Visual Studio extension to do what you want - or at least get pretty close to it.
Built-in Functionality:
Out of the box, the extension allows you to specify comment patterns you want users to be able to take an action on. Once the patterns are specified, SourceLinks will highlight any occurrences of those patterns in the text editor. You will be able to double click the highlighted items and perform a pre-configured action (such as opening a link in an internal/external browser, or launching an executable).
You can see an example in the SourceLinks configuration dialog shown below:
(source: wholetomato.com)
So you could use this feature pretty painlessly to define a keyword such as Control Image and then put comments like the following in your code:
// Control Image: my_smart_list.jpg
SourceLinks would allow you double click this text, and you could have that configured to launch the image (using a file:// or http:// url depending on how and where your images are stored) either inside Visual Studio in it's internal browser, or in an external browser.
Custom Tooltips!
Now, if you want to put in some more effort into this and actually write some code, then SourceLinks allows you to create API Extensions to display custom tooltips when the user hovers over the marked text in the editor. The default installation of SourceLinks comes with sample API extensions that you can copy to create your own. See the article linked at the very top of the answer for more details on these samples.
This post in the SourceLinks forum informs us that SourceLinks expects the custom API Extension to return the tooltip value as FlowDocument XAML text. This is awesome news for us, because a FlowDocument can contain many types of elements, including formatted text, hyperlinks, and images.
Imanges in a Flow document can be specified both inline as well as externally.
Hope this helps!
I would use doxygen -- create the images somewhere in the source tree and use doxygen comments. You can embed the \image command in source comments (see docs) and doxygen will generate all the HTML documentation from there. I think doxygen is a great tool for documenting a codebase as you can generate the documentation directly from comments in the source and distribute or host the HTML separately.

Tiddlywiki: embed/link to .msg

I'd like to use Tiddlywiki for a personal knowledge base. In my work flow a lot of content comes in as Outlook emails threads.
Is there a smart way to refer to this content without fully copying over the whole text to each and every tiddler manually?
Maybe saving Outlook mail thread as .msg file, placing it locally and referring to that file might work. The tiddler then may hold some basic summy, but whole detail content lies in the .msg file.
Any ideas?
I am in such case (more struggling with TiddlyWiki, which is great but lacks documentation currently). I ended up using the outlook:oid url-style that opens the mail in outlook. However, it's difficult to retrieve a mail oid, especially as this id changes when copying (and maybe moving) the mail to other folders/pst files.
In my case, I use some outlook mailbox parser that detect specific markup (categories, actions), and take appropriate actions (move them, create the outlook:oid link somewhere, etc). It's ugly but does the job.
You've essentially answered your own question. Alternatively, use gmail or the likes to get proper links that only you can follow.

Providing feedback based on the names or emails addresses in the 'To:', 'CC:' and 'BCC:' text fields while composing an Outlook email message

When composing an outlook message, I would like to provide non-invasive feedback to the user regarding whether the email is being sent to email addresses on approved domains.
For example, if the user is sending an email where the 'To:', 'CC:' or 'BCC:' text fields contains an email address which does not end in '#AnEmailAddress.com' then a warning of some kind should be displayed appropriately.
The warning could be a single icon which shows red or green, or perhaps each name/email address can be formatted on the 'To:' et al text fields directly, in order to provide the feedback.
I've done some digging with no specific results. I'm not sure if this can be done with VBA or the scripting within Outlook forms. Or perhaps an add-in needs to be written via .net?
Any pointers greatly appreciated.
This is a good candidate for .NET add-in. Not sure if you can do that from VBA.
Depending on the range of Outlook versions you need to support, you may want to go for VSTO add-in (separate builds for different versions) or NetOffice (one build for nearly all versions). Both have pros and cons so you need to be more specific to make a choice.
If you already compose your outlook messages with for example C# than use it also to implement some kind of alerts you want..
You question is - VBA, scripting or .NET?
My answer: it depends on your skills and preferences

Resources