First, in a feature receiver, I swapped the Event content type with the Schedule content type to take advantage of the Attendees field (and the cool Free/Busy field!):
SPList list = lists["Calendar"]; SPContentType newContentType = list.ContentTypes.Add(list.ParentWeb.ContentTypes[SPBuiltInContentTypeId.Schedule]); SPContentType oldContentType = list.ContentTypes[0]; string name = oldContentType.Name; string description = oldContentType.Description; oldContentType.Delete(); newContentType.Name= name; newContentType.Description= description; newContentType.Update();
The form now looks like this:
Second, I added an Event Receiver that sends the notices:
publicoverridevoidItemAdded(SPItemEventProperties properties) { SPList list = properties.List; SPListItem item = properties.ListItem; SPFieldUserValueCollection values = item[SPBuiltInFieldId.ParticipantsPicker]asSPFieldUserValueCollection; Listemails =newList (); foreach(SPFieldUserValue value in values) { SPUser user = value.User; if(!string.IsNullOrEmpty(user.Email)) { emails.Add(user.Email); } } if(emails.Count>0) { StringDictionary headers =newStringDictionary(); headers.Add("to",string.Join(";", emails.ToArray())); headers.Add("subject", item.Title); SPUtility.SendEmail(web, headers, body); } }