Code Fix: Unable to exclude a user from a SharePoint Site group
KB002253
PRODUCT
Issue Descriptions
This code fix solves two issues.
Issue 1.
When a user is part of a nested SharePoint group, they will be listed as a member of the nested group as well as a user of the default SharePoint Members group. When adding the user to the exclusion list, the user still reflects as a user of the default SharePoint Members group. Applying the K2HostServer.exe.config fix allows you to completely exclude the user.
Issue 2.
When high volumes of interaction with SharePoint Group Providers occur, the HostServer log files grow large due to errors logged when attempting to validate SharePoint internal users.
Error Message
For issue 2, the following error message is logged in the Host Server log file:
"745626962","2017-12-07 12:43:02","Error","General","0","ErrorMessage","1","0 SharePointRoleProvider.GetUser: System.Reflection.TargetInvocationException: An unexpected failure was encountered when contacting SharePoint to get information from the group provider [GroupName]: Key cannot be null.
Parameter name: key ---> System.ArgumentNullException: Key cannot be null.
Parameter name: key
at System.Collections.Hashtable.ContainsKey(Object key)
at SourceCode.Hosting.Server.Runtime.HostServerEngine.IsRoleProviderHosted(String securityLabelName)
at SourceCode.Hosting.Server.Runtime.HostServerEngine.GetRoleProviderContext(String securityLabelName)
at SourceCode.Security.Providers.SharePoint.GroupProvider.getUser(String loginName, String label)
at SourceCode.Security.Providers.SharePoint.Shared.SPCsomClient.SourceCode.Security.Providers.SharePoint.Shared.ISPGroupProviderClient.GetUser(String userName)
Resolution
-
- Ensure you have K2 4.7 installed.
- Download and Install the K2 4.7 November 2017 Cumulative Update from K2 Partner and Customer Portal.
- Get the K2 4.7 November 2017 Cumulative Update FP15 from Regional Support.
- Install the K2 4.7 November 2017 Cumulative Update FP15 to apply the fix.
- Add the following in the K2HostServer.exe.config in the “configSections”:
<configSections>
<section name="sourcecode.sharepoint.groupProvider" type="SourceCode.Security.Providers.SharePoint.GroupProviderConfigurationExclusionSection, SourceCode.Security.Providers.SharePoint, Version=4.0.0.0, Culture=neutral" />
</configSections>
Add each user to be excluded from the SharePoint Group Provider in the K2HostServer.exe.config as per example below:
<sourcecode.sharepoint.groupProvider>
<exclusions>
<add name="[SPLabel]|[DomainUsername]" />
<add name="[SPLabel]|[DomainUsername]" />
</exclusions>
</sourcecode.sharepoint.groupProvider>