VMware {code} Community
ronsween
Contributor
Contributor

Help Executing Workflow from C#

Hello,

I am continually getting Invalid Parameter trying to execute this workflow from C#, additionally the values are not being set though I see the values in the request

XML that are being sent in the request message.

The workflow accepts input of username and groupname, and will add a user to a group when executed.  Both values are of type AD:UserGroup and AD:User (strings).        

Can anybody shed any light as to what I am doing wrong in the following code ?

                       WindowsFormsApplication1.GAR.VSOWebControlService bleh = new WindowsFormsApplication1.GAR.VSOWebControlService();


            //WindowsFormsApplication1.GAR.VSOWebControlService.

            WindowsFormsApplication1.GAR.Workflow[] gar = bleh.getWorkflowsWithName("SSOP","administrator","********");

            MessageBox.Show(gar[0].id.ToString());

            //WindowsFormsApplication1.GAR.WorkflowToken

            WindowsFormsApplication1.GAR.WorkflowTokenAttribute[] inParameters = new WindowsFormsApplication1.GAR.WorkflowTokenAttribute[gar[0].inParameters.Length];

            WindowsFormsApplication1.GAR.WorkflowTokenAttribute singer = new WindowsFormsApplication1.GAR.WorkflowTokenAttribute();

            singer.name = "userGroup";

            singer.type = "AD:UserGroup";

            singer.value = "FLASH";

            WindowsFormsApplication1.GAR.WorkflowTokenAttribute tinger = new WindowsFormsApplication1.GAR.WorkflowTokenAttribute();

            string[] strArray = new string[] { "ron" };

            tinger.name = "users";

            tinger.type = "AD:User";

            tinger.value = "ron";

            //inParameters[0] = singer;

            //inParameters[1] = tinger;

            string username = "Administrator";

            string password = "***********";

            inParameters.SetValue(singer, 0);

            inParameters.SetValue(tinger, 1);

            WindowsFormsApplication1.GAR.WorkflowToken bing = bleh.executeWorkflow(gar[0].id.ToString(), username, password, inParameters);

            MessageBox.Show(bing.xmlContent.ToString());

Reply
0 Kudos
1 Reply
tschoergez
Leadership
Leadership

Hi Ron!

I think, you cannot specify an AD-User just via string.... you have to use the find-methods to get it from the vco-inventory (comparable to VMs for example).

To make sure the rest of you code is correct: Can you try it with another workflow which just has Strings as input type?

Regards,

Joerg

Reply
0 Kudos