I am trying to create a control that will provide anonymous users with any particular version of the sharepoint publishing page. Example:
MyPage.aspx has versions 1.0, 2.0, 3.0, 4.0, with 4.0 being the latest published version. Sharepoint by default delivers version 4.0 to anonymous users. I want to be able to programmatically provide them with version 2.0. I know how to check anonymous users and get an object for the version of the page I want. My question is: how can I tell sharepoint to deliver the specified page object?
Below I still work ...
PublishingPage currentPage = GetCurrentPageObjectVersion(2); if (currentPage != null) { // Tell sharepoint to deliver currentPage somehow? } private SPFileVersion GetCurrentPageObjectVersion(int requestedVersion) { SPFileVersion specifiedVersion = null; try { PublishingPage currentPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem); specifiedVersion = currentPage.ListItem.File.Versions.GetVersionFromID(requestedVersion); } catch (Exception e) { // Error handling here } return specifiedVersion; }
Any help would be very helpful! Please let me know if you need any clarification!
source share