Hi,
Assuming that your DMF Data project is setup, this is some code I have that works:
If it already has an execution ID, then it will use the execution id and download the package.
If the execution id id blank, it will start a new execution of the project
It also looks like your method signature for the ExportToPackage method is wrong.
This is what it is:
POST /data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportToPackage
BODY
{
"definitionGroupId":"<Data project name>",
"packageName":"<Name to use for downloaded file.>",
"executionId":"<Execution Id if it is a rerun>",
"reExecute":<bool>,
"legalEntityId":"<Legal entity Id>"
}
So, what I have in my code is like this:
Console.WriteLine("Starting data project: "+dmfDataProjectName);
string runExecutionId = string.Empty;
bool reExecuteDataProject = false;
var dmfExecutionId = d365Res.DataManagementDefinitionGroups.ExportToPackage(dmfDataProjectName, Guid.NewGuid().ToString(), runExecutionId, reExecuteDataProject, dataAreaId).GetValue();
I pass the Data Project Name as a parameter to the function.
The package name is a new Guid that gets saved on Azure Blob storage
I leave the executionId blank (string.Empty)
reExecute is false
legalEntity can be USMF in a demo data environment.