Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6037875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:08:15+00:00 2026-05-23T06:08:15+00:00

I’m writing a UCMA 2.0 application which connects with a ‘UserEndpoint’ to OCS. I

  • 0

I’m writing a UCMA 2.0 application which connects with a ‘UserEndpoint’ to OCS. I want to be able to set a custom presence message along with my availability!

I’ve run into some issues along the way and spent a lot of time Googling and tried out a few articles, the majority seem to be saying the same thing (including MS themselves):

Use XML to set the ‘userState’ activity to be custom and contain a message, then publish that in a custom category via the endpoint’s ‘LocalOwnerPresence.BeginPublishPresence’ method.

I don’t get any errors back from OCS when I do this (see the XML example below), but looking at the presence in Office Communicator (MOC) the user in question continues to appear offline. I have found that also publishing the ‘machineState’ means that we see some presence icon in MOC, but alas, I can’t get the custom activity message working.

More reading sent me on wild goose chases, such as stored procs in the OCS DB that need to be run to allow this (sounded more like for adding brand new presence categories rather than just a custom message to an existing state). I’m kind of at the end of my tether after a day ‘online’.

Any help or pointing out any gotchas would be appreciated! I’ve included a few of the sites I used when reading up on this:

Presence Intro: http://msdn.microsoft.com/en-us/library/dd253506(v=office.13).aspx

Publishing Presence: http://msdn.microsoft.com/en-us/library/dd253494(v=office.13).aspx

Presence + Custom messages: http://blogs.claritycon.com/blog/2009/03/04/how-to-publish-presence-using-ucma-v2-0-and-have-a-clever-communicator-status/

Machine state ideas: http://social.msdn.microsoft.com/Forums/en-US/ucmanagedsdk/thread/d3bd3569-66c0-4b52-86f0-900d2fb6d22e/

Presence Schema doc: http://msdn.microsoft.com/en-us/library/dd941536(v=office.13).aspx

Here’s the XML (string) that I’m using in my code, on the fly I string.Format the placeholders with a custom message and an availability integer value (“test message” and 3500 for the sake of argument).

string userStateXmlFormat = "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" manual=\"true\" xsi:type=\"userState\">\n"
            + "<availability>{0}</availability>\n"
                + "<activity>\n" 
                   + "<custom xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\">{1}</custom>\n" 
                + "</activity>\n"
            + "</state>";

Here’s the C# that does the formatting, and attempting to publish the presence:

var machineStateXml = string.Format(machineStateXmlFormat, 3500);
var userStateXml = string.Format(userStateXmlFormat, 3500, "Test Message");
var machineState = new CustomPresenceCategory("state", machineStateXml);
var userState = new CustomPresenceCategory("state", userStateXml);                
PresenceCategory[] categoriesToPublish = new PresenceCategory[] { machineState, userState };
this.Endpoint.LocalOwnerPresence.BeginPublishPresence(categoriesToPublish, this.PublishPresenceCompleted, null);

Hopefully I haven’t left anything out, please comment if you think there’s something missing!

Cheers
Pete

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:08:15+00:00Added an answer on May 23, 2026 at 6:08 am

    OK, this is a little embarrassing as I have managed to solve it – but I think I can point some blame at MS:

    It seems that you MUST specify the LCID (the culture info ID) on the custom message in order for MOC to pick it up, sadly the docs on MSDN seem to think that it’s not required (maybe it’s not, but for things to work right it is)

    http://msdn.microsoft.com/en-us/library/dd941468(v=office.13).aspx

    LCID (int): An integer representing the location ID. Optional

    This means I have to add the custom message multiple times though for each potential locale that the recipients using MOC might be in, doesn’t seem the best way to do things (see below for example).

    string userStateXmlFormat = "<state xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" manual=\"true\" xsi:type=\"userState\">\n"
      + "<availability>{0}</availability>\n"
      + "<activity>\n" 
        + "<custom LCID=\"1033\" xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\">{1}</custom>\n"
        + "<custom LCID=\"2057\" xmlns=\"http://schemas.microsoft.com/2006/09/sip/state\">{1}</custom>\n" 
      + "</activity>\n"
    + "</state>";
    

    Anyway, I hope this helps someone else who wanted a generic message for all cultures, maybe the links above are useful reading too if you want to create something similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.