0

I encountered an error in the following method based on the log error as follows:

Group cannot be found. at Microsoft.SharePoint.SPGroupCollection.GetByID(Int32 id) at 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;
    }
}

I am suspecting it may be due to the following line.

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

May I know what are the possible causes of this error, and if the additional logging that I can include in the code to troubleshoot?


Below is the error log snippet:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.