株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

spodownload.ps1
[ System.Reflection。アセンブリ] :: LoadWithPartialName "Microsoft.
SharePoint.Client" | Out-Null [ System.Reflection。アセンブリ] :: 
LoadWithPartialName "Microsoft.SharePoint.Client.Runtime" | アウトヌル  
  

$ pass = convertto-securestring "password" -AsPlainText -Force 
$ credentials = New-Object Microsoft.SharePoint.Client.
SharePointOnlineCredentials "userAccount" $ pass $ cookieValue = 
$ credentials GetAuthenticationCookie "https://xxxxxxx.sharepoint.
com/sites/site/"      
    
  

$ cookieValue = $ cookieValue "SPOIDCRL =" "" $ cookie = New-Object System.Net.Cookie 
$ cookieを置き換えます。
Name = "SPOIDCRL" $ cookie = $ cookieValue  
   
  
  

$ cookieContainer = New-Object System.net.CookieContainer 
$ cookieContainer 追加"https://xxxxxxx.sharepoint.com/sites/site/" $クッキー   


$ request = [ System.Net。WebRequestクラス] :: 作成します
"https://xxxxxxx.sharepoint.com/sites/site/Shared%20Documents/
test.xlsx" $リクエストをCookieContainer = $ cookieContainer 
$ response = $ request GetResponse ()$ responseStream = $ response GetResponseStream ()  
  
  
  

$ outputFile = [ System.IO。ファイル] :: 
作成"C:\ work \ test.xlsx" $ Buffer = New-Object Byte [] 1024 Do { 
$ BytesRead = $ responseStream 読む$バッファ0 $バッファ$ OUTPUTFILE Write $ Buffer 0 $ BytesRead } While $ BytesRead -gt 0   
    

 
        
      
    

$ responseStream ()$ responseStreamを閉じます処分()


$ outputFile Flush ()$ outputFile ()$ outputFileを閉じます処分()


参考

https://teratail.com/questions/79342

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)