I am new in sharepoint and I have to do a very simple modification in all web part. We have lots of web part containing very simple html. The html only contain a link and an image.
Web developers had put full links to pages and images and it cause some problems. I want to scan all of the web parts html and replace full links by relative links.
Is it possible ? We have tons of pages and links. Doing it manually will take 2 weeks!!!
Thanks!
EDIT #2: Now the question is: Is it possible to list all aspx files in my website? I know how to access the web parts content with a url :
using (SPLimitedWebPartManager manager = web.GetLimitedWebPartManager(
"ca/Pages/Home.aspx", PersonalizationScope.Shared))
{
foreach (System.Web.UI.WebControls.WebParts.WebPart wp in manager.WebParts)
{
System.Console.WriteLine(wp.Title);
if (wp.GetType().Equals(typeof(Microsoft.SharePoint.WebPartPages.ContentEditorWebPart)))
{
Microsoft.SharePoint.WebPartPages.ContentEditorWebPart thisWebPart = wp as Microsoft.SharePoint.WebPartPages.ContentEditorWebPart;
System.Console.WriteLine(thisWebPart.Content.InnerText );
System.Console.WriteLine(thisWebPart.Content.InnerXml);
}
}
}
EDIT #1: As requested their is an example:
I want to remove "http://www.mywebsite.com" from all shared webparts with code like this:
<A title="" href="http://www.mywebsite.com/Pages/Career.aspx" target=""><IMG style="BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: 0px solid" src="http://www.mywebsite.com/images/Career.jpg" border=0></A>