惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 热门话题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
WordPress大学
WordPress大学
Project Zero
Project Zero
P
Palo Alto Networks Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
T
Tailwind CSS Blog
Forbes - Security
Forbes - Security
F
Full Disclosure
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
O
OpenAI News
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
IT之家
IT之家
U
Unit 42
腾讯CDC
S
Security Affairs
C
Cisco Blogs
Schneier on Security
Schneier on Security
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss

博客园 - A A

SharePoint 2013 App 未在此网站上启用应用程序的旁加载 SharePoint Error 查询命令 SharePoint 2013 基于主机头创建站点无法访问 SharePoint 2013 APP 之---很抱歉,应用程序已关闭。如果您知道运行服务器的人员,请告诉他们启用应用程序。 SharePoint服务器修改域和机器名 CAML 多表查询 SPQuery.Joins and ProjectedFields SharePoint 2010 你状态机了吗! SharePoint 文档库打开HTML 直接浏览而不是打开下载对话框 User Profile Data Web Part 读取属性字段 ECMAScript Client OM(传说中的js客户端编程) - A A 自定义个性化 EditPeople控件 - A A 使用SharePoint Management PowerShell来完成对SharePoint的操作 Developer Dashboard 排忧解难!!! 使用SharePoint 人员选择控件 在 WEB APP开发 - A A SharePoint 在Default 下面添加服务端代码 - A A SharePoint 页面库 使用footer - A A 10分钟搞定 SharePoint 集成FCKEditor 标准项目文档 获取AD用户和OU属性字段名称
SharePoint Write Logs
A A · 2011-01-06 · via 博客园 - A A

using System;
using System.Security.Permissions;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Workflow;

namespace AnnouncementListEvent.EventReceiver1
{
    /// <summary>
    /// List Item Events
    /// </summary>
    public class EventReceiver1 : SPItemEventReceiver
    {
       /// <summary>
       /// An item is being added.
       /// </summary>
       public override void ItemAdding(SPItemEventProperties properties)
       {
           base.ItemAdding(properties);
           writeDataToLogFile(properties, "ItemAdding Event");
           writeListItemToCustomList(properties, "ItemAdding Event");
       }

       private void writeListItemToCustomList(SPItemEventProperties properties, string eventName)
       {
           string spLog = "";
           DateTime currentTime = DateTime.Now;
           spLog = eventName + " " + currentTime.ToString();

           using (SPSite site = new SPSite("http://moss2010/"))
           {
               using (SPWeb web = site.OpenWeb())
               {
                   web.AllowUnsafeUpdates = true;
                   SPList list = web.Lists["Log"];
                   SPListItem Item = list.Items.Add();
                   Item["Title"] = properties.ListTitle.ToString();
                   Item["Log Entry"] = spLog;
                   Item.Update();
               }
           }

       }

       private void writeDataToLogFile(SPItemEventProperties properties, string eventName)
       {
           FileIOPermission myPermissions = new FileIOPermission(PermissionState.Unrestricted);
           myPermissions.AddPathList(FileIOPermissionAccess.AllAccess, "c:\\Authoring");

           StreamWriter sw = File.AppendText(@"C:\Authoring\mySPLog.txt");
           StringBuilder sb = new StringBuilder();
           sb.AppendFormat("Date, Event and List:\n {0} {1} {2} ", DateTime.Now.ToString(), eventName, properties.ListTitle);
           sw.WriteLine(sb.ToString());
           sw.Close();
       }

    }
}