Prev: Install questions
Next: RS2000 - rsWrongItemType
From: Smokey Grindel on 14 Mar 2007 16:38 I have a XML string that was part of a subscription's matchdata... this is serialized as XML and I need to deserialize it back to a scheduledefinition object, I tried the following but it doesnt work! It returns a schedule definition object that has a start date of 1/1 and a null item recurrence... any idea why this doesnt work? I saw a lot on SQL 2000 having problems with this but the ones I tried also didnt work! Thanks! here is the code I used... this is in VB.NET 2005 Private Shared Function GetScheduleOverrides() As Xml.Serialization.XmlAttributeOverrides Dim Attoverride As New Xml.Serialization.XmlAttributeOverrides Dim Attrs As New Xml.Serialization.XmlAttributes() Attrs.Xmlns = False Attoverride.Add(GetType(ReportServer.ScheduleDefinition), Attrs) Attoverride.Add(GetType(ReportServer.MinuteRecurrence), Attrs) Attoverride.Add(GetType(ReportServer.WeeklyRecurrence), Attrs) Attoverride.Add(GetType(ReportServer.MonthlyRecurrence), Attrs) Attoverride.Add(GetType(ReportServer.MonthlyDOWRecurrence), Attrs) Attoverride.Add(GetType(ReportServer.DaysOfWeekSelector), Attrs) Attoverride.Add(GetType(ReportServer.MonthsOfYearSelector), Attrs) Return Attoverride End Function ''' <summary> ''' Deserializes match data back into a scheduled definition ''' </summary> ''' <param name="matchData"></param> ''' <returns></returns> ''' <remarks></remarks> Public Shared Function DeserializeMatchData(ByVal matchData As String) As ReportServer.ScheduleDefinition ' deserialize schedule matchData = matchData.Replace("True", "true") Dim buffer As New IO.MemoryStream(System.Text.Encoding.Default.GetBytes(matchData)) buffer.Position = 0 Dim xmlDeSerializer As New Xml.Serialization.XmlSerializer(GetType(ReportServer.ScheduleDefinition), GetScheduleOverrides) Return DirectCast(xmlDeSerializer.Deserialize(buffer), ReportServer.ScheduleDefinition) End Function
|
Pages: 1 Prev: Install questions Next: RS2000 - rsWrongItemType |