显示应用程序端点的照片 [英] Displaying a photo for an Application endpoint
问题描述
这是我的问题: 自3个月以来,我从事一个大型UCMA项目,现在我想添加一个小功能.
Here is my problem : I work on a big UCMA project since 3 month and now I would like to add a little feature.
我有很多ApplicationEndpoints可以动态添加,修改或删除,我希望每次创建ApplicationEndpoint时都指定一张图片,该图片将显示在Microsoft Lync上.
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?
谢谢
推荐答案
迟到总比没有好,但是这可能会对某人有所帮助.
Better late than never, but this might help someone.
我不确定这对于应用程序端点是否可行,但是您可以确定为用户端点发布照片设置(我已经做到了,并且可以使用).可以在MSDN上找到有关发布状态的一些基本信息:
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.
在LocalEndpoint.LocalOwnerPresence
上完成发布状态信息(包括照片设置). UserEndpoint
和ApplicationEndpoint
都是从LocalEndpoint
派生的,因此这应该确实可行.
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:
首先,您需要了解很多InstanceID
值,请在此处进行阅读:
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
第二,存在此存在对象的值,请参见Microsoft.Rtc.Collaboration.Presence.PresenceRelationshipLevel
.不要在Unknown
上发布,您会遇到异常.
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,
}
您需要发布用户照片属性的PresenceCategoryWithMetaData
,它是容器0x5
状态信息"的一部分.
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"
});
您也可以在该对象上设置一个ExpiryPolicy
,确实应该是自解释的.然后将此状态对象发布到您的端点上:
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.
这篇关于显示应用程序端点的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!