$web = Get-SPWeb "http://spsapp/mti-blog"

$list = $web.Lists["Posts"]

$posts = $list.Items

foreach ($post in $posts)

{ $createdby4 = $post["createdby4"] #createdby4 is my list column

if (($createdby4 -ne $Null) -and ($createdby4.Contains("i:0.w|soe")))

{

$createdby4 = $createdby4.SubString($createdby4.IndexOf("\") + 1)

$post["createdby4"] = $createdby4

$post.Update()

}

}

$web.Dispose()

 

请注意脚本中的判断条件等都是基于我当前的业务需求来的,不要被confused了。 另外,要使用这个脚本,可以新建一个后缀为ps1的文件,保存,运行sharepoint powershell,set-location到你保存ps1的文件的路径, 如set-location c:\myps1, 然后可以get-childitem,来显示当前路径的文件,然后以如下格式执行你的脚本:.\yourps1filename.ps1

相关文章:

  • 2022-12-23
  • 2021-07-16
  • 2021-11-21
  • 2022-03-08
  • 2021-10-08
  • 2021-08-14
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-12-23
  • 2021-06-06
  • 2021-11-22
相关资源
相似解决方案