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

We have migrated a very out-of-the-box SP2007 to SP2010 (DB attach) and have performed the visual upgrade for all sites.

Now when I open some wiki pages I get the notification: "The current page has been customized from its template. Revert to template". Reverting doesn't really work. Message still stays and site looks the same. The message seems to apear only on wiki pages which have been edited by the user in SP Designer an which have been disconnected from the original site template (they added web parts and stuff).

To get rid of the message I somewhere read that you could export the site, delete the wiki, create a new one and import it back.

I don't know if that really works and if this is the best solution but I thought to give it a try.

I tried to reimport the site but I get the message that the templates doesn't match, so the import fails. The old template seems to be WIKI#0 and the new ENTERWIKI#0. So I tried to create another site with not an "Enterprise Wiki template" but only a "Wiki Template" - but I cannot find it. No other wiki template is available in the template gallery.

I searched the web and I saw that WIKI#0 is still somehow listed as a template in 2010 but I don't know if that is only for some compatibility issues and the template itself is not selectable.

Maybe someone of you knows how to get the template or how to fix the initial problem (notification message and page not editable in browser because it is disconnected from the template)?

share|improve this question
    
Hi There. I can't answer your question at this stage, but I can maybe point you in the right direction. In order to retrieve the available Site Templates in your Sharepoint farm, run this powershell command: Get-SPWebTemplate . I checked and found that both the templates you name are available in my farm. Hope this helps. –  Fox Jul 22 '11 at 7:48
    
Yes, I see alsom both templates available in my farm and custom is "false". But I cannot create a site based on that template or at least I don't know how to do it. –  Shihan Jul 22 '11 at 11:01
    
You should be able to create a site based on that template by referencing it directly. From past experiences, it looks quite ugly though, so you'd have to do some styling. Anyways, to point you in the right direction, type the following in Powershell which will show you an example of how to do it: Get-Help New-Spweb -examples –  Fox Jul 26 '11 at 7:19

2 Answers 2

up vote 1 down vote accepted

For SP 2007, I sometimes had issues reghosting files (reverting to template). The code below worked for me (Unsure about SP 2010). My code was built based on others work located here: http://sjoere.blogspot.com/2008/05/reghosting-feature-files.html and here: http://stsadm.blogspot.com/2007/09/re-ghosting-pages.html

        try
        {
            file.RevertContentStream();
            file = web.GetFile(url);
            if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
            {
                // Still unsuccessful so take measures further 
                PropertyInfo requestProp = web.GetType().GetProperty("Request", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.GetProperty);
                object request = requestProp.GetValue(web, null);
                MethodInfo revertContentStreams = request.GetType().GetMethod("RevertContentStreams", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod);

                // I found some cases where calling this directly was the only way to force the re-ghosting of the file. 
                // I think the trick is that it's not updating the file properties after doing the revert (the 
                // RevertContentStream method will call SPRequest.UpdateFileOrFolderProperties() immediately after the 
                // RevertContentStreams call but ommitting the update call seems to make a difference. 

                revertContentStreams.Invoke(request, new object[] 
                {
                    web.Url, file.Url, file.CheckOutStatus != SPFile.SPCheckOutStatus.None
                }
                );

                MethodInfo dirtyThisFileObject = file.GetType().GetMethod("DirtyThisFileObject", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod);
                dirtyThisFileObject.Invoke(file, new object[] { });
                file = web.GetFile(url);
                if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
                {
                    output.Add("FAILURE: " + file.ServerRelativeUrl);
                    return false;
                }
            }
        }
        catch (Exception ex)
        {
            output.Add("FAILURE: " + file.ServerRelativeUrl + "  Reason: " + ex.Message);
            return false;
        }
share|improve this answer
    
nicely done. I took this bit of code and modified it to use with SP2010. I had to make sure that DirthThisFileObject reflection GetMethod is picking the overload with no arguments. MethodInfo dirtyThisFileObject = file.GetType().GetMethod( "DirtyThisFileObject", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, CallingConventions.Any, new Type[0], null); –  Roman May 31 '12 at 16:57

Right, it is still interpreted as different master page.

I ran following script:

$web = Get-SPWeb <SiteURL>

$list = $web.Lists["Wiki"]

$spQuery = New-Object Microsoft.SharePoint.SPQuery

$spQuery.ViewAttributes = "Scope='Recursive'";

$spQuery.RowLimit = 2000

$caml = '<OrderBy Override="TRUE"><FieldRef Name="ID"/></OrderBy>' 

$spQuery.Query = $caml 

do
{
    $listItems = $list.GetItems($spQuery)

    $spQuery.ListItemCollectionPosition = $listItems.ListItemCollectionPosition

    foreach($item in $listItems)
    {
        $DebugPreferences = “Continue“

        Write-host “Resetting wiki page in site.“

        $item.File.RevertContentStream()
    }
}
while ($spQuery.ListItemCollectionPosition -ne $null)
$web.Dispose()

References: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.revertcontentstream(v=office.14).aspx

share|improve this answer

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.