Use vCloud API Version 27.0 with .NET

329 Views Asked by At

I'm using the vCloud API to create an organization, organization user, virtual data center, edge gateway, and organization network.

In vCloud Director 8.2, there are now global roles and organization roles. The roles I am getting back with my API call are the global roles. When I am creating a user, I want the organization roles.

My co-worker and I have determined that it isn't possible to pull back the organization roles unless you use version 27.0 of the API. I'm using the latest version of the SDK, which is 9.0 for use with vCloud Director 8.1.

How can I specify that I'd like to use the version 27.0 of the API? If that's not possible, is there a different way to accomplish what I need? Thanks!

    private static UserType SetUserProperties(OrgUser orgUser)
    {
        UserType user = new UserType();
        user.name = orgUser.VCloudUsername;
        user.Role = GetRole();
        user.Password = orgUser.Password;
        user.EmailAddress = orgUser.Email.ToLower();
        user.IsEnabledSpecified = true;
        user.IsEnabled = true;
        user.FullName = orgUser.FullName;
        return user;
    }

 private static ReferenceType GetRole()
        {
            try
            {
                foreach (ReferenceType roleRef in admin.GetRoleRefs())
                {
                    if (roleRef.name == "Organization Administrator")
                    {
                        return roleRef;
                    }
                }
                return null;
            }
            catch (Exception ex)
            {
                throw new VCloudException(ex.Message);
            }
        }
0

There are 0 best solutions below