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


C# Authentication.oAuthTwitter类代码示例

本文整理汇总了C#中GlobusTwitterLib.Authentication.oAuthTwitter的典型用法代码示例。如果您正苦于以下问题:C# oAuthTwitter类的具体用法?C# oAuthTwitter怎么用?C# oAuthTwitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


oAuthTwitter类属于GlobusTwitterLib.Authentication命名空间,在下文中一共展示了oAuthTwitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getTwitterData

        public void getTwitterData(object UserId)
        {
            try
            {
                Guid userId = (Guid)UserId;
                oAuthTwitter OAuth = new oAuthTwitter(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);
                TwitterAccountRepository objTwtRepo = new TwitterAccountRepository();

                ArrayList arrTwtAcc = objTwtRepo.getAllTwitterAccountsOfUser(userId);
                foreach (TwitterAccount itemTwt in arrTwtAcc)
                {
                    OAuth.AccessToken = itemTwt.OAuthToken;
                    OAuth.AccessTokenSecret = itemTwt.OAuthSecret;

                    getUserProile(OAuth, itemTwt.TwitterUserId, userId);
                    getUserTweets(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                    getUserFeed(OAuth, itemTwt.TwitterScreenName, itemTwt.TwitterUserId, userId);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }

        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:25,代码来源:TwitterData.cs

示例2: FollowersStatus

 /// <summary>
 /// This Method Get All Followers Details of User
 /// </summary>
 /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <param name="ScreenName">User Screen Name</param>
 /// <returns></returns>
 public XmlDocument FollowersStatus(oAuthTwitter oAuth, string ScreenName, string cursor)
 {
     string RequestUrl = Globals.FollowerStatusUrl + ScreenName + ".xml?cursor=" + cursor;
     string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl, string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:Users.cs

示例3: FriendsId

 /// <summary>
 /// This Method Will Get All Friends Id of User  
 /// </summary>
 /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <param name="ScreenName">ScreenName Of Whom You Want To Get FriendsId</param>
 /// <returns>All Friends Id</returns>
 public XmlDocument FriendsId(oAuthTwitter OAuth, string ScreenName, SortedDictionary<string, string> strdic)
 {
     string RequestUrl = Globals.FriendsIdUrl + ScreenName;
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,strdic);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:SocialGraph.cs

示例4: PostScheduleMessage

        public override void PostScheduleMessage(dynamic data)
        {
            try
            {

                oAuthTwitter OAuthTwt = new oAuthTwitter();
                TwitterAccountRepository fbaccrepo = new TwitterAccountRepository();
                TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId);


                OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"];
                OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"];
                OAuthTwt.ConsumerKeySecret = System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"];
                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret;
                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                OAuthTwt.TwitterUserId = twtaccount.TwitterUserId;


                #region For Testing
                // For Testing 

                //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
                //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
                //OAuthTwt.AccessToken = "1904022338-Ao9chvPouIU8ejE1HMG4yJsP3hOgEoXJoNRYUF7";
                //OAuthTwt.AccessTokenSecret = "Wj93a8csVFfaFS1MnHjbmbPD3V6DJbhEIf4lgSAefORZ5";
                //OAuthTwt.TwitterScreenName = "";
                //OAuthTwt.TwitterUserId = ""; 
                #endregion

                TwitterUser twtuser = new TwitterUser();

                if (string.IsNullOrEmpty(data.ShareMessage))
                {
                    data.ShareMessage = "There is no data in Share Message !";
                }

                JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage);

                
             
                Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage);
                ScheduledMessageRepository schrepo = new ScheduledMessageRepository();
                schrepo.updateMessage(data.Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Log log = new Log();
                log.CreatedDate = DateTime.Now;
                log.Exception = ex.Message;
                log.Id = Guid.NewGuid();
                log.ModuleName = "TwitterScheduler";
                log.ProfileId = data.ProfileId;
                log.Status = false;
                LogRepository logRepo = new LogRepository();
                logRepo.AddLog(log);
            }

        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:60,代码来源:TwitterScheduler.cs

示例5: Rate_Limit_Status

        //#region OAuth
        ///// <summary>
        ///// This Method Will Check That User is Authenticated Or Not Using OAUTH
        ///// </summary>
        ///// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        ///// <returns>Return Xml Text With User Details</returns>
        //public XmlDocument Verify_Credentials(oAuthTwitter OAuth)
        //{
        //    string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, String.Empty);
        //    xmlResult.Load(new StringReader(response));
        //    return xmlResult;
        //}

        /// <summary>
        /// This method Will Check Rate Limit Of Account Using OAUTH
        /// </summary>
        /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <returns>Return Xml Text With User Details</returns>
        public XmlDocument Rate_Limit_Status(oAuthTwitter OAuth, SortedDictionary<string, string> strdic)
        {
            
            string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.RateLimitStatusUrl, strdic);
            xmlResult.Load(new StringReader(response));
            return xmlResult;
        }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:25,代码来源:Account.cs

示例6: SearchMethodForTwtUser

 public JObject SearchMethodForTwtUser(oAuthTwitter OAuth, string SearchKey, string pageindex)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchTwtUserUrl + SearchKey + "&page=" + pageindex;
     JObject response = objTwitterWebRequest.PerformWebRequest(RequestUrl, "GET");
     return response;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:7,代码来源:Search.cs

示例7: FollowersId

 /// <summary>
 /// This Method Will Get All Followers Id of User  
 /// </summary>
 /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <param name="ScreenName">ScreenName Of Whom You Want To Get Followers Id</param>
 /// <returns>All Followers Id</returns>
 public XmlDocument FollowersId(oAuthTwitter OAuth, string ScreenName)
 {
     string RequestUrl = Globals.FollowersIdUrl + ScreenName;
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET,RequestUrl,string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:SocialGraph.cs

示例8: FollowAccount

        public static bool FollowAccount(string AccessToken,string AccessTokenSecret ,string Screen_name, string user_id) 
        {
            bool IsFollowed = false;
            oAuthTwitter oauth = new oAuthTwitter();

            oauth.AccessToken = AccessToken;
            oauth.AccessTokenSecret = AccessTokenSecret;
            oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
            oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
            string RequestUrl = "https://api.twitter.com/1.1/friendships/create.json";
            SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
            if (!string.IsNullOrEmpty(Screen_name)) 
            {
                strdic.Add("screen_name", Screen_name);
            }
            else if (!string.IsNullOrEmpty(user_id))
            {
                strdic.Add("user_id", user_id);
            }
            else 
            {
                return false;
            }
            strdic.Add("follow", "true");
            string response = oauth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
            if (!string.IsNullOrEmpty(response)) 
            {
                IsFollowed = true;
            }
            return IsFollowed;
        }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:31,代码来源:TwitterHelper.cs

示例9: PostScheduleMessage

        public override void PostScheduleMessage(dynamic data)
        {
            try
            {

                oAuthTwitter OAuthTwt = new oAuthTwitter();
                TwitterAccountRepository fbaccrepo = new TwitterAccountRepository();
                TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId);
                OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"];
                OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"];
                OAuthTwt.ConsumerKeySecret= System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"];
                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                OAuthTwt.AccessTokenSecret= twtaccount.OAuthSecret;
                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                TwitterUser twtuser = new TwitterUser();
                JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage);

                Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage);
                ScheduledMessageRepository schrepo = new ScheduledMessageRepository();
                schrepo.updateMessage(data.Id);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:26,代码来源:TwitterScheduler.cs

示例10: SearchMethod

 /// <summary>
 /// This Method Will Get All Trends Of Twitter Using OAUTH
 /// </summary>
 /// <param name="User">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Json Text Of Trends</returns>
 public XmlDocument SearchMethod(oAuthTwitter OAuth, string SearchKey, string pageindex)
 {
     TwitterWebRequest twtWebReq = new TwitterWebRequest();
     string RequestUrl = Globals.SearchUrl + SearchKey + "&page=" + pageindex; 
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, RequestUrl,string.Empty);
     xmlResult.Load(new StringReader(response));
     return xmlResult;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:13,代码来源:Search.cs

示例11: Verify_Credentials

 /// <summary>
 /// This Method Will Check That User is Authenticated Or Not Using OAUTH
 /// </summary>
 /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Return Xml Text With User Details</returns>
 public JArray Verify_Credentials(oAuthTwitter OAuth)
 {
     SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
     string response = OAuth.oAuthWebRequest(oAuthTwitter.Method.GET, Globals.VerifyCredentialsUrl, strdic);
     //xmlResult.Load(new StringReader(response));
     if (!response.StartsWith("["))
         response = "[" + response + "]";
     return JArray.Parse(response);
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:14,代码来源:Account.cs

示例12: Post_Statuses_DestroyById

 /// <summary>
 /// Destroys the status specified by the required ID parameter. The authenticating user must be the author of the specified status. Returns the destroyed status if successful.
 /// </summary>
 /// <param name="oAuth"></param>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public JArray Post_Statuses_DestroyById(oAuthTwitter oAuth, string UserId)
 {
     SortedDictionary<string, string> strdic = new SortedDictionary<string, string>();
     string RequestUrl = Globals.StatusDestroyByIdUrl + UserId + ".json";
     string response = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, RequestUrl, strdic);
     if (!response.StartsWith("["))
         response = "[" + response + "]";
     return JArray.Parse(response);
 } 
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:15,代码来源:Tweet.cs

示例13: AuthenticateTwitter

        public void AuthenticateTwitter(object sender, EventArgs e)
        {
            oAuthTwitter OAuth = new oAuthTwitter();

            if (Request["oauth_token"] == null)
            {
                OAuth.AccessToken = string.Empty;
                OAuth.AccessTokenSecret = string.Empty;
                OAuth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString();
                Response.Redirect(OAuth.AuthorizationLinkGet());
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:12,代码来源:Publishing.aspx.cs

示例14: Verify_Credentials

 /// <summary>
 /// This Method Will Check That User Is Authenticatde Or Not
 /// </summary>
 /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
 /// <returns>Return True If User Is Authenticated</returns>
 public bool Verify_Credentials(oAuthTwitter oAuth)
 {
     Twitter.Core.AccountMethods.Account account = new Twitter.Core.AccountMethods.Account();
     JArray obj = account.Verify_Credentials(oAuth);
    // XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");
     foreach (var item in obj)
     {
         //XmlElement idElement = (XmlElement)xmlNode;
         //twitterUser.UserID = idElement.GetElementsByTagName("id")[0].InnerText;
         return true;
     }
     return false;
 }
开发者ID:prog-moh,项目名称:socioboard-core,代码行数:18,代码来源:TwitterUserController.cs

示例15: CheckTwitterToken

 public bool CheckTwitterToken(oAuthTwitter objoAuthTwitter, string txtvalue)
 {
     bool CheckTwitterToken = false;
     //oAuthTwitter oAuthTwt = new oAuthTwitter();
     Users twtUser = new Users();
     try
     {
         JArray twtuserjson = twtUser.Get_Users_Search(objoAuthTwitter, txtvalue, "5");
         CheckTwitterToken = true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return CheckTwitterToken;
 }
开发者ID:utkarshx,项目名称:socioboard,代码行数:16,代码来源:AjaxHelper.aspx.cs


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