TomaszPoszytek
Automation Master
Automation Master

Re: How can I schedule a workflow to daily in office 365?

Jump to solution

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

0 Kudos
Reply
freerider38
Forms Fledgling

Re: How can I schedule a workflow to daily in office 365?

Jump to solution

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

Reply
bamaeric
Nintex Employee
Nintex Employee

Re: How can I schedule a workflow to daily in office 365?

Jump to solution

I have used this solution from  with much success: Scheduled Workflows in Office 365

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How can I schedule a workflow to daily in office 365?

Jump to solution

Deewaker have our answers helped you? If so, can you choose one and mark it as "Correct" please?

Regards,

Tomasz

0 Kudos
Reply
deewaker
Nintex Newbie

Re: How can I schedule a workflow to daily in office 365?

Jump to solution

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.

0 Kudos
Reply
clavinfernandes
Cloud Wanderer

Re: How can I schedule a workflow to daily in office 365?

Jump to solution
0 Kudos
Reply
vadim_tabakman
Nintex Employee
Nintex Employee

Re: How can I schedule a workflow to daily in office 365?

Jump to solution
0 Kudos
Reply