列出MoveTo之后的不确定项目 [英] List items in limbo after MoveTo

查看:41
本文介绍了列出MoveTo之后的不确定项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个列表,我们希望将较旧的项目存档到另一个列表中.我使用了Powershell脚本来移动这些项目.我是SharePoint管理员世界的新手,所以我在网上搜索了脚本并最终得到了这个结果.

We have a list where we wanted to archive off the older items to another list. I used a Powershell script to move the items. I am new to the SharePoint admin world so I searched online for scripts and ended up with this.

Add-PSSnapin Microsoft.SharePoint.PowerShell $Web = Get-SPWeb "our sharepoint site" $SourceList = $web.Lists["source list"] $TargetList = $Web.Lists["target list"] $Query = '<Where><And><Leq><FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2017-12-31T23:59:59Z</Value></Leq><Eq><FieldRef Name="Resolved" /><Value Type="Integer">1</Value></Eq></And></Where>' $SPQuery = new-object Microsoft.SharePoint.SPQuery $SPQuery.Query = $Query $SourceFilesCollection =$SourceList.GetItems($SPQuery) Write-host "Total number of files found: "$SourceFilesCollection.count $TargetFolder = $TargetList.ParentWeb.GetFolder($TargetList.RootFolder.Url + "/"); write-host "Target Folder:" $TargetFolder.url foreach ($item in $SourceFilesCollection) { $file = $Web.GetFile($item.Url) Write-host "Item Title: " $item["Title"] write-host "Item URL: " $item.url write-host "File name: " $file.name $file.MoveTo($TargetFolder.Url + "/" + $File.name) # did not have this line $file.Update() }

我在没有$ file.Update()行的情况下运行了上述脚本.现在目标列表为空,项目已从源列表中消失.但是,当我转到网站内容时,它仍然显示源列表中有30,000多个项目(原始 项数).这些项目似乎处于某种已删除状态.我该如何解决?是导致更新的遗漏吗?我想将项目重置为正常状态,然后重新运行脚本.有可能吗? 请帮忙!

I ran the above script WITHOUT the $file.Update() line.  Now the target list is empty and the items have disappeared from the source list.  However, when I go to site contents, it still shows that the source list has over 30,000 items (the original number of items).  It seems the items are in some sort of deleted status.  How do I fix this?  Was it the omission of the update that caused it?  I would like to reset the items back to normal and rerun the script.  Is that possible?  Please help!

推荐答案

嗨tvb395,

我已经在SharePoint 2013中进行了测试,可以重现您的问题.

使用

Hi tvb395, 

I have done a test in my SharePoint 2013 and i can reproduce your issue. 

After executing the PowerShell script with


file.Update()执行PowerShell脚本之后,现在目标列表为空,项目从源列表中消失了
file.Update() , Now the target list is empty and the items have disappeared from the source list. 

我正在调查此问题,并将尽快进行更新.

最好的问候

丽莎·陈(Lisa Chen)

I am currently looking into the issue and will give an update as soon as possible. 

Best Regards, 

Lisa Chen 



这篇关于列出MoveTo之后的不确定项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆