WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Translate VB Default Member Name


Question:

Hi, can someone help with the translation from vb to WB.

Now the latest version of winbatch is similar in the way VB is in terms of handling objects with "."'s etc I want to bring the code below back in to Winbatch,

The code:-

IMUserAdmin = CreateObject("MSExchangeIM.IMUserAdmin")
IMServers = CreateObject("MSExchangeIM.IMServers")
IMVirtualServer = IMServers("BBCXM1001").VirtualServers(1)
MyUser = GetObject(sobjectpath)
IMUserAdmin.EnableUser MyUser, loginid, "im.core.bbc.co.uk", IMVirtualServer
MyUser.SetInfo
The first 2 lines are OK, I get an Expression continues past expected end for the line:-
IMVirtualServer = IMServers("BBCXM1001").VirtualServers(1)
I assume I will also get a similar error on the second from last line:-
IMUserAdmin.EnableUser MyUser, loginid, "im.core.bbc.co.uk", IMVirtualServer
Please can you advise ?

Answer:

I suspect that you have encountered the "default member" issue. You need to change the line:
IMVirtualServer = IMServers("BBCXM1001").VirtualServers(1)
to the include the name of the default property for the IMServers object. I don't have access to the type information for the object but the syntax should be something like:
IMservers.defaultmembername("BBCXM1001").VirtualServers(1)
where "defaultmembername" is the default member for the object IMServers. You should be able to find this out using a type browser or checking documentation.

While WB does support easy translation from VB, it does not support the default member syntax sometimes used in VB examples. This is partially because WB does not have a "Set" command. This does not restrict WB's COM functionality, it just requires you to find the object member actually being called by VB's default object syntax.


Article ID:   W16560
File Created: 2005:02:18:12:21:28
Last Updated: 2005:02:18:12:21:28