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.ScheduleDefin ition), Attrs)
Attoverride.Add(GetType(ReportServer.MinuteRecurre nce), Attrs)
Attoverride.Add(GetType(ReportServer.WeeklyRecurre nce), Attrs)
Attoverride.Add(GetType(ReportServer.MonthlyRecurr ence), Attrs)
Attoverride.Add(GetType(ReportServer.MonthlyDOWRec urrence), Attrs)
Attoverride.Add(GetType(ReportServer.DaysOfWeekSel ector), Attrs)
Attoverride.Add(GetType(ReportServer.MonthsOfYearS elector), 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.GetBy tes(matchData))
buffer.Position = 0
Dim xmlDeSerializer As New
Xml.Serialization.XmlSerializer(GetType(ReportServ er.ScheduleDefinition),
GetScheduleOverrides)
Return DirectCast(xmlDeSerializer.Deserialize(buffer),
ReportServer.ScheduleDefinition)
End Function