Closed RODINOliver closed 2 years ago
Can you post your project file, packages.config (if applicable) and the full text of the exception?
Sure, the error is -
error CS1061: 'ServiceClient' does not contain a definition for 'RetreiveMultiple' and no accessible extension method 'RetreiveMultiple' accepting a first argument of type 'ServiceClient' could be found (are you mis sing a using directive or an assembly reference?) [C:\SBA\Medical Information AF\Medical Information AF.csproj]
Medical Information AF.csproj -
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<RootNamespace>Medical_Information_AF</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.6.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
<PackageReference Include="Microsoft.PowerPlatform.Dataverse.Client" Version="1.0.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Xrm.Tools.CRMWebAPI" Version="1.0.25" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Did you mean "RetrieveMultiple" instead of "RetreiveMultiple"? 😅
Well, that's awkward, apparently I have dyslexia... thanks for picking up on my mistake!
Fixed typo and is working as expected now.
@RODINOliver it might be best if you use the IOrganizationService or IOrganizationServiceAsync interfaces (both of them are implemented by ServiceClient) though, cause it'll make it easier to unit test ....
Do you have a link to an example using those interfaces?
The documentation here seems to mention 'SampleCode\CS\BusinessDataModel\Templates\GetEmailTemplateAttachments.cs' but I'm not sure where that actually is.
Do you have a link to an example using those interfaces?
ServiceClient implements both so you could assign it upon initialisation, like:
IOrganizationService orgService = new ServiceClient(...)
IOrganizationServiceAsync orgService = new ServiceClient(...)
Is there another 'using' definition needed to use IOrganizationService / IOrganizationServiceAsync?
Nope, they are in the same namespace...
So currently I have -
var serviceClient = new ServiceClient(ConfigHandler.DataverseUrl, async (string dataverseUri) => {
return await AuthenticationHandler.GetAccessTokenAsync(dataverseUri);
}, true);
Is it really as simple as changing var serviceClient
to IOrganizationServiceAsync orgService
I did try it but I would've thought that the advantage would be orgService then having better intellisense or similar, but I might be missing the point entirely...
Is it really as simple as changing var serviceClient to IOrganizationServiceAsync orgService
Yep, that's it. You would get intellisense of the methods available on IOrganizationService / Async versions...
Hi Team,
I am currently trying to utilise
Microsoft.PowerPlatform.Dataverse.Client
within an Azure Function to query if rows exist with specific criteria.I keep running into issues with the 'ServiceClient' not having the 'RetrieveMultiple' definition.
As far as I can tell the definition should be recognised as it can be found here in the ServiceClient.cs file.
I could be missing something entirely, so would appreciate any advice.
End goal is as described above, just want to have an Azure Function which is able to run a lookup query as opposed to retrieve a specific entity right away.
I am using Managed Identity authentication if that has an affect on things -
The code segment which is triggering the error is -
The directives I am using as well are -
Interested in your thoughts, cheers!