Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds


  Asked By: Kris    Date: Feb 11    Category: Sharepoint    Views: 1179

My current problem started when I decided I needed to move a
customized layout into my solution so that it didn't have to be
created and linked manually. It had been previous customized and the
default.aspx had been customized (both in Designer).

When i added this file into my solution and ran it (putting it into
the MasterPage gallery) it broke default.aspx (I started getting a
404, implying that "one of my files" were missing). I assume(d) that
it had something to do with the customization interfering with a
clean replacement. So I set out to clear the customization.

First clue that something was wrong was that the file didn't have the
little blue flag indicating the default.aspx page was customized
(i've been looking at these pages from the Site Content and Structure

Next, I tried to write some code to reghost (revert) the file. Here
is what I wrote...

using (SPWeb Web = new SPSite("http://mosstrn-
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(Web);
SPListItem spList = Web.GetListItem(pubWeb.Url.ToString() + "/" +
PublishingPage homePage = PublishingPage.GetPublishingPage(spList);
SPFile fileRef = Web.GetFile(homePage.Url);
if (fileRef.CustomizedPageStatus ==
fileRef.Update(); //Only added this when the code didn't work
Console.WriteLine("Reverted File!");
} else {
Console.WriteLine("File is not customized!");

I can run this repeatedly and it never reverts the page to
CustomizedPageStatus of "none"... it stays at "Customized". Should
this work or am I missing an important assumption?

This site has been a problem child for several reasons (its a
Publishing site that has only custom non-publishing children, its
been migrated between servers several times with Avepoint, etc etc).
I have no doubt it COULD be some strange corruption, but since I
don't know if I'm barking up the wrong tree I thought I'd better



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on RevertContentStream() Or get search suggestion and latest updates.

Related Topics:


Related Post