Accessing OneDrive from Azure Mobile Service - c#

I'm developing a mobile app to share some content between users and I'm facing a weird problem.
Currently, what the app does is to allow the users to download some files from the web and store them on their OneDrive account.
The problem is that I need to download the file from the web first, and then upload it to OneDrive, and this means that I'm wasting double bandwidth for each file (OneDrive does not allow to upload a remote file).
The other required feature is to upload a file from OneDrive to my Azure storage, so, basically, I need my Azure service to work with both upload/download from/to OneDrive.
I can't find anything useful online, but I think I got a solution for the OneDrive-to-Azure scenario:
Get the file ID using the LiveSDK on my phone
Build a download link for the given file
Send the link to the Azure Mobile Service
Download the file in the Azure Storage
I've not tried it yet because I still got no access to Azure (I need to register for the trial), but I'm not sure that this may work, and even if it does I still need to figure out how to make the Azure-to-OneDrive stuff.
Do you guys have any clues?
This thing is really driving me insane :\

Related

Saving a file in OneDrive from Azure Functions

What's the simplest way for an Azure Functions to save a file into OneDrive? How does authentication work from a deployed Azure Function?
To make this discussion simpler, we have a string var content = "This is the file content" which needs to be saved as sample.txt file.
What if OneDrive folder is shared with an URL (real shared OneDrive link, will be removed - https://1drv.ms/f/s!Ak7ywxppmRtB8uRKhvT1FLmNBwXNwQ) and no authentication is required?
I'd recommend taking a look at the Microsoft Graph APIs for managing files stored in OneDrive.
They have great C# examples using the Microsoft.Graph NuGet package. You will need to implement a mechanism of authentication however and I don't think there is a way around this. For the Graph, I'd recommend looking at these implementations for getting authenticated for a user.
Once you've authenticated in your Function app, you should be able to get to where you need to be using the Graph APIs for OneDrive available.
List a user's drives
Upload or update a file in a drive

Azure storage files force download to browser

I have my files stored in Azure File System and here are the requirements -
User should be able to view the documents without downloading it to the local
This is working fine for pdf but not any other mime types
I tried setting Content-Type,Content-Disposition (in azure file properties but no luck) and also iframe.
User should be able to edit the doc online without downloading.
I don't think this is possible just with Azure and have to integrate with One Drive may be? Correct me if I am wrong?
I would really appreciate any inputs/thoughts.
Not sure if this is a viable option but using Storage Accounts in Azure, you can map these accounts as a network drives to any client machine. So they would be able to access these files via File Explorer.
This link covers the basic steps in setting it up.
Unfortunately for anyone who wishes to use this feature, they need to be on Windows 8 (or above) to be able to map a network drive successfully as it uses SMB3.
If this option is a no go I will delete the post.

Moving an asp.net web forms site on azure without coding it again to use azure blob storage

I have a asp.net web forms web site that uses many files from server disk, accept uploads, processing files on the server. All the files stored in the web server's disks.
I would like to move my site to azure web sites. But to do that i think we need to update site code to keep files in azure blobs and process from it. Right now we are not able to that. So can i move my web site to azure without using azure blobs? Is there any way i can move all my site and files to azure, keep and publish on azure but not on azure blobs?
Using Virtual Machine is not an option to us right now.
Every Azure App Service/Website comes with persisted storage, which is technically an Azure storage blob mapped to the local file system. However, your code need not be aware of that. The details are described to the File System section here.
If you can configure paths for your server files, this persisted storage should suffice.

How to properly upload video files to Azure Media Services from angularjs

For my scenario, our current app is begin coded in html5 and angularjs communicating with web api. I have a workflow scenario that I seem to not be able to find an end to end example for. I would like to allow users of my website to upload videos and images to Azure Media Services. I found several examples that seem to move the data from a web page to blob storage and then copy over to azure media services.
Is there a way to upload the file directly to Media Services, instead of having a temporary and permanent blob container(one tied to AMS), as this approach seems to force me to have an additional storage container or is there a way to move the file to blob storage followed by linking the blob file to AMS via IAssetFile?
Can someone provide an end example that demonstrates the flow from web frontend upload to the file ending up in AMS?
Once up there, is there a way to make sure users can view but not download videos?
1.Is there a way to upload the file directly to Media Services:
The Media Services SDK requires you to first create an Asset object in our system. That Asset object is backed by a container in Storage. You can create an empty Asset object, and request a write only SAS URL (We call them "Locators" in our API) to upload your content directly into. You may want to check out this AngularJS module and see if it works. http://ngmodules.org/modules/angular-azure-blob-upload
2.Can someone provide an end example that demonstrates the flow from web frontend upload to the file ending up in AMS?
Your web API/frontend should use the Media Services SDK to create the empty Asset first. Once created, hand create a write only SAS URL and hand that back to your Angular client. The Angular client can then use client side javascript library to upload directly to the blob/container using the SAS URL and a module for azure-blob upload like the one here: http://ngmodules.org/modules/angular-azure-blob-upload
3.Once up there, is there a way to make sure users can view but not download videos?
Once the video is uploaded, you should Delete the Write only SAS "Locator" from your Asset's Locators collection. This way, nobody can use it to write again.
At this point you can create a Streaming Locator. Users will only be able to stream the file through our streaming services. Your file has to be encoded in a format that we can support streaming for, so you may have to first kick off an encoding job to get it into the right format and encoding settings (MP4 files with H264 and AAC audio). If you want to stream from Media Services, you need to make sure you have at least 1 streaming reserved unit enabled on your account. In addition, if you are looking to protect your files, you can take a look at our Content Protection services, which will provide on-the-fly AES 128 or PlayReady DRM encryption to your assets. You can integrate that with JWT tokens and Active Directory to authenticate/auth your users before they are able to decrypt the video on the client side.
I'm not too familiar with Azure Media Services but after looking at this guide http://azure.microsoft.com/en-us/documentation/articles/media-services-rest-get-started/ it appears to me that you can create an asset on Azure Media Services and link it to a blob. This means you'll only have one blob container.
AMS provides Rest API for all media processing capabilities including uploading, encoding, publishing. There is a sample project (postman collection) in GitHub to play around. This sample project is also accompanied by a well-written article. Please find the links below.
https://github.com/Azure-Samples/media-services-v3-rest-postman
https://learn.microsoft.com/en-us/azure/media-services/latest/stream-files-tutorial-with-rest
Hope this will help

What would be the logic behind a Dropbox Syncing Note Taking Application?

Can anyone please suggest some logic behind a an application that syncs notes with one's DropBox Account?
Consider me a newb.
I'm thinking it should somewhere be around these lines:
The app takes notes.
The user has to input in his dropbox credentials.
Everytime a new note is created, it MUST be synced to his dropbox account.
What would be the various APIs that are to be implemented?
You will need to start thinking about using Dropbox web service APIs to upload the notes to Dropbox.
Some resources to start with:
Dropbox Developer portal to learn about using Dropbox API
Sample implementation of API for .Net for use or study
Following steps above should get your started in the right direction... One suggestion on cloud storage based design... It's best to also have some kind of local storage on the mobile device to act as an offline buffer, just in case user writes a note when they have no internet access. Write the cloud upload/sync code to run in the background.
Have fun!

Categories

Resources