本文整理汇总了C#中GlobusTwitterLib.App.Core.TwitterUser.PostDirect_Messages_New方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterUser.PostDirect_Messages_New方法的具体用法?C# TwitterUser.PostDirect_Messages_New怎么用?C# TwitterUser.PostDirect_Messages_New使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlobusTwitterLib.App.Core.TwitterUser
的用法示例。
在下文中一共展示了TwitterUser.PostDirect_Messages_New方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostTwitterDirectmessage
public string PostTwitterDirectmessage(string message, string userId, string fromId, string toId)
{
Domain.Socioboard.Domain.TwitterDirectMessages _TwitterDirectMessages = new Domain.Socioboard.Domain.TwitterDirectMessages();
Domain.Socioboard.Domain.TwitterAccount objTwitterAccount = objTwitterAccountRepository.GetUserInformation(Guid.Parse(userId), fromId);
oAuthTwitter OAuthTwt = new oAuthTwitter(ConfigurationManager.AppSettings["consumerKey"], ConfigurationManager.AppSettings["consumerSecret"], ConfigurationManager.AppSettings["callbackurl"]);
OAuthTwt.AccessToken = objTwitterAccount.OAuthToken;
OAuthTwt.AccessTokenSecret = objTwitterAccount.OAuthSecret;
OAuthTwt.TwitterScreenName = objTwitterAccount.TwitterScreenName;
OAuthTwt.TwitterUserId = objTwitterAccount.TwitterUserId;
TwitterUser twtuser = new TwitterUser();
JArray ret = new JArray();
try
{
ret = twtuser.PostDirect_Messages_New(OAuthTwt, message, toId);
_TwitterDirectMessages.MessageId = ret[0]["id_str"].ToString();
_TwitterDirectMessages.Message = ret[0]["text"].ToString();
_TwitterDirectMessages.CreatedDate = Utility.ParseTwitterTime(ret[0]["created_at"].ToString());
_TwitterDirectMessages.EntryDate = DateTime.Now;
_TwitterDirectMessages.RecipientId = ret[0]["recipient"]["id_str"].ToString();
_TwitterDirectMessages.RecipientProfileUrl = ret[0]["recipient"]["profile_image_url_https"].ToString();
_TwitterDirectMessages.RecipientScreenName = ret[0]["recipient"]["screen_name"].ToString();
_TwitterDirectMessages.SenderId = ret[0]["sender"]["id_str"].ToString();
_TwitterDirectMessages.SenderProfileUrl = ret[0]["sender"]["profile_image_url_https"].ToString();
_TwitterDirectMessages.SenderScreenName = ret[0]["sender"]["screen_name"].ToString();
_TwitterDirectMessages.Type = "twt_directmessages_sent";
_TwitterDirectMessages.UserId = Guid.Parse(userId);
objTwitterDirectMessageRepository.addNewDirectMessage(_TwitterDirectMessages);
}
catch (Exception ex)
{
}
return ret.ToString();
}