I am using Odata connected services to interact with dynamics.
I have a property(let's say p1) on an entity say E1.
I have another entity lets say E2 which has a relationship with E1. I am trying to load all properties of E1 from E2 as below:
LoadProperty(E2, nameof(E2.relationshipAttributewithE1)) - this translates into an api that looks like this: api/data/v9.1/E2(E2_Guid)/relationshipAttributewithE1
Property P1 is of File type so Odata generates the type as Edm.Binary but the LoadProperty fetches the same attribute as a Guid in form of String thus causing FormatException. I want all the properties from the related entity including P1 but P1 should be of type binary.
Detailed error:
FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
ODataException: Cannot convert the literal '00000000-0000-0000-0000-000000000000' to the expected type 'Edm.Binary'.
Temporary fix that I have done is to remove the Property from Odata xml as that property is not used anywhere as of now. This is not an ideal fix and I am looking for a fix that wouldn't involve deleting anything from autogenerated Odata files.
Is there a way to tell LoadProperty to get the base64 string instead of Guid maybe a header that tells the request what to get? Or is there anything else I can use that would get me all the properties from the related entity including P1 but P1 will be of type binary?
Any help is appreciated.
Thank you!