Hehe, there is no "on the server" when speaking about O365 tenant
I mean - not the tenant server. But the script can be hosted on any other server with SharePoint Online PowerShell console
Regards,
Tomasz
Sure it's not on the tenant server of course but a server in your organization, or in azur, etc ... and SP Online PowerShell or PowerShell + CSOM, etc
Ex with Powershell + CSOM
$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$username = ""
$password = ""
$url1="https://xxx.sharepoint.com/"
$bib = "your_bib"
function ActiveWorkflow($adresse) {
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($adresse)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $(convertto-securestring $Password -asplaintext -force))
Try
{
$list = $ctx.get_web().get_lists().getByTitle($bib)
$ctx.Load($list)
$camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
$camlQuery.ViewXml = '<View><Query><Where><Eq><FieldRef Name="WF_Start" /><Value Type="Integer">0</Value></Eq></Where></Query></View>'
$items = $list.GetItems($camlQuery)
$ctx.Load($items)
$ctx.ExecuteQuery()
for ($i = 0; $i -lt $items.Count; $i++) {
$spItem =$list.GetItemById($items[$i].Id)
$ctx.Load($spItem)
$ctx.ExecuteQuery()
$spItem.set_item("WF_Start",1)
$spItem.update()
$ctx.ExecuteQuery()
}
}
Catch
{
[system.exception]
$ErrorMessage = $_.Exception.Message
Write-Host "Erreur dans le traitement : " $ErrorMessage
}
}
ActiveWorkflow $url1
I have used this solution from with much success: Scheduled Workflows in Office 365
Deewaker have our answers helped you? If so, can you choose one and mark it as "Correct" please?
Regards,
Tomasz
Thanks everyone. It helped a lot.
I created a site workflow with a loop and pause actions. I have a set a date until the workflow will run. The pause action will pause it for 24 hrs so that the logic could execute every 24 hrs. Hence both the problem got resolved.
It's in the road-map see: Schedule Site Workflow – Customer Feedback for Nintex