当前位置: 首页>>代码示例>>C#>>正文


C# oAuthLinkedIn.LinkedProfilePostWebRequestWithImage方法代码示例

本文整理汇总了C#中GlobusLinkedinLib.Authentication.oAuthLinkedIn.LinkedProfilePostWebRequestWithImage方法的典型用法代码示例。如果您正苦于以下问题:C# oAuthLinkedIn.LinkedProfilePostWebRequestWithImage方法的具体用法?C# oAuthLinkedIn.LinkedProfilePostWebRequestWithImage怎么用?C# oAuthLinkedIn.LinkedProfilePostWebRequestWithImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GlobusLinkedinLib.Authentication.oAuthLinkedIn的用法示例。


在下文中一共展示了oAuthLinkedIn.LinkedProfilePostWebRequestWithImage方法的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;
            
        }
开发者ID:socioboard,项目名称:socioboard-core,代码行数:52,代码来源:ApiLinkedInController.cs

示例2: SetPostOnPageWithImage

        public string SetPostOnPageWithImage(oAuthLinkedIn oauth, string PageId, string imageurl, string post)
        {
            //string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            //xml += " <share><visibility><code>anyone</code></visibility><comment>" + post + "</comment>";
            ////xml += "<content><submitted-url>http://socioboard.com/</submitted-url><title>none</title> <submitted-image-url>" + imageurl + "</submitted-image-url></content></share>";
            //xml += "<content><submitted-url>http://localhost:5334/</submitted-url><title>none</title> <submitted-image-url>" + imageurl + "</submitted-image-url></content></share>";


            string url = "https://api.linkedin.com/v1/companies/" + PageId + "/shares?format=json";
            string response = oauth.LinkedProfilePostWebRequestWithImage("POST", url, post, imageurl);
            return response;

        }
开发者ID:socioboard,项目名称:socioboard-core,代码行数:13,代码来源:Company.cs

示例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();
        }
开发者ID:socioboard,项目名称:socioboard-core,代码行数:57,代码来源:ApiLinkedInController.cs


注:本文中的GlobusLinkedinLib.Authentication.oAuthLinkedIn.LinkedProfilePostWebRequestWithImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。