ShareTarget example not able to get photo from the share of Photos app? RRS feed

  • Question

  • I am trying to understand the ShareTarget example app.  


    When I go to app such as "fotoeditor", "accuweather", and invoke share charm.  The ShareTarget example is able to display the picture being shared.  I guess that is because these apps shares bitmap and thumbnail.

    However, when I go to Windows 8's default "Photos" app and select a photo from "Pictures library" and invoke share charm.  The ShareTarget example is unable to get the pictures data.  It appears that "Photos" app does not share bitmap or thumbnail.  It does share StorageItem.  However, the StorageItem's path is "" blank.  In that case, how would we able to access the photo being shared.  

    Thank you in advance for your help.

    Saturday, September 15, 2012 4:26 AM

All replies

  • You don't access a StorageItem's contents from its path, since the path is not guaranteed to exist and in many cases if it does exist it will be somewhere that an app cannot read from.

    You can access an image stored in a StorageFile by creating a blog URL with Url.createObjectURL. See How to select and display an image for details.


    Saturday, September 15, 2012 7:19 PM
  • Thanks for that idea Rob.  Been trying many ideas and no success.  From this blob url, how can we create BackgroundTransferContentPart?

    A related thread with Brian has stopped (http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/7a22908f-71c6-4392-b10b-31ded6749a50/), so hope we haven't stumped you either.  Thanks

    Sunday, September 16, 2012 8:37 AM
  • I'm not sure that thread has stopped as much as it has taken a break for the weekend. You will also get better responses if you don't tag new questions onto existing threads. Try to keep one question per thread, and one thread per question.

    As far as BackgroundTransferContentPart goes, you wouldn't pass it a blog URL. BackgroundTransferContentPart.SetFile takes the StorageFile you started with.

    Remember that StorageFile is the primary container we're using. You generally don't want to downconvert it to a lesser format (like a path or URL) until you are using it for something that specifically needs that format.


    Monday, September 17, 2012 2:45 AM
  • Thanks Rob.  We tried to use StorageFile that we received from Share source.  But when we use the StorageFile our app received from Microsoft Photos app, it does not work with   BackgroundTransferContentPart.  Is it because the StorageFile from Photos app has blank path property?  Interestingly, Background Transfer works with the StorageFile our app received from other share sources.  (Sorry, I was mistaken and thought that other thread was more than a week old already: time flies with development.)
    Monday, September 17, 2012 3:50 AM