Disable New e-mail button in Outlook 2010 - c#

I have an existing Outlook Add-In that was developed for a client for Outlook 2003/2007. One of the requirements was that the add-in would disable the default New email button on the toolbar. I was able to do this by accessing the CommandBars object of the Explorer windows.
They are now looking at migrating the tool to Outlook 2010. Obviously the CommandBars object is no longer available, and I have not been able to find anything regarding programmatically disabling any of the built-in buttons on the ribbon.
Is it possible to programmatically change the state of any of the built-in buttons?
Any suggestions here would be appreciated

If group policy is an option, the "right" way to do this in Outlook 2010 is via group policy settings. From Technet:
"Verify that you have the necessary security permissions for the GPO: either Edit settings or Edit settings, delete, and modify security. For more information about permissions that are needed to manage Group Policy, see “Delegating administration of Group Policy” in the Group Policy Planning and Deployment Guide (http://go.microsoft.com/fwlink/?LinkId=182208).
In Group Policy Object Editor console, expand User Configuration, expand Administrative Templates, and then expand the application for which you want to disable commands (for example, double-click Microsoft Excel 2010).
Click Disable items in User Interface, click Predefined, double-click Disable commands, click Enabled, select the commands that you want to disable, and then click OK."
Full documentation here: http://technet.microsoft.com/en-us/library/cc179143.aspx#section3
Good luck!

Related

Programmatically get the list of the ribbons using VSTO add-in

I have created a C# VSTO add-in with Visual Studio 2019 that receives commands from a socket connection and it can insert text, modify buttons only in my ribbon using office Interop.
I want to know two things.
How can I get the name of all the ribbons (Home, Insert, Design,
....) programmatically?
Initiate a mouse click (for example click Bold button in the Home tab) on any other ribbons than the one I created.
For the 2nd question, I want to use office add-in only, not by simulating keypress/mouse event.
How can I get the name of all the ribbons (Home, Insert, Design, ....) programmatically?
There is no trivial way for getting this job done. You can try using Accessibility API. Microsoft Active Accessibility is a Component Object Model (COM)-based technology that improves the way accessibility aids work with applications running on Microsoft Windows. It provides dynamic-link libraries that are incorporated into the operating system as well as a COM interface and API elements that provide reliable methods for exposing information about UI elements.
Initiate a mouse click (for example click Bold button in the Home tab) on any other ribbons than the one I created.
You can use the CommandBars.ExecuteMso method which executes the control identified by the idMso parameter. This method is useful in cases where there is no object model for a particular command. Works on controls that are built-in buttons, toggleButtons, and splitButtons. On failure, it returns E_InvalidArg for an invalid idMso, and E_Fail for controls that are not enabled or not visible.
Application.CommandBars.ExecuteMso("Copy")
Accessibility API (as Eugene mentioned) is pretty much the only way to drive Outlook Ribbon and its controls. Keep in mind that since Microsoft has never documented the controls and their ids, they are subject to change between the versions.
If using Redemption (I am its author) is an option, it exposes SafeExplorer and SafeInspector objects that expose the ribbon and its controls using Accessibility and low level Windows API.
Redemption.SafeExplorer sExplorer = new Redemption.SafeExplorer();
sExplorer.Item = OutlookApplication.ActiveExplorer;
foreach (var tab in sExplorer.Ribbon.Tabs)
{
MessageBox.Show(tab);
}

How to hide an addon Ribbon until we want to display it using Outlook 2013 and C#?

I'm developing a commercial application and I need to setup an authentication in Outlook. A panel use for connection in outlook trigger a server check with an API. But, this panel is display in my ThisAddin code file. However, my addin Ribbon is handle in another file (ACF_Ribbon). I want to hide this Ribbon until the user is authenticated by my panel, then display it if the authentication is done successfully.
Anyone can have a solution ? I found nothing in the MSDN for Outlook.
UPDATE & PARTIAL ANSWER :
As far as I have search, it's nearly impossible using the Ribbon designer due to the fact that the management of the Ribbon is done automaticly.So my actual solution is to disable all button while the authentification isn't done. That's not a solution, but could help if someone have the same matter than me.
Your ribbon must specify the getVisible callback pointing to your function. See https://msdn.microsoft.com/en-us/library/ee633442%28v=office.11%29.aspx?f=255&MSPPError=-2147217396 for more details.

Add custom tab in Sitemanager->Administrations->Users

I have a requirement that I need to add a extra tab in SiteManager->Administration->Users
This tab will have functionality of Users only but with more advanced filters, this is because HotFix/Version Upgrade of Kentico can update the default and code functionality of Kentico, so we don't want to update its basic functionality
So it's a risk if we change core Advanced Search functionality therefore we need to have a new page/webpart with our needed requirement.
Any help is appreciated, we have been looking on it from a while, didn't found any solution for the same.
In version 7 I would do it this way:
Create your new search page by copying the existing one along with its underlying controls (to ensure upgrade won't break your changes)
Make your customizations
Navigate to CMS Site manager -> Development -> Modules -> Users -> Edit User -> User interface
Add UI Element e.g. "Advanced search"
set Target URL to your page
set Element is custom to true

How to navigate programmatically in an Office 2010 addin?

Does anybody know if it is possible (and in that case how) to navigate programmatically in an Office 2010 addin?
The idea is to create a settings button on a ribbon tab, that when clicked, will direct the user to the settings of the add-in that would be located in the backstage view. Is there a way to programmatically change the active view being displayed to the user or something like that?
Thank you!!
As a developer putting on the user spectacles, I find your approach not convincing. If I click on a settings button, I expect a well-designed dialog, not to be thrown into backstage view. On the other hand - as a developr I'm much more at ease with a well-designed Windows Form than with the controls Microsoft provides for the backstage user interface; I guess you'll find there more limitations then you like.
As far as I understand your question, you want to have two different entry points to your settings dialogue - one from a button in the ribbon, and another from a point in the backstage view. Why not combining and showing from both positions the same form? Also Microsoft provides you with additional dialogues, if you click on controls in the backstage view.
Technically:
If you want to start the action of a ribbon control, you can use the "ExecuteMSO" command of the application.commmandbar object, e.g. in Word you may use
Application.CommandBars.ExecuteMso "ApplicationOptionsDialog"
to open this dialogue. However, I've done a limited test to call a custom button in backstage view, and it failed. Sol I guess that you can use ExecuteMSO only for built-in commands.

Prompting a user when activating a SharePoint feature through the site

I would like to know if there is a way to prompt the user when activating/deactivating a feature within SharePoint.
The background behind this is that I have a SharePoint solution that deploys several configuration files that are modified by the user when deployed to the site. I would like to either allow the user to decide whether or not to overwrite the files when activating or deactivating a feature.
Thanks guys!
Do you need this to work on ANY feature that is activated in your site, or just on features that are developed by you? If this is the latter case, you can add an event handler (SPFeatureReceiver) to your feature and catch the feature activated event.
EDIT: As per #Muhimbi's comment I finally understood the question - you want to allow user edit some properties and only then to activate the feature. In this case, I would suggest to define the feature as "hidden", so it does not show up in "web features" and "site features" list. Then create a custom page for "administration" of this feature, which would allow the user to override the settings in question etc. Then, register this administration page with SharePoint (again, deployed as a feature, these two features may be stapled together). Quote a good article about it can be found here: http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?ID=13
EDIT2: found a similar article here on SO: SharePoint Feature Activation Form
One of the responses gives a good point - "The problem is, you don't always know where your feature activation code is going to run. If you turn on the feature using stsadm, it will execute in stsadm.exe, not the web process."

Categories