I have a WPF-Application that uses the MS-Graph API, to search for EMails containing a specific keyword and display them to the user.
To get only the mails a user searches for, the MS-Documentation recomments this:
var messages = await graphClient.Me.Messages
.Request()
.Search("Pizza")
.GetAsync();
The problem is, this doesn't work in my code and I can't figure out why.
The only thing my VS tells me is that it could not resolve symbol "search" and I didn't find anything about this problem here or somewhere else on the internet.
The way I'm doing it at the moment is this:
var queryOption = new List<QueryOption>()
{
new QueryOption("$search", "Pizza")
};
var messages = await serviceClient.Me.Messages.Request(queryOption).GetAsync();
This works as expected, but does anyone now how to do it as shown in the MS-Documentation?
I would appreciate any help!
Currently, there is no search method available for the IUserMessagesCollectionRequest object, so you are using it correctly. This is also described here:
https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/overview.md#custom-query-options
Related
We use the AmazonDeviceFarmClient.ListDevicesAsync call with a very simple ListDevicesRequest in order to get a list of all devices available in Device Farms in a C# platform.
An example of our code:
var cfg = new AmazonDeviceFarmConfig
{
RegionEndpoint = RegionEndpoint.USWest2
};
using (var client = new AmazonDeviceFarmClient(new BasicAWSCredentials([DeviceFarmAccessKey], [DeviceFarmSecretKey]), cfg))
{
var arn = GetProjectArn();
var response = client.ListDevicesAsync(new ListDevicesRequest
{
Arn = arn
}).Result;
}
On Powershell/python, using the aws devicefarm list-devices command, a comprehensive list of all possible devices is returned.
Using our C# code we get a truncated list, missing several devices that we need, despite there being no filters. We have tried various things including changing the permissions of the API user, and changing the region with no luck.
It looks increasingly like our best course of action will be to run a powershell script within our C# environment, rather than using the C# Device Farm API, whose list devices command appears to be not working.
Given that we are waiting for a result using the Result keyword, I would not expect this to be an async issue.
As pointed out by Jeroen Mostert, we missed out on the NextToken property. It was sending an incomplete list down (an uneven number, like 236, which made us think that it wasn't a pagination type issue), and using NextToken in a repeat call to the same method gave us the few remaining results.
Thank you for your prompt response!
I have been testing the google api to get the comments of my android application in google play and it always returns me the empty authorname, do I need some other permission? I put the json of what returns me.
Thank you!
I suspect this is an issue with fields
var request = service.Reviews.List ("my.app");
request.Fields = "*";
var results = request.ExecuteAsync() ;
I don't have access to that api so the code is an educated guess give it a try let me know if it doesn't work. Try testing it here as well Google APIs explorer.
Update 1:
I have one last guess try running a Reviews.Get request after your review.list maybe the name isn't return in the list it should be though.
var request = service.Reviews.Get("my.app",reviewIdFromListRequest);
request.Fields = "*";
var results = request.ExecuteAsync() ;
If this doesn't work i say we log it as a bug.
Update 2:
apparently its a documented bug
Found in this documentation page reviews
I'd like to create a sign-in card that is not a link to a webpage to sign in to. Something that behaves something like this
All of the resources I've found online only show the button link like
Whose code looks something like this
var replytoconversation = context.MakeMessage();
replytoconversation.Text = "Authorize your Account";
replytoconversation.Attachments = new List<Attachment>();
var cardbuttons = new List<CardAction>();
cardbuttons.Add(new CardAction
{
Title = "connect",
Value = "http://mail.google.com",
Type = ActionTypes.Signin
});
SigninCard plcard = new SigninCard("Log in to your account", cardbuttons);
Attachment plattachment = plcard.ToAttachment();
replytoconversation.Attachments.Add(new SigninCard("Log in to your account", cardbuttons).ToAttachment());
await context.PostAsync(replytoconversation);
Any help would be appreciated thanks
What you are asking is not possible using the card system in the way you are asking. The only way I can think of at the moment would be to create a login web page alongside your web interface chat (if that's what you are using) and embed the web page in the chat bot (I've done something like this for a similar reason). This is a useful way of dealing with a number of things, such as connecting to a system that does not have an api. I know it's not the exact answer you want, but it's really the only way to my knowledge.
Just updating this as ive been working on it lately. If you use Adaptive-Cards, you can add in Input boxes using AdaptiveTextInput. Link these to a submit function and you can have the user input their details in,then pass them to another function. Here, you can either cast out of the bot to an auth protocol (not sure about how, havent tried yet), or you can do what I'm doing, and use a http/ftp database to authenticate data. Not that secure, but depends on what you are using it for.
I'm currently following a tutorial on how to show Twitter feeds with LINQ to XML in C#. However, seeing as Microsoft has replaced WebClient with HTTPClient, I'm unsure how to proceed on my quest of integrating this into my Windows 8 application.
The tutorial: http://www.codeproject.com/Articles/117614/How-to-query-twitter-public-status-using-LINQ-to-X
The thing is that I'm "halfway" used to DownloadStringCompleted, which I believe is not in the HTTPClient api. So after searching for a while on the async/await functionality, I mixed some of my knowledge together with some tutorials and snippets I found, but what I ended up with would not work:
public async Task<XElement> GetXmlAsync()
{
var client = new HttpClient();
var response = await client.GetAsync("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=VladimirPutin");
var text = response.Content.ReadAsStringAsync();
return XElement.Parse(text.Result);
XElement xmlTweets = XElement.Parse(text.Result);
listboxTweetsSecond.ItemsSource = from tweet in xmlTweets.Descendants("status")
select new UserTweet
{
UserImageSrc = tweet.Element("user").Element("profile_image_url").Value,
UserMessage = tweet.Element("text").Value,
UserName = tweet.Element("user").Element("screen_name").Value
};
}
(Yeah, the Twitter username is just a placeholder)
I do not need an entire code as an answer, but I'd love it if someone could point out where I should go from here, as well as what I should do in general, as this (of course) does not work (as in, it does not show anything when I run it/debug mode).
Comment out the line
return XElement.Parse(text.Result);
and it should probably work.
Having done that (i.e. you are no longer returning an XElement) you can probably change the method signature top return just a task.
public async Task GetXmlAsync()
{
// method body
}
Right now I have an app that allows a user to schedule/post a Facebook post and then monitor the likes/comments. One of the problems I foresee is that currently I am pulling every single comment/like whether it's been processed or not. What I would like to do instead is be able to say 'Give me all the NEW comments since XYZdate/XYZcomment.' Is this currently possible?
var accessToken = existingUserNode.Attributes["accessToken"].Value;
var facebookAPIMgr = new FacebookWrapper.FacebookAPIManager();
var msg = new FacebookWrapper.FacebookMessage()
{
AccessToken = accessToken,
FacebookMessageId = facebookPost.FacebookMessageId
};
//Get Facebook Message Comments
// Need to find a way to limit this to only new comments/likes
var comments = facebookAPIMgr.RetrieveComments(msg);
You can do time-based pagination as part of your graph API query. If you keep a unix timestamp of when you polled things last, you can simply do https://graph.facebook.com/{whatever}?since={last run}.
This worked when I was working heavily with the Graph API earlier this year, and is still around on the documentation, but considering how much Facebook loves to change stuff without telling anyone you may still encounter problems. So just a warning, YMMV.