C# Sharepoint在ItemUpdate事件中从列表中获取更改的附件名称

C# Sharepoint在ItemUpdate事件中从列表中获取更改的附件名称,c#,events,sharepoint,C#,Events,Sharepoint,J发生sharepoint“项目更新(SPItemEventProperties属性)”事件 此事件需要处理“文档库”和带有附件的“通用列表”。在“文档库”上,它工作得很好,但在“通用列表”中,当用户在此事件中更改附件时,我有一个小问题(删除旧附件,插入新附件) 我有这样的想法: if (properties.List.BaseType.Equals(SPBaseType.GenericList)) { for (int ind

J发生sharepoint“项目更新(SPItemEventProperties属性)”事件

此事件需要处理“文档库”和带有附件的“通用列表”。在“文档库”上,它工作得很好,但在“通用列表”中,当用户在此事件中更改附件时,我有一个小问题(删除旧附件,插入新附件)

我有这样的想法:

if (properties.List.BaseType.Equals(SPBaseType.GenericList))
               {
                   for (int index = 0; index < properties.ListItem.Attachments.Count; index++)
                   {
                       //Do something

                       string relativeFileUrl = SPUrlUtility.CombineUrl(properties.ListItem.Attachments.UrlPrefix, properties.ListItem.Attachments[index]);
                       relativeFileUrl = relativeFileUrl.Remove(0, properties.Web.Site.Url.Length);

                       //Do something
                   }
               }
if(properties.List.BaseType.Equals(SPBaseType.GenericList))
{
对于(int index=0;index
在这样的解决方案中,我有一个相对文件url,其中包含指向。。。已删除的文件(不是插入的新文件)


如何获取在此事件中插入的新附件的url???

项添加是同步事件,列表项和附件也不会提交到数据库中。因此,如果需要在ItemAdding()事件中获取附件,则可以通过ASP.NET请求对象来获取附件


你试过了吗?

你好,肯。我在2013年6月补充了这个问题。现在,我在另一家没有sharepoint的公司工作,而且。。。我不知道如何检查它是否工作。我在sharepoint工作了2.5年,我不想为这项技术浪费更多的时间。顺便说一句,谢谢你的关注;)