Wednesday 4 May 2016

Open Provider hosted Apps in SharePoint Model Dialog Using Custom Action

Hi Guys,


If you are new to provider hosted App and you have requirement to open list item in your popup model dialog from SharePoint Online  as per Microsoft https://msdn.microsoft.com/en-us/library/office/jj163816.aspx  there is only one way to pass item id using custom action.  But I have found another tricks to open your model dialog without using custom Action and you can pass  item id from there as well.


So if you want to open model dialog the you need to add three property as below code

      HostWebDialog="true"
           HostWebDialogHeight="800"
           HostWebDialogWidth="850"
-----------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="6465cfae-e358-47ef-a41e-570f628318a4.openDialog"
                RegistrationType="List"
                RegistrationId="{$ListId:Lists/customlist;}"
                Location="EditControlBlock"               
               Sequence="399"
               Title="Create Freight Request"
             HostWebDialog="true"
           HostWebDialogHeight="800"
           HostWebDialogWidth="850">

    <UrlAction Url="https://xyz.azurewebsites.net/Pages/Default.aspx?{StandardTokens}" />
  </CustomAction>
</Elements>

Happy Coding !!