I am trying to figure out how to place a K2 role, that contains users, into a new sharepoint site that is created during a process instance. It appears this should be built in K2 functionality, since the user browser will let you drag a K2 Role over into an "Add Users to Sharepoint Site/Group" event. When trying to do this with a process data field, the following code is executed in the K2 workflow code behind. Note the sections I have bolded. The UserOrGroupCollection node is empty.
Code:
private void Lookup_K2Role(XmlDocument xmlDocument)
{
try
{
XmlNodeList XmlSharePointItemCollection = xmlDocument.SelectNodes("//ROOT/SharePointPeopleAndGroupsItem/UserOrGroupCollection/UserOrGroup/Type[.='K2Role']");
XmlNode XmlSharePointItem = null;
Here is the XML it is executing against (i took the liberty of taking out extra data, and my site url):
<ROOT><Action>ADDUSERSANDGROUPS</Action>
<SharePointPeopleAndGroupsItem><Url><SharePointSite>http://XXXXXXX</SharePointSite><SharePointList></SharePointList><SharePointFolder></SharePointFolder><SharePointListItem></SharePointListItem><SharePointGroup></SharePointGroup></Url>
<K2FieldIntegration><Value>False</Value><K2Field></K2Field></K2FieldIntegration><SharePointItemType>SHAREPOINTSITE</SharePointItemType><BreakRoleInheritance>True</BreakRoleInheritance><CopyRoleAssignments>False</CopyRoleAssignments><AssignSiteMemberPermission>False</AssignSiteMemberPermission>
<UserOrGroupCollection></UserOrGroupCollection>
<K2SharePointItemCollection></K2SharePointItemCollection><K2UserOrGroupCollection></K2UserOrGroupCollection></SharePointPeopleAndGroupsItem>
Further; When I try to modify the Event, as to "hard code" my role I am trying to add via drag and drop, I actualy get an exception in the K2 runtime when trying to execute K2.Configuration.MyCode at Properties_ExecuteCode()
Exception:
SourceCode.Framework.Data.GetValueException was caught
Message="An unexpected error has occured while trying to resolve a value for Resolver ID 106C5886-18B1-4c09-BEB3-6F7342669D18."
Source="SourceCode.ResolverFramework"
ResolverId="106C5886-18B1-4c09-BEB3-6F7342669D18"
StackTrace:
at SourceCode.Framework.Data.ResolverManager.GetValue(String runtimeData)
at Project_bc4b6f91cc6a4241b5a766580eb0f731.EventItemContext_15e7d91bc10f4a21ab18e483eff05de7.ExtenderConfig.get_MyCode() in c:Documents and SettingsAdministratorLocal SettingsTempExtenderProjectsCSWinWF-bc4b6f91cc6a4241b5a766580eb0f731KOServerContext.cs:line 150
at ExtenderProject_bc4b6f91cc6a4241b5a766580eb0f731.EventItem_15e7d91bc10f4a21ab18e483eff05de7.Properties_ExecuteCode(Object sender, EventArgs e) in c:Documents and SettingsAdministratorLocal SettingsTempExtenderProjectsCSWinWF-bc4b6f91cc6a4241b5a766580eb0f731EventItem_15e7d91bc10f4a21ab18e483eff05de7.xoml.cs:line 70
Is this a bug or a botched config item? Should I be able to Assign a role to a sharepoint group from inside the K2 blackpearl process? This is kind of unclear from the Help Files
Thanks