コード例 #1
0
        /// <summary>
        /// Sends message to current member
        /// </summary>
        /// <param name="subject">Message subject</param>
        /// <param name="body">Message body</param>
        /// <param name="includeSenderInRecipients">Indicates whether sender of message should be included in recipients</param>
        /// <returns>Value containing true or false, depending on operation success, and response status</returns>
        /// <exception cref="LinkedInMissingParameterException">Thrown when message's subject or body are null or empty strings</exception>
        public LinkedInResponse <bool> SendMessage(string subject, string body, bool includeSenderInRecipients)
        {
            if (string.IsNullOrEmpty(subject))
            {
                throw new LinkedInMissingParameterException("Message subject cannot be null or empty", "Subject");
            }
            if (string.IsNullOrEmpty(body))
            {
                throw new LinkedInMissingParameterException("Message body cannot be null or empty", "Body");
            }

            var options = new LinkedInMessageOptions
            {
                Body    = body,
                Subject = subject,
                IncludeSenderInRecipients = includeSenderInRecipients
            };

            options.Recipients.Add(Id);
            return(RequestRunner.SendMessage(options));
        }