Does Outlook, as a Drop Target, support IAsyncOperation? - outlook

I am playing with Creating something from nothing, asynchronously [Developer-friendly virtual file implementation for .NET improved!].
This brilliant article demonstrates how to create a customized DataObject implementing delayed data extract on drop/paste and asynchronous data trnasfer on background thread.
It worked perfectly untill I tried to drop a file into Outlook 2016. It still works but the UI is not responsive despite the fact that my dataobject has "IsAsynchronous" set to true.
After debugging I found when dropped to Outlook IAsyncOperation.GetAsyncMode is not called and IDataObject.GetData is called on the UI thread.
My question is does Outlook support IAsyncOperation? If it does what am I missing? If it does not support IAsyncOperation, is there a workaround or different solution?
Regards
Xiao

Related

Replicate the share email to microsoft teams function

I am currently investigating a way to share emails from our desktop application. Written in c# using .Net framework 4.7
We would like to use the same dialog that gets initiated when you use the "Share to Teams" button in outlook passing in the .eml file. The user would be responsible for selecting which people or channels to share to.
Does anyone have any recommendations?
We can succesfully build a simple url share using their launcher concepts, but this is pretty limited to the browser and doesn't support files
https://teams.microsoft.com/share?href=www.stackoverflow.com&msgText=Testing
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/share-to-teams
And there is nothing mentioned in their deep-links section on msdn to achieve this
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-links
If you're building your own desktop app experience anyway, why not use Graph for this? For instance, see https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http . You'd need to do your own Search box, but you can do that on Graph also - here for instance is a channel listing endpoint (this example is for within a specific Team): https://learn.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-1.0&tabs=http

PowerPoint - how to run a macro automatically?

I'd like to run a macro that sets the zoom to 100%, something like Windows(1).View.Zoom = 100, every time ANY file is opened in PowerPoint. The files are already created, so using a template to set the zoom is not possible. How can I do this?
There isn't really a way (that I am aware of) to do this through a macro or powerpoint add-in. You might be able to do it using a custom web add-in but I don't have enough experience with that to provide an example.
After looking around there have been a few success stories. One of which is creating a custom UI element and then adding an onLoad hook to that.
Here is the thread.
Here is a link to the Custom UI Editor Tool However I had no luck in getting it to work. I believe (This is only my theory) that it is not compatible with the latest .NET framework.
If you do end up trying to do this, here is a link to the xml formatting documentation for UI elements. And a link to a little tutorial related to this.
Sorry I couldn't be of more help. This should at least get you started. If anyone else has a simpler way I would love to know as well.

Disabling visual styles in manifest while retaining Common Controls functionality

I'm using pure WINAPI, and need to send the TB_GETMETRICS message. However, that message only works if you add a manifest file to your application with a reference to Common Controls version 6.0. I added it, the message is working, but now my application is using Vista/Windows 7 visual styles, which I do not want.
Is there any way to keep the Common Controls 6.0 reference while using Classic theme, either by modifying the manifest file or by calling some API function?
Note: I tried SetWindowTheme but the result was a mix of Classic and Aero.
EDIT: I hadn't read the SetWindowTheme function correctly, so I was thinking calling it for the parent hWnd would automatically call it for all its child. It turns out I need to call it for each control I want to use Windows Classic. It's working as it should now.
To disable visual styles for all controls, call SetThemeAppProperties(STAP_ALLOW_NONCLIENT) or SetThemeAppProperties(0) before you create your main window.
To disable visual styles per HWND you can call SetWindowTheme(hwndControl,L"",L"")
If you need to support systems without v6 common controls you can probably figure out which system metrics (or hardcoded values) are used in the toolbar control by playing with the system metric values and system DPI.
Solved by using SetWindowTheme (with L"" as parameters) properly: all I had to do was call it for each and every control my application creates. It feels hackish but gets the job done.

Deploying CRM solution

Using the crm 2011 sdk samples I've written a C# routine in Visual Studio to deactivate all active records in a custom entity. Now I'd like to wire this routine to a custom button on ribbon (figured that one out using RibbonDiffXml) However I'm unsure how to go about deploying. Am I creating a dll to register with the plugin registration tool? Any guidance would be appreciated!
As I see it, you have two options:
Rewrite your code to use the Organization Service from JavaScript. You can put the code completely inside the button this way. However, this requires manually constructing the SOAP calls to the API. The SDK has a walkthrough for this.
Include your code in a plugin, create a custom entity that you can register this plugin against, and create an instance of that entity from the JavaScript that will fire when clicking your ribbon button. This is detailed in an answer to a similar question.
Here are even more alternative solutions:
Create a workflow plugin and trigger that workflow (that runs async in the background). Triggered manually, on an event or from a javascript.
Create a javascript but use the REST API or even better, use the CrmRestKit to deal with the REST-part and keep your scripts clean and easy to read and maintain.
Create an ASP.NET page (or silverlight control) that displays a dialog that shows a progress bar while the process is running.

Disable Own Word 2007 Add-In If No Document Loaded

I've developed an application-level add-in for Word 2007 using Visual Studio 2010 and .NET 3.5. Part of what it does is use the
Globals.ThisAddIn.Application.Selection.Range
to insert text.
However, when there is no document loaded this code fails. I could catch the exception or programmatically detect whether a document was currently open, but I think there must be an easier way...
When Word 2007 is open but no document is loaded, most of the buttons on the ribbon are disabled (that is, greyed out).
Any idea how this is achieved?
Will the add-ins hook into an event and disable their buttons accordingly?
If so, would this be the
DocumentBeforeClose
event, and could this be risky if Word is somehow opened without a document? (That is, there's no document loaded, but the event hasn't yet been triggered.)
Thanks in advance!
UPDATE:
OK, it seems like making use of the
getEnabled="MyMethod"
attribute of the XML might be the way forward, but this seems to only work for the individual controls on the Ribbon rather than the whole ribbon itself.
You basically answered your own question.
I could catch the exception or
programmatically detect whether a
document was currently open
Catching the exception is a bit nasty, but would work.
Programmatically detecting whether there is a document loaded is the best alternative.
And it's easy.
If Globals.ThisAddIn.Application.Documents.Count > 0 then
'at least one document is opened
end if
Can't get much easier than that.
Is there something else you were trying to accomplish with the stuff about the buttons on the ribbon?
Try using the DocumentChange event instead (see my answer on this thread).

Resources