banner



How To Upload A Url To Files On Canvas

This open source library uses theAzure Hulk Service fromMicrosoft Dynamics 365 Business concern Central to access your storage business relationship, containers and blobs.

Run across too here:Blob Service REST API

BlobService API

Disclaimer:  …please go along in mind, this example does not comprehend every aspects andis provided "AS IS". Experience free to improve, contribute, utilize this API as an inspiration or contact me, if you have some ideas 😉

Authentication

In each scenario, authentication is in my opinion the hardest challenge. Azure Blob Service API is an important service and well secured.

One style, is to use Authorize with Shared Primal. For this, enter your Azure Portal and generate a SaS-Token for your Storage Business relationship:

Generate SaS Token

SaS-Token Example:

          sv=2018-01-28&ss=b&srt=sco&sp=rwdlac&se=2019-04-12T14:23:51Z&st=2019-03-12T07:23:51Z&spr=https&sig=Zsmo45gte5dvbNwRzCauydWhYMFZXWmoIdzR8prGGxw%3D                  
Token Clarification Example
sv Storage services version sv=2018-01-28
st Start time st=2019-01-12T07:23:51Z
se Death time se=2019-04-12T14:23:51Z
ss Resource (b=blob, f=files, q=queue, t=table) ss=b
sp Permissions (r=read, w=write, d=delete, l=list, a=add together, etc) sp=rwdlac
srt Resource Types (south=service, c=container, o=hulk object) srt=sco
spr Protocol spr=https
sig Signature Zsmo45gte5dvbNwRzCauydWhYMFmoIdzR8prGGxw=
sip Allowed IP Addresses

(Please see Constructing-an-Business relationship-SAS for more details)

Simulation

When yous starting time with any API, it'southward improve to simulate your HTTP calls. I utilize Visual Studio Lawmaking with the REST Client extension. This allows to include the simulation files into my workspace and I can run them when to set up my API calls and, when I do some troubleshooting.

The current API capture these methods and calls:

Method Simulation
Listing Containers list.containers.http
List Blobs list.blobs.http
Get Hulk go.blob.http
Put Blob put.blob.http

To run these HTTP calls, replace the variables with your storage account data.

Simulate – List Containers

          ### Alter these variables: @business relationship = <storage-account-name> @sasToken = <sas-token> ###  ### Listing Containers for Storage Account Become https://{{business relationship}}.blob.core.windows.net/?comp=list&{{sasToken}}                  

The result is XML:

          <?xml version="1.0" encoding="utf-8"?> <EnumerationResults ServiceEndpoint="https://myaccount.hulk.core.windows.cyberspace/">   <Containers>     <Container>       <Proper name>demo-in</Name>       <Properties>         <Last-Modified>Sat, 09 Mar 2019 18:51:18 GMT</Concluding-Modified>         <Etag>"0x8D6A4C0372195CD"</Etag>         <LeaseStatus>unlocked</LeaseStatus>         <LeaseState>available</LeaseState>         <HasImmutabilityPolicy>false</HasImmutabilityPolicy>         <HasLegalHold>faux</HasLegalHold>       </Properties>     </Container>     ...   </Containers>   <NextMarker /> </EnumerationResults>        

Simulate – List Blobs

          ### Change these variables: @account = <storage-account-name> @container = <container-name> @sasToken = <sas-token> ###  ### LIST Blobs for Storage Account Container Get https://{{account}}.hulk.core.windows.net/{{container}}?restype=container&comp=listing&{{sasToken}}                  

The result is XML:

          <?xml version="1.0" encoding="utf-eight"?> <EnumerationResults ServiceEndpoint="https://myaccount.blob.core.windows.internet/" ContainerName="demo-in">   <Blobs>     <Blob>       <Proper noun>example.jpg</Proper noun>       <Properties>         <Cosmos-Time>Sat, 09 Mar 2019 23:03:43 GMT</Creation-Time>         <Last-Modified>Saturday, 09 Mar 2019 23:03:43 GMT</Last-Modified>         <Etag>0x8D6A4E37A3C6BD0</Etag>         <Content-Length>94099</Content-Length>         <Content-Blazon>image/jpeg</Content-Type>         <Content-Encoding />         <Content-Language />         <Content-MD5 />         <Cache-Control />         <Content-Disposition />         <BlobType>BlockBlob</BlobType>         <AccessTier>Hot</AccessTier>         <AccessTierInferred>truthful</AccessTierInferred>         <LeaseStatus>unlocked</LeaseStatus>         <LeaseState>available</LeaseState>         <ServerEncrypted>truthful</ServerEncrypted>       </Properties>     </Blob>     ...   </Blobs>   <NextMarker /> </EnumerationResults>        

Simulate – Become Blob

          ### Change these variables: @business relationship = <storage-business relationship-name> @container = <container-proper noun> @blobName = <blob-name> @sasToken = <sas-token> ###  ### Get a Hulk course Storage Account Container Get https://{{account}}.blob.core.windows.net/{{container}}/{{blobName}}?{{sasToken}}                  

The result contains the blob content as stream / text.

Simulate – Put Hulk

          ### Change these variables: @account = <storage-account-name> @container = <container-proper noun> @blobName = <hulk-name> @sasToken = <sas-token> @length = 0 ###  ### Store a file every bit Blob in a Storage Account Container PUT https://{{account}}.hulk.cadre.windows.net/{{container}}/{{blobName}}?{{sasToken}} x-ms-hulk-type: BlockBlob Content-Length: {{length}}                  

The file is stored in the content and thelength must exist correct. This simulation instance creates / stores an empty file.

MSDyn365BC API for Hulk Service

The API is implemented in CodeunitMME Blob Service API. Following methods are covered:

          // List Containers from Blob Storage process ListContainers(var containers: Record "MME BlobStorage Container" temporary): Boolean;  // List Blobs from Blob Storage Container process ListBlobs(containerName: Text; var blobs: Record "MME BlobStorage Blob" temporary): Boolean;  // Go Blob from Blob Storage Container procedure GetBlob(containerName: Text; blobName: Text; var text: Text): Boolean; process GetBlob(containerName: Text; blobName: Text; var stream: InStream): Boolean;  // Put Hulk to Blob Storage Container procedure PutBlob(containerName: Text; blobName: Text; var text: Text): Boolean; process PutBlob(containerName: Text; blobName: Text; var stream: InStream): Boolean;  // Become Url for Blob procedure GetBlobUrl(containerName: Text; blobName: Text): Text;        
Table Description
MME Blob Storage Account Storage Account Information
MME Blob Storage Account Container Data
MME Hulk Storage Account Blob Information

D365BC Example

Setup the Storage Business relationship in D365BC

The instance shop information well-nigh the storage business relationship in tableMME BlobStorage Account. To setup you can utilise folioSetup Storage Account:

Setup Storage Account

Storage Business relationship – Containers

Your Storage Account in your Azure Portal provides a list of the containers, allow to create new containers or delete existing containers:

Containers in Azure

For Dynamics 365 Business Key I added the page "Hulk Storage Container Listing" (MME BlobStorage Container List).

Containers in MSDyn365BC

Storage Account – Containers Blobs

Container Blobs in Azure

When you open a container from your Storage Account in your Azure Portal, it shows a list of the blobs. You can as well upload, download or delete blobs in this page.

The blobs of a container are listed by page "Blob Storage Hulk List" (MME BlobStorage Blob Listing). This page contains too a preview (JavaScript Control-Add-In) to show the Image or Text in a factbox.

Container Blobs in MSDyn365BC

This page allows currently to upload and download blobs … experience gratuitous to contribute new content and functionality!!!

Download Blob
Download Blob

The Source Code at Github:

https://github.com/megel/MSDyn365BC-BlobService-Balance-API

Source: https://never-stop-learning.de/upload-files-into-your-azure-storage-with-dynamics-365-business-central/

Posted by: purdyequaringer.blogspot.com

0 Response to "How To Upload A Url To Files On Canvas"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel