一键分享博客或新闻到Teams好友或频道

在最近的开发者工具更新中,Teams提供了一个Share to Teams的能力,就是在你的网页上面,放置一个按钮,用户点击后,就可以很方便地将当前网页或者你指定的其他网页,分享到Teams好友或频道中。

这个开发文档在这里,请参考 https://docs.microsoft.com/en-us/microsoftteams/platform/share-to-teams

这个功能非常好,欢迎大家试用。另外,我因为长期有写博客的习惯,我也顺便改造了一下博客的系统,添加了这个按钮。

640?wx_fmt=png

点击该按钮后,会弹出一个对话框

640?wx_fmt=png

在这个对话框中,可以选择分享的目标,然后还可以添加说明文字,然后点击“共享”按钮

640?wx_fmt=png

此时如果切换到Teams,就可以看到已经有一个消息分享过来

640?wx_fmt=png

看起来还不错吧,还等什么呢?赶紧在你的网站中添加这个功能吧。

文末福利

我的博客是在博客园写的,如果你正好也是在这个平台,你可以通过我写好的下面的代码快速添加。

    <style>	
        .divblock {	
            padding: 10px;	
            margin-bottom: 10px;	
            margin-top: 10px;	
            margin-right: 10px;	
            border: #c0c0c0 1px dashed;	
            text-align: left;	
            display: table-cell;	
        }	
</style>	

	
    <script>	

	
        document.getElementById("green_channel").setAttribute("class","divblock");	

	
        let sharebutton = document.createElement("div");	
        sharebutton.setAttribute("data-href", window.location.href);	
        sharebutton.setAttribute("class", "divblock teams-share-button");	
sharebutton.setAttribute("data-msg-text","分享好文章:");	
      document.getElementById("blog_post_info").insertBefore(sharebutton, document.getElementById("green_channel"));	
</script>	

	

	
    <script async defer src="https://teams.microsoft.com/share/launcher.js">	
</script>

请进入你的博客管理后台,进入“设置”页面

640?wx_fmt=png

然后在“博客侧边栏公告”里面粘贴上面的代码即可。

640?wx_fmt=png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值