Calling Nintex-WebService from Powershell

  • 17 November 2014
  • 4 replies
  • 5 views

Badge +1

HI,

 

I'd like to call the Nintex-WebService from Powershell to delegate a task.

 

I'm using my script as shown:

 

$web = Get-SPWeb "http://myWeb" $list = $web.Lists["DelegateTasks"] $myItem = $list.GetItemById(1)  $username = "administrator" $password = "secretWord" $domain = "domain" $taskID = $myItem["Title"] $taskList = $myItem["ListId"] $taskDelegateeSPUser = $myItem["Delegatee"] $taskDelegateUserObject = $userObj = New-Object Microsoft.SharePoint.SPFieldUserValue($web, $taskDelegateeSPUser) $taskDelegatee = $taskDelegateUserObject.User.UserLogin if($taskDelegatee.ToString().Contains("|")) {     $taskDelegatee = $taskDelegatee.ToString().Split("|")[1] } $taskDelegationComment = $myItem["Comment"] $taskNotifyFlag = $false   $wsUrl = $web.Url + "/_vti_bin/NintexWorkflow/Workflow.asmx?WSDL" $proxy = New-WebServiceProxy -Uri $wsUrl $proxy.Credentials = new-object System.Net.NetworkCredential($username, $password, $domain) [xml]$response = $proxy.DelegateTask($taskID, $taskList, $taskDelegatee, $taskDelegationComment, $taskNotifyFlag.ToString()) $web.Dispose()

 

Now I always get: "this task is currently locked by a running workflow and cannot be edited"

 

What can I do? Where is my error?

 

Kind regards,

Markus


4 replies

Badge +3

Hi Markus,

I do have the same problem but with a different issue.

I used the below script but it always errors out stating that the listname is not a valid one. I also provided the list guid id  for the workflow task list name but still the same error.

I am doing this in SharePoint 2013 with Nintex 2013

siteUrl = http://dev.contoso.com/IHS

$url = $siteUrl + "/_vti_bin/nintexworkflow/workflow.asmx"

$ws = New-WebServiceProxy -Uri $url -UseDefaultCredential

$ws.DelegateTask(2602,”Workflow Tasks”, “domainusername”, “Reassigned”, $true);

Error below:

Exception calling "DelegateTask" with "5" argument(s): "Server was unable to

process request. ---> Cannot find task list.

Can you help me identify the mistake I am doing in the below script.?

Badge +1

Hi,

Have you tried to use the guid of your tasklist?

regrads - Markus

Badge +3

Hi Markus,

I tried with guid instead of the workflow task list name, but still it threw the same error

Thanks,

Senthil Kumaresan

Badge +3

Hi,

 

I tried with the ?Wsdl for the below line and it worked.

 

$url = $siteUrl + "/_vti_bin/nintexworkflow/workflow.asmx?WSDL"

 

Thanks,

Senthil Kumaresan

Reply