snipt

Ctrl+h for KB shortcuts

C#

Make a tab available for Ribbon UI

1
2
3
4
5
6
7
string tabId = "Your.Tab.Id";
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
ribbon.MakeTabAvailable(tabId);
ribbon.InitialTabId = tabId;
ribbon.CommandUIVisible = true;
ribbon.Enabled = true;
ribbon.Minimized = false;
https://snipt.net/embed/e83fbbd5c4c4a9476a70854dc4eced38/
/raw/e83fbbd5c4c4a9476a70854dc4eced38/
e83fbbd5c4c4a9476a70854dc4eced38
csharp
C#
7
2019-06-11T18:26:13
True
False
False
Jan 08, 2013 at 03:06 AM
/api/public/snipt/52820/
make-a-tab-available-for-ribbon-ui
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kt">string</span> <span class="n">tabId</span> <span class="p">=</span> <span class="s">&quot;Your.Tab.Id&quot;</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a><span class="n">SPRibbon</span> <span class="n">ribbon</span> <span class="p">=</span> <span class="n">SPRibbon</span><span class="p">.</span><span class="n">GetCurrent</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="n">Page</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="n">ribbon</span><span class="p">.</span><span class="n">MakeTabAvailable</span><span class="p">(</span><span class="n">tabId</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="n">ribbon</span><span class="p">.</span><span class="n">InitialTabId</span> <span class="p">=</span> <span class="n">tabId</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a><span class="n">ribbon</span><span class="p">.</span><span class="n">CommandUIVisible</span> <span class="p">=</span> <span class="k">true</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a><span class="n">ribbon</span><span class="p">.</span><span class="n">Enabled</span> <span class="p">=</span> <span class="k">true</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="n">ribbon</span><span class="p">.</span><span class="n">Minimized</span> <span class="p">=</span> <span class="k">false</span><span class="p">;</span> </span></pre></div> </td></tr></table>
ribbon, sharepoint