I want to retrieve the thumbnail path of a layer at our enterprise portal, and while that is straight forward I have the challenge, that I cannot use the path returned
https://our-portal.com/portal/sharing/rest/content/items/580d1a480196436fb7e2e1170466ba94/info/thumbnail/thumbnail1548171039005.png
Because there I am getting an Error 403 (You do not have permissions to access this resource or perform this operation.).
The layer itself I can create using
string curService = $"https://our-portal.com/portal/home/item.html?id={guid}";
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(new Uri(curService, UriKind.Absolute), activeMapView.Map, 0));
How can I connect to the thumbnail?
Solved! Go to Solution.
The solution to get to the thumbnail is to add the token of your current session to the thumbnail path.
ArcGISPortal activePortal = ArcGISPortalManager.Current.GetActivePortal();
string sessionToken = activePortal.GetToken();
_thumbnail = $"{portalItem.ThumbnailPath}?token={_portalToken}";
The solution to get to the thumbnail is to add the token of your current session to the thumbnail path.
ArcGISPortal activePortal = ArcGISPortalManager.Current.GetActivePortal();
string sessionToken = activePortal.GetToken();
_thumbnail = $"{portalItem.ThumbnailPath}?token={_portalToken}";