silverlight - MyGroups not implemented in Communicator.UIAutomation -


i'm working on out of browser silverlight app provides ms office communicator 2007 controls. i'm using automation sdk. docs installed sdk state there's mygroups property in imessenger2 interface, return groups user has defined, when try use it, notimplementedexception. here's code i'm using:

dynamic communicator = automationfactory.createobject("communicator.uiautomation"); communicator.autosignin(); foreach (dynamic g in communicator.mygroups) {     //do group } 

if replace mygroups mycontacts, can contact list fine. have different access properties in imessenger2 interface? i've seen few things on web mygroups deprecated windows messenger, docs, seems should available ms office communicator.

if can't use mygroups, there way groups user has created?

the problem here mygroups property marked notscriptable, meaning can't call in way doing i.e. using automationfactory. security reasons, properties , methods in automation api not scriptable - avoid malicious pages automating communicator , carrying out tasks without knowing.

it looks com interop in silverlight treated in same way e.g. creating , calling api vbscript, won't able access of non-scriptable properties , methods. see reference details of properties , methods not scriptable.

i'm guessing going hobble app. think what's hurting decision go silverlight oob. there way use wpf (or winforms) rather silverlight? if did this, reference api directly, , have full access properties/methods.

otherwise, can't think of many options. can't trap oncontactaddedtogroup event, not scriptable.

it might possible wrap api .net assembly, , expose via com, instantiate in same way - not scriptable might still respected in case, won't buy anything. hard without trying it, , still horrible solution.

edit: i've given wrapper method try (needed similar proof of concept customer), , seems work. way did it:

create new .net class library. define com interface:

[comvisible(true)] [guid("8999f93e-52f6-4e29-ba64-0adc22a1fb11")] public interface icomm {     string getmygroups(); } 

define class implements interface (you'll need reference communicatorapi.dll sdk):

[comvisible(true)] [classinterface(classinterfacetype.none)] [guidattribute("c5c5a1a8-9bfb-4ce5-b42c-4e6688f6840b")] [progid("test.comm.1")] public class comm : icomm {     public string getmygroups()     {         var comm = new communicatorapi.messengerclass();          var groups = comm.mygroups imessengergroups;         return string.join(", ", groups.oftype<imessengergroup>().select(g => g.name).toarray());     } } 

build, , register using regasm. call oob silverlight app:

dynamic communicator = automationfactory.createobject("test.comm.1"); messagebox.show(communicator.getmygroups()); 

note, same technique works using lync api:

public string getmygroups() {     var comm = lyncclient.getclient();     return string.join(", ", comm.contactmanager.groups.select(g => g.name).toarray()); } 

although works, can't whether it's practice, it's working around security restriction presumably there reason. guess worst happen malicious web page potentially use component, if knew progid of control.

edit: also, using method you'd need careful memory leaks, e.g. make sure you're releasing com objects when you're finished them - easy enough do, needs little discipline ;o)


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -