惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
The Hacker News
The Hacker News
D
Docker
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
罗磊的独立博客
A
Arctic Wolf
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
Spread Privacy
Spread Privacy
B
Blog
A
About on SuperTechFans
L
LINUX DO - 最新话题
博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
W
WeLiveSecurity
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
T
The Exploit Database - CXSecurity.com
美团技术团队
J
Java Code Geeks
Cloudbric
Cloudbric
雷峰网
雷峰网
Vercel News
Vercel News
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
G
Google Developers Blog
T
Tenable Blog
PCI Perspectives
PCI Perspectives
Engineering at Meta
Engineering at Meta
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Hackread – Cybersecurity News, Data Breaches, AI and More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
C
Cybersecurity and Infrastructure Security Agency CISA
S
Secure Thoughts
N
News and Events Feed by Topic
GbyAI
GbyAI
S
SegmentFault 最新的问题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

博客园 - 范文轩

Sharepoint中的Feature Stapling功能 如何向列表中添加数据值(开发篇补充REST) 如何向列表中添加数据值(开发篇) 如何向列表中添加数据值(管理员篇) 在SharePoint 2010中动态加载Visio Web Part 使用编程的方式来启动SharePoint的工作流 InfoPath 2010调用REST的一个小应用 SharePoint 2010 WSP包部署过程中究竟发生什么? 如何查看SharePoint 2010的CU版本 SharePoint 2010多语言包的安装 在SharePoint 2010中使用Linq时候,请注意特殊字符 自定义ASP.NET WebApplication中调用SharePoint2010的对象 在Infopath 2010中调用Web Service 谈谈SharePoint 2010的客户端对象模型的性能问题 给Document Set里面添加文件夹 给Chart Web Part 添加过滤功能 SharePoint 2010的Form认证的用户注册功能 SharePoint 调查列表的自定义错误页面 Reporting Services 2008 and SharePoint 2010
SharePoint 2010中的WebProvisioned Event Handler
范文轩 · 2012-02-15 · via 博客园 - 范文轩

在SharePoint 2010中,新增加了一些Event Handler事件,例如:针对Web级别的WebProvisioned(SPWebEventProperties)WebAdding(SPWebEventProperties),和针对列表级别的ListAdding(SPListEventProperties)ListDeleting(SPListEventProperties)等,更加详细的内容请参考:http://msdn.microsoft.com/en-us/library/ff407299.aspx

在本文中我将简单说一下WebProvisioned(SPWebEventProperties)这个事件。官方的描述是:After event that fires after a subsite is fully provisioned and the provisioning process has stopped, but does not fire when the root web site of a new site collection is created。我的理解:就是当站点(Web)创建完成之后,你可以自定义的事件,譬如说:修改站点的母版页,新建自定义列表等等。

第一步,项目中添加“Event Handler”,选中Web Events,然后选中想要捕获的事件,例如“a site was provisioned” .如下图:

image

第二步,写你的自定义逻辑。(我的demo是要修改站点的title):

   1:  /// <summary>
   2:      /// Web Events
   3:      /// </summary>
   4:      public class TestEventHandlerWebProvisioned : SPWebEventReceiver
   5:      {
   6:         /// <summary>
   7:         /// A site was provisioned.
   8:         /// </summary>
   9:         public override void WebProvisioned(SPWebEventProperties properties)
  10:         {
  11:             //base.WebProvisioned(properties);
  12:             SPWeb web = properties.Web;
  13:             web.Title = "test"+web.Title;
  14:             web.Update();
  15:         }

第三步,发布(感谢VS2010,让SharePoint的开发变得如此的简单)

结果:当你在当前站点新建一个网站的时候,网网站的标题前面会自定加上一个“test”。

疑问:

1. 当我在当前站点的子站点新建网站的时候,标题会变化吗?这个feature还会起作用吗?如果不起作用,难道我还要在每个站点上都激活这个feature?有没有其他的办法?

2. 我现在有一个新的需求,当用户新建“博客”或者“工作组”站点的时候,我要在站点里面新建一个列表;或者说当用户新建“我的站点”的时候,我想要在每个用户自己的站点上加上点东西,怎么办?

我在下一篇中会介绍一下Feature Stapling,它可以满足你的需求。