process{if($ClientContext-eq$null){throw"Cannot bind argument to parameter 'ClientContext' because it is null."}if($PSCmdlet.ParameterSetName-eq'All'){$Caml=New-objectMicrosoft.SharePoint.Client.CamlQueryif($PSBoundParameters.ContainsKey('FolderUrl')){$Caml.FolderServerRelativeUrl=$FolderUrl}$XmlDocument=New-ObjectSystem.Xml.XmlDocument$ViewElement=$XmlDocument.AppendChild($XmlDocument.CreateElement('View'))if($PSBoundParameters.ContainsKey('Scope')){$ViewElement.SetAttribute('Scope',$Scope)}if($PSBoundParameters.ContainsKey('ViewFields')){$ViewFieldsElement=$ViewElement.AppendChild($XmlDocument.CreateElement('ViewFields'))foreach($ViewFieldin$ViewFields){$FieldRefElement=$ViewFieldsElement.AppendChild($XmlDocument.CreateElement('FieldRef'))$FieldRefElement.SetAttribute('Name',$ViewField.GetValue($ClientContext))}}if($PSBoundParameters.ContainsKey('Query')){$QueryElement=$ViewElement.AppendChild($XmlDocument.CreateElement('Query'))$QueryElement.InnerXml=$Queryif($QueryElement.FirstChild.Name-eq'Query'){$QueryElement=$QueryElement.FirstChild}}if($PSBoundParameters.ContainsKey('RowLimit')){$RowLimitElement=$ViewElement.AppendChild($XmlDocument.CreateElement('RowLimit'))$RowLimitElement.InnerText=$RowLimit}if($PSBoundParameters.ContainsKey('Position')){$Caml.ListItemCollectionPosition=$Position}$Caml.ViewXml=$XmlDocument.InnerXml$ClientObjectCollection=$ParentObject.ClientObject.GetItems($Caml)Invoke-ClientContextLoad`-ClientContext$ClientContext`-ClientObject$ClientObjectCollection`-Retrieval$RetrievalWrite-Output$ClientObjectCollection-NoEnumerate:$NoEnumerate}if($PSCmdlet.ParameterSetName-eq'Identity'){$PathMethod=New-ObjectMicrosoft.SharePoint.Client.ObjectPathMethod(`$ClientContext,`$ParentObject.ClientObject.Path,`'GetItemById',`[object[]]$Identity)$ClientObject=New-ObjectMicrosoft.SharePoint.Client.ListItem($ClientContext,$PathMethod)Invoke-ClientContextLoad`-ClientContext$ClientContext`-ClientObject$ClientObject`-Retrieval$RetrievalWrite-Output$ClientObjecttrap{throw'The specified list item could not be found.'}}if($PSCmdlet.ParameterSetName-eq'IdentityGuid'){$Caml=New-objectMicrosoft.SharePoint.Client.CamlQuery$Caml.ViewXml=`'<View Scope="RecursiveAll">'+`'<RowLimit>1</RowLimit>'+`'<Query>'+`'<Where>'+`'<Eq>'+`'<FieldRef Name="UniqueId"/>'+`'<Value Type="Guid">'+$IdentityGuid+'</Value>'+`'</Eq>'+`'</Where>'+`'</Query>'+`'</View>'$ClientObjectCollection=$ParentObject.ClientObject.GetItems($Caml)Invoke-ClientContextLoad`-ClientContext$ClientContext`-ClientObject$ClientObjectCollection`-Retrieval$Retrievalif($ClientObjectCollection.Count-eq0){throw'The specified list item could not be found.'}Write-Output$ClientObjectCollection[0]}}