Outlook XML feed - make it appear in a specific window

I am making my first attempt to create a feed in Outlook using XML, and I am having problems determining how to tell my add-in that I want the feed to appear in Explorer windows.

Tip

Thank.

my Ribbon1.XML file is:

    <?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="MyGroup"
               label="My Group">
          <button idMso="Delete"/>
        </group>
      </tab>
      <tab idMso="TabMail">
        <group idMso="GroupMoveActions"
               visible="false">
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

A magic error popup will appear:

UI runtime error in testOLaddin2

Error found in CustomUI XML of "testingOLaddin2"

Line: 3
Column: 10
Error Code 0x80004005
Failed to find Office control by ID
ID: TabMail

Upon request, tape generation code:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using Office = Microsoft.Office.Core;

using System.Diagnostics;

namespace testingOLaddin2
{
    [ComVisible(true)]
    public class Ribbon1 : Office.IRibbonExtensibility
    {
        private Office.IRibbonUI ribbon;

        public Ribbon1()
        {
        }

        #region IRibbonExtensibility Members

        public string GetCustomUI(string ribbonID)
        {
            return GetResourceText("testingOLaddin2.Ribbon1.xml");
        }

        #endregion

        #region Ribbon Callbacks
        //Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1

        public void Ribbon_Load(Office.IRibbonUI ribbonUI)
        {
            this.ribbon = ribbonUI;
        }


        #endregion

        #region Helpers

        private static string GetResourceText(string resourceName)
        {
            Assembly asm = Assembly.GetExecutingAssembly();
            string[] resourceNames = asm.GetManifestResourceNames();
            for (int i = 0; i < resourceNames.Length; ++i)
            {
                if (string.Compare(resourceName, resourceNames[i], StringComparison.OrdinalIgnoreCase) == 0)
                {
                    using (StreamReader resourceReader = new StreamReader(asm.GetManifestResourceStream(resourceNames[i])))
                    {
                        if (resourceReader != null)
                        {
                            return resourceReader.ReadToEnd();
                        }
                    }
                }
            }
            return null;
        }

        #endregion
    }
}
+3
source share
2 answers

It depends on the method you use to create add-ons and ribbons. If you use

IRibbonExtensibility.GetCustomUI(string RibbonId)

you could only do this by returning the xml tape if the RibbonId parameter is

"Microsoft.Outlook.Explorer"

Edit

After changing the code, it may work:

public string GetCustomUI(string ribbonID)
{
  if (ribbonID == "Microsoft.Outlook.Explorer")
    return GetResourceText("testingOLaddin2.Ribbon1.xml");

  return null; // if problems here, try return string.Empty
}
+9

GetCustomUI(string RibbonId) Outlook , CreateRibbonExtensibilityObject() ThisAddIn, . - XML ( GetCustomUI).

XML Outlook . , " " XML , .

, Mail Calendar:

<?xml version="1.0" encoding="UTF-8"?>
<customUI  xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon>
    <tabs>
      <tab idMso="TabCalendar">
      <!-- Calendar tab controls go here -->
      </tab>
      <tab idMso="TabMail">
      <!-- mail tab controls go here -->
      </tab>
    </tabs>
  </ribbon>
</customUI>

Microsoft idMso , , , Excel:

+2

All Articles