Download and display images from sharepoint (Xamarin.Forms PCL) -


i'm developping app based on sharepoint rest api , microsoft graph. app composed tabbed page, , on first tab want display news sharepoint. want images news, using url of images image source returns me "forbidden" error. so, decided find way download images. i've been looking way few days now, , found nothing...

does knows way that, or why have forbidden access error ?

i bring precisions, i'm using httpclient authenticate tenant rest api :

client = new httpclient(); uri muri = new uri(app.returnuri); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); var data = await dependencyservice.get<iauthenticator>()                          .authenticate(app.loginauthority, app.restresourceuri, app.clientid, muri); app.authenticationresult = data; client.defaultrequestheaders.authorization = new authenticationheadervalue("bearer", app.authenticationresult.accesstoken); 

from that, hope knows if there way download images, or access url in order use them source. succeeded in retrieving urls not displaying images, knowing can retrieve other data sharepoint

thanks help,

the image component can use url data, requires images aren't behind authentication case sharepoint images. why it's returning forbidden error.

var webimage = new image { aspect = aspect.aspectfit }; webimage.source = imagesource.fromuri(new uri("https://xamarin.com/content/images/pages/forms/example-app.png")); 

to add authentication layer sharepoint able implement own uriimagesource implementation. in end imagesource needs stream object getting either internet or local storage work.

to download , store images have write code both platforms because local storage works differently. check out blog post starting point combined own piece of code.

https://blog.falafel.com/xamarin-forms-storing-and-retrieving-photos/


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -