User Query

Mar 10, 2012 at 12:30 AM

I am using the single auth so I can work on getting my queries down for my application



I am working on performing single user lookups in mvc4.     

The entire query has no errors in visual studio till i run it. I scaffolded a default details view just to see what single details i get and how it works.

 

Basically when i user authenticates I want to get some of their details.   I am trying to drill right in to the user object rather the status since i dont need any message stuff for this query. 

I am getting  a type parameter error


I tried using the examples to no avail.

 

     
 twitterCtx = new TwitterContext(auth);
 
            var TweetUserInfo = (from user in twitterCtx.User
                                 select new TweetUser
                                 {
                                     ImageUrl = user.ProfileImageUrl,
                                     UserId = user.UserID,
                                     ScreenName = user.ScreenName,
                                     Id = user.ID,
                                     User = user.Identifier.UserID,
                                     Identifier = user.Identifier.ID,
                                     CreatedAt = user.CreatedAt 
                                 });
            
 
        
            //var TweetUser = TweetUserInfo.ToList();
                           
         //  var TweetUser = TweetUserInfo.SingleOrDefault();           
             
    
 
            return View(TweetUser);

Mar 10, 2012 at 1:50 AM

I went to the twitter site and got the updated info and this query worked

 

           var TweetUserInfo = (from user in twitterCtx.User
                             where user.Type == UserType.Lookup &&
                                   user.ScreenName == "BattleShouts"
                             select new TweetUser
                             {
                                 ImageUrl = user.ProfileImageUrl,
                                 UserId = user.UserID,
                                 ScreenName = user.ScreenName,
                                Id = user.ID,
                                  User = user.Identifier.UserID,
                                 Identifier = user.Identifier.ID,
                               CreatedAt = user.CreatedAt
                             })
                            .ToList();

It wont let me pass auth.screenname for the name, ill have to thing of a creative way around it

Coordinator
Mar 10, 2012 at 2:40 AM

What do you mean by "It won't let you"?  Are you receiving an error message?

BTW, if you're using SingleUserAuthorizer, then you already know the ScreenName of the authorized user.  Is there more to your scenario that I'm not seeing?

Joe

Mar 10, 2012 at 2:44 AM
Edited Mar 10, 2012 at 3:40 AM

The screenname   needs to be in quotes and if i have more its a comma separated string. so i need to build the object and surround it with quotes thats all.

 

I wanted to use auth.screenname or something simple :)  Programming isnt as simple its made to be but im having fun and  trying overcome challenges where ill make a simple method to put quotes around auth screen name

 

and the answer to your question, i need to still put quotes around it.  I wont be using single auth in production. I am just trying to get my query set and not have to deal with authorizing.