【发布时间】:2010-06-14 14:03:57
【问题描述】:
我正在使用 SharePoint 2007 对象模型 API 将角色分配给 SharePoint 对象,但是当您执行此操作时,您必须事先知道 SharePoint 对象的类型,如下所示:
// apply the new roleassignment to the folder. You can do this at the listitem level if desired (i.e. this could be SPfile.Item…. instead of SPFolder.Item)
folder.Item.RoleAssignments.Add(roleAssignment);
我想要一个能够传递 SharePoint 对象的方法的实现,确定 SharePoint 对象的类型,如下所示:
public static bool AssignRole(string spWebUrl, object spObject, SPUser oUser, string spRoleDefinition);
示例 SharePoint 对象类型为:SPSite、SPWeb、SPList、SPListItem、SPField、SPFolder
任何有关如何解决确定 SharePoint 对象类型问题的帮助将不胜感激。
旁注:
There is a way to determine the object type(有点),如果您知道该对象在站点中所在位置的完整 url,尽管这真的不是我想走的路线。
【问题讨论】:
标签: c# sharepoint sharepoint-2007 oop