Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a Sharepoint 2010 installation and I have troubles getting this works: I have a list with some columns:

  • Place
  • Assigned to
  • Date and time
  • Comments

I want Sharepoint sends an email when a new list item is created. The email must be send to "Assigned to" person, who can be any on the Active Directory.

After that, I also want (if possible) that Sharepoint puts a new appoitment in the Exchange calendar of "Assigned to" person with the "Date and time"

Can someone help me?

Thanks

share|improve this question
add comment

migrated from stackoverflow.com May 22 '13 at 14:58

This question came from our site for professional and enthusiast programmers.

5 Answers

you have to create sharepoint workflow (using sharepoint designer) which starts when item is created in this list , this workflow will send an e-mail to the "Assigned to" user

check this link to find more info. about sending email in a workflow

http://office.microsoft.com/en-001/sharepoint-designer-help/send-e-mail-in-a-workflow-HA010239042.aspx

share|improve this answer
1  
I always thought in a workflow like something which creates tasks, and I don't need any task for this. I'm reading the article. Thank you very much –  Tomás Crespo García May 22 '13 at 10:55
    
@TomásCrespoGarcía you are welcome –  Mahmoud Farahat May 22 '13 at 11:16
add comment

Maybe I'm thinking too much like a dev and not enough like someone looking for the simplest solution available, but it seems to me that you want to create an event receiver that operates on the list when the ItemAdded trigger is pulled. Here is a guide on how to set up an event receiver for a specific list instance:

http://msdn.microsoft.com/en-us/library/ff398052.aspx

Once you've set up that event receiver, you can send the email within it or within a supporting class using the SPUtility.SendEmail method.

SPUtility.SendEmail(web, false, false, to, subject, htmlBody, false);

Where...

  • "web" is an SPWeb object.
  • "to" is the email address that you're sending the email to. You can call the email from the item using code similar to the following:

    SPUser user = (SPUser)item["AssignedTo"];
    string to = user.Email;
    
  • "subject" is the subject line.

  • "htmlBody" is the body.
share|improve this answer
add comment

Thanks JohnWCraven, that sound great!

I have followed your link, creating a breakpoint in the base.ItemAdding() line, and the breakpoint is hit when I add a new element to the list.

However when I add a few more lines of code, either above or below of base.ItemAdding(), no breakpoint hit, my code isn't executing, so I can't send an email.

I can't figure what's happening, Can you help me to continue?

share|improve this answer
add comment

Sharepoint designer workflow is simplest solution. It will not create any task. On creation of a list item, mail will be triggered to assigned to person and workflow ends. You have to use only "Send an Email" action for this. You can use event handler or receiver too for that , but it will be itemAdded() event. I will definitely suggest Workflow for your requirement, it will be simple and need no custom coding. thanks....

share|improve this answer
add comment

Creating via workflow and event receiver are both the possible options .

Creating a workflow with Sharepoint Designer might be the quickest and easiest way as it can provide u with email UI template to fill in easily.

If u need a little more customization apart from just sending the mail then you can go for event reciever.

Thanks, Aravind

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.