Pages

Wednesday, November 30, 2011

How To Add a "Follow Community" button in an Email

View Comments

I saw this posted internally and just felt compelled to share. My colleague, Romain Lienard, He developed a way to quickly add a button to an email so that recipients can quickly follow an IBM Connections Community with a single click. I can see this being very very handy, specially when combined with the community email newsletter generator. This is a great example of using LotusScript and the IBM Connections API.

What follows is a copy of Romain's blog entry:


image

  

  

  

  

  

  

  

  

  

  

  

  

  

    

The IBM Connections API can be used with Lotus Notes and its LotusScript programming language in order to facilitate some tasks for end users.


So with some Notes support from Herbert Hilhorst, I wrote a piece of LotusScript that automatically follows a community with a simple click. The authentication is done directly in the Notes client

  

All you have to do is :

1 - create a button in your mail, via Create>Hotspot>Button.

2 - Specify a label for your button, select LotusScript instead of Formula

image

  

  

  

image

  

  

  

  

  

3 - Copy & paste this code, after changing the CommunityUID (here it's 5bf86449-cd87-4e02-bef5-a24f24408723) according to your needs :

Sub Click(Source As Button)
     
     Dim objHttp
     
     Set objHttp = CreateObject("Microsoft.XMLHTTP")
     url = |https://w3-connections.ibm.com/communities/follow/atom/resources?source=communities|
     req = |<entry>
<id>urn:lsid:ibm.com:follow:resource-5bf86449-cd87-4e02-bef5-a24f24408723</id>
<category term="resource-follow" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="communities" scheme="http://www.ibm.com/xmlns/prod/sn/source"></category>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/resource-type"></category>
<category term="5bf86449-cd87-4e02-bef5-a24f24408723" scheme="http://www.ibm.com/xmlns/prod/sn/resource-id"></category>
</entry>|
     objHttp.open "POST", url, False, "", ""
     objHttp.setRequestHeader "Content-type", "text/xml"
     objHttp.send(req)
     Msgbox "You're now following the TEC-F community. Thank you !"
     
End Sub

  

Save your document, click on the button, and voila ! Here's the original blog entry so you can give thanks to Romain :).

image



blog comments powered by Disqus