Search code examples
sharepointsharepoint-2013sharepoint-apps

Is it possible to use a Custom Action to add an item to a Site Actions menu in a Sharepoint 2013 app?


I've been trying for a while to add a Site Action menu element that would link to my remote app web page, like this example.

The problem is that the example is not actually using the custom action to modify a site action menu. This would be easy if I wasn't developping on a Sharepoint app model. When I try to add the custom action to my sharepoint site, nothings happens. I've tried many different variations, all with the same result. Here's what I've settled on, thinking it should work:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Location ="Microsoft.SharePoint.StandardMenu"
                GroupId ="SiteActions"
                Id="CreateSiteAction"
                Title="Create Site"
                Sequence="1000">

    <UrlAction Url="~remoteAppUrl/../MyRemoteWebApp?" />
  </CustomAction>

</Elements>

I can see 2 possible scenarios:

1) My custom action definition is broken or is missing something I don't know about

2) Custom actions on site action menus simply aren't possible for sharepoint apps through XML. This blog seems to suggest this is the case

I mention the XML part because I have actually managed to add an element to the site action menu programatically. The problem is that, as far as I know, I lose the flexibility of the remoteAppUrl token being automatically replaced, along with other annoyances.

So, what are your thoughts on the matter ? Did I miss something ? Can it be done with a purely XML-based definition ? What alternatives are there ?


Solution

  • Turns out it's apparently not really possible, according to this MSDN post. As I mentioned, it IS possible to have the same effect through a code based alternative, but it has its pains.