Getting a SAS URL by just creating a locator - how?

I have code from a very helpful blogger that shows how to use JavaScript to upload to Azure. This means that he has created a webpage that will let any user who accesses it upload a file to a blog on his Azure storage. However, I want the user to upload
a video file to my "Azure media services" and not just to a regular "blob".  I'm actually not sure this is necessary, because I think videos can be viewed when just uploaded to standard blobs without even using media services. 
But I asked him how he would do it, and he said:
1. create an asset in media service
2. For that asset, create a locator with write permission
3. Use that locator to give you a SAS URL.
His JavaScript webpage asks the user to enter a SAS URL, but if I can use Visual Basic code in the code-behind page to generate a SAS URL, I don't have to ask the user to know it.  Also, it lets me use media services.
So I looked at the sample code that Microsoft provides for uploading to media services, and I have a few questions.  So here is a fragment of code and then the questions:
Public Function CreateAssetToGetSASurl(assetCreationOptions As AssetCreationOptions, singleFilePath As String) As IAsset
Dim theDate As DateTime
theDate = Now
Dim strDate As String
strDate = Replace(CType(theDate.ToOADate, Double).ToString, ".", "_")
Dim assetName = "UploadSingleFile_" & strDate & "_" & keepalphanum(Session("username"))
Dim asset = CreateEmptyAsset(assetName, assetCreationOptions)
Dim fileName = Path.GetFileName(singleFilePath)
Dim assetFile = asset.AssetFiles.Create(fileName)
Dim Duration As TimeSpan = lifetime
Dim accessPolicy = _context.AccessPolicies.Create(assetName, Duration, AccessPermissions.Write Or AccessPermissions.List)
Dim locator = _context.Locators.CreateLocator(LocatorType.Sas, asset, accessPolicy)
' locator.Delete()
' accessPolicy.Delete()
Return asset
End Function
I believe the locator created above is correct, but I think I should get rid of the lines that do this:
 Dim fileName = Path.GetFileName(singleFilePath)
        Dim assetFile = asset.AssetFiles.Create(fileName)
After all, I'm not uploading a file from my server, instead I'm relying on javascript code to upload a file.  So I would think I could get rid of these 2 lines, but I'm not sure my locator then points to anything. 
I also don't know how to get the SAS at this point.
Finally, there are two lines at the end of the function that delete the locator and the access policy, but I assume that if I do that, my SAS URL is no longer valid.  So my question is, when would I delete the locator -- after I was sure the file was
uploaded?  After it was encoded?
Thanks in advance,
Gideon

Hi,
I would suggest you have a look at this code sample. From the description we can see the introduction.
Details:
Introduction
The c# code in this project uses Windows Azure Storage SDK, Windows Azure Media Services Client SDK, and Media Services REST APIs to demonstrates the following:
•how to upload a stream to the storage blob associated with the Windows Azure Media Services account
•how to associate the file in the blob with the asset using the Media Services REST APIs.
•how to get a SAS URL pointing to the uploaded file. 
From my experience, this sample may give you some help.
#Sample Code:
http://code.msdn.microsoft.com/windowsazure/How-to-Upload-a-Stream-to-40ab9cc3
Best Regards
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Save file just created in QuickTime, How???

    I create new file (AAC, audio) in QuickTime by paste some tracks into one QT-document. Then I need to save this new soundtrack. I do following:
    tell application "QuickTime Player"
    tell application "Finder"
    set the temp_folder to (make new folder at desktop with properties {name:"_JoinToAudiobookTempfolder_"}) as alias
    end tell
    set the new_file to ((temp_folder as text) & "temp_file")
    (* Some Code *)
    save movie 1 given «class dfil»:file new_file, «class savk»:self contained
    end tell
    But QT doesn't save file on folder "_JoinToAudiobookTempfolder_" on Desktop! It shows windows "Save File As" and wait that I specify location and file name! Why?

    I understand. So, I decided to change the order of
    processing :-)) At first I'll join mp3's in QT, and
    than convert created track into AAC using iTunes.
    You can do that, but if you can do everything with QT, then why bother with iTunes?
    Another question - i don't want quicktime to show
    "Welcome Movie". So, i need to disable this feature
    or temporary turn it off. I tried use this:
    tell application "QuickTime Player"
    set show welcome movie automatically to false
    end tell
    But this not works. So, ... how?
    show welcome movie automatically is a read-only property, so you can not set it.
    You can disable it in QT's Preferences --> Show Content Guide automatically
    PS. That too bad that applescript application's
    library doesnot contain live examples.....
    No you don't want that. Things will get bloated.

  • My friend put her apple id in my ipod now i can't get mine to come up just hers pops up, how do i get mine back?

    how do i get my apple id back after a friend has put her's in my ipod?

    Go to Settings>Store and sign out and then sign into the account you want.
    If you are updating app and she installed apps using here account you will have update the apps one at a time untill the remaining apps were purchased from aone account and you will have to know her password to update her purchased apps.

  • HT204053 I was using find my iphone on my pc and i accidentally chose to remove the device. I didnt realize it would permanently take the iphone off the grid. I thought it would just temporarily stop locating, How do i find it now with no phone?

    I was using find my iphone on my pc and i accidentally removed the device. I thought that meant just temporarily removing it since it was not able to locate or remote lock or wipe my lost phone. Now how do i put it back on? it appears to have ben permanently taken off the grid and now i cannot continue to try to locate my iphone. The phone did have find my iphone turned on. Can i put it back on>? i dont have the phone obviously its stolen.

    At this point you can't do anything.  But today, thieves are smart - they know how to combat the Find My iPhone service, so you probably wouldn't find the phone anyway.  That service is primarily used for lost devices, less for stolen devices.

  • I upgraded to OS Yosemite on my MacBook Air...and I cannot upgrade the Adobe Flash download that Adobe keeps asking me to download. I get the screen and when I click on the icon it just creates a new window but not download. Thoughts?

    I upgraded to OS Yosemite on my MacBook Air...and I cannot upgrade the Adobe Flash download that Adobe keeps asking me to download. I get the screen and when I click on the icon it just creates a new window but not download. Thoughts?

    I just tried the link and it is just fine. If the GateKeeper pops up then open Security & Privacy preferences, click on the General tab, set the last radio button to Anywhere.

  • My dad and I have shared an iTunes account for years and I just created a new apple id but I have no Idea how to get all those purchases to this new account. Help please?

    My dad and I have shared an iTunes account for years and I just created a new apple id but I have no Idea how to get all those purchases to this new account. Help please?

    The old Apple ID (presumably your dads) owns those songs and your new Apple ID does not.  However, your dad can authorize your iD to use the songs by going to Store > Authorize This Computer from your iTunes menu and entering his Apple ID and password.

  • I just created a new apple id for my self and when i go to update an app it shows my moms email and she wont tell me her password how do i get my email to show up

    i just created a new apple id for my self and when i go to update an app it shows my moms email and she wont tell me her password how do i get my email to show up

    You should have your stuff separate from your mom's. Delete all the apps downloaded or purchased with your mom's Apple ID and download or purchase them with your own Apple ID. Back up files and data first if possible.

  • HT1904 Hi I just created apple store account and I didn't get verification mail and I can't buy any games withou it. What should ii do?

    Hi I just created apple store account and I didn't get verification mail and I can't buy any games withou it. What should ii do?

    If you already created an Apple ID, you have to enter a credit card in order to use that ID now. If you don't have a credit card at all, you will have to create a new Apple ID to use without a credit card and you will need to have another email address in order to do this.
    First you will have to sign out of your current ID in Settings> iTunes & App Store>Apple ID. You can tap the ID and tap Sign Out. Now you can proceed with creating a new Apple ID according to the instructions in here.
    Create iTunes Store account without credit card - Apple ...
    You are saying that you don't have a credit card, but if you had one, you could enter the credit card in order to use the ID that you already created, but you never have to use it. You can use gift cards or just download free content. But unless you create the ID as outlined above, you must enter payment details.

  • I just created an apple ID and then tried to log in to facetime but, keep getting : an error occurred during activation, try again" can anyone assist?

    i just created an apple ID and then tried to log in to facetime but, keep getting : an error occurred during activation, try again" can anyone assist?

    i just created an apple ID and then tried to log in to facetime but, keep getting : an error occurred during activation, try again" can anyone assist?

  • I am not able to open a PDF file that I just created. I get an access denied message instead.

    I am not able to open a PDF file that I just created. I get an access denied message instead.

    Thanks for asking.
    I was combining different types of files into a single PDF. Some of them were excel spreadsheets and I had set the print areas in each file. When I cleared the print area the problem stopped. So I am assuming that had something to do with it. Though I am not sure.
    The strange thing was that I was able to open the excel source documents after creating the faulty PDF but some of the MS word source documents also had "access denied" status. I still cannot figure that part out.

  • Why do i get 2 curves and not just 1 when i create a diagram from a row of data in a table ?

    Why do I get 2 curves and not just i when I create a diagram from a row af data in a table ?

    Erik,
    Thank you for giving me the points.  Generally you wait to award points until your problem is solved.  It is totally your at your descretion.
    OK.
    This is still not clear.  To post a screenshot get the "stuff" you want to show in view on your screen, then type the key combination <Command>+<Shift>+3.  The cursor will change to a crosshair.  Click and hold on the top-left corner, then drag to enclose what you want to show (to the bottom-right corner), then release.  The screenshot will appear on your desktop and will be named something like "".
    Now click the camera icon in the tool bar for this forum:
    , click the text box to allow you to navigate to, and select your screenshot.
    Here is what you sent me:
    The graph does not seem to be associated with the table of data you are showing.  Generally when you highlight a graph the corresponding table will highlight and show the source of each of the series in the graph (dark and light blue).
    This is what I would expect to see when highlighting a graph:
    Right now I think there is ANOTHER table arround that is the source for the graph and the table you show is "just another table".  You can move your data into the table the graph refers to by copy and paste, or simply typing the values.  You can change how many series there are by grabbing the little circle at the bottom right of the highlighted cells (when you have the graph highlighted) and dragging as shown:
    The Numbers Users' Guide is a great resource you should utilize and can be found here:
    http://support.apple.com/manuals#macosandsoftware
    The chapter on graphing (or charting) is 7 and starts on page 134.

  • I have just created an apple ID to use face time, however when I try to log in I get the message 'email already verified' and can't move on.

    I have just created an apple id to use face time. However whenI try to log in I get the message 'email already verified' and then can't move on.
    Can anyone help please.

    You must create the account using an Apple device, a Mac (Lion or greater) or an IOS device (IOS5 or greater). Having done that you will be able to sign in from your Windows machine.
    FYI, iCal is an application that can display calendars from iCloud (and others) it is not a calendar itself, merely a calendar client. In Windows Outlook is the calendar client.

  • How to get itunes gift card code when just creating account?

    where do i get a gift card code from? when just creating a apple id, and i cant redeem

    The code is on the back of the iTunes gift card
    Do you have an iTunes gift card?

  • HT2534 I have just created an Apple Id for itunes, it is allowing me to get to the debit card stage but they no longer accept Visa Debit, there is no other option for me as i dont have any other cards and there isnt a 'none' option! HELP!!

    I have just created an Apple Id for itunes, it is allowing me to get to the debit card stage but they no longer accept Visa Debit, there is no other option for me as i dont have any other cards and there isnt a 'none' option! HELP!!

    How did you create the account ? Unless you followed the instructions on the page that you post from exactly then you won't get the 'none' option and you will need to enter payment details - those instructions won't work on existing accounts.
    I tried those instructions a week ago in response to another thread and I got the 'none' option on it e.g. on my computer's iTunes I logged out of my existing account, found a free app in the store, clicked on its 'free' price, clicked on 'create Apple id' on the popup, and after agreeing to the terms and filling in my details I was able to select 'none' as my payment option and download a free app with it.

  • How can i get the full URL of a page displayed rather than just the main website URL

    I'm using Safari 8.0 on an iMac.  When I go to a website I'm used to seeing a specific page URL displayed /changing as I navigate around a site through its various subsections etc. Now after updating to Yosemite all I get is the URL of the general website. This means I can't make specific references/links in work that I'm doing/sharing. There must surely be a way of  getting the info into the bar so that I can copy it .... can anyone help please?

    Jorge Huedo wrote:
    > Yeah i know it was because i was getting crazy and i wanted to see debuggin if the image really existed in the km.
    > Okey I have use the IUrlGeneratorService like this.
    >
    >      IURLGeneratorService ugs = (IURLGeneratorService) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
    >      IUriReference uriRef;
    >      uriRef = ugs.getRelativeUri(PathKey.IMAGE_PATH).appendPath(
    >      resourceimg.getRID().toExternalForm());
    >
    > And it has returned me the next url:
    >
    > irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/etc/public/mimes/images/pip_hesaeventos/blank.JPG
    >
    > Now i have added to the base of the server the url:
    >
    > http://altp4.es.heiway.net:54500/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/etc/public/mimes/images/pip_hesaeventos/blank.JPG
    >
    > And the return is:
    >
    > 404
    > El recurso solicitado no está disponible.
    >
    > Any idea?
    You need to use the propert PathKey; I think CONTENT_ACCESS should be correct.

Maybe you are looking for

  • How to use standard BADi?

    Good day experts. I have a requirement which I need to save details (such as amount, description, doc. no. etc) on F-22 (screen 0700) into a ztable which I will going to create. Since F-22 is a SAP standard, I need to use Exits or BADi to accomplish

  • Alert: WebServices connectivity (Internal) transaction failure - The credentials can't be used to test Web Services.

    Hi. Could you please help me to resolve this issue. I have SCOM 2012 installed to monitor environment with Exchnage 2010 SP3. There are 2 sites with Exchnage servers within the organization. There are 2 mailboxes being created to test both sites. I a

  • ConvertMovieToFile returns -43 on some systems, not others

    I have a code snippet that converts a file from mp3 to AAC using quicktime, this code works on my 64 bit windows 7 boxes (2 of them), at least on 32 bit windows 7 Pro, Vista Ulitmate, and windows XP box. but on two mac bootcamp installs of windows 7

  • Not Getting the Quuery string parameters in the submission of Html Form.

    Hi We are using the MVC architecture, and while submitting the form conatining some hiddenn parameters aand havin URL as abc/xyz?a=b&c=d I am able to retrieve the hidden parameters on form submission but am not getting query parametres. regards Amit

  • Switching between CC accounts on one PC

    Hi everyone, I have my own private Creative Cloud subscription - everything works great. Recently I've got the corporate account for teams from my work. Is there any way to switch between accounts smoothly? Especially I'd like to have both Creative C