本文整理汇总了C#中GlobusLinkedinLib.Authentication.oAuthLinkedIn.LinkedProfilePostWebRequest方法的典型用法代码示例。如果您正苦于以下问题:C# oAuthLinkedIn.LinkedProfilePostWebRequest方法的具体用法?C# oAuthLinkedIn.LinkedProfilePostWebRequest怎么用?C# oAuthLinkedIn.LinkedProfilePostWebRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobusLinkedinLib.Authentication.oAuthLinkedIn
的用法示例。
在下文中一共展示了oAuthLinkedIn.LinkedProfilePostWebRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LinkedInScheduleUpdate
public string LinkedInScheduleUpdate(LinkedInManager LinkedInManager)
{
string json = "";
if (LinkedInManager.ScheduleTime<=DateTime.Now)
{
oAuthLinkedIn _oauth = new oAuthLinkedIn();
Domain.Socioboard.Domain.LinkedInAccount _LinkedinAccount = objLinkedInAccountRepository.getLinkedinAccountDetailsById(LinkedInManager.ProfileId);
try
{
_oauth.ConsumerKey = ConfigurationManager.AppSettings["LinkedinApiKey"];
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
logger.Error(ex.Message);
}
try
{
_oauth.ConsumerSecret = ConfigurationManager.AppSettings["LinkedinSecretKey"];
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
logger.Error(ex.Message);
}
_oauth.Token = _LinkedinAccount.OAuthToken;
string PostUrl = "https://api.linkedin.com/v1/people/~/shares?format=json";
if (string.IsNullOrEmpty(LinkedInManager.ImageUrl))
{
json = _oauth.LinkedProfilePostWebRequest("POST", PostUrl, LinkedInManager.comment);
}
else
{
string imagepath = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(LinkedInManager.ImageUrl, "wwwroot")[1].Replace("\\", "/");
json = _oauth.LinkedProfilePostWebRequestWithImage("POST", PostUrl, LinkedInManager.comment, imagepath);
}
if (!string.IsNullOrEmpty(json))
{
json = "Message post on LinkedIn for Id :" + LinkedInManager.ProfileId + " and Message: " + LinkedInManager.comment;
objScheduledMessageRepository.UpdateScheduledMessage(Guid.Parse(LinkedInManager.ScheduleMessageId));
}
else {
json= "Something Went Wrong";
}
}
return json;
}
示例2: SetPostOnPage
public string SetPostOnPage(oAuthLinkedIn oauth, string PageId, string post)
{
//string response1 = oauth.APIWebRequest("GET", GlobusLinkedinLib.App.Core.Global.GetCompanyUrl, null);
//XmlDocument xmlCompany = new XmlDocument();
//xmlCompany.Load(new StringReader(response1));
//string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//xml += "<share><visibility><code>anyone</code></visibility><comment>"+post+"</comment></share>";
//string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><share><visibility><code>anyone</code></visibility><comment>" + post + "</comment></share>";
//string url = "https://api.linkedin.com/v1/companies/" + PageId + "/shares";
string url = "https://api.linkedin.com/v1/companies/"+PageId+"/shares?format=json";
string response = oauth.LinkedProfilePostWebRequest("POST", url, post);
return response;
}
示例3: LinkedInProfileUpdate
public IHttpActionResult LinkedInProfileUpdate(LinkedInManager LinkedInManager)
{
oAuthLinkedIn _oauth = new oAuthLinkedIn();
string json = "";
Domain.Socioboard.Domain.LinkedInAccount _LinkedinAccount = objLinkedInAccountRepository.getLinkedinAccountDetailsById(LinkedInManager.ProfileId);
try
{
_oauth.ConsumerKey = ConfigurationManager.AppSettings["LinkedinApiKey"];
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
logger.Error(ex.Message);
}
try
{
_oauth.ConsumerSecret = ConfigurationManager.AppSettings["LinkedinSecretKey"];
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
logger.Error(ex.Message);
}
_oauth.Token = _LinkedinAccount.OAuthToken;
string PostUrl = "https://api.linkedin.com/v1/people/~/shares?format=json";
if (string.IsNullOrEmpty(LinkedInManager.ImageUrl))
{
json = _oauth.LinkedProfilePostWebRequest("POST", PostUrl, LinkedInManager.comment);
}
else {
string imagepath = ConfigurationManager.AppSettings["DomainName"].ToString() + Regex.Split(LinkedInManager.ImageUrl, "wwwroot")[1].Replace("\\", "/");
json = _oauth.LinkedProfilePostWebRequestWithImage("POST", PostUrl, LinkedInManager.comment,imagepath);
}
#region ScheduledMessage
if (!string.IsNullOrEmpty(json))
{
objScheduledMessage.Id = Guid.NewGuid();
objScheduledMessage.PicUrl = LinkedInManager.ImageUrl;
objScheduledMessage.ProfileId = LinkedInManager.ProfileId;
objScheduledMessage.ProfileType = "linkedin";
objScheduledMessage.ScheduleTime = DateTime.Now;
objScheduledMessage.ShareMessage = LinkedInManager.comment;
objScheduledMessage.Status = true;
objScheduledMessage.UserId = Guid.Parse(LinkedInManager.UserId);
objScheduledMessage.CreateTime = DateTime.Now;
objScheduledMessage.ClientTime = DateTime.Now;
if (!objScheduledMessageRepository.checkMessageExistsAtTime(objScheduledMessage.UserId, objScheduledMessage.ScheduleTime))
{
objScheduledMessageRepository.addNewMessage(objScheduledMessage);
}
}
#endregion
return Ok();
}