Hello community,
as described in subject im currently creating a C# WebAPI using ServiceClient of Microsoft.PowerPlatform.Dataverse.Client Nuget package.
Goal:
- Create a record using AAD-App-Credentials for a user who does not have permission to dataverse table without losing data, which user initially executed my web api call.
So if i understand it correctly, i need to use CreatedBy + CreatedByDelegate fields.
CreatedBy/ModifiedBy = Real User who executed web api call
CreatedByDelegate/ModifiedByDelegate = App User
I only achieve this if both objects (AAD-User + AAD-App) have Write-Access to DataVerse table. It does not work, if the user who called my api does not have direct permissions to create records.
Is there any way to achieve my goal?
What i tried right now:
crmServiceClient = new ServiceClient(cert, StoreName.My, null, new Uri("https://{EnvironmentUrl}"), true, null, "{ClientId}", null, null);
--> this creates record as app
crmServiceClient.CallerId --> Setting this does not do anything
crmServiceClient.CallerAADObjectId --> Setting this throws exception as the user i set has no permission in dataverse.
Any ideas on how to achieve this or is this scenario even possible?