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.
Related
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();
}
In an Outlook 2013 VSTO addin (C#), I can check to see if the user is currently in the Calendar area/view by using "if(ActiveExplorer().CurrentView is CalendarView) ..."
How do I do something similar to check and see if the user is in the Mail view, where "Mail" is selected/blue at the bottom of the Outlook window and the user sees their Inbox items? There is no MailView type, or anything similar that I could find, to compare ActiveExplorer().CurrentView, etc., against.
Instead of using the CurrentView property of the Explorer class I'd suggest checking the DefaultItemType property of the Folder class. It returns a constant from the OlItemType enumeration indicating the default Outlook item type contained in the folder.
The CurrentFolder property of the Folder class returns a Folder object that represents the current folder displayed in the explorer. So, the code may look like the following one:
ActiveExplorer().CurrentFolder.DefaultItemType
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.
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;
}
}
Does anyone know if you can obtain the following user interface components as seen in various adobe products for use in ones own product?
Treeview (Adobe Acrobat)
Collapsable Toolbars (Adobe Photoshop, Illustrator)
Are you building on the .NET platform?
You then have access to many COM libraries that Adobe's programs use internally.
For eg. you can directly instantiate and command an instance of Adobe Illustrator by:
In Visual Studio, right click your project and choose "Add Reference".
Choose "Adobe Illustrator CS4/CS3 Type Library", press OK.
(located at "C:\program files\adobe\adobe illustrator cs3/cs4\plug-ins\extensions\scriptingsupport.aip")
Now in your program :
C#
// open AI, init
Illustrator.Application illuApp = new Illustrator.Application();
// open doc
Illustrator.Document illuDoc = illuApp.Open("C:\myai.ai", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, null);
// close doc
illuDoc.Close();
illuDoc = null;
// close AI
illuApp.Quit();
illuApp = null;
VB
'open AI, init
Dim illApp As Illustrator.Application = New Illustrator.Application()
' open doc
Dim illDoc As Illustrator.Document = illApp.Open("C:\myai.ai", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, Nothing)
' close doc
illDoc.Close()
illDoc = Nothing
'close AI
illApp.Quit()
illApp = Nothing
Try browsing around in the "Add Reference" window, to find more libraries. You might even directly be able to hook on to Adobe's internal UI libraries!
See these ComponentSource pages if you're looking at purchasing / licensing:
Tree components
Toolbar and UI components
Although you won't get Adobe's components, you'll get ones with similar functionality or even replicas.
Free alternatives would also be available though. Try Googling for some open-source ones!