disable the "save as" button in Powerpoint 2013 using c# addin

I have created an C# addin and, under certain conditions, and I would like to disable the "save as" command on the backstage, either grey the commands out, or remove them completely.  Any help much appreciated.
Winterfell63Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JSRWilsonCommented:
That would usually be done in the RibbonX XML code attached to your AddIn

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
      <commands>
      <command idMso="FileSaveAs" enabled="0" />
</commands>
</customUI>

If there are conditions you would use get getEnabled and add code to set the returnValue to True or False
Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
Instead of trying to disable it, you could handle it using the PowerPoint application event PresentationBeforeSave and then cancelling it with user feedback?
Winterfell63Author Commented:
Hi JSRWikson
Thanks for your speedy reply, and please forgive the "thickie" response here, but I am using VS2012, created the addin using the wizard and I see no Ribbon XML code in my solution.  To be honest, I am more used to using MVVM and WPF than creating addins and I did think that this would be a relatively trivial task, however, it seems to elude my simple mind!
Any further advice you can give would, indeed, be most welcome.
Thanks
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Winterfell63Author Commented:
Hi Jamie,
I did think of that, it would, however be a counter-intuitive user experience.  If all else fails, then I will fall back on this, but for the time being, I will see if there are alternative solutions out there.  Life was SO much easier (although uglier) in the world of MFC <sigh>
omgangIT ManagerCommented:
You need to add a ribbon to your VS project.  Right click project, add new item, select Office/SharePoint from left pane then choose Ribbon (Visual Designer).

That will get you a ribbon to work with and try JSRWilson's suggestion.

OM Gang
Winterfell63Author Commented:
Hi OM Gang
I did as you suggested - but still could find no xml so added a ribbon (xml) and modded that.  This had no effect on the visibility or functionality of the save as button. Any further clues?
JSRWilsonCommented:
I'm just wondering what your AddIn does if it doesnt show a ribbon?

The XML I posted definitely works to simply disable and could be modded to selectively disable.

Just open this file which has the XML attached and you should see .
Save-As-is-disabled.pptx
Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
JSRWilson - your example disables the Save As button in the ribbon but not in the backstage.

This will disable both the Save button and the Save As tab in the backstage of PowerPoint 2013:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<backstage>
		<button idMso="FileSave" visible="false"/>
		<tab idMso="TabSave" visible="false"/>
	</backstage>
</customUI>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JSRWilsonCommented:
Yep youre right

I  was in 2010 where it's different! You would probably want to use  getVisible if there are conditions (I haven't tested)
Winterfell63Author Commented:
thanks to both JSRWilson and to jamie Garroch
I will try this when I get back to my dev machine.
Just to put you in the picture with regards to my add in:
It does show a ribbon (but added as a designer type) but the functionality I am trying to implement happens before my ribbon button actually gets used - two different aspects of my addin.
If a powerpoint presentation is created (by automation) with specific words in the slide notes, I need to save the presentation to a specific location and remove the immediately obvious save-as features (such as the save-as button).
I can detect the conditionm but couldn't seem to jump the final hurdle.  I will let you know how I get on.
Thanks
Tony
Winterfell63Author Commented:
To JSRWilson and to Jamie Garroch
OK, although I am still having problems, the original question, as asked, has been answered so I am sharing the solution acceptance.
For any readers searching for the same thing:

Visual Studio 2012 Ultimate
Powerpoint 2013

1. Create a new item -> Ribbon(XML) note: NOT Ribbon (Designer)

2. Modify the schema

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">

Open in new window

3. Create my button group, button and associated callbacks manually in the XML and cs files

4. Add the following code

<backstage>
    <button idMso="FileSaveAs" visible="false"/>
    <tab idMso="TabSave" visible="false"/>
</backstage>

Open in new window


This results in the fileSaveAs Button not being visible.
I wanted to do the following:
MyRibbon.xml
<backstage>
    <button idMso="FileSaveAs" getVisible="SaveAsEnabled"/>
    <tab idMso="TabSave" getVisible="SaveAsEnabled"/>
</backstage>

MyRibbon.cs
private bool saveAsEnabled;

bool SaveAsEnabled (object Obj)
{
    return saveAsEnabled;
}

Open in new window


but the SaveAsEnabled  function is never called, neither is the <BackStage onShow="OnShow">  ever called.
I guess that my be the subject for another question.  So thanks to both of you for your help thus far.
Tony
Winterfell63Author Commented:
quick, accurate and friendly responses
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft PowerPoint

From novice to tech pro — start learning today.