I want to copy files from Azure blob storage to SharePoint Folder using Microsoft Flow. I have tried several times and the flow always fail when its running.
I have attached the flow that I'm currently trying to execute:
Can someone help me with this?
For your problem, please refer to the logic I post below (I have upload a testcsv.csv file to the blob storage):
After the trigger "When a blob is added or modified", we need to use "Get blob content" action to get the content of the csv file. Then add "Create file" action of SharePoint and put the file content which we got from blob to the "File Content" box.
By the way, as you mentioned it is a csv file, so in my blob storage container I only have one file by default. If there are more than one file in your blob storage, you can use "List blobs" action and use "For each" to loop it and then create each of the file in SharePoint.
I tried that however failed as it would not handle if you have folder structure in the blob and you'd like to mirror that structure in SP and copy individual files to folders.
Related
I have Azure blob storage, which contains some CSV files.
My task:
1. Create a logic app for the blob storage.
2. Retrieve the data from the blob storage.
3. Convert the retrieve file to JSON.
3. Upload that data to an online portal through API.
I've tried retrieving the data by "Get blob content" action, but not sure where to see the result. I have just created the logic app, but I'm stuck on what to do next.
For your question about
I've tried retrieving the data by "Get blob content" action, but not sure where to see the result.
When you run the logic app, you can see the content of your csv file in the OUTPUTS, shown as below:
If you want to use an api to upload the data, you just need to do the operation like below screenshot(but it also depends the type of your api's request body) :
Since you mentioned your azure storage blob contains some csv files, so maybe you need to loop the files. You can use "List blobs" action and "For each" action to loop them and then get blob content.
Hope it helps, if you have any further problem, please let me know.
I have an Azure storage account where I have created a folder to upload & download a file in it.I am also performing the rename operation on it e.g when I perform rename operation and upload the file into the blob all Blob metadata get updated successfully.
Please suggest the changes.
How to download the Azure blob content with the same name of File
As Gaurav Mantri said that you could specify the ContentDisposition property for your blob. Use the Azure Storage Explorer, you could quick set the ContentDisposition property as follows:
But when I downloading the image, the ContentDisposition seems not working at all. Then I found a similar issue, you need to set the DefaultServiceVersion for your blob storage service. And you need to write your code and set the DefaultServiceVersion, more details you could refer to here and choose your development language.
Test:
Additionally, if you upload/download your blob files by programming, you could refer to issue1 and issue2.
I am using LogicApp to import a set of files which are inside the directory(/devcontainer/sample1/abc.csv).
The problem here is that,I could not even located to the azure file from my LogicApp, I am getting the following error as:
verify that the path exists and does not contain the blob name.List Folder is not allowed on blobs.
Screenshots for reference
The problem here is that,I could not even located to the azure file from my LogicApp,
The file explorer will show all the contains and blobs when you choose blob path. And it will cache the data for a period of time to ensure the smoothness of the operation. If a blob is added to the container recently, it will not be seen and chosen from the file explorer. The workaround is by clicking the change connection link and using a new connection to retrieve the data.
Does your blob connection pointing to the correct storage account? one thing you can try to do is instead of providing the path try to browse the path so that you can what are the containers and the blobs that are present in the storage account that you are trying to access.
I want to create following folder structure on Azure:
mycontainer
-images
--2007
---img001.jpg
---img002.jpg
Now, one way is to use PUT Blob request and upload img001.jpg specifying the whole path as
PUT "mycontainer/images/2007/img001.jpg"
But, I want to first create the folders images and 2007 and then in a different request upload the blob img001.jpg.
Right now when I tried to doing this using PUT BLOB request:
StringToSign:
PUT
x-ms-blob-type:BlockBlob
x-ms-date:Tue, 07 Feb 2017 23:35:12 GMT
x-ms-version:2016-05-31
/account/mycontainer/images/
HTTP URL
sun.net.www.protocol.http.HttpURLConnection:http://account.blob.core.windows.net/mycontainer/images/
It is creating a folder but its not empty. By, default its creating an
empty blob file without name.
Now, a lot of people say we can't create a empty folder. But, then how come, we can make it using the azure portal as the browser must be sending some type of rest request to create the folder.
I think it has to do something with Content-Type i.e. x-ms-blob-content-type, which should be specified in order to tell azure that its a folder not a blob.
But, I am confused.
I want to first create the folders images and 2007 and then in a different request upload the blob img001.jpg
I agree with Brendan Green, currently, Azure blob storage just enable us to create virtual directory structure by naming blobs with path information in their names.
I think it has to do something with Content-Type i.e. x-ms-blob-content-type, which should be specified in order to tell azure that its a folder not a blob. But, I am confused.
You could check the description of Request Headers that could be set for Put Blob operation and you will find it does not support creating an empty folder by specifying some request headers.
Besides, as Gaurav Mantri said, if you really want to create an empty folder structure without content, you could try to use Azure File storage and it also enables us to use REST API to access Azure File storage. And the Create Directory operation cloud be used to create a new directory under the specified share or parent directory.
PUT https://myaccount.file.core.windows.net/myshare/myparentdirectorypath/mydirectory?restype=directory
This is not possible - the folder structure is virtual only.
See Get started with Azure Blob storage using .NET. You can only create a container, and everything else held in that container is a blob.
Excerpt:
As shown above, you can name blobs with path information in their
names. This creates a virtual directory structure that you can
organize and traverse as you would a traditional file system. Note
that the directory structure is virtual only - the only resources
available in Blob storage are containers and blobs.
I currently have a web role which displays a webpage, the webpage allows the user to select a file from their computer, the web role then uploads the file to some Azure Blob Storage.
However the file the user usually uploads is a zip file so i would like to unzip the file and extract the contents and then upload the contents to the Azure Blob Storage.
I have attempted to do this by using the SharpZipLib example I found here
http://blog.logiclabz.com/c/unzip-files-in-net-c-using-sharpziplib-open-source-library.aspx
I have add the references to my web role for the ICSharpCode.SharpZipLib.dll file and the ZipOperations.dll however I am still receiving the following errors;
Another thing I am confused about is when I am calling UnZipFile(...); what would be the directory of the file I am uploading, would it be the ID of the form which the file is selected in.
Thanks in advance, Sami.
The ZIP file should be uploaded to your web role local disk first, let's say you saved it in a local resource. Then you can invoke the SharpZip to extract the content to some other local resource, then finally upload the content files to the BLOB.
Regarding the windows azure local resource, please have a look http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx
Regarding your errors it looks like you didn't add necessary "using" statements at the beginning of your code. For example you need "using System.IO" then you can use File, Directory, etc. in your code.