Forum Discussion
Audi86
Aug 25, 2022Brass Contributor
Converting code to run on single item by disabling for loop
hi, Below i have a chunk of code which is running on each item in my SharePoint online classic document library using a for loop. I want to modify it as a test to run on a single ite...
- Aug 26, 2022After line 36 with a if ($ListItem | where id -eq 10) {
Aug 26, 2022
Ok... Screenshot?
Audi86
Aug 26, 2022Brass Contributor
- Aug 29, 2022Good to hear 🙂
- Audi86Aug 29, 2022Brass ContributorHarm_Veenstra
that worked! thanks - Aug 26, 2022After line 36 with a if ($ListItem | where id -eq 10) {
- Audi86Aug 26, 2022Brass Contributorthis part is just displaying the results.
i am also suggested by someone to try using
$ListItem | where id -eq 10
but not sure how to put it or use it in my case - Aug 26, 2022Something in this part or in the ctx.executequery ?
[PSCustomObject] @{
ItemID = $ListItem.ID
Status = $WorkflowInstance.Status
WorkflowStarted = $WorkflowInstance.InstanceCreated
WorkflowAssociation = $WorkflowAssociations | where {$_.ID -eq $WorkflowInstance.WorkflowSubscriptionId} | Select -ExpandProperty Name
ItemUrl = "$($Web.Context.Web.Url)/$($workflowInstance.Properties["Microsoft.SharePoint.ActivationProperties.CurrentItemUrl"])"
StartedBy = $workflowInstance.Properties["Microsoft.SharePoint.ActivationProperties.InitiatorUserId"]
}