Forum Discussion

miguelisidoro's avatar
miguelisidoro
Iron Contributor
Apr 25, 2018

SharePoint Online Provider Hosted Add Ins - Display SharePoint Images from Addin (Cross-Domain call)

Hello,

 

I want to develop a provider-hosted addin and display images that are stored in SharePoint Online libraries or Office 365 Private CDN. The problems is that the addin will run in a different domain than SharePoint Online, making access to images a cross-domain call. If user doesn't authenticate against SharePoint (even if the user is authenticated in the addin), the image will not be displayed due to unauthorized access.

 

My choice for a provider-hosted addin is because I need a web application where I have complete control over the rendered html and the current options of developing on top of SharePoint do not allow this (possibly in the future when SPFx brings the possibility of developing full pages),

 

What the best approach in order for the images to be displayed without having the user to be authenticated in SharePoint.

 

The addin must be rendered in an immersive full page experience, without showing any of the SharePoint Online elements (App Launcher, left navigation, top navigation, etc).

 

BackOffice for the app will be SharePoint Online including the presentation of content in publishing pages (images, videos, etc that will be stored in SharePoint Online, possibly using Office 365 Private CDN).

 

I can think of some possibilities:

 - Implementing a way to always return images in encoded base64 - I am not an enthusiast of this option since it forces every image to be rendered through a request to a service and it increases both the page payload and if I cache data the size of the information I need to store in cache (store byte[] or the base64 encoded string instead of a simple url)

- Having the addin to be embedded in a SharePoint page - the main challenge here is how to ensure I can embed the addin in a full page, hiding all the SharePoint elements

 

I don't like the approaches I thought so far. Can anyone help?

 

Some of the links I found in the web around this:

 

https://blogs.msdn.microsoft.com/richard_dizeregas_blog/2014/06/27/displaying-cross-domainsecure-ima... - Displaying Cross-Domain/Secure Images from SharePoint Apps – Richard diZerega's Blog

https://mysharepointlearnings.wordpress.com/tag/provider-hosted-appadd-in/ - Provider Hosted App/Add-In | My SharePoint Learnings

https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-... - Cross-domain images in SharePoint provider-hosted add-ins | Microsoft Docs

https://nathanwellsblog.com/tag/sharepoint-cdn/ - SharePoint CDN – Nathan Wells

 

Thanks,

Miguel

No RepliesBe the first to reply

Resources