0

First of all, I'm pretty new to SharePoint so don't shoot me if this is a noobish question or if I don't provide all the right information at once... :)

I have a team-site in SharePoint with following URL: "http://myServer/Opdracht_Ben/". By going to this URL I'm redirected to following page: "http://myServer/sites/Opdracht_Ben/SitePages/Home.aspx".

In Visual Studio I have a project for this site with a feature. When this site-feature is activated it should change the content of the home-page to some custom tekst and layout (i.e.: HTML). The content is not contained within a web part or the page is not a WikiPage, just text on a page.

I've been looking on MSDN and on several tech-sites and blogs but I have not found anything that could help me further. Does anyone know how I can 'reach' the content of the page and modify/update it?

PS: On StackOverflow I have found a related question (Click for the question), but the provided solution is for when the web is a "Publishing Web", which is not the case here, so that solution won't do me any good.

Thanks in advance!

1 Answer 1

1

I don't have a working solution to post but I'm pretty sure that you would need to get hold of the page via the object model, find its LimitedWebPartManager then iterate through the .WebParts until you found the one for the content. From there, you would probably have to cast the web part from the generic WebPartDefinition to the specific type (a .GetType() will help you identify the exact type but I suspect you are looking for a ContentEditorWebPart). Once you have the specific web part, there should be a property available like .Content that can be changed.

Just remember to update the page after you make the changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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