Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

A Thursday challenge - does anyone have any good ideas for this scenario in the intranet migration (CMS2002 - SP2007) project I'm working on:

I need to identify documents on the intranet which have embedded links to pages. I can identify links to other documents (since in CMS2002, such links are in the format '/NR/rdonlyres'), but pages are more tricky as I think the only thing to pattern match on would be the extension (.aspx, .htm etc.). Remember however, that the links could be in format "Policy Document", meaning the link target itself isn't in the document content as seen by say, a search engine.

Some other challenges:

  • The documents are in CMS 2002 and it would NOT be easy to write CMS code for this task. For one thing, the original source code for this solution is missing presumed dead (and there is no documentation), so building a fully-functional working VM is unlikely. I have a restored SQL db though.
  • Docs are Office 2003 format

I have some ideas, but all are a time-sink compared to how much time we actually have. I love to hear about any site-scraping tools which might help here, but all suggestions welcome.

share|improve this question
    
So you are trying to build of list of Office 2003 documents (doc, xls, ... where does it stop?), and this list is basically a sub set of the current set of documents that stored in a CMS2002 site, and the criteria for each of these documents is that it must contain at least one hyperlink to a web page (any web page, or only those under a specific domain e.g. the domain of the CMS2002 site?). Is this correct? –  Jaap Vossers Feb 25 '10 at 13:52
    
Yes, that's about it. Ideally to cover all Office docs, though the client believes the links are only in Word docs. We're only interested in links to the CMS site. I probably wasn't clear, but the reason for identifying these documents is so that links can be updated (i.e. fixed) after the migration. We're really looking just for a report - fixing can be done manually by the content authors. I can think of some solutions which don't involve fixing the links in the Office docs, but obviously we'd prefer to fix at source. As well as know exactly how many of these we've got. –  Chris O'Brien - MVP Feb 25 '10 at 14:49
add comment

2 Answers 2

Don't know anything of the structure of CMS 2002 database (are the docs stored as BLOB like in sharepoint?), but the parsing of the documents themselves should be easy enough.

If you open a word 2003 document in notepad you can see the hyperlinks as they are prefixed by HYPERLINK even if they are displaying text instead of the URL.

You parse each document as a string and list out those which contain embedded links to the intranet. I don't know if you could swop out the link text and save the document back without breaking it, but you could generate a report at least.

share|improve this answer
    
That's good information, thanks. This means I can actually write some quick and dirty code to see how many of these we've got. So this solves one half of the problem at least. –  Chris O'Brien - MVP Feb 26 '10 at 9:49
add comment

Presuming you already found a way to iterate all your documents, you could load the document in C# using Microsoft.Office.Interop

for example for word use Microsoft.Office.Interop.Word.Application, open the document, iterate Hyperlinks collection.

This article shows how to open documents (this is where you wish you were using C# 4 and optional arguments:-): http://msdn.microsoft.com/en-us/library/tcyt0y1f(VS.80).aspx How to: Access Office Interop Objects by Using Visual C# 2010 Features (C# Programming Guide) Microsoft.Office.Interop.Word Namespace

share|improve this answer
    
Thanks Anders. I think this approach is more technically correct, but I prefer it less since it involves reading/research etc. Since this task is like item 374 on the migration task list (:)), that's unlikely to happen to be honest, so unless it takes hours to run I'll likely go with generic parsing code per the other suggestion. Both these approaches probably fit into my "time-sink" category though :) I take it no-one is aware of a tool which may help? –  Chris O'Brien - MVP Feb 26 '10 at 9:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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