博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SPUtility.SendEmail
阅读量:4582 次
发布时间:2019-06-09

本文共 1501 字,大约阅读时间需要 5 分钟。

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:

enter image description here

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;     List
emails =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);     } }

转载于:https://www.cnblogs.com/csts/archive/2012/04/19/2456589.html

你可能感兴趣的文章
1.Nginx服务应用
查看>>
MySQL基础
查看>>
凹凸贴图与法线贴图
查看>>
sqlserver跨服务器数据库sql语句
查看>>
设计模式-结构型模式,外观模式(6)
查看>>
Trie模版
查看>>
2018HDU多校训练-3-Problem F. Grab The Tree
查看>>
2016012032四则运算网页版结对项目报告
查看>>
淘宝专业版改基础版方法
查看>>
[转]ARM Pipeline
查看>>
[转]Blocking Code Injection on iOS and OS X
查看>>
颜色分类函数
查看>>
(中等) HDU 4725 The Shortest Path in Nya Graph,Dijkstra+加点。
查看>>
sort-归并排序
查看>>
django 快速实现完整登录系统(cookie)
查看>>
.NET中的out和ref关键字
查看>>
Python之ftp服务器
查看>>
KMP预处理
查看>>
oracle的wm_concat函数实现行转列
查看>>
C语 三子棋小游戏
查看>>