using microsoft graph api to retrieve chat members - azure-ad-graph-api

Following this link : https://learn.microsoft.com/en-us/graph/api/conversationmember-list?view=graph-rest-beta&tabs=csharp
I tried using :
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var members = await graphClient.Me.Chats["{id}"].Members
.Request()
.GetAsync();
However, visual studio gives IUserRequestBuilder doesn't not contain a definition for Chats.
Microsoft.Graph version used from NuGet packages 3.8.0
Thx

The chats endpoint i believe is in the beta endpoint. that means you should be using in vs, the nuget package microsoft.graph.beta
and not microsoft.graph.

Related

"Failed to get document because the client is offline" only on web app - Firebase Firestore on Flutter

I'm using FireFlutter to store data in the Firebase Firestore.
The web app returns this error:
Error: [cloud_firestore/unavailable] Failed to get document because the client is offline.
Steps to reproduce:
1- Create a new Firebase project (no Analytics) and activate Firestore in test mode; add a collection called test with a document called test and some dummy data; from the project settings, add a new web app and copy the CDN instructions in the web/index.html file just before the closing body tag;
2- Create a new Flutter project (I use VSCode and ask it to create an empty application);
3- Add firebase_Core and cloud_firestore dependencies
4- In the terminal, use fireflutter configure, using the Firebase project just created; for this test I only build the web application;
5- Add
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
in the main function and
MainApp({super.key}) {
FirebaseFirestore.instance
.collection('test')
.doc('test')
.get()
.then((value) {
print(value);
}).catchError((error) {
print(error);
});
}
}
in the MainApp class constructor;
6- Run the Flutter project
The debug console shows the error described above.
The connection is not a problem, no ad blocker is activated.
Mobile versions work, this makes me think the problem could be in some configuration file, but I don't understand what to check.
Can anyone point me to the right direction?

Upgrading mongo-java-driver to Version 3.9.1

I am in the midst of upgrading the Spring version of one of our projects. As a result of this, the MongoDB library also had to be upgraded.
I am not able to track what the previous version of the MongoDB library used was, but the current version is now 3.9.1.
I have the following piece of code that doesn't work because of the upgrade, how should I rewrite it?
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.ServerAddress;
public sampleMethod() {
MongoClient client = null;
if (...) {
List<ServerAddress> saList = new ArrayList<>();
for (...) {
saList.add(...);
}
client = new MongoClient(saList);
} else if (...) {
MongoClientURI mongoClientURI = new MongoClientURI("mongodb://...");
client = new MongoClient(mongoClientURI);
} else {
MongoClientURI mongoClientURI = new MongoClientURI("mongodb://..." + this.encryptedProperties.getProperty("mongo.username") + "....");
client = new MongoClient(mongoClientURI);
}
return new MongoTemplate(client, srcDbname);
}
The problem now is with the return statement, because post Version 2.1, MongoTemplate's signature is now public MongoTemplate(com.mongodb.client.MongoClient mongoClient, String databaseName). Pre Version 2.1, it was public MongoTemplate(com.mongodb.MongoClient mongoClient, String databaseName).
I was looking at the documentation for the MongoClient interface (com.mongodb.client.MongoClient package) & it states that "Instances of this class can be created via the MongoClients factory.". Looking at MongoClients, the methods can't accommodate the creation of MongoClient with parameters List<ServerAddress>, MongoClientURI like MongoClient (com.mongodb.MongoClient package) does.
Package
Old Version
Link
New Version
Link
mongo-java-driver / com.mongodb
not sure, couldn't locate but will update
-
3.9.1
https://www.javadoc.io/static/org.mongodb/mongo-java-driver/3.9.1/index.html
org.springframework.data:spring-data-mongodb
2.0.8.RELEASE
https://docs.spring.io/spring-data/mongodb/docs/2.0.8.RELEASE/api/
3.2.0
https://docs.spring.io/spring-data/mongodb/docs/3.2.0/api/
Please bear with me as I am a junior dev (6 months of work experience) & I'm not familiar with upgrading project versions, thank you for your understanding
I am not sure how to proceed, I am currently reading the docs & doing some Google searches to see what a possible solution would be
I don't have experience in MongoDB
It looks like you're upgrading to version 3.2 of Spring Data MongoDB. As per the reference documentation, that major version series (3.x) requires you to use the 4.x version of the MongoDB Java Driver.
7.1. Dependency Changes Instead of the single artifact uber-jar mongo-java-driver, imports are now split to include separate
artifacts:
org.mongodb:mongodb-driver-core (required)
org.mongodb:mongodb-driver-sync (optional)
org.mongodb:mongodb-driver-reactivestreams (optional)
Depending on the application one of the mongodb-driver-sync,
mongodb-driver-reactivestreams artifacts is is required next to the
mandatory mongodb-driver-core. It is possible to combine the sync and
reactive drivers in one application if needed.

how to call Package Manager Console and execute Find-Package in visual studio extension

I'm developing a visual studio extension(vsix).
Now, I want to get a nuget package latest version. I only found one way by using Package Manager Console, dotnet CLI still not support search command.
So, how can I call Package Manager Console and execute Find-Package command, or is there another way can get package latest version from specific package source server.
Have you tried the way in below doc or not?
https://learn.microsoft.com/en-us/nuget/guides/api/query-for-all-published-packages
I built a simple VSIX with customer Command item, and it could use below code to perform search packages from NuGet(need to install Nuget.PackageManagement into your VSIX project first).
List<Lazy<INuGetResourceProvider>> providers = new List<Lazy<INuGetResourceProvider>>();
providers.AddRange(Repository.Provider.GetCoreV3()); // Add v3 API support
//providers.AddRange(Repository.Provider.GetCoreV2()); // Add v2 API support
PackageSource packageSource = new PackageSource("https://api.nuget.org/v3/index.json");
SourceRepository sourceRepository = new SourceRepository(packageSource, providers);
PackageMetadataResource packageMetadataResource = await sourceRepository.GetResourceAsync<PackageMetadataResource>();
IEnumerable<IPackageSearchMetadata> searchMetadata = await packageMetadataResource.GetMetadataAsync("JSON.net", true, true, null, NuGet.Common.NullLogger.Instance, CancellationToken.None);
var a= searchMetadata.ToString();

The type or namespace platform does not exist in the name space MvvmCross.Forms

I followed the TipCalc tutorial as recommended in the mvvmcross documentation
Here, The Core project and UI project works perfectly. But the android MainActivity has errors as it cannot find the namespace
MvvmCross.Forms.Platforms.Android.Core
MvvmCross.Forms.Platforms.Android.Views
Everything appears right but i am unable to figure out what i am doing wrong.
I have installed:
MvvmCross 6.1.2
MvvmCross.Forms 6.0.1.0
Xamarin.Forms 3.1.0.583944
I use TargetFrameWork 8.1 (Oreo)and .net Standard 2.0
I also confirmed in the MvvmCross GitHub repository that the namespace exists.
Here is a peek at
using Android.App;
using Android.Content.PM;
using Android.OS;
using TipCalc.Core;
using TipCalc.Forms.UI;
using MvvmCross.Forms.Platforms.Android.Core;
using MvvmCross.Forms.Platforms.Android.Views;
namespace TipCalc.Forms.Droid
{
[Activity(
Label = "TipCalc.Forms.Droid",
Icon = "#drawable/icon",
Theme = "#style/MyTheme",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
LaunchMode = LaunchMode.SingleTask)]
public class MainActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<App, FormsApp>, App, FormsApp>
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
}
}
}
Screenshot of the error
Your MvvmCross and MvvmCross.Forms packages are not in sync. They need to be the same version.
Easiest way is to go to the NuGet Package Manager for the solution in VS for Windows and consolidate the packages through the consolidate tab.
If you can't do that you can uninstall the packages, then re-install them.

How do I connect to Nuget online repository using Nuget API?

I am trying to connect to Nuget Online repository using a HTTP URI. I am using PackageManager object and supplying it with DataServicePackageRepository object in the constructor. It does not seem to fetch the list. What I might be doing wrong ?
Should I use a different Repository class?
Here is my Package Manager initializer code
var remoteRepo = new NuGet.DataServicePackageRepository(new Uri("http://myserver/myrepo/nuget"));
PackageManager pkgMan = new PackageManager(remoteRepo, #"C:\Path\To\LocalRepoPath");
If you just want the list of packages you do not need to use the DataServicePackageRepository or the PackageManager directly. You can just use the PackageRepositoryFactory and the IPackageRepository.GetPackages() method.
The code below returns the top 10 packages ordered by the most downloaded. This is similar to what Visual Studio returns in the Manage Packages dialog.
string url = "https://www.nuget.org/api/v2/";
IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository(url);
var packages = repo
.GetPackages()
.Where(p => p.IsLatestVersion)
.OrderByDescending(p => p.DownloadCount)
.Take(10);
foreach (IPackage package in packages) {
Console.WriteLine(package);
}