Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SharePoint列表附件,如何覆盖它们_Sharepoint - Fatal编程技术网

SharePoint列表附件,如何覆盖它们

SharePoint列表附件,如何覆盖它们,sharepoint,Sharepoint,关于SharePoint的快速问题。。。。 我需要使用SharePoint sdk更新列表上的附件,但每次删除旧附件并添加新附件时,都不会添加新文档。下面是我的代码 /* Delete the attachment first and create a new attachment.*/ string fileName = newAttachmentName.Substring(0, newAttachmentName.IndexOf("."));

关于SharePoint的快速问题。。。。 我需要使用SharePoint sdk更新列表上的附件,但每次删除旧附件并添加新附件时,都不会添加新文档。下面是我的代码

/* Delete the attachment first and create a new attachment.*/
            string fileName = newAttachmentName.Substring(0, newAttachmentName.IndexOf("."));
            //Delete Attachment
            SPAttachmentCollection attachments = item.Attachments;
            if (item.Attachments != null)
            {
                string oldfilename = attachments[0].ToString();

                attachments.DeleteNow(oldfilename);
                item.Update();
            }

            //AddAttachement(item, newAttachmentName, attachmentStream, true);
            attachments.Add(newAttachmentName, contents);
            ////attachments[0] = filename;
            item.Update();

也许这会有所帮助:

以下内容不起作用:

SPAttachmentCollection attachments = listitem.Attachments;

foreach (SPFile file in attachments)
{
  // Do something
}
以下方法确实有效:

SPFolder folder = web.Folders["Lists"].SubFolders[list.Title].SubFolders["Attachments"].SubFolders[listitem.ID.ToString()];
foreach (SPFile file in folder.Files) 
{   
    // Something useful here 
}

也许这会有所帮助:

以下内容不起作用:

SPAttachmentCollection attachments = listitem.Attachments;

foreach (SPFile file in attachments)
{
  // Do something
}
以下方法确实有效:

SPFolder folder = web.Folders["Lists"].SubFolders[list.Title].SubFolders["Attachments"].SubFolders[listitem.ID.ToString()];
foreach (SPFile file in folder.Files) 
{   
    // Something useful here 
}
覆盖新文件的位置创建新附件实例(附件1)


覆盖新文件创建新附件实例(attachment1)

链接不会退出链接。没过多久就找到了:)链接没有退出链接。没过多久就找到了:)