Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Web Services

Reply
Contributor
Posts: 11
Registered: ‎07-29-2013
My Device: BlackBerry 10
My Carrier: Verizon
Accepted Solution

Create User in BlackBerry 5 environment

I'm trying to create a user in the Blackberry 5 environment.  I'm converting the code from c# to vb.NET.  In c# the code works, but I can't get two lines to convert to bb.NET.

 

Below, I have a snippet of the code that is giving me errors. The red, bold, underlined code is the problem code, and below it in purple is the actual error message.  I need help on getting this code written in vb.NET.

 

Dim request2 AsNew BAAServiceEmailExchange.gatherEnableBlackBerryUserAttributes()

request2.result = userAccount

request2.locale ="en_US"

       

Dim result2 As BAAServiceEmailExchange.GatherEnableBlackBerryUserAttributesResult = emailExchangeWebService.gatherEnableBlackBerryUserAttributes(request2).returnValue

       

If Not (result2.gatherEnableBlackBerryUserAttributesReturnStatus.code = BAAServiceEmailExchange.GatherEnableBlackBerryUserAttributesReturnStatusEnumType.SUCCESS) Then

           

Return False

       

EndIf

       

Dim createUserRequest As New BAAServiceCore.createUser

       

Dim userEnableBBAttributes As New BAAServiceCore.UserEnableBlackBerryAttributes()

        userEnableBBAttributes.enableBlackBerryUserAttributes = BAAServiceCore.EnableBlackBerryUserAttributesType(result2.enableBlackBerryUserAttributes.Length)

  The Error is: EnableBlackBerryUserAttributesType Is a type in BAAServiceCore and cannot be used as an expression

       

Dim userAttrType(result2.enableBlackBerryUserAttributes.Length) As BAAServiceCore.EnableBlackBerryUserAttributesType

        userEnableBBAttributes.enableBlackBerryUserAttributes = userAttrType

       

For j AsInteger = 0 To result2.enableBlackBerryUserAttributes.Length - 1

            userEnableBBAttributes.enableBlackBerryUserAttributes(j) = result2.enableBlackBerryUserAttributes(j)

       The Error is:  value of type: BAAServiceEmailExchange.EnableBlackBerryUserAttributesType cannot be converted to BAAServiceCore.EnableBlackBerryUserAttributesType

Next

Contributor
Posts: 11
Registered: ‎07-29-2013
My Device: BlackBerry 10
My Carrier: Verizon

Re: Create User in BlackBerry 5 environment

Ok, I figured the first error out.

 

Old Line:

 

userEnableBBAttributes.enableBlackBerryUserAttributes = BAAServiceCore.EnableBlackBerryUserAttributesType(result2.enableBlackBerryUserAttributes.Length)

 

New Line:

 

userEnableBBAttributes.enableBlackBerryUserAttributes = New BAAServiceCore.EnableBlackBerryUserAttributesType(result2.enableBlackBerryUserAttributes.Length) {}

 

I still need help with the second error.

 

Thanks

Contributor
Posts: 11
Registered: ‎07-29-2013
My Device: BlackBerry 10
My Carrier: Verizon

Re: Create User in BlackBerry 5 environment

Ok, I resolved the problem with the following line:

 

userEnableBBAttributes.enableBlackBerryUserAttributes = BAAServiceCore.EnableBlackBerryUserAttributesType(result2.enableBlackBerryUserAttributes.Length)

  The Error is: EnableBlackBerryUserAttributesType Is a type in BAAServiceCore and cannot be used as an expression

 

I set up web references for each of the 4 web services.  It turns out that the Namespace (the BAAServiceCore.) is the culprit, as you cannot share types across multiple web services.  So I created a dll library using the proxy.cs file (from the sample code) and added a reference to that dll, removed the web references, and removed the Namespace in every case (e.g. BAAServiceCore.EnableBlackBerryUserAttriibutesType became EnableBlackBerryUserAttributesType).  I hope this helps someone else