I've been working on a SharePoint-hosted app for SharePoint 2013. In order to "extend the reach" of the app a bit, I've included a CustomAction that will add a button to each document library's ribbon in the host web as demonstrated below.

Document library ribbon showing CustomAction with default image.

The XML being used to create this CustomAction is nothing particularly special:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="4f835c73-a3ab-4671-b142-83304da0639f.LibraryDetailsCustomAction"
                Title="Invoke &apos;LibraryDetailsCustomAction&apos; action">
      Update the UI definitions below with the controls and the command actions
      that you want to enable for the custom action.
        <CommandUIDefinition Location="Ribbon.Library.Actions.Controls._children">
          <Button Id="Ribbon.Library.Actions.LibraryDetailsCustomActionButton"
                  Alt="Examine Library Details"
                  LabelText="Examine Library Details"
                  Image16by16="_layouts/15/images/placeholder16x16.png" />
        <CommandUIHandler Command="Invoke_LibraryDetailsCustomActionButtonRequest"
    </CommandUIExtension >

Where I'm struggling, though, is with the Image32by32 and Image16by16 attributes. By default, they point to an orange dot placeholder image found in the _LAYOUTS folder. I want to use my own images (that are deployed with my app), but I can't find a way to do so.

With a SharePoint-hosted app, I don't have the option of placing elements in the _LAYOUTS area. By definition (or at least my understanding of it), I can't place/provision anything in the host web, either. The best I can do is place images and other items into the app web.

I've attempted to use the ~appWebUrl token to reference images I'm deploying into my app web, but this token isn't parsed/processed. Relative image references (such as /images/myimage.png) reference the host web rather than the app web, as well.

I don't see any way of using custom images for the Image32by32 and Image16by16 attributes short of employing something like an absolute URL to pull each image from a web-based location (e.g., http://www.myhost.com/images/myimage.png).

Am I missing something? Has anyone successfully used their own app web image resources in this sort of scenario?

  • 1
    It would seem that token processing should be possible within the Image32by32 and Image16by16 attributes based on this article from Chris Hopkins: blogs.msdn.com/b/chhopkin/archive/2012/08/20/… Even though I knew it wouldn't work, I inserted a ~site token in as the attribute value, and it appeared to successfully resolve to the host web site URL. Perhaps the new SharePoint 2013 tokens simply haven't been added yet? Commented Jan 17, 2013 at 22:39

5 Answers 5


Fun stuff, I was checking this site since I stopped answering SO SharePoint questions for a few years now and this was the first thing in the list, a very interesting oversight during the "host web Feature" option for CustomActions.

What a detailed investigation! Luckily I have a solution for you.


With Microsoft dropping browser support for IE7 in 2013 you can simply make use of data URIs for your images without worrying about lack of support.

I took the opportunity to convert both of yours below



enter image description here

  • This is awesome!!! I just verified this in my on-premises environment. Very creative, effective solution! Now if only there was a clean way to use JavaScript to get the data URIs from assets deployed in the app web... Commented Jan 26, 2013 at 19:18
  • I agree wholeheartedly with Danny: awesome, awesome, AWESOME REPLY! I had no idea that something like this could be done! I verified this approach in my app with a deploy to Office 365 Preview, and it works like a charm! Having to Base64-encode images is a small pain, but knowing that I can deploy SharePoint-hosted apps without a dependency on an external server simply for images is tremendous. Thank you for the incredibly clever approach (and for encoding my images, too)! Commented Jan 27, 2013 at 15:23
  • Absolutely great solution! Thanks for sharing :) Once again SharePoint failed to knock us off :) Commented Jun 23, 2013 at 20:54
  • 1
    – Dennis G
    Commented Nov 8, 2013 at 10:44

I didn't really expect anyone to "chase this down" for me, so I spent some time doing a lot of digging on my own. The short answer (as of January 2013) is "no" - there doesn't appear to be any way to leverage tokens like ~appWebUrl in the Image32by32 and Image16by16 attributes. The way that the image attributes are processed is inherently different than the way the CommandAction attribute is processed.

I documented my exploration in a blog post here:


It goes into all the nitty-gritty detail of what's happening behind the scenes, as well as the work-around I ended up using.


If your SP app has a remote web in the solution, you can store the image in you remote app and use the token ~remoteAppUrl to correctly resolve the URL to that image.

For some reason MS wired up ~remoteAppUrl correctly but did not do the same for ~appWebUrl. Hopefully they will fix that in the future.

  • Thanks for the reply, Jamie! This information is definitely good to know for autohosted and provider-hosted apps, and I wasn't aware that there were differences in processing for those apps vs. SharePoint-hosted apps. Commented Jan 27, 2013 at 15:17

put the images in the images folder in the VS 2012 project. Then refer to the path like this

Image32by32="Images\audiencetweets32.jpg" Image16by16="Images\audiencetweets16.jpg" />

also replace the appicon file with your own and thats how you get your icon to show up in the store/catalog

  • Thanks, Bill, but unfortunately that doesn't work. Using relative references like Images\audiencetweets32.jpg will result in links resolving to the host web rather than the app web. That's the behavior I'd expect given that the custom action is being shown in the host web rather than the app web. Commented Jan 17, 2013 at 21:31

Please use "YourAppName/Images/Image32by32.png". You can check "YourAppName" by right click on the AppManifest.

Hope this help!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.