Opening Provider Hosted from Custom Ribbon Button

Hi,

I'm trying to launch the Provider hosted app from Custom Ribbon button. I have used created a list using csom and added the custom action through code. In Command action, i have mentioned like below

 UserCustomAction action1 = action.Add();
                   action1.Location = "CommandUI.Ribbon.ListView";
                   action1.Sequence = 1000;
                   action1.Title = "Restore Items";
                   action1.CommandUIExtension = @"<CommandUIExtension><CommandUIDefinitions>"
                          + "<CommandUIDefinition Location=\"Ribbon.ListItem.Actions.Controls._children\">"
                          + "<Button Id=\"InvokeAction.Button\" TemplateAlias=\"o1\" Command=\"Invoke_Command\" CommandType=\"General\" LabelText=\"Restore Items\" Image32by32=\"_layouts/15/images/placeholder32x32.png\" Image16by16=\"_layouts/15/images/placeholder16x16.png\" />"
                          + "</CommandUIDefinition>"
                          + "</CommandUIDefinitions>"
                          + "<CommandUIHandlers>"
                          + "<CommandUIHandler Command =\"Invoke_Command\" CommandAction='~remoteAppUrl/Pages/CustomActionTarget.aspx?{StandardTokens}&amp;SPListItemId={SelectedItemId}&amp;SPHostUrl={SiteUrl}' />"
                          + "</CommandUIHandlers></CommandUIExtension>";
                 
                   action1.Update();

                   clientContext.ExecuteQuery();

 But When i click on the button, its redirecting to the URL with hard-coded {StandardTokens}. I'm not getting the parameters from StandardTokens.

Please help.

Thanks

July 18th, 2015 5:50am

I am looking into it.. Please give some time to get th
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2015 1:50pm

Hi,

I suggest you check the following article from MSDN:

Create custom actions to deploy with SharePoint Add-ins

https://msdn.microsoft.com/en-us/library/office/jj163954.aspx

Best Regards

August 2nd, 2015 9:28pm

Hi Dennis,

Thanks for our help.

But still i have also worked on the above Documentation. If i do the same, the custom ribbon button will get attavhed to all lists/ libraries in the site. Since I need to attach to a particular list , I'm attaching it through CSOM code using UserCustomAction. All parameters are getting passed except {StandardTokens} which is passed as a string.

Thanks.

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2015 11:46pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics