修改文档库中文件名称

/// <summary>        

/// An item was added.        

/// </summary>        

public override void ItemAdded(SPItemEventProperties properties)        

{            

  base.ItemAdded(properties);

      SPListItem item = properties.ListItem;            

  string fileName = "人员测评" + "-" + properties.UserDisplayName +  "-" + DateTime.Now.ToString("yyyyMM") + item.File.Name.Substring(item.File.Name.LastIndexOf('.'));            

item.File.MoveTo(item.Url.Substring(0, item.Url.IndexOf('/') + 1) + fileName, true);        

}

posted on 2014-12-09 14:32  thankyou  阅读(151)  评论(0编辑  收藏  举报