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 ...
随机推荐
- Pthreads 读写锁
▶ 使用读写锁来限制同一数据多线程读写.若任何线程拥有读锁,则其他任何请求写锁的线程将阻塞在其写锁函数的调用上:若任何线程拥有写锁,则其他任何请求读锁和写锁的线程将阻塞在其对应的锁函数上,相当于将读与 ...
- 【python 】装饰器 (多个参数的函数,带参数的装饰器)【转】
最简单的模板是这样的 #-*-coding:utf-8-*- def outer(func): def inner(): print 'before' func() print 'after' # r ...
- Centos7手动编译安装Python3
Python3的安装方式非常的简单,首先去到Python下载目录下载想要的Python包,这里我选择了3.6.5版本 $ wget https://www.python.org/ftp/python/ ...
- rundeck
docker run -d -p 4440:4440 -e EXTERNAL_SERVER_URL=http://109.105.4.65:4440 -v/root/rundeck:/var/rund ...
- shared_ptr&scoped_ptr&weak_ptr
[RAII - Resource Acquisition Is Initialization] 获得一个资源的时候,不管这个资源是对象.内存.文件句柄或者其它什么,你都要在一个对象的构造函数中获得它, ...
- jdk版本问题
今天遇到很郁闷的问题jdk 版本是1.6 如何设置1.8 记录一下 可以设置环境变量设置jdk版本问题再就是在 1.java工具设置jdk版本问题 2.grandle 设置要注意 3.生成环境设置j ...
- win7 python2.7安装PIL库
一.前言 遇到客户给了一个需求,需要拼接多个图片,上网找到一个解决方式,不过是需要安装PIL的,相信安装过这个库的应该都遇到很多问题,接下来说说怎么解决. 我的环境是: 操作系统:win10 64bi ...
- 5-math中函数汇总
math.h 数学函数库,一些数学计算的公式的具体实现是放在math.h里,具体有:1 三角函数double sin (double);double cos (double);double tan ( ...
- Differential expression analysis for paired RNA-seq data 成对RNA-seq数据的差异表达分析
Differential expression analysis for paired RNA-seq data 抽象背景:RNA-Seq技术通过产生序列读数并在不同生物条件下计数其频率来测量转录本丰 ...
- hra 直线
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI ...