create web part page in document library

Oct 7, 2010 at 7:02 PM

Hello,

I am trying to create a web part page via the web services. 
I assume that one of the easiest ways would be to use the  copy function and rename the file, but it appears that only works for office and text files - not aspx pages. 
The next thing I thought of was get the xml from a sample web part page and use that to create it.  I can get the xml of the page, but can't figure out how to create the new page based on the others xml.

Any comments the community can offer on this would be great!  Thank you!

function copyWebPartPage() {
  sourceURL = $().SPServices.SPGetCurrentSite() + "/SampleWebPartPage.aspx";
  
  $().SPServices({
    operation: "GetWebPartProperties",
    async: false,
    pageUrl: sourceURL,
    completefunc: function(xData, Status) {
      //alert(xData.responseXML.xml);	
      $(xData.responseXML).find("WebParts").each(function() {
        $(xData.responseXML).find("WebPart").each(function() {
          alert($(xData.responseXML).text());
        });
      });
    }
  });
}

Coordinator
Oct 7, 2010 at 7:44 PM

John:

I'm curious why you'd want to do this. Can you outline your business requirements a bit?

M.

Oct 7, 2010 at 8:48 PM

We are using sharepoint to track some basic project management information.  I want the user to be able to enter a project name on a form with a button.
When they click the button I want it to create a web part page and change the description to the project title and add some web parts to the page.  I know that spservices has the ability to add web parts to a page and I would like to utilizethat function, but first I need to create the page itself.  I figured that I could perhaps copy an existing page that is similar or use the xml to create the new web part page.  I am new to this, so I could be missing a basic concept but it seemed to make sense to me.  I could be making this way too complex.  That's why I came to the forums.  Any help would be great and thanks for taking the time to answer.

 

- John

Coordinator
Oct 8, 2010 at 2:36 AM

I think a *far* better approach is to have a single page with Data View Web Parts (DVWPs) on it which filter based on Query String parameters.  You'd just add items to the appropriate lists and show them filtered for a specific project based on the the identifier on the Query String.

M.

Oct 18, 2010 at 12:34 PM

SP Designer is currently notan option for me, although once it is available I will use this solution. 

Coordinator
Oct 18, 2010 at 12:45 PM
It's going to be harder to do this without SharePoint Designer, but you can add script in a Content Editor Web Part (CEWP). However, I'm not positive that you will be able to do all that you want with the Web Services. M.
Oct 18, 2010 at 12:53 PM

Yes it stinks for me currently.  No VS, no SP Designer.  All I am able to work with right now is the web services in CEWPs.