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 ...
随机推荐
- (1/24) 认识webpack
1.什么是webpack (1)webpack是一个模块打包工具,它做的事情是,分析你的项目结构,找到JavaScript模块以及其它的一些浏览器不能直接运行的拓展语言(Scss,TypeScript ...
- Java——复制txt文件
将源文件复制到目标文件,同时输出源文件内容,需要提供一个源文件和目标文件路径参数(如果不存在则自动创建) public static void copyTxt(String sourceFile, S ...
- delphi XE8 NetHTTPRequest NetHTTPClient
delphi xe8 推出2个新http控件,NetHTTPRequest.NetHTTPClient 可以调用ASP.Net 一般应用程序获取网页数据,用旧的控件idhttp控件也可以,推荐用新的这 ...
- oracle ROW_NUMBER用法
Oracle中row_number().rank().dense_rank() 的区别 row_number的用途非常广泛,排序最好用它,它会为查询出来的每一行记录生成一个序号,依次排序且不会重复 使 ...
- Unpacking Argument Lists
[Unpacking Argument Lists] The reverse situation occurs when the arguments are already in a list or ...
- python之private variables
[python之private variables] “Private” instance variables that cannot be accessed except from inside a ...
- Air File.load加载问题
不要用File.load同时加载多个文件,有时会引起程序崩溃. 在需要同时加载多个文件时,要一个一个排队加载,等到上一个加载完成再加载下一个. 也可以设定一个static的File,加载前先File. ...
- N 秒打开一个新窗口
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- [leetcode]621. Task Scheduler任务调度
Given a char array representing tasks CPU need to do. It contains capital letters A to Z where diffe ...
- Qt Thread
Threading Classes (Qt help manual key words) These Qt Core classes provide threading support to appl ...