Programmatically Disable Event Firing on List Item Update in SharePoint 2010
1. Microsoft.SharePoint.dll
Create EventFiring.cs 1.Right-click on the project, select Add and click on New Item. 2.In the templates pane, select Class. 3.Enter the Name as EventFiring and then click OK. 4.Replace EventFiring.cs with the following code: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace DisableEventFiring
{
public classEventFiring : SPItemEventReceiver
{
public void DisableHandleEventFiring()
{
this.EventFiringEnabled =false;
}
public void EnableHandleEventFiring()
{
this.EventFiringEnabled =true;
}
} }
Program.cs 1.Replace Program.cs with the following code: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace DisableEventFiring
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("https://serverName/sites/Vijai/"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists.TryGetList("Custom");
SPListItem item = list.GetItemById(34);
item["Title"] ="Updated Successfully";
EventFiring eventFiring = newEventFiring();
eventFiring.DisableHandleEventFiring();
item.Update();
eventFiring.EnableHandleEventFiring();
Console.WriteLine("Updated Successfully");
Console.ReadLine();
}
}
}
} }
Programmatically Disable Event Firing on List Item Update in SharePoint 2010的更多相关文章
- SharePoint 2010 用Event Receiver将文件夹自动变成approved状态 (2)
接上篇,先贴ItemUpdated的代码: base.ItemUpdated(properties); if (properties.ListItem.FileSystemObjectType != ...
- SharePoint 2010 用Event Receiver将文件夹自动变成approved状态 (1)
当开发一个sharepoint门户网站,或者是一个内容管理的网站的时候,站点的模板通常会选用publish portal,或者是开启了publishing feature来对内容进行版本控制和流程控制 ...
- [SharePoint 2010] Copy list item with version history and attachment
private void MoveItem(SPListItem sourceItem, SPListItem destinationItem) { if (sourceItem == null || ...
- Creating SharePoint 2010 Event Receivers in Visual Studio 2010
转:http://msdn.microsoft.com/en-us/library/gg252010(v=office.14).aspx Summary: Learn how to create a ...
- appium()-The event firing
原文地址:https://github.com/appium/java-client/blob/master/docs/The-event_firing.md since 4.1.0 The purp ...
- 批量删除SharePoint 2010的List中的item
第一种方式:循环遍历List中的所有item,然后根据条件去判断当前item是否应该被删除[注:要用 i-- 方式去遍历,这也是删除集合里面item的常用做法,如果用 i++ 的方式去遍历删除,会出错 ...
- 解决在SharePoint 2010/2013部署自己的Event Handler后,抛出”不能载入被引用的第三方的程序集"的问题
今天在处理客户的一个问题的时候.我们已经把我们SharePoint EventHandler依赖的第三方的TIBCO.EMS.dll注冊到GAC里面了,可是日志里面还是抛出了不能载入被引用的第三方的程 ...
- jsom sharepoint 2010 循环获取多个list的item值
<script type="text/javascript"> // <![CDATA[ var chongdianbaId; var elm = documen ...
- C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据
转载:http://www.cnblogs.com/kivenhou/archive/2013/02/22/2921954.html 操作List前请设置SPWeb的allowUnsafeUpdate ...
随机推荐
- socket与http的区别
---------------------------------------------------------------------------------------------------- ...
- Java 堆栈,内存分配理解
Java虚拟机的堆.栈.堆栈 https://www.zhihu.com/question/29833675
- jsp的静态导入
<body> <!-- include 包括 包含 页面相互引用 静态引入 把多工文件 合并为一个文件 然后在编译 不要有重复的变量 --> <h1>this is ...
- Oracle-11g-r2 实例囚笼(Instance Caging)配置
实例囚笼(Instance Caging)应用场合: 在单台多 CPU 的服务器上,经常出现同时运行多个数据库实例的情况,此方式有利于提高硬件的使用率. 但是多个数据库实例运行,将会互相争用服务器资源 ...
- 解题报告-603. Consecutive Available Seats
Several friends at a cinema ticket office would like to reserve consecutive available seats. Can you ...
- lombok 介绍及基本使用方法
Lomboz是一个基于LGPL的开源J2EE综合开发环境的Eclipse插件,对编码,发布,测试,以及debug等各个软件开发的生命周期提供支持,支持JSP,EJB等.Lomboz是Eclipse的一 ...
- Introduction Sockets to Programming in C using TCP/IP
Introduction Computer Network: hosts, routers, communication channels Hosts run applications Routers ...
- JSFF或JSF页面加载时触发JavaScript之方法
现象一 最近在项目中遇到这么一个问题,有些页面元素是在页面加载时通过JavaScript动态渲染而成.当生成这些元素的JavaScript脚本被放置于JSPX文件中时,界面渲染没有问题.但是当我们把生 ...
- xshell上传下载文件(Windows、Linux)
经常有这样的需求,我们在Windows下载的软件包,如何上传到远程Linux主机上?还有如何从Linux主机下载软件包到Windows下:之前我的做法现在看来好笨好繁琐,不过也达到了目的,笨人有本方法 ...
- Java 连接 Hive的样例程序及解析
以后编程基于这个样例可节省查阅API的时间. private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriv ...