I am trying to get the PublishingRollupImage of a list item using the server object model (requirement) in a sandbox solution. The problem I have is that I can't reference the Microsoft.SharePoint.Publishing assembly required for ImageFieldValue

This is how I would do it with a farm solution

foreach (SPListItem item in listItems)
 bannerImages.Add(new BannerImage
  Title = Convert.ToString(item[SPBuiltInFieldId.Title]),
  Subtitle = Convert.ToString(item["Subtitle"]),
  RollupImage = ((ImageFieldValue)(item["PublishingRollupImage"])).ImageUrl,
  Link = Convert.ToString(item["Link"]),

but if I try to activate it as a sandbox solution I get an error saying that I can't include a reference to the DLL mentioned above

How would I go about getting the URL of the image without using ImageFieldValue? It would be hosted in Office365 so can't change any web.config or write custom CAS etc.

Edit: it's SharePoint 2013.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.