Home
Manage Your Code
Snippet: XML deserialization for SharePoint workflow and InfoPath forms (C#)
Title: XML deserialization for SharePoint workflow and InfoPath forms Language: C#
Description: Example of using XML deserialization to get information from the AssociationData and InitiationData properties of the SPWorkflowActivationProperties class in SharePoint workflow. Views: 476
Author: Matt Morse Date Added: 12/23/2007
Copy Code  
1private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
2{
3    XmlSerializer serializer = new XmlSerializer(typeof(SeminarRequest));
4    XmlTextReader assocReader = new XmlTextReader(new StringReader(workflowProperties.AssociationData));
5    SeminarRequest assocForm = serializer.Deserialize(assocReader) as SeminarRequest;
6    _approver = assocForm.Approver[0].AccountId;
7    _approvalThreshold = assocForm.ApprovalThreshold.Value;
8    
9    XmlTextReader initReader = new XmlTextReader(new StringReader(workflowProperties.InitiationData));
10    SeminarRequest initForm = serializer.Deserialize(initReader) as SeminarRequest;
11    _seminarTitle = initForm.SeminarTitle;
12    _comments = initForm.Comments;
13}