views:

464

answers:

4

Hi there, currently I'm faced with a LOT of static HTML documents to convert to SharePoint (MOSS 2007), basically they can remain static, but need to be migrated into the SharePoint site with the SharePoint look and feel (each page needs to be updated with the SharePoint headers and footers at a minimum), are there any tools out there that can help accomplish this that anyone knows of? Thanks!

Edit: Answer must be doable at a price < $500.

A: 

Haven't tried it myself, but this sounds like it's up to the task:

http://www.metalogix.net/Products/Website-Migration-Manager-for-SharePoint/

Conan
It may be a good product, but after speaking to their rep, don't talk to them unless you're migrating > 5,000 pages (I'm approximately 500 pages) and while I won't give their price, hiring an intern to copy/paste is probably cheaper at the 5,000 page level.
tekiegreg
+1  A: 

For a manual Copy/Paste of the content into the "Look and Feel" you can use a Basic Page (View All Site Content => Create => Web Pages => Basic Page). You can also upload direct HTML files to document libraries and point them as the "content link" for the content of those basic pages.

F.Aquino
Nope, missed the point about being easy to execute and maintain the SharePoint look and feel on the site, I still have to update every header and footer to be consistent with the SharePoint site...
tekiegreg
+2  A: 

The QND answer is to create 500 custom pages

using (SPSite siteCollection = new SPSite("http://yoursite.com")) {
  using (SPWeb site = siteCollection.RootWeb) {
    MemoryStream fileStream = new MemoryStream();
    StreamWriter fileWriter = new StreamWriter(fileStream);
    fileWriter.WriteLine("<%@ Page MasterPageFile=\"~masterurl/default.master\"  meta:progid=\"SharePoint.WebPartPage.Document\" %>");
    fileWriter.WriteLine("<asp:Content ID=\"PageTitle\" runat=\"server\" contentplaceholderid=\"PlaceHolderPageTitle\">");
    fileWriter.WriteLine(...insert page title here...);
    fileWriter.WriteLine("</asp:Content>");
    fileWriter.WriteLine("<asp:Content ID=\"PageTitleInTitleArea\" runat=\"server\" contentplaceholderid=\"PlaceHolderPageTitleInTitleArea\">");
    fileWriter.WriteLine(...insert page title summary here...);
    fileWriter.WriteLine("</asp:Content>");
    fileWriter.WriteLine("<asp:Content ID=\"PageMain\" runat=\"server\" ContentPlaceHolderID=\"PlaceHolderMain\" >");
    fileWriter.WriteLine(...insert the html body mark up here...);
    fileWriter.WriteLine("</asp:Content>");
    fileWriter.Flush();
    site.Files.Add(... your page name .aspx here ..., fileStream);
    fileWriter.Close();
    fileWriter.Dispose();
    fileStream.Close();
    fileWriter.Dispose();
  } 
} 
TFD
Did not think about custom coding, you win :-)
tekiegreg
A: 

Are these html pages written in fairly standard manners? If you know you need to remove the first X lines from the top and Y lines from the bottom, you can use the following unix command string to prep the files (assuming, for the example, they are all named file01.html, file02.html, etc):

for i in file*.html; do head -n -X $i | tail +Y > $i.stripped; done

Then you can have standard headers and footers in files named appropriately and run a command like:

for i in num*.stripped; do cat header $i footer > $i.sharepoint; done

These two commands would replace the first X lines of the file with the contents in the file named header and the last Y lines of the file with the contents of footer and place them in files called file01.html.stripped.sharepoint ready for moving (and renaming).

If this wouldn't work but you know that all lines above or below a certain string of text need to be cut, then you could use this script (pasted into a file called 'trim') to perform the first prep task:

#!/usr/bin/perl

my $direction = shift;
my $r = shift;
my $file = shift;

open(FILE,"<",$file) or die 'could not open file ' . $file;

my $matched = 0;

while(<FILE>) {
   $matched ||= m/$r/;
   if ($direction eq 'before') {
      next if not $matched;
   } else {
      last if $matched;
   }    
   print;
}

The first argument is the direction you want cut, the second is the string (in regular expression form) and the third is the file name:

Run like:

perl trim after '^STRING$' file.html

and for all files:

for i in file*.html; do perl trim after '^STRING$' $i > $i.stripped_header; done

After your files are prepped, the second command from above to throw on the header and footer would be all that is necessary.

A little long winded, but the point is that you should be able to deal with this easily via a little scripting.

jsoverson