1

Looking to see how I could create a button on a SharePoint page that would create a new site. I know this can be done through Site Actions and a couple more clicks, but I want to make it intuitive for the user to just click a button and essentially do the same thing as it would navigating through Site Actions...

1
  • Not out of the box. Can you use Visual Studio or JavaScript? – Erin L Aug 18 '16 at 21:21
2

You should try to do the following

  • Edit your page that you need to add the link button .
  • Add content Editor.
  • From the above ribbon click on Edit Source.
  • Add the following code to create a link to open in the model dialog to create a new website.(or add your final link that navigating through Site Actions)
<script>
    function openDialog(pageUrl) { 
    var options = {
        url: pageUrl,
        title: 'Create New Site',
        allowMaximize: false,
        showClose: true,
        width: 700,
        height: 500
    };
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);       
    }
      
    </script>

 <a onclick="openDialog("http://yourrootsite/_layouts/15/newsbweb.aspx");"
 href="#">Create New Site</a>

OutPut

enter image description here

Check also the detail steps that matched with your situation at Open a link via Modal Dialog in SharePoint

6
  • Hi! This doesn't seem to be working for me. Maybe because this is 2013 and I am using 2010? Is there another way? Thank you! – Jackie Aug 19 '16 at 15:32
  • what's your issue now my bro ?! you only need to put your final link URL and I tried in both 2010 and 2013 and worked properly – Mohamed El-Qassas MVP Aug 19 '16 at 16:03
  • I changed the final link URL and tested it but the link doesn't do anything. I went back into the CEWP and it changed the whole thing to this: <script> function openDialog(pageUrl) { var options = { url: pageUrl, title: 'Create New Site', allowMaximize: false, showClose: true, width: 700, height: 500 }; SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); } </script><a onclick="openDialog(" href="#">Create New Site</a> – Jackie Aug 19 '16 at 16:12
  • try to use this in cewp var options = { url:'/_layouts/prjsetng.aspx', title:'Title, Description, and Icon', width:640, height:400 } SP.UI.ModalDialog.showModalDialog(options); – Mohamed El-Qassas MVP Aug 19 '16 at 16:26
  • I tried this and unfortunately it still isn't working. I do not have a TeamViewer but thanks for the help. – Jackie Aug 19 '16 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.