zoukankan      html  css  js  c++  java
  • Event Handler的开发与部署2

    1、首先打开Microsoft Visual Studio 2005,创建一个Class Library的项目,取名为Eallies.EventHandler.Demo。

    2、创建项目成功后,将默认的Class1.cs改名为DocumentHandler.cs,并添加Microsoft.SharePoint.dll的引用,该DLL的具体位置在C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI。

     3、编写DocumentHandler.cs的代码

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Xml;

    using Microsoft.SharePoint;

    using System.IO;

    namespace Eallies.EventHandler.Demo

    {

        public class DocumentHandler : IListEventSink

        {

            public void OnEvent(SPListEvent list)

            {

                 if (list.Type == SPListEventType.Insert)

                 {

                     string path = @"c:\DocumentHandler.txt";

                     string text = "Insert" + "-" + DateTime.Now.ToString();

                     StreamWriter writer = new StreamWriter(path);

                     writer.Write(text);

                     writer.Close();

                 }

            }

        }

    }

    4、将项目的输出目录更改为C:\Inetpub\wwwroot\wss\VirtualDirectories\9001\_app_bin。

    5、为项目创建一个强名称。

     

     

    作者:johnny 出处:http://www.cnblogs.com/sunjunlin 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    201116西瓜书机器学习系列---2、模型评估
    201116西瓜书机器学习系列---1、绪论
    js中null和undefined的区别
    ajax和pjax有什么区别
    html5中的web存储
    Java调用linux命令及Shell脚本
    plsql developer中,清除登录历史
    PLSQL自动登录,记住用户名密码&日常使用技巧
    Linux中查看进程状态信息
    Is there any difference between GROUP BY and DISTINCT
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/1768044.html
Copyright © 2011-2022 走看看