< class="prominent-subhead ">

Code Fix: Unable to exclude a user from a SharePoint Site group

This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

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)


    1. Ensure you have K2 4.7 installed.
    2. Download and Install the K2 4.7 November 2017 Cumulative Update from K2 Partner and Customer Portal.
    3. Get the K2 4.7 November 2017 Cumulative Update FP15 from Regional Support.
    4. Install the K2 4.7 November 2017 Cumulative Update FP15 to apply the fix.
    5. Add the following in the K2HostServer.exe.config in the “configSections”:


<section name="sourcecode.sharepoint.groupProvider" type="SourceCode.Security.Providers.SharePoint.GroupProviderConfigurationExclusionSection, SourceCode.Security.Providers.SharePoint, Version=, Culture=neutral" />


Add each user to be excluded from the SharePoint Group Provider in the K2HostServer.exe.config as per example below:



      <add name="[SPLabel]|[Domain\Username]" />

      <add name="[SPLabel]|[Domain\Username]" />