{"id":5398,"date":"2019-06-27T22:17:23","date_gmt":"2019-06-28T03:17:23","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=5398"},"modified":"2019-06-28T08:24:00","modified_gmt":"2019-06-28T13:24:00","slug":"did-you-know-you-can-add-a-share-to-teams-button-to-your-web-content","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=5398","title":{"rendered":"Did you know \u2026 you can add a \u201cShare to Teams\u201d button to your web content?"},"content":{"rendered":"<p>If you can add script tags to the page head, you can add a \u201cShare to Teams\u201d button on your web site. This can be used to allow employees to share internal sites to Teams, but it can also be used on public sites to allow visitors to post links to <em>their<\/em> Teams organization.<\/p>\n<p>How? There are two steps \u2013 add \u201c&lt;script async defer src=&#8221;https:\/\/teams.microsoft.com\/share\/launcher.js&#8221; &gt;&lt;\/script&gt;\u201d in HEAD. The post that is made to Teams is *prettier* if you have\u00a0 meta properties for title, description, and image within the linked page.<\/p>\n<p>Then add a div with class \u201cteams-share-button\u201d. The \u201cdata-href\u201d value is the URL to be shared. If you <em>don\u2019t<\/em> want a page preview to render, you can set \u201cdata-preview\u201d to false.<\/p>\n<p>Sample page content:<\/p>\n<pre>&lt;head&gt;\r\n    &lt;title&gt;Teams Share Test&lt;\/title&gt;\r\n    &lt;meta property=\"og:title\" content=\"Lisa Rushworth Home Page\"&gt;\r\n    &lt;meta property=\"og:description\" content=\"Lisa Rushworth's Home Page\"&gt;\r\n    &lt;meta property=\"og:image\" content=\"https:\/\/www.rushworth.us\/lisa\/RedR.png\" \/&gt;\r\n    &lt;script async defer src=\"https:\/\/teams.microsoft.com\/share\/launcher.js\" &gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body bgcolor=\"black\" text=\"white\"&gt;\r\n    &lt;div class=\"content\"&gt;\r\n        &lt;P&gt;Here is the really cool information contained on this web site. It is so interesting that you want to share it to Teams.&lt;\/P&gt;\r\n        &lt;P&gt;Click the Teams button at the bottom and you'll see a form that allows you to share the URL as a thread in a Teams channel.&lt;\/P&gt;\r\n    &lt;\/div&gt;\r\n    &lt;div class=\"teams-share-button\" data-href=\"https:\/\/www.rushworth.us\/lisa\/teamstest.php\" data-preview=\"true\"&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n<\/pre>\n<p>Visitors will see a small Teams logo in the teams-share-button div. To share the URL in Teams, they just need to click on the Teams logo.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1075\" height=\"316\" class=\"wp-image-5399\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-30.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-30.png 1075w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-30-300x88.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-30-768x226.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-30-1024x301.png 1024w\" sizes=\"auto, (max-width: 1075px) 100vw, 1075px\" \/><\/p>\n<p>A new window will load. If the user is not logged into the Team web site, they will be prompted to log in. Once logged in, the share dialogue will be displayed. If your site has title, description, and icon meta tags, a preview card will be included at the bottom.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"836\" class=\"wp-image-5400\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-31.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-31.png 882w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-31-300x284.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-31-768x728.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/p>\n<p>Click in the \u201cShare to\u201d field and type a Team or Channel name \u2013 Teams and Channels from the user\u2019s organization will be displayed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"836\" class=\"wp-image-5401\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-32.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-32.png 882w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-32-300x284.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-32-768x728.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/p>\n<p>The user can add text to the thread. Click \u201cShare\u201d to share the link to the selected Teams channel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"836\" class=\"wp-image-5402\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-33.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-33.png 882w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-33-300x284.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-33-768x728.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/p>\n<p>A confirmation page will be displayed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"836\" class=\"wp-image-5403\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-34.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-34.png 882w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-34-300x284.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-34-768x728.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/p>\n<p>In Teams, a new thread will be created. This is the thread for my shared URL.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1251\" height=\"269\" class=\"wp-image-5404\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-35.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-35.png 1251w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-35-300x65.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-35-768x165.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/word-image-35-1024x220.png 1024w\" sizes=\"auto, (max-width: 1251px) 100vw, 1251px\" \/><\/p>\n<p>The URL used in the teams-share-button DIV doesn&#8217;t have to match the page on which it is used &#8212; I can add a &#8216;share to Teams&#8217; button that posts any URL to Teams.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=5407\" rel=\"attachment wp-att-5407\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5407\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/ShareOtherURL.png\" alt=\"\" width=\"882\" height=\"836\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/ShareOtherURL.png 882w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/ShareOtherURL-300x284.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2019\/06\/ShareOtherURL-768x728.png 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you can add script tags to the page head, you can add a \u201cShare to Teams\u201d button on your web site. This can be used to allow employees to share internal sites to Teams, but it can also be used on public sites to allow visitors to post links to their Teams organization. How? &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[677],"tags":[666,686,265],"class_list":["post-5398","post","type-post","status-publish","format-standard","hentry","category-office-365","tag-microsoft-teams","tag-ms-teams","tag-office-365"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5398"}],"version-history":[{"count":4,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5398\/revisions"}],"predecessor-version":[{"id":5414,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/5398\/revisions\/5414"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}