Task
|
Procedure
|
Connect to Group Chat
|
-
Connect to Office Communications Server using UCMA 2.0 Core SDK,
and establish a local endpoint.
-
Construct a
GroupChatEndpoint
.
-
Invoke
BeginEstablish(AsyncCallback, Object)
.
|
Browse chat rooms
|
-
Connect to Group Chat.
-
Obtain a reference to
GroupChatServices
.
-
Invoke one of the browse methods on
GroupChatServices
:
These methods return a collection of
ChatRoomSnapshot
objects. A snapshot is a summary of the chat room which
includes a currently active user count.
|
Query chat history for multiple chat rooms
|
-
Connect to Group Chat.
-
Browse chat rooms and identify the Chat room URI of the chat
rooms you wish to query.
-
Construct a query using the
ChatHistoryQueryOptions
class.
-
Obtain a reference to
GroupChatServices
.
-
Invoke
BeginQueryChatHistory(ChatHistoryQueryOptions, AsyncCallback,
Object)
.
|
Join a chat room
|
-
Connect to Group Chat.
-
Construct an instance of
ChatRoomSession
.
-
Identify the name or URI of a chat room you wish to join.
-
Subscribe to events, such as:
-
Invoke
BeginJoin(Uri,
AsyncCallback, Object)
.
|
Send and receive chat messages
|
-
Join a chat room.
-
Receive inbound messages and changes to chat room properties as
appropriate, based on the events to which you are subscribed.
-
Upon receiving a
ChatMessage
:
-
View the raw content by accessing the
MessageContent
property.
-
Parse the formatted content by accessing the
FormattedMessageParts
collection. A message can consist of alert notifiers, story
titles, plain text, hyperlinks, chat room links, emoticons, and
downloadable file links.
-
View other metadata about the message by accessing the
MessageAuthor
and
Timestamp
properties.
-
Post a message to the chat room using
BeginSendChatMessage(FormattedOutboundChatMessage, AsyncCallback,
Object)
.
|
Post a chat room link, hyperlink, emoticon, alert, or story
message
|
-
Join a chat room.
-
Construct a
FormattedOutboundChatMessage
, supplying a story title and alert indicator as
desired.
-
Append formatted message parts using:
-
Post the message to the chat room using
BeginSendChatMessage(FormattedOutboundChatMessage, AsyncCallback,
Object)
.
|
Upload files
|
-
Join a chat room.
-
Construct an instance of
ChatRoomFileUploadJob
.
-
Subscribe to
ProgressChanged
on the job instance to monitor progress of the upload.
-
Invoke
BeginUploadFile(ChatRoomFileUploadJob, AsyncCallback, Object)
on the chat room session to begin uploading the file.
-
If desired, cancel the file transfer operation by invoking
CancelJob
()
()
()
()
on the job instance.
|
Download files
|
-
Join a chat room.
-
Receive a message which contains a link to a file that you wish
to download.
-
Find the
MessagePartFileDownloadLink
among the
FormattedMessageParts
of the chat message.
-
Construct an instance of
ChatRoomFileDownloadJob
.
-
Subscribe to
ProgressChanged
event on the job instance to monitor progress of the
download.
-
Invoke
BeginDownloadFile(ChatRoomFileDownloadJob, AsyncCallback,
Object)
on the chat room session to begin downloading the file.
-
If desired, cancel the file transfer operation by invoking
CancelJob
()
()
()
()
on the job instance.
|
View recent chat history of a chat room
|
-
Join a chat room.
-
Invoke
BeginGetRecentChatHistory(Int32, AsyncCallback, Object)
.
|
Store and retrieve a bundle of user preferences for your
application
|
Note
|
This special case scenario is useful for applications that store
distributed, application-specific user settings similar to those
stored by the Group Chat client. It can also be used to retrieve
preferences used by the Group Chat client, but the data encoded in
the results is not a published format.
|
-
Connect to Group Chat.
-
Serialize your application's preferences to a string, choose an
identifying label, and construct an instance of
GroupChatPreferenceBundle
.
-
Obtain a reference to
GroupChatServices
.
-
Invoke
BeginSetPreferenceBundle(GroupChatPreferenceBundle, AsyncCallback,
Object)
.
-
If desired, save the preference bundle locally, and record the
sequence ID returned from
EndSetPreferenceBundle(IAsyncResult)
.
-
Invoke
BeginGetPreferenceBundle(String, Int32, Boolean, AsyncCallback,
Object)
to retrieve the preference from the server at a later date.
Supply the last known sequenceID when invoking this method. If the
last known sequenceID is less than the current sequenceID stored on
the server, the server will respond with new preference data. If
the sequenceID matches, the server will return an empty result.
|