/// <summary> /// Method to publish comment /// </summary> /// <param name="accessToken"></param> /// <param name="comment"></param> public async static void PublishComment(string accessToken, string comment) { try { var requestUrl = String.Format(linkedinSharesEndPoint, accessToken); var shareMsg = new { comment = comment, visibility = new { code = "anyone" } }; var requestJson = JsonConvert.SerializeObject(shareMsg); StatusAndResponseClass response = await TSGLinkedInManager.JsonPostData(LinkedInCredential.PostLinkedInMessageURl(LinkedInCredential.LinkedInAccessToken), requestJson); if (response.statusCode == 200 || response.statusCode == 201) { await new MessageDialog("Post published successfully.").ShowAsync(); } else if (response.statusCode == 400) { // For Duplicate messaage await new MessageDialog("Do not post duplicate content").ShowAsync(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception Occur PostLinkedInNetworkUpdate() LinkedInHelper : " + ex.ToString()); } }
/// <summary> /// Method to publish comment with content /// </summary> /// <param name="accessToken"></param> /// <param name="comment"></param> /// <param name="title"></param> /// <param name="submittedUrl"></param> /// <param name="submittedImageUrl"></param> /// <param name="description"></param> public async static void PublishCommentandContent(string accessToken, string comment, string title, string submittedUrl, string submittedImageUrl, [Optional] string description) { try { var requestUrl = String.Format(linkedinSharesEndPoint, accessToken); var shareMsg = new { comment = comment, content = new { title = title, submitted_url = submittedUrl, // "http://www.bigcode.net", submitted_image_url = submittedImageUrl, //"http://2.bp.blogspot.com/-8r_lWT_32lQ/TxrQW12ngPI/AAAAAAAAI70/ifMF4Z16M-Y/s1600/SQL+Server+session+state.png", description = description }, visibility = new { code = "anyone" } }; var requestJson = JsonConvert.SerializeObject(shareMsg); StatusAndResponseClass response = await TSGLinkedInManager.JsonPostData(LinkedInCredential.PostLinkedInMessageURl(LinkedInCredential.LinkedInAccessToken), requestJson); if (response.statusCode == 200 || response.statusCode == 201) { await new MessageDialog("Post published successfully.").ShowAsync(); } else if (response.statusCode == 400) { // For Duplicate messaage await new MessageDialog("Do not post duplicate content").ShowAsync(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception Occur PostLinkedInNetworkUpdate() LinkedInHelper : " + ex.ToString()); } }