使用Powershell定期检查SharePoint项目的属性

使用Powershell定期检查SharePoint项目的属性,powershell,sharepoint-2013,Powershell,Sharepoint 2013,我正在使用powershell检查我刚才添加的SharePoint是否已更改。为此,我首先通过 $spFile = $spFiles.Add(...) 之后,我经常这样做: $spFile.Item["propertyName"] 每次的结果都是一样的,即使我在SharePoint中更改了属性。所以我想我必须刷新Powershell中的项目。如何做到这一点?您需要再次获取文档库,然后只有您才能获取更改后的值。它存储在缓存中,像这样的事情你需要做 $library = $web.Lists[

我正在使用powershell检查我刚才添加的SharePoint是否已更改。为此,我首先通过

$spFile = $spFiles.Add(...)
之后,我经常这样做:

$spFile.Item["propertyName"]

每次的结果都是一样的,即使我在SharePoint中更改了属性。所以我想我必须刷新Powershell中的项目。如何做到这一点?

您需要再次获取文档库,然后只有您才能获取更改后的值。它存储在缓存中,像这样的事情你需要做

 $library = $web.Lists["DocumentLibrary"]
 $spFiles= $library.Items | where {$_.FileSystemObjectType -eq "File"}
 foreach ($spFile in $spFiles) {
       $spFile.Item["propertyName"]
    }

谢谢我希望有一个更简单的方法,但这是可行的:$item=$spWeb.GetListItem($spFile.ServerRelativeUrl)