Click here to Skip to main content
12,630,410 members (32,368 online)
Click here to Skip to main content
Add your own
alternative version

Stats

9.5K views
1 bookmarked
Posted

Open SharePoint App Url as a Modal Dialog in SharePoint 2013 (SharePoint App)

, 4 Apr 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
How to open SharePoint App URL as a modal dialog in SharePoint 2013 (SharePoint app)

In SharePoint 2010, we used JavaScript to open the URL in a modal dialog. In SharePoint 2010, we used to write JavaScript to make the URL open in the modal dialog. If we write EditControlBlock actions, we used JavaScript as follows:

<CustomAction 
                Id="Custom.ProvisionGroup"
                Location="EditControlBlock"
                Title="My Custom Action"
                RegistrationType="ContentType"
                RegistrationId="0x01"
               ImageUrl="/_layouts/images/editicon.gif" >
 
<UrlAction Url="javascript:OpenPopUpPageWithTitle
('{SiteUrl}/_layouts/myCustom/default.aspx?List={ListId}&ID={ItemId}', 
RefreshOnDialogClose, 600, 400,'My Custom Action')" />
 
</CustomAction>

In SharePoint 2013 using JavaScript encountered:

Error occurred in deployment step 'Install app for SharePoint': 
There were errors when validating the App Package.

Thus for SharePoint 2013, we need to use three special attributes in CustomAction.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="a266876f-6356-4342-91a3-ef3d55b1e570.MenuItemCustomAction1"
                RegistrationType="ContentType"
                RegistrationId="0x01"
                Location="EditControlBlock"
                Sequence="10001"
                Title="Invoke &apos;MenuItemCustomAction1&apos; action"
                HostWebDialog="TRUE"
                HostWebDialogHeight="420"
                HostWebDialogWidth="510"
                >
    <!-- 
    Update the Url below to the page you want the custom action to use.
    Start the URL with the token ~remoteAppUrl if the page is in the
    associated web project, use ~appWebUrl if page is in the app project.
    -->
 
    <UrlAction  Url="~appWebUrl/Pages/Default.aspx?{StandardTokens}&amp;
                SPListItemId={ItemId}&amp;SPListId={ListId}"/>
    
  </CustomAction>
</Elements>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Melick
Sri Lanka Sri Lanka
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161205.3 | Last Updated 4 Apr 2014
Article Copyright 2014 by Melick
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid