Happy weekend everybody!
So after my last blogpost around my choice for the next CEO at Microsoft, I thought I’d get back to talking about LightSwitch this time (I know – how novel for a blog named for LightSwitch to actually talk about it). One of the great things about working at Microsoft is you work with some incredibly smart people – one of these folks is Mike Gannotti, who is one of the architects at the Malvern MTC (MTC stands for Microsoft Technology Center) where I am based out of.
We were talking on Thursday about how I’d like to connect Yammer to a LightSwitch app – he quickly pointed out, “Yeah, that’s a great idea! All you need to do is use the email address of the Yammer site you want to post to and WHAMMO! All finished!” (He may or may not have actually said “WHAMMO!”, but if you’ve met Mike, it sounds like something he would say, so I’ll assume he did.). This sounded like a much better idea than my original one, which was digging into the Yammer API’s and spending weeks figuring out how to make this work, so I agreed and pretended like this is what I was thinking all along.
If you don’t what Yammer is, you can learn more about it here, but at a high level it is a great way for companies and their employees to collaborate and stay connected to their projects/teams/co-workers. When I’ve built apps in the past with LightSwitch, one of the things people liked most was the ability to have an email fire off based on an event (record saving/updating/whatever) so they could stay on top of what was happening. Since folks already use Yammer for this type of activity here at Microsoft, having this activity post their instead of happen via email directly made the most sense.
So how can we make this happen? Easy!
Step 1 – Go sign-up for Yammer (or better yet, buy it for your whole company)
Step 2 – Create a new group in Yammer and have it either be a public or private group, depending on what you’re looking to share.
Step 3 – Your group email address is determined the following way (reprinted from this Microsoft Support article) – “If you want to post a message by using email to a specific group in your network, you must send an email message to both the group and network names in lowercase, together with a plus (+) symbol in between the names, and without any spaces or punctuation, followed by @yammer.com. For example, to create a post by using email to the Sales Team in the Contoso network, you would send an email message to email@example.com.”
Step 4 – Follow the steps in Beth Massi’s blogpost titled “Sending Email from a LightSwitch SharePoint App using Exchange Online” for whatever entity you are looking to have email posts based on.
Step 5 – Grumble about having to convert Beth’s code samples from VB to C#
Step 6 – Ignore Beth’s emails telling you to quit complaining about VB (I have a whole folder of these in Outlook, actually)
Step 7 – Change the following line -
message.ToRecipients.Add(“Your Yammer Group Email Address eg firstname.lastname@example.org”)
Step 8 – Test it out! I made a real simple entity showing a Partner dropdown list and an area where I can add some notes -
After I hit save, I check Yammer to see if it works -
See how easy that was? Now one thing to keep in mind – by default, Yammer is setup to require any post by email to get an additional approval from the sender before it is posted. If you want your app to post automatically, you need to uncheck that setting from whatever account is being used to send the emails from under the Account –> Notifications menu -
And because users can be notified by email when a new item is posted in a Yammer group, it’s an easy way to keep a team up to date and encourage additional collaboration. So thanks Mike Gannotti, and starting leveraging Yammer in your next app!