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 ...
随机推荐
- (翻译)React Container Components
原文:Container Components Container Components 在 React 模式上对我的代码有最深远影响的一个模式叫 container component 模式. 在 ...
- C++中构造函数作用
一. 构造函数是干什么的 class Counter { public: // 类Counter的构造函数 // 特点:以类名作为函数名,无返回类型 Counter() { m_value = ; } ...
- react之echarts数据更新
react之echarts数据更新 在使用setState更新数据时,如果要将图标更新,需要做一些简单的封装,代码如下: import React, { Component } from 'react ...
- 规则引擎以及blaze 规则库的集成初探之二——JSR94 的规则引擎API和实现
http://jefferson.iteye.com/blog/67839 规则引擎以及blaze 规则库的集成初探之二——JSR94 的规则引擎API和实现
- 在VMware Workstation中安装Ubuntu Server 16.04.5图解教程
最近要在Ubuntu中部署openstack,为了节省空间和内存,最终选择了Ubuntu服务器.看了很多前辈和大佬的安装教程,在这里记录一下我自己的Ubuntu Server 16.04.5的安装过程 ...
- iOS对HTTPS证书链的验证原理
今天看到所在的某个开发群问https原理,之前做HTTPS ,下面简单说下原理.希望能帮助你理解. HTTPS从最终的数据解析的角度,与HTTP相同.HTTPS将HTTP协议数据包放到SSL/TSL层 ...
- FineUI学习
1.无限级菜单绑定 using (DataTable dt = SqlPagerHelper.GetTableByCondition(DefaultConnection.ConnectionStrin ...
- JavaScript stringObject.replace() 方法
定义和用法: replace() 方法用于在字符串中用一些字符替换另一些字符,或替换一个与正则表达式匹配的子串. 语法: stringObject.replace(RegExp/substr,reol ...
- ie高版本浏览器不支持velocity的问题解决
<head><meta http-equiv="X-UA-Compatible" content="IE=5"></head> ...
- Django和Ajax
本文目录 一 什么是Ajax 二 基于jquery的Ajax实现 三 案例 四 文件上传 五 Ajax提交json格式数据 六 Django内置的serializers(把对象序列化成json字符串) ...