M2Mal
M2Mal

Reputation: 15

Microsoft.Graph collections deserialization within DLL

I have strange problem with receiving collection from Microsoft Graph. My goal is to create add-in as DLL for another system, which process MS Graph collections. I use code as follow:

var drives = graphClient.Sites[siteId].Drives.Request().GetAsync().Result;
return drives.Count;

In Visual Studio 2019, within Unit Test Project, it work fine without errors.

Problem appears, when I use the DLL in destination system. There the same code throw following exception:

-2146233088 | Could not create an instance of type Microsoft.Graph.ISiteDrivesCollectionPage. Type is an interface or abstract class and cannot be instantiated

Have you any idea, why Graph SDK as Add-in doesn't automaticly deserialize received objects? It work fine if receive one class, not collection.

Work-around is by use HttpRequestMessage / HttpResponseMessage, but it's so friendly as above.

I will be grateful for your help

Upvotes: 0

Views: 352

Answers (1)

Dev
Dev

Reputation: 2464

Sounds like a dependency(.net framework, libraries) is missing at the destination system. Make sure it has the necessary dependencies installed. Always use the latest NuGet package, make sure the dependencies exist in the destination system.

Upvotes: 0

Related Questions