3

I have a provider hosted add-in running on a SharePoint Online development site that has several lists as part of the solution. My goal is on when somebody clicks a Ribbon CustomAction associated with an app list, that it goes to a Controller Action in my provider app and that View is returned.

I have seen my examples which use {StandardTokens} in the CommandAction url such as this example.. However when I click the command action the Url does not replace {StandardTokens}, that is the text "{StandardTokens}" appears in my querystring.

My CommandUIHandler Element:

<CommandUIHandler Command="Invoke_BonusApproveRibbonActionButtonRequest" CommandAction="~remoteAppUrl/Home/ActionJump?{StandardTokens}&amp;Action=ApproveBonus&amp;SPListItemId={SelectedItemId}&amp;SPListId={SelectedListId}"/> 

An example output Url:

https://localhost:44300/Home/ActionJump?{StandardTokens}&SPHostWebUrl={SPHostWebUrl}&Action=ApproveBonus&SPListItemId=1&SPListId=%7B525F44C3-6EAE-4EEE-960B-08733541A0C8%7D

In attempting to solve this problem I went as far as to put all of the tokens in the querystring when visiting the lists that were part of my add-in. My thinking was that the elements in StandardTokens needed to be present in the page when clicking the action. This did not work. Nor did listing the elements that make up StandardTokens individually in the CommandAction attribute.

Elements.xml

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="c940f2b7-0bfa-404c-9920-6920af78ca89.BonusApproveRibbonAction" RegistrationType="List" RegistrationId="100" Location="CommandUI.Ribbon" Sequence="10001" Title="Invoke Approve Bonus Ribbon Action"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children"> <Button Id="Ribbon.ListItem.Actions.BonusApproveRibbonActionButton" Alt="Approve Bonus" Sequence="100" Command="Invoke_BonusApproveRibbonActionButtonRequest" LabelText="Approve Bonus" TemplateAlias="o1" Image32by32="images/check-32.png" Image16by16="images/check-16.png" /> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="Invoke_BonusApproveRibbonActionButtonRequest" CommandAction="~remoteAppUrl/Home/ActionJump?{StandardTokens}&amp;Action=ApproveBonus&amp;SPListItemId={SelectedItemId}&amp;SPListId={SelectedListId}"/> </CommandUIHandlers> </CommandUIExtension> </CustomAction> </Elements> 
6
  • Please share the entire element.xml file. Commented Feb 22, 2016 at 21:29
  • aren't you missing the fileextension ".aspx" in the CommandAction? Commented Feb 23, 2016 at 17:19
  • No this is a Mvc Route. The page loads correctly. Commented Feb 23, 2016 at 17:56
  • what value do you expect standardtokens to be replaced with? Commented Feb 24, 2016 at 7:47
  • SPHostUrl=...&SPLanguage..&SPClientTag=0&SPProductNumber=....&SPAppWebUrl=... trying to use the individual tokens doesn't work either. {SPHostUrl} etc... >> also StandardTokens does work when I start my remote app. Commented Feb 24, 2016 at 15:16

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.