Power apps pen input image save to CRM notes - dynamics-crm

I am working on powerapps which will integrate with CRM and create records in it. As part of this I wanted to save the peninput as a note in CRM. But CRM only takes images as base64 encoded. In powerapps the output of pen input is not base64 encoded instead it is a URI to a local blob storage.
If I save the local blob storage then, in CRM it will not show the image.
There is a way to do it in SharePoint but that is not working for CRM.
Is there a way to save the peninput to CRM?

Related

botframework get attachment api returns with 404 for old images

Background
We are using the following api to fetch image data uploaded from our user via bot.
The API reference is the following.
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#get-attachment
And the use case is the following.
User pasted image along with text and send message to bot.
The following image is the [bot side].
We are fetch the pasted image data and show it on [our app side].
The following is our app side.
Issue
But we found that for the images uploaded [1 month ago], the API returns with 404 http code and we could not get image data anymore.
For the images uploaded recently, The api responsed with 200 and image binary data which we can take usage and show it.
Question
Is it possible that MS side put some restriction for pasted image that uploaded to botframework blob storage more than a month?
It's important to note that the Azure Bot Service's Connector service is not a storage service. When attachments are sent to/thru the Connector, Azure will store the attachment for no more than 24 hours.
If you are needing to access attachments sent days/weeks/months ago, then you should utilize Azure Blob Storage, or some equivalent service, to meet those needs.

Optimize and host images in Azure?

I'd like to host images for my website on Azure. The images should be compressed and available in different resolutions.
Of course, I could just compress and scale the images by myself and put them in a blob storage.
But is there a way to let Azure do the work for me?
I want to upload an image in a very high resolution and Azure should create versions in different resolutions and compress them. After that the image should be published so that I can retrieve it from my website.
Is there a better way to host images than Azure blob storage?
You can create an Event Subscription that will respond to the blob storage uploaded event, after that, an Azure Function will be triggered and will handle the event by creating a resized version of an image and copying it to a separate storage container. This is an auto-scale solution. An example that exactly describes your situation can be found on official microsoft docs page Tutorial: Automate resizing uploaded images using Event Grid.
Event Grid enables Azure Functions to respond to Azure Blob storage events and generate thumbnails of uploaded images. An event subscription is created against the Blob storage create event. When a blob is added to a specific Blob storage container, a function endpoint is called. Data passed to the function binding from Event Grid is used to access the blob and generate the thumbnail image.

How to get image from SharePoint document library into thumbnail card of messaging extension of bot framework

I'm having a SharePoint document library which contains some icons. And i'm having a azure web app bot used for messaging extension using bot framework. In messaging extension preview thumbnail card i need to load the icons from SharePoint library.
Both SharePoint document library and Azure bot are on different tenant and users are also different.
SO when i'm trying to load icons from SharePoint library its giving me unauthorized error due to different tenant and users.
Is there any way to pass base64 string to thumbnail card in to load the image instead of url.
I have tried to convert image from SharePoint document library to base64 string but didn't got a way to pass that base64 string to messaging extension.
I need to show images from sharepoint document library into thumbnail card of bot framework.
There are 2 approaches you can implement.
Store images to Azure blob storage and use static url from the blob. You can use SAS key for security.
Other approach is storing images to SharePoint doc library as you listed in question then you are getting base64 value of image and store that value to a variable and use it in DataUri as below
string.Format("data:image/png;base64,{0}",Convert.ToBase64String(photoBytes));

Where can I store a user accessible Google Slides template?

I'm currently working on a website which allows reports to be generated and saved as a Google Slide via the Google Slides API. The reports are generated using a template slide which contains placeholder shapes which are then populated with graphs and text.
My problem is that the template Google Slides file needs to be accessible to any user who decides to generate a report. But...
Google Drive can only be authorized via oAuth. Users coming to the site will not be able to authenticate any drive which does not belong to them
The template cannot be stored in the codebase as the slides API is only able to interact with files stored in the cloud AND it is not possible to download a file in 'Google Slides format'
It could be possible to store the template on Google Cloud Storage, but it is not possible to import a Slides file without converting it to another format. Attempting to convert the file once it has been uploaded does not produce a new slides file within the cloud storage
Is there anywhere I could store my Google Slides template and have it accessible to my application at all times so that it may generate reports based on that template?

Set content type of azure blob to image in WP7

I am uploading a stream of photo from my phone camera to azure. I am uploading e.ChosenPhoto which is a stream of the taken photo and i am using blob.Metadata["ImageType"] = "image/jpeg"; but still, when the photo is uploaded the content is marked as application/octet-stream and when i go to the url the browser download the photo instead of displaying it.
What steps do i need to do in order for it to make it jpg ?
EDIT: it seems that the library that comes with WAT for WP - WindowsPhoneCloud.StorageClient.dll
doesn't support blob.Propeties at all. (maybe because WP only support async calls ?) Is there any workaround on setting the content type ?
Try setting blob.Properties.ContentType = "image/jpeg".
Unless the SAS is used, it is highly recommended that we use a cloud service to upload blobs. If we upload a blob directly from Windows Phone without SAS, we have to embed our storage account key in the Windows Phone application. If a hacker gets the key, he will obtain full control of our Windows Azure storage account. For example, he can upload several TB data to the storage, and requires us to pay for the data. So instead of trying to upload the blob from Windows Phone, please try to host a service in Windows Azure. We upload the image to our service, and our service saves the file in blob. As long as we don’t return the storage key in any response, it will be safe.
If we have to upload directly from Windows Phone without SAS, we may need to manually use the REST API for the scenario to work. According to http://watwp.codeplex.com/discussions/352111 , the WAT library doesn’t allow us to specify a content type. In addition, I would like to point out that WAT is just a toolkit. It is not a built-in Windows Azure component.
Best Regards,
Ming Xu.

Resources