Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to checkout file using PowerShell REST API in SharePoint Server 2013 located in subsite?

$
0
0
I'm trying to check out file which is located inside document library under sub site.

Site URL : mymainsite/subsite/subsite/My Library/test.xlsx

I'm using below PowerShell script

    function CheckOutFile($filePath) {
        Write-Host "CheckOut file is in process"
   
   
        $response = PostRequest ("/_api/web/getFileByServerRelativeUrl('/My Library/test.xlsx')/CheckOut()") (ConvertTo-Json @{ 
            __metadata = @{ type= "SPFile" }
            ServerRelativeUrl = "/My Library/test.xlsx"
        })
    }

**Note:** If I'm trying to checkout in root site library then it is working fine when I'm referring to subsite library it showing "The remote server returend error :(400)Bad request".

What I'm doing wrong here :(


 

Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>