0
我们有一个特定的业务需求,我们需要让用户能够在一个Wiki库创建Wiki页面,但是从添加Web部件到一个Wiki限制他们页。如果我们提供用户来访问Wiki库,用户可以通过单击插入添加Web部件并添加现有的Web部件。SharePoint 2010的Wiki网页库 - 限制插入Web部件在Wiki页面
有谁知道反正让用户能够贡献页面通过编辑的内容,但不能添加Web部件的页面?
感谢
我们有一个特定的业务需求,我们需要让用户能够在一个Wiki库创建Wiki页面,但是从添加Web部件到一个Wiki限制他们页。如果我们提供用户来访问Wiki库,用户可以通过单击插入添加Web部件并添加现有的Web部件。SharePoint 2010的Wiki网页库 - 限制插入Web部件在Wiki页面
有谁知道反正让用户能够贡献页面通过编辑的内容,但不能添加Web部件的页面?
感谢
如果你可以添加你可以为了检查一个Web部件的情况下创造的列表项ItemUpdating
事件维基事件接收器功能的自定义代码并取消保存并显示一条消息。
如果您只希望对单个实例进行操作,然后修改下面的代码示例以检查Wiki库实例,则基于模板(对于您的案例中的所有wiki库)的列表的事件接收器将触发所有列表你想控制。
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
SPListItem item = properties.ListItem; //get the list item being updated
string pageUrl = item.Url; //get the item url for the web part manager
SPLimitedWebPartManager lwpm = properties.Web.GetLimitedWebPartManager(pageUrl, PersonalizationScope.Shared); //get the web part manager
if (lwpm.WebParts.Count > 0) //test for the presence of any web parts
{
properties.Cancel = true; //cancel the save
properties.ErrorMessage = "WebParts are not allowed on this wiki page."; //display message to the user
}
}