2017-02-10 2 views
0

이 Powershell/Office365/SharePoint 자료에 익숙하지 않으므로 여기에 몇 가지 도움을 요청하는 이유가 있습니다. 내가 작업하고있는 문제는 다음과 같습니다. SharePoint의 그룹에 Office365에 있습니다. 여러 사람이 공유하는 문서가 있으며,이 문서에서는 내용이 변합니다. 이 문서를 로컬 컴퓨터로 정기적으로 다운로드하고 싶습니다.Office 365 (Powershell 포함)에서 Sharepoint 그룹의 특정 파일을 다운로드하십시오.

나는이 작업을 위해 PowerShell을 사용하는 것이 가장 좋은 방법이라고 생각했습니다. 그러나 지금까지 PowerShell을 사용하여 Office365에 로그인 할 수있었습니다.

Set-ExecutionPolicy RemoteSigned 
Import-Module Msonline 
$mycred = Get-Credential 
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $mycred -Authentication Basic -AllowRedirection 
Import-PSSession $session 
Connect-MsolService -Credential $mycred 

문제는 : 지금해야 할 일은 무엇입니까? 내가 인터넷 검색을 할 때, 많은 스크립트가 있는데, 모든 사람들이 내가 찾던 것처럼 보이지 않는 다른 기능을 사용하고있다. 나는 또한이 주제에 대한 훌륭한 튜토리얼을 발견하지 못했다.

편집

는 PhilC의 대답은 약간의 도움 만, 누락 된 무언가가 거기에 몇 가지 질문을 발생했습니다.

$sharepointURL="https://somesharepoint-my.sharepoint.com/" 
$SPOUSer="[email protected]" 
$SPOPassword="sometestingpassword" 

// ... 

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client"); 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime"); 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Taxonomy"); 

// ... 

$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($sharepointURL) 
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($SPOUser,$SPOPassword); 

if (!$ctx.ServerObjectIsNull.Value) { 
    Write-Host "Connected to SharePoint Online site: '$sharepointURL'" -ForegroundColor Green 
} 

Write-Host "Load Web ..." 
$web = $ctx.Web 
$ctx.Load($web) 
$ctx.ExecuteQuery() 

Write-Host "Load file ..." 
$file = $ctx.Web.GetFileByServerRelativeUrl("/personal/myuser_email_com/Documents/test1.docx") 
$ctx.Load($file) 
$ctx.ExecuteQuery() 

그러나 몇 가지 질문이 여기에 발생했습니다 :

여기에 추가로 물건 I가 더 부분 후에 추가 한이다

  1. 내가 모두 로그인해야합니까, 마이크로 소프트 오피스 365 및 SharePoint에?

  2. 이 스크립트를 실행하면 다음과 같은 오류 메시지가 나타납니다. Exception calling "ExecuteQuery" with "0" argument(s): "Access denied. Sie haben keine Berechtigung, diesen Vorgang auszuführen oder auf diese Ressource zuzugreifen"이 작업을 수행 할 권한이 없거나이 리소스에 액세스 할 수 없습니다. 내가 뭘 잘못하고있어? Office365에서 만든 파일입니다. 추가 권리가 필요합니까? BTW, 나는 사용자와 물건을 관리하는 관리자가 아닙니다.

추가 참고 : 두 번째 스크립트를, 나는 나와 공유 된 SharePoint 그룹에서 파일을 다음 단계를 수행하기 전에, 내 문서에서 파일을 다운로드하여 다운로드하기위한 작은 예제를 만들고 싶었 .

+0

나는이 게시물에 내 대답을 발견 http://stackoverflow.com/a/25476651/4872413 – kristian

답변