首页 > 代码库 > 修改文档库中文件名称

修改文档库中文件名称

/// <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);        

}

修改文档库中文件名称