Folder display mode olFolderDisplayNoNavigation causing artifacts in Outlook 2013 - outlook

A Outlook Add-in explorer window with the folder display mode setting olFolderDisplayNoNavigation is causing errors within the GUI of Outlook 2013. In Outlook 2010 the setting worked fine, but now it shows artifacts / UI glitches on the left menu pane, which should not be displayed at all. Is there any way to fix this behavior?
public void open_myExplorer(IRibbonControl control)
{
Recipient myRecipient = Globals.ThisAddIn.Application.Session.CreateRecipient("user#email.com");
MAPIFolder mFolder = Globals.ThisAddIn.Application.Session.GetSharedDefaultFolder(myRecipient, OlDefaultFolders.olFolderNotes);
Explorer myExplorer = Globals.ThisAddIn.Application.Explorers.Add(mFolder, OlFolderDisplayMode.olFolderDisplayNoNavigation);
myExplorer.Display();
}

I've solved the problem by using
myExplorer.NavigationPane.IsCollapsed = true;
myExplorer.ShowPane(OlPane.olNavigationPane, false);
instead of setting the display mode to olFolderDisplayNoNavigation.

Related

outlook web-addin not working on desktop client

I've developed a web-addin for outlook365. However, for some reason, the add-in stops working on desktop client. It just load the HTML page for the taskpane but not executing the taskpane.js. The add-in still works on web based outlook. I tried to investigate the issue, found that the Office.onReady handler is not called on desktop client. Any idea what could be the cause?
Thanks,
Peng
The Office.initialize = function () {}; needs to be called first.
If an Outlook add-in running on Windows is not working correctly, try turning on script debugging in Internet Explorer.
Go to Tools > Internet Options > Advanced.
Under Browsing, uncheck Disable script debugging (Internet Explorer) .
We recommend that you uncheck these settings only to troubleshoot the issue. If you leave them unchecked, you will get prompts when you browse. After the issue is resolved, check Disable script debugging (Internet Explorer) again.
I had the same problem.
Finally, I use Office.onReady(); rather than Office.initialize = function () {};. Refer to the link below for more details :
Outlook addin

Change solution root folder icon in navigation options

How do you change the icon of solution you that just got created? Third item below is the solution that is an Add-in. And the above three items above are its items.
Here is some part of the code
if (firstRun == true)
{
solutionRoot =
rootStoreFolder.Folders.Add("Solution Demo",
Outlook.OlDefaultFolders.olFolderInbox)
as Outlook.Folder;
solutionCalendar = solutionRoot.Folders.Add(
solCal,
Outlook.OlDefaultFolders.olFolderCalendar)
as Outlook.Folder;
solutionContacts = solutionRoot.Folders.Add(
"Solution Contacts",
Outlook.OlDefaultFolders.olFolderContacts)
as Outlook.Folder;
solutionTasks = solutionRoot.Folders.Add(
"Solution Tasks",
Outlook.OlDefaultFolders.olFolderTasks)
as Outlook.Folder;
}
else
{
solutionRoot =
rootStoreFolder.Folders["Solution Demo"]
as Outlook.Folder;
solutionCalendar = solutionRoot.Folders[
"Solution Calendar"]
as Outlook.Folder;
solutionContacts = solutionRoot.Folders[
"Solution Contacts"]
as Outlook.Folder;
solutionTasks = solutionRoot.Folders[
"Solution Tasks"]
as Outlook.Folder;
}
You need to use the SetCustomIcon method of the Folder class.
The icon or bitmap resource can have a maximum size of 32x32. Icons that are 16x16 or 24x24 are also supported, and Microsoft Outlook can scale up a 16x16 icon if Outlook is running in high Dots Per Inch (DPI) mode. Icons of other sizes cause SetCustomIcon to return an error.
You can only call SetCustomIcon from code that runs in-process as Outlook. An IPictureDisp object cannot be marshaled across process boundaries. If you attempt to call SetCustomIcon from out-of-process code, an exception will occur.
The custom folder icon that this method provides does not persist beyond the running Outlook session. Add-ins therefore must set the custom folder icon every time that Outlook boots.
The custom folder icon does not appear in other Exchange clients such as Outlook Web Access, nor does it appear in Outlook running on a Windows Mobile device.
You can read more about Solutions module in the Programming the Outlook 2010 Solutions Module article.

Is there a way to see if a specific Add-In is installed?

Is there a way (API or other?) to find out if an add-in is installed?
I'm looking at augmenting the Exchange install to insert my own button to tell my user if an Outlook add-in is installed or not?
Is there an API for finding out?
The Office Object Model has a COMAddins collection accessible from the Outlook.Application object that you can use to iterate through all registered add-ins. Any add-in that is loaded will have COMAddin.Connect set to True (which you can set to False to unload the add-in).
https://msdn.microsoft.com/en-us/library/ff870066.aspx
The trick to doing this in Exchange and OWA (not desktop Outlook) is to use JS to manually open the Add-Ins pane and try to click your add-in. Not perfect, I realize, but it does satisfy the original requirement even though there is no direct API support.
Edit the file named, microsoft.owa.mail.compose.js and find a good place to enter something similar to the following.
var workDocument = (this.bh.bz) ? $(this.bh.bz.document) : window.document;
var yourAddIn = $(workDocument).find('iframe[title="Your_Add-In_Name"]');
if (yourAddIn.length > 0) {
yourAddIn[0].contentWindow.postMessage({ id: 'Look_for_your_id_using_DevTools_F12_and_Find_the_id', message: 'send'}, '*');
return;
} else {
// Click Add-in button, click the add-in name in the add-ins list
var addInsButton = $(workDocument).find("button[title='Add-ins']");
if (addInsButton.length <= 0) {
return;
}
addInsButton[0].click();
}

Outlook addin has failed to find Office control by ID

I've just built an MS Outlook Add In using Visual Studio and Office 2010. I've installed it ok on 4 machines, but one user is getting the following error -
Error found in Custom UI XML of "...."
...
...
Failed to find Office control by ID
Everyone is running Windows 7 and Outlook 2010 - not sure why this person is having a problem. Can anyone suggest how to diagnose this?
For those having similar issues, you don't have to remove any add-in.
What is happening is: Outlook will try to load all ribbons (found in your ribbon xml) into any window the user goes to. Then it'll complain about not finding ID x or y.
Just make sure your GetCustomUI method in Ribbon.cs does not load the entire ribbon XML at once but rather loads it per fragment.
If you're not sure what IDs you need to target, use a breakpoint in GetCustomUI then start Outlook, surf different views (main, new email, new appointment, calendar...etc) in order to gather the IDs for the views wherein you need to show you add-in.
In my case, I needed Microsoft.Outlook.Explorer, Microsoft.Outlook.Mail.Compose and Microsoft.Outlook.Appointment.
Therefore I changed my GetCustomUI to:
public string GetCustomUI(string ribbonID)
{
switch (ribbonID)
{
case "Microsoft.Outlook.Explorer":
return GetResourceText("MyAddin.RibbonsForOutlookExplorer.xml");
case "Microsoft.Outlook.Mail.Compose":
return GetResourceText("MyAddin.RibbonForOutlookMailCompose.xml");
case "Microsoft.Outlook.Appointment":
return GetResourceText("MyAddin.RibbonForOutlookAppointment.xml");
default:
return null;
}
}
Of course, I had to break down my Ribbon.xml into the three XML files mentioned above. The result: Outlook will ONLY load the fragment needed for a given screen (appointment, new email ...) and will not complain about "not finding an ID on screen X or Y".
Finally, for those who are not sure why some users get that error while others don't: it's because of "Show add-in user interface errors" option (in Options -> Advanced). If that is unchecked then Outlook will ignore the malformed ribbon XML errors. If it checked, users will get related errors about your add-in (if any exists) and also about other add-ins.
If it works for everyone except one user. As #Brijesh Mishra mentioned check if the user has got any other addin and if he is having own quick access tool bar customized.
If he has got any of this then, remove the other addins and try to install or reset the quick access tool bar customization.
For all of you that use a Designer-based VSTO plugin, and not the XML solution.
I searched all the web for this problem, but only found XML-based solutions.
There's nothing for Visual Designer on the web, because in this case you don't have to override the "GetCustomUI" method.
Ribbons designed by using the Visual Designer return a RibbonManager by default.
This RibbonManager object represents all Ribbon (Visual Designer) items in the project and is automatically handled in background through the active window inspector.
So you don't have to write any special code to handle different windows.
To configure it correctly you just have to:
Add one extra Visual Designer Ribbon for every window the user goes to
in the Ribbon Object go under "RibbonType", open the checkbox list an only activate the corresponding window, where the ribbon should appear.
If there is more than one window checked in the list, Outlook trys to insert the ribbon in all the marked windows. Even if the corresponding window is currently not opened. That's the reason, why the error "Failed to find control ID" appears.
the actual fix for me was to separate the ribbon XML files containing the customUI and redirecting to the correct one in the GetCustomUI method (implemented using Office.IRibbonExtensibility)
in example:
public string GetCustomUI(string RibbonID)
{
switch (RibbonID)
{
case "Microsoft.Outlook.Mail.Read":
return GetResourceText("namespace.type1.xml");
case "Microsoft.Outlook.Mail.Compose":
return GetResourceText("namespace.type2.xml");
default:
return null;
}
}

TaskDialog default button

stackoverflow just works faster :)
I'm using the Windows® API Code Pack for Microsoft® .NET Framework to access Windows 7 API and I want to change my old MessageBox to TaskDialog.
One thing I cannot find is the default button of the dialog. Is there a way to set it? what about a work around?
thanks
There is a Default property on a control under the taskbased dialog you can set to true. From the sample (Samples\TaskDialogDemo\CS\TaskDialogDemo) that ships with it:
TaskDialog tdEnableDisable = new TaskDialog();
tdEnableDisable.Cancelable = true;
tdEnableDisable.Caption = "Enable/Disable Sample";
tdEnableDisable.InstructionText = "Click on the buttons to enable or disable the radiobutton.";
enableButton = new TaskDialogButton("enableButton", "Enable");
enableButton.Default = true;
enableButton.Click += new EventHandler(enableButton_Click);
If you run the demo, click Enable/Disable sample and then press Enter a few times you will see that the two buttons take turns being the default.

Resources