首页 新闻 会员 周边 捐助

空元素中的xml无法调用类文件

0
悬赏园豆:50 [已关闭问题] 关闭于 2011-09-20 16:59

在sharepoint的文档库中,我想实现在下拉菜单中新建一个选项—“锁定”,主要功能是实现点击锁定后收回该文档的权限,使任何人都没有查看编辑该文档的权限。我新建了一个空元素和一个类,类的功能是控制权限,并用空元素中的xml去调用这个类。

空元素:Elements.xml

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
  Id = "0x0101004de98b4273484499bd03932084e617e0"
  Location = "EditControlBlock"
  RegistrationId = "101"
  RegistrationType = "List"
  Sequence = "1000"
  Title = "锁定2"
 >
  <UrlAction Url="javascript:__doPostBack('MyEventTarget','itemid={ItemId}{ListId}')"/>
  </CustomAction>

  <CustomAction
  Id="UserInterfaceCustomActions.SiteActionsToolbar"
  GroupId="SiteActions"
  Location="Microsoft.SharePoint.StandardMenu"
  Sequence="1000"
  Title="MY SITE ACTIONS BUTTON"
  ControlAssembly="ZHFD_DEPART_WorkLog,Version=1.0.0.0,Culture=neutral,PublicKeyToken=95d4eedb01a256e5"
  ControlClass="ZHFD_DEPART_WorkLog.actioncontrols">
  </CustomAction>
</Elements>

 

actioncontrols.cs:

namespace ZHFD_DEPART_WorkLog
{
    public class actioncontrols:SPLinkButton
    {
        protected  override void OnLoad(EventArgs e)
        {
            
            if (this.Page.Request["__EVENTTARGET"] == "MyEventTarget")
            {

               string ListAndItemId = this.Page.Request["__EVENTARGUMENT"].ToString();
                int ItemLenBeg = ListAndItemId.IndexOf("=") + 1;
                int ListLenBeg = ListAndItemId.IndexOf("{");
                int ListLenEnd = ListAndItemId.IndexOf("}") + 1;
                string ItemId = ListAndItemId.Substring(ItemLenBeg, ListLenBeg - ItemLenBeg);
                string ListId = ListAndItemId.Substring(ListLenBeg, ListLenEnd - ListLenBeg);
                Guid listId = new Guid(ListId);
                int itemId = Convert.ToInt32(ItemId);

                SPWeb myweb = SPContext.Current.Web;
                SPList loglist = myweb.Lists[listId];
                foreach (SPListItem getitem in loglist.Items)
                {
                    if (getitem.ID == itemId)
                    {
                        //移除权限
                        RemoveRoles(getitem);

                     }

               }

            }

       }

   }

}

 现在的问题是Elements.xml无法调用到actioncontrols.cs,请大家帮帮忙,替我找找原因,谢谢了

他说他叫badboy的主页 他说他叫badboy | 菜鸟二级 | 园豆:210
提问于:2011-09-19 16:30
< >
分享
所有回答(1)
0

在webconfig中把ControlAssembly="ZHFD_DEPART_WorkLog,Version=1.0.0.0,Culture=neutral,PublicKeyToken=95d4eedb01a256e5"
  ControlClass="ZHFD_DEPART_WorkLog.actioncontrols"

设为信任控件即可。

他说他叫badboy | 园豆:210 (菜鸟二级) | 2011-09-20 16:59
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册