前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >PowerShell 批量签入SharePoint Document Library中的文件

PowerShell 批量签入SharePoint Document Library中的文件

作者头像
用户1161731
发布2018-01-11 15:53:01
1.3K0
发布2018-01-11 15:53:01
举报
文章被收录于专栏:木宛城主

由于某个文档库设置了编辑前签出功能,导致批量导入文件时这些文件默认的状态都被签出了。如果手动签入则费时费力,故利用PowerShell来实现批量签入Document Library中的文件。

Resolution

代码语言:javascript
复制
Add-PSSnapin Microsoft.SharePoint.PowerShell

function CheckInDocument([string]$url){
    
    $spWeb=Get-SPWeb $url

    $spDocument=$spWeb.Lists.TryGetList("Documents");

    Write-Host "需要签入文件的文档库:$($spDocument.Title)"

    $files=$spDocument.CheckedOutFiles

    Write-Host "需要签入的文件个数:$($files.Count)"

    $files|where{$_.CheckOutStatus -ne "None"}|%{
     
      $_.TakeOverCheckOut();   
      $docItem=$spDocument.GetItemById( $_.ListItemId);
      $docItem.File.CheckIn("Administrator Check In");
      Write-Host "$($docItem.File.Name) Check In" -ForegroundColor Green
    }
    $spWeb.Dispose();
}

CheckInDocument("http://reus");
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2014-06-10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Resolution
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档