Import/Export BC Item Pictures
This service will help workaround the limitation in the Business Central web services that limits compatibility of web services and BLOBS.
I have a full blog that goes into more detail about the procedures used and how to consume the web service here.
I had the requirement to import an Item Image into Business Central, but found it took more effort than I initially realized. Before we can begin, we need to understand how Business Central stores media. The actual file is stored in a binary large object (BLOB) field. This field is stored in the Tenant Media table in Business Central. The Media record is then included in a Media Set on the Item record. This will allow multiple media objects to be linked to a single record. To keep this example simple, we will only work with a single image for each item, but the data structure looks like this:
- If you aren't familar with building AL extensions you can use the Microsoft documentation to get started.
- The Pag.83000.ItemBlobWs.al file can be modified as needed to use additional logic.
- If using this service to import Images, note that an existing images will be deleted prior to importing the new one.
Web Service isn't available after publishing
- Make sure the service is published as outlined here.
- Make sure the service is named as expected ex. /ODataV4/Company('Sample')/ItemPictureWS
Failed to create record.: The request was blocked by the runtime to prevent accidental use of production services.
- Go to Business Central > Extensions > Item Image Web Service > Configure and enable ‘Allow HttpClient Requests’.
Web Service performance is slow
- Due to the nature of all the file encoding and retrieval this is a slow web service compared to the standard ones.
- If you have any suggestions on how to improve the performance of this service feel free to open an issue.
Something else isn't working properly
- Use github's issue reporter on the right
- Send me an email ethan.sorenson@eonesolutions.com (might take a few days)
- 1.0.0.0 first release on BC v16
Enjoy!