コード例 #1
0
        /// <summary>
        /// Adds new channel chat message with support for content types
        /// </summary>
        /// <param name="content">Content of the message</param>
        /// <param name="contentType">Message content type e.g. Text, Html</param>
        /// <param name="attachments">Attachments within the message</param>
        /// <param name="subject">Message subject</param>
        /// <param name="hostedContents">Hosted contents for inline content</param>
        /// <returns></returns>
        public async Task <ITeamChatMessage> AddAsync(string content, ChatMessageContentType contentType = ChatMessageContentType.Text, ITeamChatMessageAttachmentCollection attachments = null, string subject = null, ITeamChatMessageHostedContentCollection hostedContents = null)
        {
            if (string.IsNullOrEmpty(content))
            {
                throw new ArgumentNullException(nameof(content));
            }

            var newChannelChatMessage = CreateNewAndAdd() as TeamChatMessage;

            // Assign field values
            newChannelChatMessage.Body = new TeamChatMessageContent
            {
                PnPContext  = newChannelChatMessage.PnPContext,
                Parent      = newChannelChatMessage,
                Content     = content,
                ContentType = contentType,
            };

            if (attachments != null && attachments.Length > 0)
            {
                newChannelChatMessage.Attachments = attachments;
            }

            if (hostedContents != null && hostedContents.Length > 0)
            {
                newChannelChatMessage.HostedContents = hostedContents;
            }

            newChannelChatMessage.Subject = subject;

            return(await newChannelChatMessage.AddAsync().ConfigureAwait(false) as TeamChatMessage);
        }
コード例 #2
0
 /// <summary>
 /// Adds a new channel chat message
 /// </summary>
 /// <param name="batch">Batch the message is associated with</param>
 /// <param name="content">Content of the message</param>
 /// <param name="contentType">Message content type e.g. Text, Html</param>
 /// <param name="subject">Message Subject</param>
 /// <returns>Newly added channel chat message</returns>
 public ITeamChatMessage AddBatch(Batch batch, string content, ChatMessageContentType contentType = ChatMessageContentType.Text, string subject = null)
 {
     return(AddBatchAsync(batch, new ChatMessageOptions()
     {
         Content = content, ContentType = contentType, Subject = subject
     }).GetAwaiter().GetResult());
 }
コード例 #3
0
 /// <summary>
 /// Adds a new channel chat message
 /// </summary>
 /// <param name="content">Content of the message</param>
 /// <param name="contentType">Message content type e.g. Text, Html</param>
 /// <param name="subject">Message Subject</param>
 /// <returns>Newly added channel chat message</returns>
 public async Task <ITeamChatMessage> AddBatchAsync(string content, ChatMessageContentType contentType = ChatMessageContentType.Text, string subject = null)
 {
     return(await AddBatchAsync(PnPContext.CurrentBatch, new ChatMessageOptions()
     {
         Content = content, ContentType = contentType, Subject = subject
     }).ConfigureAwait(false));
 }
コード例 #4
0
 public void SendMessage(ChatMessageContentType contentType, byte[] contentRaw)
 {
     lock (synchronization) {
         Console.WriteLine("Entering send message 2");
         var message = new ChatMessageDto {
             SequenceNumber     = Interlocked.Increment(ref outboundMessageSequenceNumber),
             LogicalClock       = IncrementThenCaptureCurrentLogicalClock(),
             FriendlySenderName = campfireChatClient.LocalFriendlyName,
             ContentType        = ChatMessageContentType.Text,
             ContentRaw         = contentRaw
         };
         Console.WriteLine("Made message");
         SendMessage(message);
         Console.WriteLine("Exiting send message 2");
     }
 }
コード例 #5
0
 /// <summary>
 /// Adds a new channel chat message
 /// </summary>
 /// <param name="content">Content of the message</param>
 /// <param name="contentType">Message content type e.g. Text, Html</param>
 /// <param name="attachments">Attachments within the message</param>
 /// <param name="subject">Message subject</param>
 /// <param name="hostedContents">Hosted contents for inline content</param>
 /// <returns>Newly added channel chat message</returns>
 public ITeamChatMessage Add(string content, ChatMessageContentType contentType = ChatMessageContentType.Text, ITeamChatMessageAttachmentCollection attachments = null, string subject = null, ITeamChatMessageHostedContentCollection hostedContents = null)
 {
     return(AddAsync(content, contentType, attachments, subject, hostedContents).GetAwaiter().GetResult());
 }
コード例 #6
0
 /// <summary>
 /// Adds a new channel chat message
 /// </summary>
 /// <param name="content">Content of the message</param>
 /// <param name="contentType">Message content type e.g. Text, Html</param>
 /// <param name="attachments">Attachments within the message</param>
 /// <param name="subject">Message subject</param>
 /// <param name="hostedContents">Hosted contents for inline content</param>
 /// <returns>Newly added channel chat message</returns>
 public async Task <ITeamChatMessage> AddBatchAsync(string content, ChatMessageContentType contentType = ChatMessageContentType.Text, ITeamChatMessageAttachmentCollection attachments = null, string subject = null, ITeamChatMessageHostedContentCollection hostedContents = null)
 {
     return(await AddBatchAsync(PnPContext.CurrentBatch, content, contentType, attachments, subject, hostedContents).ConfigureAwait(false));
 }