Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $SiteURL = "http://vmsrvr1:28516/"
- Write-Host "Loading CSOM libraries" -foregroundcolor black -
- backgroundcolor
- yellow
- Add-Type -Path "c:Program FilesCommon Filesmicrosoft sharedWeb
- Server Extensions15ISAPIMicrosoft.SharePoint.Client.dll"
- Add-Type -Path "c:Program FilesCommon Filesmicrosoft sharedWeb
- Server Extensions15ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
- Write-Host "Lib. successfully loaded !" -foregroundcolor black -
- backgroundcolor Green
- $scriptPath = "D:PoCSolutions"
- $User = "mydomainadminuser1" #Read-Host -Prompt "username"
- $password = Read-Host -Prompt "Enter password" -AsSecureString
- Write-Host "Trying to reach $SiteURL // Handling ClientContext..." -
- foregroundcolor black -backgroundcolor yellow
- $Context = New-Object
- Microsoft.SharePoint.Client.ClientContext($SiteURL)
- $credentials = New-Object
- Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,
- $password)
- $Context.Credentials = $credentials
- $context.RequestTimeOut = 5000 * 60 * 10;
- $web = $context.Web
- $site = $context.Site
- $context.Load($web)
- $context.Load($site)
- try
- {
- $context.ExecuteQuery()
- Write-Host "Connected !" -foregroundcolor black -backgroundcolor
- Green
- }
- catch
- {
- Write-Host "Impossible to reach $SiteURL : bad password ?" -
- foregroundcolor black -backgroundcolor Red
- return
- }
- $list = $web.Lists["APT"];
- $fields = $list.Fields;
- $list.Fields | select InternalName | Export-Csv -path ./blabla.csv;
- Write-Host "Done !" -foregroundcolor black -backgroundcolor Green
Add Comment
Please, Sign In to add comment