powershell Powershell在SharePoint中查找特定字段类型的出现次数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell Powershell在SharePoint中查找特定字段类型的出现次数相关的知识,希望对你有一定的参考价值。

$webApp = Get-SPWebApplication https://xxxxx
$fieldType = 'CascadingDropDownFieldType' #[Guid]"{becafe54-ff71-416b-bc43-959aab6b07f7}"

foreach($site in $webApp.Sites){
	
	#if($site.Url -eq 'https://homeportnwtest.psns.navy.mil/cmdtools/tools'){
		Write-Host "Site URL: " + $site.Url -background yellow -foreground black
		<# foreach($web in $site.AllWebs)  
		{           
		  foreach($list in $web.Lists)  
		  {
			$fieldInUseList = $list.Fields | Where {$_.TypeAsString -eq $fieldType}
			$fieldInUseCt = $fieldInUseList.Count
			if($fieldInUseCt -gt 0) {
				foreach($field in $fieldInUseList){
					Write-Host "'$web' web - Found a match in the '$field' field in the '$list' list"
					"'$web' web - Found a match in the '$field' field in the '$list' list" | out-file 'E:\Logfiles\Cascade.txt' -append
					$list.Url | out-file 'E:\Logfiles\Cascade.txt' -append
				}
			}            
		  }
		  foreach($ct in $web.ContentTypes) {
			 $fieldInUseCt = $ct.FieldLinks | Where {$_.TypeAsString -eq $fieldType }
			 $fieldInUseCt = $fieldInUseList.Count
			if($fieldInUseCt -gt 0) {
				foreach($field in $fieldInUseList){
					Write-Host "'$web' web - Found a match in the '$field' field in the '$ct' Contenttype"
					"'$web' web - Found a match in the '$field' field in the '$ct' Contenttype" | out-file 'E:\Logfiles\Cascade.txt' -append
					$list.Url | out-file 'E:\Logfiles\Cascade.txt' -append
				}
			 }
		  }
		} #>
	#}
}
$fieldId = [Guid]"fa564e0f-0c70-4ab9-b863-0177e6ddd247"

$site = Get-SPSite("http://yoursite/") 

foreach($web in $site.AllWebs)  
{            
  foreach($list in $web.Lists)  
  {
    $fieldInUseList = $list.Fields | Where {$_.Id -eq $fieldId }
    if($fieldInUseCt) {
        Write-Host "'$web' web - Found a match in the '$field' field in the '$list' list"
    }            
  }
  foreach($ct in $web.ContentTypes) {
     $fieldInUseCt = $ct.FieldLinks | Where {$_.Id -eq $fieldId }
     if($fieldInUseCt) {
        Write-Host "'$web' web - Found a match in the '$field' field in the '$ct' Contenttype"
     }
  }
}

以上是关于powershell Powershell在SharePoint中查找特定字段类型的出现次数的主要内容,如果未能解决你的问题,请参考以下文章

PowerShell校验哈希

text 用于检查sha-256下载的PowerShell脚本

用PowerShell的命令行检查文件的校验MD5 SHA1 SHA256

Windows下计算文件MD5和SHA256等摘要的方法(利用PowerShell)

如何将 powershell 中文件的 SHA256 哈希值与已知值进行比较?附加问题

win10 powershell 验证下载的包的MD5/sha1的签名值