如何向匿名用户显示 Sharepoint 发布页面的特定版本而不是最新批准的版本
我正在尝试创建一个控件,它将向匿名用户提供任何特定版本的共享点发布页面。示例:
MyPage.aspx 有版本 1.0、2.0、3.0、4.0,其中 4.0 是最新发布的版本。默认情况下,Sharepoint 将向匿名用户提供 4.0 版本。我希望能够以编程方式为他们提供 2.0 版本。我知道如何检查匿名用户,并获取我想要的页面版本的对象。我的问题是,如何告诉 sharepoint 传递指定的页面对象?
以下是我迄今为止正在处理的内容...
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;
}
任何帮助将不胜感激!如果需要进一步说明,请告诉我!
I am trying to create a control that will deliver any specific version of a sharepoint publishing page to anonymous users. Example:
MyPage.aspx has versions 1.0, 2.0, 3.0, 4.0, with 4.0 being the latest published verison. Sharepoint by default will deliver version 4.0 to anonymous users. I want to be able to programmatically give them version 2.0 instead. I know how to check for anonymous users, and get the object for the version of the page that I want. My question is, how do i tell sharepoint to deliver the specified page object?
Below is what I am working with so far...
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 greatly appriciated! Please let me know if any further clarification is needed!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 SPFileVersion 中,您可以获取与页面的特定版本关联的列表项。然后,您的控件可以使用版本化列表项的属性值设置(覆盖)页面上字段控件的值(由页面的页面布局定义)。
From your SPFileVersion, you can get the list item associated with the specific version of the page. Your control can then set (override) the values of the field controls on the page (defined by the page's page layout) with the versioned list item's property values.