XML Fields added by the K2 SharePoint wizards (SPWFI/SP Events/Item Reference wizards)
Credits to Neil Maartens, K2 Learning
Hello, it’s your friendly neighborhood training-content guy again with some bedtime reading
One of the benefits of this gig is that I get to investigate those things that have always bugged me in the field, like “what are those XML fields that are added to a process by the SharePoint wizards, and what’s inside them?”
The following write-up is extracted from a new learning module that will be available shortly (300.HLP K2 and Microsoft SharePoint Content Management). I thought it would be good to share what I’ve discovered since you may need to use this info in real projects sometime.
So without further ado, a breakdown of the various XML datafields added by the SharePoint Workflow process, SharePoint Events process and Item Reference event wizards:
Fields Added by the SharePoint Events Process Wizard
When you use the SharePoint Workflow Integration wizard to expose a K2 workflow as a SharePoint workflow, K2 will create 4 XML datafields in the process automatically.
SPComments (hidden)
This (hidden) datafield is very useful to know about, since the comments entered by users during Client Events are saved into the XML field. If you wanted to include comments from the manager as to why the request was rejected, for example, you can find the manager’s comments in this XML structure. The table below describes the values saved in this XML datafield.
Showing hidden fields and the SPComments datafield

| Field | Value Stored | Sample Value |
| Comments | A repeating node containing all the comments entered by various users during the workflow Client Events | n/a |
| EventName | The name of the Client Event for the user task | Manager Approval |
| Comment | A repeating node, since a task may have had more than one user’s input | n/a |
| UserName | The user name of the user that completed the task | DENALLIXadministrator |
| DisplayName | Display Name of the user that completed the task | DENALLIXadministrator |
| DateTime | The date that the task was completed | 1/26/2012 2:40 PM |
| Body | The comment body entered by the approver | Not _x0020_enough _x0020_leave _x0020_days Note that the special characters like space are encoded.
|
| Action | The action selected by the user when completing the item | Rejected |
SharePoint_Item
The SharePoint_Item XML datafield stores all the metadata values for the item based on the item content type. The structure of this XML datafield will vary between different lists, so we won’t list the fields in the structure here. For reference, the screenshot below just shows the type of data saved in the SharePoint_Item datafield:
Structure of the SharePoint_Item XML datafield

SPIntegrationData (hidden)
The SPIntegraiotn XML datafield is used by K2 to store the details relating to the K2/SharePoint Workflow integration.
The Screenshot below shows the structure of this field., and the table following describes the fields in this XML strcuture:
The SPIntegrationData XML Field Structure

| Field | Value Stored | Sample Value |
| HistoryListId | Internal SharePoint ID of the List used to save the Workflow History | 38ac23da-22cf-4628-b56d-708a5c887f65 |
| HistoryListURL | The relative URL of the workflow history list
The URL is relative form the root site of the site collection
|
/K2Learning/Lists/Workflow History |
| HistoryListName | The Display Name of the workflow history list | Workflow History |
| ItemName | The Name of the item submitted to workflow | Test Item |
| ItemTitle | The Title of the item submitted to workflow | Test Item |
| ItemId | The SharePoint ID of the item submitted to worfklow | 2 |
| ItemUniqueId | The internal SharePoint ID of the item submitted to workflow | 28fe05a3-6563-4d9d-906d-bc59c4bbe70e |
| ItemURL | The relative locaiotn of the item submitted to workflow.
The URL is relative to the URL of the Site where the list is defined.
|
Lists/SharePointWorkflowList/2_.000 |
| ListTitle | The title of the list where the item resides | SharePointWorkflowList |
| ListId | The internal SharePoint ID of the list where the item resides | 675684a7-8090-461c-8076-e18c83ed83c7 |
| ListURL | The relative URL of the list where the item resides.
The URL is relative from the root site of the site collection
|
/K2Learning/Lists/SharePointWorkflowList |
| OriginatorName | The name of the user that submitted the workflow | DENALLIXadministrator |
| OriginatorLoginName | The login name of the user that submitted the item to workflow | DENALLIXadministrator |
| OriginatorId | The internal SharePoint ID if the user that submitted the item to workflow | 1 |
| OriginatorEmail | Email of the person who submitted the item to workflow | administrator@denallix.com |
| SiteTitle | The title of the root site of the site collection | PortalRootSite |
| SiteId | The internal SharePoint ID for the root site of the site collection | 54707d5b-9e8d-410e-aec7-84ebca121dbb |
| SiteURL | The URL of the root site of the site collection | http://portal.denallix.com |
| TaskListTitle | The title of the task lists where user tasks will be displayed | Tasks |
| TaskListId | The internal SharePoint ID of the task list where user tasks are displayed | a0dbb13c-9ba3-4d59-a086-74c52a24efcd |
| TaskListURL | The relative URL of the task list where user tasks are displayed.
The URL is relative to the URL of the root site on the site collection
|
/K2Learning/Lists/Tasks |
| WebId | The internal SharePoint ID of the site where the list resides | 4217499d-9fa3-4715-9c32-f02cb9086d05 |
| WebURL | The full URL of the site where the list resides | http://portal.denallix.com/K2Learning |
| WorkflowId | The unique SharePoint ID for the SharePoint workflow | 5840d436-8b67-4808-ac2c-03e9921c1871 |
| TemplateName | The name of the SharePoint workflow | K2LearningTestsSharePointWorkflowIntegrationProcess |
| InternalState | A list of valid sates for the SharePoint workflow | Locked, Running, NotStarted |
| AuthorUserLoginName | Login name of the author of the item | DENALLIXadministrator |
| InstantiationData | A collection of instantiation data when the workflow was started | (depends on the item being submitted) |
| CustomData | Custom data (not used) |
WFIProcessField
The WFIProcessField XML datafield added by the wizard is a standard Content Field/Item Reference Field. The screenshot below shows the structure of this XML field, and the table following describes the fields in this structure.
The structure of the WFIProcessField

Note: The sample values are based on a list item created in a list located at http://portal.denallix.com/K2Learning/Lists/SharePointEventsList
| Field | Value Stored | Sample Value |
| Type | The Content Type of the item | ListItems |
| Item (repeating node) | This is a repeating XML node. Multiple Items can be listed under this repeating node. | |
| ID | The index of the current item in the Item repeating node | 1 |
| SiteURL | The URL of the site where the item list is located | http://portal.denallix.com/K2Learning |
| ListURL | The relative URL of the list where the item is located.
The URL is relative to the Site where the list exists.
|
Lists/SharePointEventsList |
| FolderURL | The name of the folder where the item exists.
If no folder, the Item ID is used.
|
TestFolder
or
2_.000
|
| Item | The ID of the item that started the process | 2 |
| URL | The full URL to the item.
Can be used as a hyperlink to open the Display Page of the item.
|
http://portal.denallix.com/K2Learning/Lists/SharePointEventsList/DispForm.aspx?ID=2 |
| Source | (Not relevant for the SharePoint workflow integration wizard) |
List Item MetaData
When you run the SharePoint Events process wizard, you may elect to save the metadata of the list item that started the workflow into a Process-level XML datafield.
Selecting whether to save the metadata of the item that started the workflow

The structure of this data field will depend on the definition of the list or library where the item is created, so we cannot provide a definitive screenshot or explanation of the structure. However, the screenshot and table below describe an example of this XML datafield for a sample list.
A sample XML Datafield representing the Metadata of a List Item

Note: each field has two sub-properties: Title and Name. Title is the display name of the property in SharePoint, and Name is the internal system name for the property in SharePoint.
| Field/Field Data Type | Notes | Sample Value |
| Choice | Saves the Name of the item selected in the choice drop-down | Option 1 |
| DateTime (e.g. Created, Modified or custom date field) |
Timestamp for the SharePoint server where the item was created | 2012-01-26T11:54:10 |
| Lookup | The ID and Value of the selected lookup item | 2;#Finance |
| User
(e.g. Author or custom user field)
|
Stores values in domainusername for AD users | DENALLIXadministrator |
| ID | The SharePoint List Item ID | 2 |
| Title | Stores the title | Test Item |
| YesNo | True or False value | True |
Fields Added by the SharePoint Events Process Wizard
When you use the SharePoint Events Process wizard to associate a K2 workflow with a SharePoint event, K2 will create two XML datafields in the process automatically. It is valuable to know about these datafields, since you may need to use these fields when interacting with the list item at a later stage of the workflow.
SPEventsField
The SPEventsField XML datafield added by the wizard is a standard Content Field/Item Reference Field. The screenshot below shows the structure of this XML field, and the table following describes the fields in this structure.
The structure of the SPEventsField

Note: The sample values are based on a list item created in a list located at http://portal.denallix.com/K2Learning/Lists/SharePointEventsList
| Field | Value Stored | Sample Value |
| Type | The Content Type of the item | ListItems |
| Item (repeating node) | This is a repeating XML node. Multiple Items can be listed under this repeating node. | |
| ID | The index of the current item in the Item repeating node | 1 |
| SiteURL | The URL of the site where the item list is located | http://portal.denallix.com/K2Learning |
| ListURL | The relative URL of the list where the item is located.
The URL is relative to the Site where the list exists.
|
Lists/SharePointEventsList |
| FolderURL | The name of the folder where the item exists. If no folder the Item ID is used. | TestFolder
or
2_.000
|
| Item | The ID of the item that started the process | 2 |
| URL | The full URL to the item.
Can be used as a hyperlink to open the Display Page of the item.
|
http://portal.denallix.com/K2Learning/Lists/SharePointEventsList/DispForm.aspx?ID=2 |
| Source | (Not relevant for the SharePoint Events process wizard) |
EventDetails
The EventDetails XML datafield added by the wizard represents details about the event that caused the workflow to start. The structure of this XML field is shown in the screenshot below, and the table following describes the fields:
The structure of the EventDetails Field

Note: The sample values are based on a list item created in a list located at http://portal.denallix.com/K2Learning/Lists/SharePointEventsList
| Field | Value Stored | Sample Value |
| Scope | The scope at which the event occurred (e.g. ListItem or List) | ListItem |
| EventType | The event that caused the workflow to fire | ItemAdded |
| SiteURL | The full URL to the site where the list is defined | http://portal.denallix.com/K2Learning |
| SiteRelativeURL | The relative URL of the site where the list is located, relative to the Root Site URL of the Site Collection | /K2Learning |
| List | The Name of the list where the list item was created | SharePointEventsList |
| ListRelativeURL | The relative URL of the List where the item is located. The URL is relative to the Site where the list is defined |
Lists/SharePointEventsList |
| ListFullURL | The full URL of the List where the item is located. | http://portal.denallix.com/K2Learning/Lists/SharePointEventsList |
| ListItem | The ID if the list item that started the process | 2 |
| ListItemTitle | The title of the list item that started the process | Test Item |
| ListItemRelativeURL | The relative URL of the list item that started the workflow.
The URL is relative to the Site where the list item is defined.
|
Lists/SharePointEventsList/2_.000 |
| ListItemFullURL | The full URL to the list item that started the workflow.
This link can be used as a hyperlink to open the List Item display form.
|
http://portal.denallix.com/K2Learning/Lists/SharePointEventsList/DispForm.aspx?ID=2 |
| Folder | The folder where the list item is saved.
(If no folder, the list item ID is used, as shown here)
|
TestFolder
or
2_.000
|
| Fields | Stores the BEFORE and AFTER metadata values of the Item in two separate fields in CDATA format | (Depends on the Item’s Metadata) |
Fields Added by the Item Reference Wizard
Structure of the Content Field/Item Reference Field

| Field | Value Stored | Sample Value |
| Type | The Content Type of the item | Documents |
| Item (repeating node) | This is a repeating XML node. Multiple Items can be listed under this repeating node. | |
| ID | The index of the current item in the Item repeating node | 2 |
| SiteURL | The URL of the site where the item list is located | http://portal.denallix.com/K2Learning/300.HLP |
| ListURL | The name of the List where the Item exists | Shared Documents |
| FolderURL | The name of the folder where the item exists | Demo Folder |
| Item | The Name/Title of the Item in SharePoint | My Document.docx |
| URL | The full URL to the item | http://portal.denallix.com/K2Learning/300.HLP/Shared Documents/Demo Folder/My Document.docx |
| Source | If this item was copied from another item, the source will contain the original item’s details in the same structure. This can be used to delete or otherwise modify the original item after creating a copy of the item. |




