I tried using Launcher.CanOpenAsync to see if it can detect gmail and facebook on emulator. It always returns false, even if the apps are installed.
I tried three apps in total, all three installed in emulator:
bool supportsUri = await Launcher.Default.CanOpenAsync("lyft://");
bool supportsUri = await Launcher.Default.CanOpenAsync("fb://");
bool supportsUri = await Launcher.Default.CanOpenAsync("gmail-inbox://");
Why does it always return false? Any suggestions? I tried on iOS also, and modified the Info.plist accordingly but to no avail.
This two lines of code work fine, but i dont want to compose an email, I want to see the inbox, so mailto doesnt really help.
await Launcher.OpenAsync("mailto:example#gmail.com");
await Browser.OpenAsync("https://www.facebook.com/RingotanApp");
Related
I am trying to upgrade an app which belongs to a chat. If the app is not installed, below code successfully install it:
await graph.Chats["19:7f...3#thread.v2"].InstalledApps
.Request()
.AddAsync(teamsAppInstallation);
But once the app is added, below code shows zero entries:
var installedApps = await graph.Chats["19:7f...3#thread.v2"].InstalledApps.Request().GetAsync();
I was expecting to see my app there. My target is to call Upgrade() for the app, because it should allow me to add ConversationReferences in one of the event functions (e.g. OnTurnAsync), that will allow me to send proactive message to the chat. Am I doing something wrong?
Permissions for an application are set:
TeamsAppInstallation.ReadWriteSelfForChat.All
TeamsAppInstallation.ReadWriteForUser.All
The authentication with the Graph API is done successfully, as I can create a chat, list channels etc.
https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
data:
grant_type=client_credentials&client_id={ MS_APP_ID_ENC }&client_secret={ MS_APP_PASS_ENC }&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
I was adding the app to the chat both manually and with C# request:
var teamsAppInstallation = new TeamsAppInstallation {
AdditionalData = new Dictionary<string, object>()
{
{
"teamsApp#odata.bind", "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/0c...68/"}
}
};
var installedApp = await graph.Chats["19:7f...3#thread.v2"].InstalledApps. Request().AddAsync(teamsAppInstallation);
And the app was added. It can be used in the chat.
It turned out that I've used wrong application permissions. Even though TeamsAppInstallation.ReadWriteSelfForChat.Al is listed in the docs, I needed to add TeamsAppInstallation.ReadWriteForChat.All to make it working.
I have a problem with azure function only when I publish.
the code run not in order, all the functions run at the same time.
ex :
var logger = context.GetLogger(nameof(MibProposalRequest));
logger.Log(LogLevel.Warning, $"Début de la fonction : MibProposalRequest {DateTime.UtcNow}");
try
{
var getStringResponse = await this.GetStringAsync(req, logger).ConfigureAwait(false);
if (getStringResponse.Error != null)
{
return new HttpResponseMessage()
{
StatusCode = getStringResponse.Error.StatusCode,
ReasonPhrase = getStringResponse.Error.Message
};
}
else
{
var requestBody = getStringResponse.Response.ToString();
var deserializeRequestBodyResponse = await this.DeserializeRequestBodyAsync(requestBody, logger).ConfigureAwait(false);
if (deserializeRequestBodyResponse.Error != null)
{
return new HttpResponseMessage()
{
StatusCode = deserializeRequestBodyResponse.Error.StatusCode,
ReasonPhrase = deserializeRequestBodyResponse.Error.Message
};
}
In this example I need to get the response of the function GETStringAsync and after go to the function : DeserializeRequestBodyAsync.
If I run the azure function in local (debug) it's all ok, everything it's in order.
First log the function start.
After Get the string
end deserializeObject.
But when I publish the function and I test it, when I'm loocking at the log in portal.azure.
All the function run not in good order.
So sometimes I get an error from deserializeObject function because no string to deserialize.
But its suppose to do the GetStringAsync function first.
Why this append?
Image of the log
as you can see the function start log is not the first to show up why ?
looks like all the code run completely not in order.
should be like this :
Log of vs debug
Everything is good each functions run in good order (so no problems)
Why this append only when the function is published ??
Ps: I tried to run the function not async but nothing change.
PS2: I tried to put all the code in the same function (Run) nothing changed.
PS3: I tried to put task.wait nothing changed.
I need help please 2 days I'm on this.
https://azure.microsoft.com/en-us/updates/general-availability-azure-functions-supports-net-5-in-production/?cdn=disable
From my experience this was a pain to get to work with Azure Functions on .NET 5. Either roll back to 3.1 or wait till 11/9/2021 for .NET 6 to release out of preview. .NEt 6 preview is allowed on Azure for testing.
Are you running .NET 5 in Azure in isolated mode? See link above.
"To support .NET 5, Azure Functions introduces a new isolated process model that runs .NET function apps in a separate worker process outside the Azure Functions host runtime."
I just found a solution in the code:
List<ProposalIdModel> list = (List<ProposalIdModel>)deserializeGuidsAsyncResponse.Response ?? new List<ProposalIdModel>();
Like this the list while never be null.
But it's wired in visual studio in debug no problem, but when I publish sometime the list get null.
So problem solved.
I also update to netCore6.
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
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'm working on a UWP app and I was thinking about moving from the old LiveSDK (which is discontinued and was last updated around 2015) to the new OneDriveSDK (the Graph APIs), specifically using the UWP Community Toolkit Services package and its APIs.
The library seems pretty easy to use as far as login and files/folders management go, but so far I haven't been able to find a way to retrieve the user full name, the user email and the profile picture.
Here's the code I'm currently using to do so, using LiveSDK (code simplified here):
public static async Task<(String username, String email)> GetUserProfileNameAndEmailAsync(LiveConnectSession session)
{
LiveConnectClient connect = new LiveConnectClient(session);
LiveOperationResult operationResult = await connect.GetAsync("me");
IDictionary<String, object> results = operationResult.Result;
String username = results["name"] as String;
if (!(results["emails"] is IDictionary<string, object> emails)) return default;
String email = emails["preferred"] as String ?? emails["account"] as String;
return (username, email);
}
public static async Task<ImageSource> GetUserProfileImageAsync([NotNull] LiveConnectSession session)
{
LiveConnectClient liveClient = new LiveConnectClient(session);
LiveOperationResult operationResult = await liveClient.GetAsync("me/picture");
String url = operationResult.Result?["location"] as String;
// The URL points to the raw image data for the user profile picture, just download it
return default;
}
I've looked at the guide here and I see there seems to be a replacement for all of the above, but I haven't been able to integrate that with the UWP Toolkit service. For example, to retrieve the user info, here's what I've tried:
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/");
await OneDriveService.Instance.Provider.AuthenticationProvider.AuthenticateRequestAsync(request);
using (HttpResponseMessage response = await OneDriveService.Instance.Provider.HttpProvider.SendAsync(request))
{
String content = await response.Content.ReadAsStringAsync();
}
But this fails with an exception at the SendAsync call.
NOTE: I know there are the Graph APIs too in the UWP Toolkit, with ready-to-use methods to retrieve the user info and profile picture, but apparently you need an office 365 subscription to use those APIs (both as a dev, and probably as a user too), so I guess that's not what I'm looking for here, since I've always been able to retrieve these info using a normal OneDrive client.
Is there a way to do this on UWP, either through some method within the UWP Toolkit, or with some other solution?
Thanks!
EDIT: I've reused the code from the sample app, registered my app to get a clientID and made a quick test, but it's not working as expected and I'm getting this exception:
Fixed, see below
EDIT #2: According to this question, I had to switch to https://graph.microsoft.com/beta to get the profile picture, as the 1.0 version of the APIs doesn't support it for normal MS accounts right now. All things considered, it seems to be working just fine now 👍
I followed the MSDN document to register my app for Microsoft Graph. After that, I will get an application ID(in API, it's called as clientId).
Then, I used the Microsoft Graph Connect Sample for UWP to login in with my general MS account. It worked well. I could get the username, email etc.
Please note that if you want to run this sample successfully, you would need to use the application ID to initialize the PublicClientApplication object in AuthenticationHelper.cs.
public static PublicClientApplication IdentityClientApp = new PublicClientApplication("your client id");