views:

788

answers:

3

Hi guys, When I make a meeting in Outlook, the recipient gets a approve/reject button in the top of the email. I'd like to do a similar thing with SharePoint: when a task is created, an email is sent to the person the task is assigned to, and the email asks the recipient to either accept or reject the task. I've seen demos of people doing this with a custom ASPx page, but I'd like to make it directly in the email. How should I go about doing that?

I'm used to making workflows in Visual Studio, so I'm happy with code examples for setting up an email and/or parsing the response

Cheers

Nik

+1  A: 

The approve/reject buttons in Outlook shows up because the email is in the iCalendar format. I dont know if this is the best way, but you can send out your own iCalendar emails using C# code and set the response email to a mail server you control. From that mail server you can process the email and use the SharePoint WebService API to approve the item in SharePoint.

JMD
That sounds like a great idea since I already do Exchange and SharePoint integration. I read the WikiPedia article, and it sounds like a good suggestion, and quite easy to do myself. Can you recommend any APIs that I could use from SharePoint, or should I just format my own email-message and send that?
niklassaers
When we implemented some custom iCalendar functionallity in SharePoint we created the e-mails using plain c# in a SharePoint Event Receiver. But there is some kind of iCalendar functionality built in since you can generate .ics files from the calendar list.One thing I'm not sure about is how you verify that the response is from the correct user. Is it possible to use some email headers or do you have to include a hashed value / GUID in the email. If so, is it possible to make Outlook include it in the response?
JMD
Thanks, I have no idea what I can make Outlook include in the response, but I'll give it a shot. :-) Thank you very much for your suggestions
niklassaers
A: 

I like JMD's suggestion but I don't know how you'd interact with SharePoint from the mail server.

It might be a easier to send an HTML-formatted email with two links (<a href="...">...</a>) for the Accept and Reject buttons. You could use CSS to format them so that they look like real buttons.

You could then create an ASPX page (or better an IHttpHandler implementation) to perform an action based on parameters passed to it via a URL. You'd want to pass in the site, web and list details and the list item ID along with a value to indicate whether the item is approved or rejected.

Then set the URLs of your "buttons" in the email to call your handler and pass in the appropriate parameter values.

The downside to this is that the "buttons" would be part of the message body and not part of the Outlook chrome but, on the other hand, they would be usable from any email client.

dariom
Thanks for the suggestion. It had crossed my mind, and certainly there are lots of examples that do it with a link and an ASP page. Even SharePoint does it that way for acceptance of new list items if you have that turned on. But my users know and user outlook meetings every day, and since I'd like to have as consise a userexperience as possible, I'd much rather go the mail route than have a browser window pop up and have to implement the hooks all over again myself.
niklassaers
A: 

Hi niklassaers,

I have come across the same situation where I have to approve right from the email. I was thinking, your experience may help me decide which is a better option. You can consider my skill level similar to yours.

Have a great day!

Nafees
Hi Nafeees, Implementation stranded because of resistance to upgrading Office version, so our routines were redesigned instead. If I were to do it over, I think that so far JMDs answer is the way to go
niklassaers