设置自定义状态 [英] Setting Custom Presence
问题描述
我已使用Office Communicator部署指南配置自定义状态并使用客户端进行设置。特别是我想这样做是为了提供可用的自定义字符串,例如"在家工作"。这工作正常。
我有一个小应用程序,我希望能够以编程方式执行此操作,但到目前为止还没有。下面是一段示例代码。
CommunicatorAPI.Messenger communicator = new CommunicatorAPI.Messenger();
string mySignName = communicator.MySigninName;
IMessengerContactAdvanced contact =(IMessengerContactAdvanced )communicator.GetContact(mySignName,communicator.MyServiceId);
object [] mPP = new object ;
字符串mBusy ="在通话中";
1:
mPP [(int)PRESENCE_PROPERTY.PRESENCE_PROP_AVAILABILITY] = 3000;
mPP [(int)PRESENCE_PROPERTY.PRESENCE_PROP_CUSTOM_STATUS_STRING] ="在家工作";
contact.PresenceProperties =(object)mPP;
break;
case 2:
mPP [(int)PRESENCE_PROPERTY.PRESENCE_PROP_AVAILABILITY] = 6500;
mPP [(int)PRESENCE_PROPERTY.PRESENCE_PROP_CUSTOM_STATUS_STRING] ="去吃午饭";
contact.PresenceProperties =(对象)mPP;
break;
}
catch(例外e)< br> {
Debug.WriteLine(e.StackTrace);
Debug.WriteLine(e.Message);
Debug.WriteLine(e.InnerException);
我可以看到我的状态更改,但它只更改为Available或Busy,并且不会显示我设置的字符串。我做错了什么或者我可以这样做吗?
感谢任何帮助。
Rory
Hi,
I have used the Office Communicator Deployment guide to configure custom presence states and set them using the client. In particular I want to do this to have custom string set for availibility such as 'Working from home'. This worked fine.
I have a small application and I want to be able to do this programitically, but so far have not been able to. Below is a piece of sample code.
CommunicatorAPI.Messenger communicator = new CommunicatorAPI.Messenger();
string mySignName = communicator.MySigninName;
IMessengerContactAdvanced contact = (IMessengerContactAdvanced)communicator.GetContact(mySignName, communicator.MyServiceId);
object[] mPP = new object;
string mBusy = "In a call";
try
{
switch (state)
{
case 1:
mPP[(int)PRESENCE_PROPERTY.PRESENCE_PROP_AVAILABILITY] = 3000;
mPP[(int)PRESENCE_PROPERTY.PRESENCE_PROP_CUSTOM_STATUS_STRING] = "Working from home";
contact.PresenceProperties = (object)mPP;
break;
case 2:
mPP[(int)PRESENCE_PROPERTY.PRESENCE_PROP_AVAILABILITY] = 6500;
mPP[(int)PRESENCE_PROPERTY.PRESENCE_PROP_CUSTOM_STATUS_STRING] = "Gone to lunch";
contact.PresenceProperties = (object)mPP;
break;
}
}
catch (Exception e)
{
Debug.WriteLine(e.StackTrace);
Debug.WriteLine(e.Message);
Debug.WriteLine(e.InnerException);
}
I can see my presence state change but it changes to Available or Busy only and the string I set does not appear. Am I doing something wrong or can I do it this way?
Any help appreciated.
Thanks
Rory
推荐答案
PRESENCE_PROP_AVAILABILITY属性只能设置为其中一个值,根据以下页面 http://msdn.microsoft.com/en-us/library/bb787249.aspx
The PRESENCE_PROP_AVAILABILITY property can only be set to one of these values, according to the following page http://msdn.microsoft.com/en-us/library/bb787249.aspx
这篇关于设置自定义状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!