Jaeden Cook
asked on
Separating output values with comma
We have a Powershell script which retrieves contents of a Sharepoint list and generates an output, I need to separate multiple values with a Comma.
emailaddress1@email.com
emailaddress2@email.com
I need help formatting it as:
emailaddress1@email.com , emailaddress2@email.com
$aClient = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$aClientRuntime = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$aClientPub = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Publishing.dll")
$username = "xxxxx"
$password = ConvertTo-SecureString -String 'xxxxx' -AsPlainText -Force
$Url = "https://xxxxxx/sites/"
# SharePoint Online
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext $Url
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials $UserName,$Password
$clientweb = $ctx.Web
$ctx.Load($clientweb)
$ctx.ExecuteQuery()
#Retrieve List
$List = $ctx.Web.Lists.GetByTitle("On Call List")
$qry = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()
$items = $List.GetItems($qry)
$ctx.Load($items)
$ctx.ExecuteQuery()
foreach ($item in $items)
{
$item["Title"]
}
It produces a result formated like this:emailaddress1@email.com
emailaddress2@email.com
I need help formatting it as:
emailaddress1@email.com , emailaddress2@email.com
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.