cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
markus79
Nintex Newbie

Calling Nintex-WebService from Powershell

Jump to solution

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

Labels: (2)
0 Kudos
Reply
5 Replies
netsenthil
Nintex Newbie

Re: Calling Nintex-WebService from Powershell

Jump to solution

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”, “domain\username”, “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.?

0 Kudos
Reply
markus79
Nintex Newbie

Re: Calling Nintex-WebService from Powershell

Jump to solution

Hi,

Have you tried to use the guid of your tasklist?

regrads - Markus

0 Kudos
Reply
netsenthil
Nintex Newbie

Re: Calling Nintex-WebService from Powershell

Jump to solution

Hi Markus,

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

Thanks,

Senthil Kumaresan

0 Kudos
Reply
Not applicable

Re: Calling Nintex-WebService from Powershell

Jump to solution

What is your workflow design?

Basically it because the delegate task cannot obtain lock from workflow for editing. Please refer to this for information: Task Lock - Task is locked by a running workflow and cannot be edited

0 Kudos
Reply
netsenthil
Nintex Newbie

Re: Calling Nintex-WebService from Powershell

Jump to solution

Hi,

 

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

 

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

 

Thanks,

Senthil Kumaresan

0 Kudos
Reply