Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Altering stp files to ease deployment

  Asked By: Felicia    Date: Nov 26    Category: Sharepoint    Views: 2601

I have a site template which i am exporting from one environment to
another. Normally, I create an stp file and deploy it on the other
environment. However, one of the webparts thats within the site has a
parameter which requires full url link to work, it does not accept
relative links. So on environment one, the webpart's parameter will be
http://enviroment1/site/blah (does not accept "/site/blah"), on the
other environment, its http://enviroment2/site/blah.

What this means is every time i go to deploy it, i need to deploy the
stp file on environment two, create a site, alter the webpart and
recreate a new template for environment two.

What i want to know is, is it possible for me to alter the stp file
and correct the parameter url.

I know that the stp file is just a cab file with a manifest.xml file
which is in CAML. However, trawling through the manifest file, i can't
find where the webpart information is stored. How/is this possible?

Where is the webpart information stored when you deploy an stp file on
a different server (as stated earlier, i can't find it in the stp file)?



4 Answers Found

Answer #1    Answered By: Emmett Hyde     Answered On: Nov 26

Yes it is possible to crack open a SharePoint Template Package, edit the
manifest.xml file, recreate the CAB, and deploy.

I suspect that the Web Part is stored  as a stream file  but I've never
attempted to package a site  containing a custom Web Part.

Answer #2    Answered By: Michelle White     Answered On: Nov 26

The web part properties are all serialized in the .stp file. Do a search
in manifest.xml for <webparts, and you'll see a section pointing to

What you can do, however, is export the web part on the old server, so
that you have the .dwp file. You can edit the .dwp in Notepad to change
the property. Then delete the web part from the page on the development
site before you make the .stp. deploy  the .stp, create  your new site,
and import the edited .dwp file.

Alternatively, you can deploy the site  with the old web part, you can go
to the web parts maintenance page (append ?contents=1 to the URL so that
it is server/sites/sitename/default.aspx?contents=1), and delete
the old web part from there. Then import the new web part.

Answer #3    Answered By: Sheena Ray     Answered On: Nov 26

Do you have any idea where i can find  out the
format of the serialization?

The problem with the process you have defined is that it still
requires me to deploy  the .stp, alter  it, and recreate a new .stp file
and redeploy that.

Answer #4    Answered By: Gopal Jamakhandi     Answered On: Nov 26

I thought of another solution. It's probably too much work, but it might jiggle
something else loose. If the web part is always going to go into the same web
part zone (which it sounds like it will) it's trivial to write a program that
would add it to a page. You could probably script the creation of the sites to
be something like this:

1) Create site  with STSADM.
2) Do a find  with replace on Web part DWP file  replacing existing URL with URL
of new site.
3) Use custom program to add new DWP file to page in new site.

I'm not a developer by any stretch of the imagination and I was able to write a
program that added a web part to a page. If I still have the code I'll send it
to you. I wouldn't wait for it though, I'm pretty sure I deleted it.

Anyway, not sure if that helps or not, but it's something to think about.

Didn't find what you were looking for? Find more on Altering stp files to ease deployment Or get search suggestion and latest updates.