{"id":68,"date":"2011-11-03T22:16:00","date_gmt":"2011-11-04T05:16:00","guid":{"rendered":"https:\/\/mmman.itgroove.net\/?p=68"},"modified":"2023-02-24T21:47:08","modified_gmt":"2023-02-24T21:47:08","slug":"hiding-a-menu-item-in-a-sharepoint-context-menu","status":"publish","type":"post","link":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/","title":{"rendered":"Hiding a Menu Item in a SharePoint Context Menu"},"content":{"rendered":"<p>The goal here was to remove 2 menu items from the context menu on a document library, without affecting the other menu items.\u00a0 The menu (before changes) is below.<\/p>\n<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"400\"><a href=\"https:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" title=\"image\" src=\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png\" alt=\"image\" width=\"199\" height=\"307\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"400\">Original menu, before any changes<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>The goal was to remove the two menu items \u201cSMS Document Approval\u201d and \u201cPublish a Major Version\u201d.\u00a0 The first was an old Nintex workflow (great add-on), but when the workflow was deleted, the menu item for some reason didn\u2019t go with it.\u00a0 The other was being removed to enable us to take finer grained control of the publishing process.<\/p>\n<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"400\"><a href=\"https:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"image\" src=\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb1.png\" alt=\"image\" width=\"196\" height=\"332\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"400\">Goal: Remove these two menu items<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Note that I wanted to apply this across the entire site collection, therefore, to accomplish this, I added some CSS code to the site collection\u2019s master page (v4.master).\u00a0 Right before the end of the &lt;head&gt; section, I added the following block of code:<\/p>\n<p>[css]<\/p>\n<p>li.ms-MenuUIULItem[text~=SMS],<br \/>\nli.ms-MenuUIULItem[text~=Publish]<br \/>\n{<br \/>\ndisplay: none;<br \/>\n}<\/p>\n<p>[\/css]<\/p>\n<p>What this is ultimately doing is selecting the menu items (\u201cli&#8217;\u201d), and for any menu item whose class is \u201cms-MenuUIULItem\u201d, where there\u2019s an attribute \u201ctext\u201d, whose value begins with the phrase \u201cSMS\u201d or \u201cPublish\u201d, it will hide the entire li, effectively eliminating the menu item.\u00a0 The HTML code it\u2019s hiding looks a little like this below.<\/p>\n<p>[html]<\/p>\n<li class=\"ms-MenuUIULItem\" id=\"mp1_0_0\">\n[\/html]<\/p>\n<p>As you can see, in this situation, we were able to take advantage of CSS selectors, and utilize a fairly unused selector, the attribute selector which allows you to match on anything that has an attribute [myattribute], any attribute whose value is exactly equal to somevalue [myattribute=someval] (note, there cannot be spaces in the value), or any attribute whose value is a white space-separated list of words, one of which is exactly &#8220;someval&#8221; [myattribute~=someval] or [myattribute~=someval otherval] (note: If &#8220;val&#8221; contains white space, it will never represent anything (since the words are separated by spaces). If &#8220;val&#8221; is the empty string, it will never represent anything either).<\/p>\n<p>The final menu ends up looking like the following.<\/p>\n<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"400\"><a href=\"https:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"image\" src=\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb2.png\" alt=\"image\" width=\"205\" height=\"282\" border=\"0\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"400\">The final menu, with the two items permanently removed.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>The goal here was to remove 2 menu items from the context menu on a document library, without affecting the other menu items.\u00a0 The menu (before changes) is below. Original menu, before any changes &nbsp; The goal was to remove the two menu items \u201cSMS Document Approval\u201d and \u201cPublish a Major Version\u201d.\u00a0 The first was &hellip; <a href=\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/\"><\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[3,7],"tags":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hiding a Menu Item in a SharePoint Context Menu - Archive<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hiding a Menu Item in a SharePoint Context Menu - Archive\" \/>\n<meta property=\"og:description\" content=\"The goal here was to remove 2 menu items from the context menu on a document library, without affecting the other menu items.\u00a0 The menu (before changes) is below. Original menu, before any changes &nbsp; The goal was to remove the two menu items \u201cSMS Document Approval\u201d and \u201cPublish a Major Version\u201d.\u00a0 The first was &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/\" \/>\n<meta property=\"og:site_name\" content=\"Archive\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-04T05:16:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-24T21:47:08+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Colin Phillips (Alumni)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Colin Phillips (Alumni)\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/\",\"url\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/\",\"name\":\"Hiding a Menu Item in a SharePoint Context Menu - Archive\",\"isPartOf\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png\",\"datePublished\":\"2011-11-04T05:16:00+00:00\",\"dateModified\":\"2023-02-24T21:47:08+00:00\",\"author\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b\"},\"breadcrumb\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#primaryimage\",\"url\":\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png\",\"contentUrl\":\"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog Archive\",\"item\":\"https:\/\/regroove.ca\/archive\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hiding a Menu Item in a SharePoint Context Menu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/regroove.ca\/archive\/#website\",\"url\":\"https:\/\/regroove.ca\/archive\/\",\"name\":\"Archive\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/regroove.ca\/archive\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b\",\"name\":\"Colin Phillips (Alumni)\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g\",\"caption\":\"Colin Phillips (Alumni)\"},\"url\":\"https:\/\/regroove.ca\/archive\/author\/cphillips\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hiding a Menu Item in a SharePoint Context Menu - Archive","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/","og_locale":"en_US","og_type":"article","og_title":"Hiding a Menu Item in a SharePoint Context Menu - Archive","og_description":"The goal here was to remove 2 menu items from the context menu on a document library, without affecting the other menu items.\u00a0 The menu (before changes) is below. Original menu, before any changes &nbsp; The goal was to remove the two menu items \u201cSMS Document Approval\u201d and \u201cPublish a Major Version\u201d.\u00a0 The first was &hellip;","og_url":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/","og_site_name":"Archive","article_published_time":"2011-11-04T05:16:00+00:00","article_modified_time":"2023-02-24T21:47:08+00:00","og_image":[{"url":"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png"}],"author":"Colin Phillips (Alumni)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Colin Phillips (Alumni)","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/","url":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/","name":"Hiding a Menu Item in a SharePoint Context Menu - Archive","isPartOf":{"@id":"https:\/\/regroove.ca\/archive\/#website"},"primaryImageOfPage":{"@id":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#primaryimage"},"image":{"@id":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#primaryimage"},"thumbnailUrl":"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png","datePublished":"2011-11-04T05:16:00+00:00","dateModified":"2023-02-24T21:47:08+00:00","author":{"@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b"},"breadcrumb":{"@id":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#primaryimage","url":"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png","contentUrl":"http:\/\/mmman.itgroove.net\/wp-content\/uploads\/mmman\/2011\/11\/image_thumb.png"},{"@type":"BreadcrumbList","@id":"https:\/\/regroove.ca\/archive\/2011\/11\/03\/hiding-a-menu-item-in-a-sharepoint-context-menu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Archive","item":"https:\/\/regroove.ca\/archive\/"},{"@type":"ListItem","position":2,"name":"Hiding a Menu Item in a SharePoint Context Menu"}]},{"@type":"WebSite","@id":"https:\/\/regroove.ca\/archive\/#website","url":"https:\/\/regroove.ca\/archive\/","name":"Archive","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/regroove.ca\/archive\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b","name":"Colin Phillips (Alumni)","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g","caption":"Colin Phillips (Alumni)"},"url":"https:\/\/regroove.ca\/archive\/author\/cphillips\/"}]}},"_links":{"self":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/68"}],"collection":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":1,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":2026,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/68\/revisions\/2026"}],"wp:attachment":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}