CSV files can not be exported from the personal or public view of Sharepoint

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
(System.Reflection.Assembly) :: LoadWithPartialName (& # 39; Microsoft.SharePoint.Client & # 39;) | Out-Null

(System.Reflection.Assembly) :: LoadWithPartialName (& # 39; Microsoft.SharePoint.Client.Runtime & # 39;) | Out-Null
(System.Reflection.Assembly) :: LoadWithPartialName (& # 39; Microsoft.SharePoint.Client.Publishing & # 39;) | Out-Null

$ login = & # 39; DomainName-Here Email-Here.org & # 39;
$ password = ConvertTo-SecureString & # 39; password-here & # 39; -AsPlainText -Force
$ webUrl = & # 39; https: // URL / sites / Tam / List & # 39;
$ listName = & # 39; / ListName / ViewName & # 39;

$ context = New Object Microsoft.SharePoint.Client.ClientContext $ webUrl
Microsoft.SharePoint.Client.SharePointOnlineCredentials $ login, $ password
$ context.Credentials = Name of new object type System.Management.Automation.PSCredential -argumentlist & # 39; $ login & # 39 ;, $ password

$ web = $ context.Web
$ list = $ web.Lists.GetByTitle ($ listName)
Write Host "CompletelURL" $ webUrl $ listName

$ query = New object Microsoft.SharePoint.Client.CamlQuery
$ items = $ list.GetItems ($ query)

$ context.Load ($ items)
$ context.ExecuteQuery ()

$ ListItemCollection = @ ()

$ items | for each {

$ ExportItem = New-Object PSObject

$ ExportItem | Add member -MemberType NoteProperty name "ID" value $("I WOULD")
$ ExportItem | Add member -MemberType NoteProperty name "ClientFullName" value $
( "Client Full Name")
$ ExportItem | Add member -MemberType NoteProperty name "ClientID" value $("Customer ID")
$ ExportItem | Add member -MemberType NoteProperty name "AssignedTo" value $
("Assigned to")
$ ExportItem | Add member -MemberType NoteProperty name "ITTSentDate" value $( "ITTSentDate")
$ ExportItem | Add member -MemberType NoteProperty name "HearReqDueDate" value $
( "HearReqDueDate")
$ ExportItem | Add member -MemberType NoteProperty name "ITTTermReason" value $( "ITTTermReason")
$ ExportItem | Add-Member -MemberType NoteProperty-Name "Source" value $
("Source")
$ ExportItem | Add member -MemberType NoteProperty name "AmendIssueDate" value $( "Amendment Issue Date")
$ ExportItem | Add member -MemberType NoteProperty name AmendReasons value $
( "Amendment Reasons")
$ ExportItem | Add member -MemberType NoteProperty name "RescindIssueDate" value $( "RescindIssueDate")
$ ExportItem | Add member -MemberType NoteProperty name "RescindReason" value $
( "RescindReason")
$ ExportItem | Add member -MemberType NoteProperty name "HearReqRecdDte" value $( "HearReqRecdDte")
$ ExportItem | Add member -MemberType NoteProperty name "HearApprDenied" value $
( "HearApprDenied")
$ ExportItem | Add member -MemberType NoteProperty name "HearDateApprDenied" value $( "HearDateApprDenied")
$ ExportItem | Add member -MemberType NoteProperty name "DeniedReason" value $
( "DeniedReason")
$ ExportItem | Add member -MemberType NoteProperty name "DateSentLegal" value $( "DateSentLegal")
$ ExportItem | Add member -MemberType NoteProperty name "HearSchedNoticeDate" value $
( "HearSchedNoticeDate")
$ ExportItem | Add-Member -MemberType NoteProperty name "HearDate" value $( "Hear Date")
$ ExportItem | Add member -MemberType NoteProperty name "HearReschedDate1" value $
( "HearReschedDate1")
$ ExportItem | Add member -MemberType NoteProperty name "HearReschedDate2" value $ _ ("HearReschedDate2")

$ ListItemCollection + = $ ExportItem

}

$ ListItemCollection | Export Csv -Path C: Path.csv

Error below:

Exception when calling "ExecuteQuery" with "0" arguments: "The remote server returned an error: (401) Unauthorized."
In line: 34 characters: 1
+ $ context.ExecuteQuery ()
+ ~~~~~~~~~~~~~
+ CategoryInfo: NotSpecified: (:) (), MethodInvocationException
+ FullyQualifiedErrorId: WebException

An error occurred while listing a collection: The collection was not initialized. It was not requested or the request was not executed. This may need to be requested explicitly.
In line: 39 characters: 1
+ $ items | for each {
+~~~~~~~~~~~~
+ CategoryInfo: InvalidOperation: (Microsoft.Share … lient.ListItem): d__0) (), RuntimeException
+ FullyQualifiedErrorId: BadEnumeration