LiveConnectClient does not contain a definition for DownloadAsync. - winrt-xaml

I am writing a Universal App with VS2013 update 2. But it looks like DownloadAsync was deprecated as I get the compile error: Microsoft.Live.LiveConnectClient' does not contain a definition for 'DownloadAsync'
LiveConnectClient clientLocal = new LiveConnectClient(client.Session);
var downloadResult = await clientLocal.DownloadAsync(string.Format("{0}/content", folderId));
A recent solution had me try that code so it must have worked in VS2012?? See link:
OneDrive Upload/Download to Specified Directory
Any working examples using the latest VS2013 and Microsoft.Live?

For LiveConnect SDK 5.6 WinRT WP8.1 DownloadAsync is not available. I went with the solution at:
Returned value is null when downloading a file from OneDrive

Related

Graph SDK for .NET doesn't have Request method

I'm trying to use the Graph SDK and NuGet 5.0.0-preview16 and forwarding the example it says to use Request method in example
var users = await graphClient.Users.Request().GetAsync();
but I have an error in the code:
'UsersRequestBuilder' does not contain a definition for 'Request' and
no accessible extension method 'Request' accepting a first argument of
type 'UsersRequestBuilder' could be found (are you missing a using
directive or an assembly reference?
Since C# SDK V5 Request method is removed and you can call directly GetAsync method. But V5 is still in preview and it's better to use latest V4 version.
var users = await graphClient.Users.GetAsync();
Upgrade guide can be found here.
Fixed: I changed Microsoft.Graph on NuGet from 5.0.0-preview16 to 4.47.0

Azure Text Moderator not found

API Name:
TextModerator
have Azure Subscription and I created the cognitive service, and from a c# console, I'm trying to test the TextModerator project.
When this line is called:
var screenResult =
client.TextModeration.ScreenText("text/plain", new MemoryStream(Encoding.UTF8.GetBytes(text)), "eng", true, true, null, true);
I got the following message:
Microsoft.CognitiveServices.ContentModerator.Models.APIErrorException
: 'Operation returned an invalid status code 'NotFound''
the endpoint is like this:
https://contentmoderator-****.cognitiveservices.azure.com/contentmoderator
Any Idea?
Saad
You can use the following base endpoint for your specific Region(ex:westus).
https://westus.api.cognitive.microsoft.com.
Install the client library:
Within the application directory, install the Content Moderator client library for .NET with the following command:
dotnet add package Microsoft.Azure.CognitiveServices.ContentModerator --version 2.0.0
If you're using the Visual Studio IDE, the client library is available as a downloadable NuGet package.
Please follow the below document for Moderate Text.
https://learn.microsoft.com/en-us/azure/cognitive-services/content-moderator/dotnet-sdk-quickstart#setting-up
Please follow the API Reference for more information.

Azure function: Could not load file or assembly Microsoft.IdentityModel.Tokens, Version=5.2.1.0

Im writing an azure function to generate a JWT token and return it to the client. The code is tested locally in a console app and all seems to work fine. This is the package reference included in the working console app, and in my functions app:
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.1" />
When running the function host locally with func host start and executing the code it results in the error:
Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."
I don't understand why this is happening, the dll is laying in the output folder along with my application dll. The only other thing I can think of is that the function host has its own set of packages that it sources from and this one is not available yet, having been only released 12 days ago.
I'm not sure. Any help on why this is happening or how to get around it?
Details:
Azure Functions Core Tools (2.0.1-beta.22)
Function Runtime Version: 2.0.11415.0
I got this issue and it seems to be related to some kind of bug in the Azure function SDK. the fix was to add:
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
to your csproj file. As documented here
I had installed this package Microsoft.AspNetCore.Authentication.JwtBearer
And for me, the issue was resolved.
You can uninstall System.IdentityModel.Tokens.Jwt
Because the Microsoft package depends on the system package, so it gets installed automatically.
I was able to solve this exact issue by using an older version of the nuget package. My starting point was that I had copied a class file from an old project to a new one. The class file referenced JwtSecurityToken. This did not compile in the new project, so I added Security.IdentityModel.Tokens.Jwt from nuget package manager. I just added latest version. This worked fine locally, but just like you, it failed when published to azure. I then looked at the old project and noticed that it was using 5.1.4 of that Security.IdentityModel.Tokens.Jwt. So, I downgraded to that version and it now works when published.
fwiw: this is the v2 preview runtime version at the time I did this.
https://<mysite>.azurewebsites.net/admin/host/status?code=<myadminkey>
{
"id": "<mysite>",
"state": "Running",
"version": "2.0.11587.0",
"versionDetails": "2.0.11587.0-beta1 Commit hash: 1e9e7a8dc8a68a3eff63ee8604926a8d3d1902d6"
}
tl;dr
None of the above worked for me and this would randomly happen from time to time until today it happened all the time. The only reason I could see was that Microsoft.IdentityModel.Tokens was not directly referenced in the executing project, but was on a referenced project. The library was sitting in the bin folder, it just wouldn't load.
Reference
Taking a clue from this solution to another problem I was able to resolve it like so:
Solution
Create a static constructor in the app's entry point class
static MainClass()
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
Add the handler
private static System.Reflection.Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
{
var domain = sender as AppDomain;
var assemblies = domain.GetAssemblies();
foreach(var assembly in assemblies)
{
if (assembly.FullName.IsEqualTo(args.Name))
{
return assembly;
}
}
var folder = AppDomain.CurrentDomain.BaseDirectory;
var name = args.GetLibraryName().Name.Split(Symbols.Comma).FirstOrDefault();
var library = $"{name}.dll";
var file = Path.Combine(folder, library);
if (File.Exists(file))
{
return Assembly.LoadFrom(file);
}
return null;
}

LoginApi ERROR Restsharp.addfile

Currently using RestSharp V106.1.0 as well a v2.1.8
While attempting to integrate docusign with our application I received an error off of the loginAPI:
string accountId = loginApi(username, password, integratorKey);
Receiving this error
{"Method not found: 'RestSharp.IRestRequest RestSharp.RestRequest.AddFile(System.String, System.Action`1, System.String, System.String)'."}
I have verified all of the parameters have the correct value and I was able to recreate a working API usage in a brand new project without prior packages installed. This leads me to think it is the version of RestSharp that is giving me this issue.Based on research about others having this issue it was an issue of the library change within updates.
Is there a specific version that is required as the dependancies for Docusign Package in visual studio doesn't mention a Restsharp version requirement?
Thank you in advance.

Bluemix node.js doesn't like "=>"

I'm new to Bluemix and node.js. I'm creating a Bluemix app that integrates with Box, but the built in Box service uses out-of-date node.js support, and I'd like to use the most recent node.js Box SDK.
I'm including this line at the top of my code
var BoxSDK = require('box-node-sdk');
But in processing this SDK, the log file throws an error on this line (line 191 of box-node-sdk/lib/api-request.js):
this.stream.on('error', err => this.eventBus.emit('response', err));
The error is:
SyntaxError: Unexpected token =>
What do I need to do to get Bluemix's node.js to recognize this (apparently new) syntax?
After some further digging, I discovered this page in the Bluemix runtime documentation, which says:
A node version should always be specified in the package.json file. If it is not, the latest node version will be used.
I removed the engines{} section from my package.json file to force it to use the latest node version, and I've gotten past this problem. (On to my next error...)
Thanks very much to jfriend00, who gave the crucial information that led me where I needed to go!

Resources