Deserialize matchData in sql reporting services 2005

S

Smokey Grindel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top