找不到SP组

时间:2019-04-01 03:14:24

标签: exception sharepoint collections spgroup

基于以下日志错误,我在以下方法中遇到错误:

  

找不到组。在   Microsoft.SharePoint.SPGroupCollection.GetByID(Int32 id)在   Site.Subsite.ERMS.Admin.SystemSetting.FolderAccessControl.FolderAccessControlUserControl.GetChildNodes(RadTreeNodeEventArgs   e)

private void GetChildNodes(RadTreeNodeEventArgs e)
{
    var methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
    try
    {
        using (SPMonitoredScope scope = new SPMonitoredScope("[{0}]{1}".FormatWith(Location, methodName)))
        {
            var itemid = Convert.ToInt32(e.Node.Attributes["itemId"]);
            Log.LogDebug("itemid : " + e.Node.Attributes["itemId"] ,Location);
            var filePlan = new Site.CommonLibrary.FilePlan();
            SPList list;
            var listCollection = SortByTitle ? filePlan.GetSortByTitleFilePlan(itemid, out list,SelectedSystem) : filePlan.GetSortByReferenceFilePlan(itemid, out list,SelectedSystem);
            Log.LogDebug("List collection count: " + listCollection.Count.ToString(), Location);

            foreach (SPListItem item in listCollection)
            {
                if (item != null)
                {
                    Log.LogDebug("List collection item content type: " + item["ContentType"].ToString(), Location);
                    if (item["ContentType"].Equals(SiteConfig.FolderContentType))
                    {
                        var access = false;
                        var isManager = false;
                        var index = 0;

                        isAdmin = PermissionLookup.GetAccessSetup(out isManager, out index, item.ParseSPGroup("Business Owner").Name, SPContext.Current.Web.CurrentUser);

                        //admin or record manager
                        if (isAdmin || index == 2)
                        {
                            access = isAdmin ? isAdmin : PermissionLookup.GetManageFolderPermissionPermission()[index];

                            if (access)
                            {
                                var childNode = GetFormattedNode(list, item.Folder);
                                e.Node.Nodes.Add(childNode);
                            }
                        }
                    }
                    else
                    {
                        var childNode = GetFormattedNode(list, item.Folder);
                        e.Node.Nodes.Add(childNode);
                    }
                }
            }
        }
    }
    catch (Exception ex)
    {
        ex.PreserveStackTrace();
        throw;
    }
}

我怀疑可能是由于以下原因所致。

isAdmin = PermissionLookup.GetAccessSetup(out isManager, out index, item.ParseSPGroup("Business Owner").Name, SPContext.Current.Web.CurrentUser);

我能否知道此错误的可能原因是什么,以及是否可以在代码中包括其他日志记录来进行故障排除?


下面是错误日志代码段:

enter image description here

0 个答案:

没有答案