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的更多相关文章

  1. SharePoint 2010 用Event Receiver将文件夹自动变成approved状态 (2)

    接上篇,先贴ItemUpdated的代码: base.ItemUpdated(properties); if (properties.ListItem.FileSystemObjectType != ...

  2. SharePoint 2010 用Event Receiver将文件夹自动变成approved状态 (1)

    当开发一个sharepoint门户网站,或者是一个内容管理的网站的时候,站点的模板通常会选用publish portal,或者是开启了publishing feature来对内容进行版本控制和流程控制 ...

  3. [SharePoint 2010] Copy list item with version history and attachment

    private void MoveItem(SPListItem sourceItem, SPListItem destinationItem) { if (sourceItem == null || ...

  4. 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 ...

  5. appium()-The event firing

    原文地址:https://github.com/appium/java-client/blob/master/docs/The-event_firing.md since 4.1.0 The purp ...

  6. 批量删除SharePoint 2010的List中的item

    第一种方式:循环遍历List中的所有item,然后根据条件去判断当前item是否应该被删除[注:要用 i-- 方式去遍历,这也是删除集合里面item的常用做法,如果用 i++ 的方式去遍历删除,会出错 ...

  7. 解决在SharePoint 2010/2013部署自己的Event Handler后,抛出”不能载入被引用的第三方的程序集"的问题

    今天在处理客户的一个问题的时候.我们已经把我们SharePoint EventHandler依赖的第三方的TIBCO.EMS.dll注冊到GAC里面了,可是日志里面还是抛出了不能载入被引用的第三方的程 ...

  8. jsom sharepoint 2010 循环获取多个list的item值

    <script type="text/javascript"> // <![CDATA[ var chongdianbaId; var elm = documen ...

  9. C# 对sharepoint 列表的一些基本操作,包括添加/删除/查询/上传文件给sharepoint list添加数据

    转载:http://www.cnblogs.com/kivenhou/archive/2013/02/22/2921954.html 操作List前请设置SPWeb的allowUnsafeUpdate ...

随机推荐

  1. OpenCL NativeKernel 计算矩阵乘法

    ▶ 使用函数 clEnqueueNativeKernel 来调用 C/C++ 本地函数(在 OpenCL 中将其看做回调函数),使用本地编译器(而不是 OpenCL 编译器)来编译和执行内核 ● 代码 ...

  2. python类静态变量

    python的类静态变量直接定义在类中即可,不需要修饰符,如: 1 class Test: stc_attr = 1 def __init__(self,attr1,attr2): self.attr ...

  3. leetcode172

    public class Solution { public int TrailingZeroes(int n) { ) { ; } else { ; var y = TrailingZeroes(x ...

  4. leetcode111

    /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...

  5. OleVariant Variant

    OleVariant ArrayDimCount OleVariant; System.Variants.hpp   判断OleVariant 是否为空 System::OleVariant ov i ...

  6. eclipse中debug改变变量的值

    step1:debug断点到变量的下一行,在debug试图的右上角variables中看到该变量的值: step2:鼠标右键点击str出现下图,选择Change Value... step3:点击Ch ...

  7. set 续3

    -------siwuxie095                 set 技巧高级篇:     1.利用 set /a 进行赋值     在开启变量延迟情况下,要判断数组 S!n! 的值的情况, 不 ...

  8. sqlserver查询存储过程的创建时间及最后修改时间

    select  [name] ,create_date ,modify_date FROM  sys.all_objects where  type_desc = N'SQL_STORED_PROCE ...

  9. mybatis中的factory工厂与Sqlsession

    1.SqlSession的使用范围 SqlSession中封装了对数据库的操作,如:查询.插入.更新.删除等.通过SqlSessionFactory创建SqlSession,而SqlSessionFa ...

  10. webkit com wrapper 推荐!

    https://groups.google.com/forum/#!topic/microsoft.public.vb.general.discussion/ZaFY95aDZoY http://ww ...