zoukankan      html  css  js  c++  java
  • PowerShell 批量签入SharePoint Document Library中的文件

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

    Resolution

    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");
  • 相关阅读:
    顺序栈用C语言实现
    对队列的操作和算法
    对链表的操作与算法
    对动态数组的操作与算法
    链表
    冒泡排序
    指针之动态分配内存
    字符串匹配KMP算法
    DS二叉树--层次遍历
    DS图--最小生成树
  • 原文地址:https://www.cnblogs.com/OceanEyes/p/powershell-check-in-files-batch.html
Copyright © 2011-2022 走看看