I have a custom attribute with the type 'file' and I need to delete the file via a plugin. I checked the documentation located here: https://learn.microsoft.com/en-us/powerapps/developer/data-platform/file-attributes and it says that for .net I have to use DeleteFileRequest. I checked the documentation for this request and looks like it requires file ID, but I'm not sure where I can get it. I tried to pass parameters in the ParameterCollection, similar to the Download Request, but it doesn't work this way:
var req = new DeleteFileRequest()
{
Parameters = new ParameterCollection()
{
new KeyValuePair<string, object>("Target", new EntityReference("xxx_entityName", locId)),
new KeyValuePair<string, object>("FileAttributeName", "xxx_attributeName")
}
};
Didn't find any samples for this request in Google, so if someone has any experience with this - please share. Thank you.
I was able to get the File ID (GUID) that is required for the DeleteFileRequest. It presents in the target Entity in file attribute during file upload. So in the plug-in registered at ModifiedOn (can't use File field as a trigger), you can see in the file field the ID. You can save it somewhere for later use. Unfortunately still not sure how to get it for the already uploaded file. Please share your thoughts if you know how to do it.