powershell 这将从sharePoint列表中获取Created By(作者)和Modified By(编辑器)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 这将从sharePoint列表中获取Created By(作者)和Modified By(编辑器)相关的知识,希望对你有一定的参考价值。

$webUrl = "https://xxxxx/cmdtools/tools/RDR"
    $listName = "Deficiency Reports"
    # Open web and library
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    $items = $list.items
    
	'RDR' | out-file f:\temp\wintzer.txt -append
    foreach ($item in $items)
    {
        if($Item["Author"].ToString() -like '*wintzer*'){
		'Author' | out-file f:\temp\wintzer.txt -append
		$Item["ID"] | out-file f:\temp\wintzer.txt -append
		$Item["Author"] | out-file f:\temp\wintzer.txt -append}
	if($Item["Editor"].ToString() -like '*wintzer*'){
		'Editor' | out-file f:\temp\wintzer.txt -append
		$Item["ID"] | out-file f:\temp\wintzer.txt -append
		$Item["Editor"] | out-file f:\temp\wintzer.txt -append}
    }
function testField($field)
 {
	if($Item[$field] -ne $null -and $Item[$field].ToString() -like '*wintzer*'){
		$field | out-file f:\temp\wintzer.txt -append
		$Item["ID"] | out-file f:\temp\wintzer.txt -append
		$Item[$field] | out-file f:\temp\wintzer.txt -append}
 }
 <#
 $webUrl = "https://homeportnw.psns.navy.mil/cmdtools/tools/RDR"
    $listName = "Deficiency Reports"
    # Open web and library
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    $items = $list.items
    
	'RDR' | out-file f:\temp\wintzer.txt -append
    foreach ($item in $items)
    {
       testField('Author')
	   testField('Editor')
	   testField('Issuer')
	   testField('AssignedTo')
	   testField('Routing1')
	   testField('Routing2')
	   testField('Routing3')
	   testField('Routing4')
	   testField('Routing5')
	   testField('Routing6')
	   testField('Reviewer')
	   testField('Closing%5Fx0020%5FOfficial')
	   testField('Author')
	   testField('Author')
    }
#>

$webUrl = "https://homeportnw.psns.navy.mil/tools/cats"
    $listName = "CATS Items"
    # Open web and library
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    $items = $list.items
    
	'RDR' | out-file f:\temp\wintzer.txt -append
    foreach ($item in $items)
    {
       testField('Author')
	   testField('Editor')
	   testField('Approver')
	   testField('AssignedTo')
	   testField('Concurrence')
	   testField('Concurrence2')
	   testField('Concurrence3')
	   testField('Concurrence4')
	   testField('Concurrence5')
	   testField('Concurrence6')
	   testField('WorkLead')
    }

<#
	$webUrl = "https://homeportnw.psns.navy.mil/tools/cats"
    $listName = "CATS Items"
    # Open web and library
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    $items = $list.items
    
	'Cats' | out-file f:\temp\wintzer.txt -append
    foreach ($item in $items)
    {
        if($Item["Author"].ToString() -like '*wintzer*'){
		'Author' | out-file f:\temp\wintzer.txt -append
		$Item["ID"] | out-file f:\temp\wintzer.txt -append
		$Item["Author"] | out-file f:\temp\wintzer.txt -append
		}
	if($Item["Editor"].ToString() -like '*wintzer*'){
		'Editor' | out-file f:\temp\wintzer.txt -append
		$Item["ID"] | out-file f:\temp\wintzer.txt -append
		$Item["Editor"] | out-file f:\temp\wintzer.txt -append}
    }
	#>

以上是关于powershell 这将从sharePoint列表中获取Created By(作者)和Modified By(编辑器)的主要内容,如果未能解决你的问题,请参考以下文章

powershell 这将获取SharePoint网站中用于创建网站的模板

powershell 这将为SharePoint创建一个新的Web应用程序

powershell 这将获得与SharePoint列表相关的所有工作流

powershell 这将在sharepoint中创建一个新的自定义列表

powershell 这将检查SharePoint任务列表是否具有电子邮件分配标志

powershell 这将查找并回收SharePoint列表项。也是分组项目的示例。