How to use the ODataV4 web service to get the item picture in Visual Studio 2017

xavierho970304
Member Posts: 12
Hi guys,
May I know how to use the ODataV4 web service to get the item image/picture in Visual Studio 2017?
Any expert can help me on this or provide me the sample? I had installed the OData v4 client code generator also but still cannot get it.
Thank you.
May I know how to use the ODataV4 web service to get the item image/picture in Visual Studio 2017?
Any expert can help me on this or provide me the sample? I had installed the OData v4 client code generator also but still cannot get it.
Thank you.
0
Answers
-
What version of NAV are you using?
If you could use the API endpoints instead of OData, then look at this: https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/api/dynamics_item_get_picture
If you have to use OData, then the easiest solution is adding a field to your OData page, and display the image as a Base64 string (imo)
0 -
What version of NAV are you using?
If you could use the API endpoints instead of OData, then look at this: https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/api/dynamics_item_get_picture
If you have to use OData, then the easiest solution is adding a field to your OData page, and display the image as a Base64 string (imo)
I using BC version 16, do you mean I need to create a new field to get the image as a Base64 string right? May I know do you have any example for this? It is because I know if direct use the SOAP or OData cannot get the url/data from my original item image field0 -
See following code for a simple example using OData.
Let me know if something is not clearpage 50000 "OData Item" { PageType = List; ApplicationArea = All; UsageCategory = Lists; SourceTable = Item; layout { area(Content) { repeater(GroupName) { field("No."; "No.") { ApplicationArea = All; } field(Base64Gbl; Base64Gbl) { ApplicationArea = All; } } } } var Base64Gbl: Text; trigger OnAfterGetRecord() var TenantMediaLcl: Record "Tenant Media"; ConvertMgmtLcl: Codeunit "Base64 Convert"; InStreamLcl: InStream; begin Base64Gbl := ''; if Rec.Picture.Count > 0 then if TenantMediaLcl.Get(Rec.Picture.Item(1)) then begin TenantMediaLcl.CalcFields(Content); TenantMediaLcl.Content.CreateInStream(InStreamLcl); Base64Gbl := ConvertMgmtLcl.ToBase64(InStreamLcl); end; end; }
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions