Displaying a photo for an Application endpoint

做~自己de王妃 提交于 2020-01-11 11:08:58

问题


Here is my problem : I work on a big UCMA project since 3 month and now I would like to add a little feature.

I have a lot of ApplicationEndpoints which can be added, modified or deleted dynamically and I would like, each time that I create an ApplicationEndpoint, to specify a picture which will be displayed on Microsoft Lync.

I already have a lot of other functionnalities but I'd really like to have this one.

I searched for days but I didn't find anything so before telling myself that it can't be done, I wanted to ask !

Does anyone know if that is possible ? In that case, could you show me the way to do it?

Thank you


回答1:


Better late than never, but this might help someone.

I'm not sure if this is possible for an application endpoint, but you can publish photo settings for a user endpoint for sure (I have done this and it works). Some basic info on publishing presence can be found on MSDN: Publishing Presence.

Publishing presence information (which includes photo settings) is done on the LocalEndpoint.LocalOwnerPresence. Both UserEndpoint and ApplicationEndpoint derive from LocalEndpoint, so this should be doable really.

The actual publishing gets slightly complex because there are a lot of different combinations of 'levels' to publish on:

First, there are a bunch of InstanceID values that you need to know about, read up on them here: Presence data source and category instance ID

Second, there is a value for who this presence applies to, see Microsoft.Rtc.Collaboration.Presence.PresenceRelationshipLevel. Don't publish on Unknown, you'll get an exception.

public enum PresenceRelationshipLevel  
{  
    Unknown = -1,  
    Everyone = 0,  
    External = 100,  
    Colleagues = 200,  
    Workgroup = 300,  
    Personal = 400,  
    Blocked = 32000,  
}

You need to publish a PresenceCategoryWithMetaData for the user photo properties, which is part of container 0x5, "Presentity information".

var photoPresence = new PresenceCategoryWithMetaData(
    0x5, // The container id
    (int)PresenceRelationshipLevel.Everyone,
    new ContactCard(0x5) // Same container ID again
    {
        IsAllowedToShowPhoto = true,
        PhotoUri = "<uri to your photo here"
    });

You can set an ExpiryPolicy on this object too, should be self explainatory really. Then publish this presence object on your endpoint:

Endpoint.LocalOwnerPresence.BeginPublishPresence(new[] { photoPresence  }, cb => { 
    Endpoint.LocalOwnerPresence.EndPublishPresence(cb);
}, null);

And that should do it, really. I ended up explicitly publishing to all relationship levels because it didn't cascade the data as logically expected. This turned into quite a lengthy reply, also for my own future reference. Please let me know if this works for app endpoints too.




回答2:


Pretty sure that you can't do this. Because it's an Application Endpoint, by definition it isn't related to any one particular user. It would certainly be nice though. :)



来源:https://stackoverflow.com/questions/11398689/displaying-a-photo-for-an-application-endpoint

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!