小编aar*_*pey的帖子

使用Sharepoint事件接收器在文档库中创建一个文件夹

我使用以下代码在我的文档库中创建一个文件夹.事件被触发并执行到我的代码的最后一行,没有任何问题.但是,文件夹未在我的文档库中创建或列出.

public override void ItemAdded(SPItemEventProperties properties)
{
    base.ItemAdded(properties);        

    string strDashListRoot = "http://win-hmpjltdbh5q:37642";
    using (SPSite site = new SPSite(strDashListRoot))
    {
        using (SPWeb web = site.OpenWeb())
        {
            web.AllowUnsafeUpdates = true;                    

            SPList spl = web.Lists["client_documents"];
            spl.Items.Add("", SPFileSystemObjectType.Folder, "Helllworld");
            spl.Update();
            web.AllowUnsafeUpdates = false;
        }
    }           
}
Run Code Online (Sandbox Code Playgroud)

c# sharepoint-2010 event-receiver

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

event-receiver ×1

sharepoint-2010 ×1