Showing posts with label scheduledefinition. Show all posts
Showing posts with label scheduledefinition. Show all posts

Tuesday, February 14, 2012

deserializing ScheduleDefinition from GetSubscriptionProperties me

I got deserializing to work, but the problem is; If I create the schedule
using the web interface it will not work, but if I do it using my interface
it works.
The XML that is returned from my subscription reports:
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScheduleDefinition
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <StartDateTime
xmlns=\"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</StartDateTime>\n
<EndDate
xmlns=\"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</EndDate>\n
<MinuteRecurrence
xmlns=\"http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">\n
<MinutesInterval>900</MinutesInterval>\n
</MinuteRecurrence>\n</ScheduleDefinition>"
The XML that is returned from a report scheduled using the web app:
"<ScheduleDefinition><StartDateTime>2005-03-25T05:30:00.000-05:00</StartDateTime><MinuteRecurrence><MinutesInterval>105</MinutesInterval></MinuteRecurrence></ScheduleDefinition>"
private wsReportingServices.ScheduleDefinition
DeSerializeSchedule(string XMLString)
{
MemoryStream vStream = GetStreamFromString(XMLString);
XmlAttributes attrs=new XmlAttributes();
attrs.XmlElements.Add(new
XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteRecurrence)));
attrs.XmlElements.Add(new
XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRecurrence)));
attrs.XmlElements.Add(new
XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyRecurrence)));
attrs.XmlElements.Add(new
XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.MonthlyRecurrence)));
attrs.XmlElements.Add(new
XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.MonthlyDOWRecurrence)));
XmlAttributeOverrides attrOver=new XmlAttributeOverrides();
attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefinition",attrs);
XmlSerializer newSr=new
XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);
return
(wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);
}Here is the code that works:
static public ScheduleDefinition GetScheduleDefinition(string
matchData)
{
ScheduleDefinition res = null;
if (!crgUtl.IsEmpty(matchData))
{
string endDateStart = "<EndDate>";
string endDateEnd = "</EndDate>";
string scheduleString = matchData;
string endDateString = string.Empty;
// 1. Find <EndDate> tag and parse it separately,
because it is not serialized correctly by Microsoft.
int posStart = matchData.IndexOf(endDateStart);
int posEnd = matchData.IndexOf(endDateEnd);
if (posStart != -1 && posEnd != -1)
{
endDateString = scheduleString.Substring(
posStart + endDateStart.Length,
posEnd - posStart - endDateStart.Length);
scheduleString =
scheduleString.Substring(0, posStart)
+ scheduleString.Substring(
posEnd + endDateEnd.Length,
scheduleString.Length - posEnd -
endDateEnd.Length);
}
// 2. Replace True/False on true/false.
scheduleString = scheduleString.Replace(">True</",
">true</");
scheduleString = scheduleString.Replace(">False</",
">false</");
// 2.1 Replace occurrences of which week item on
serialized correct value:
for (int i = 0; i < WHICH_WEEK_ENUM.Length; i++)
scheduleString =scheduleString.Replace(WHICH_WEEK_STRINGS[i], WHICH_WEEK_ENUM[i]);
// 3. Deserialize ScheduleDefinition.
Stream stream = null;
XmlReader xmlReader = null;
try
{
// set overrides options to pass namespace tag
during deserialization:
XmlAttributeOverrides overrides =GetScheduleOverrides();
stream = new
MemoryStream(System.Text.Encoding.Default.GetBytes(scheduleString));
xmlReader = new XmlTextReader(stream);
XmlSerializer ser = new
XmlSerializer(typeof(ScheduleDefinition), overrides);
res =(ScheduleDefinition)ser.Deserialize(xmlReader);
}
finally
{
if (xmlReader != null) xmlReader.Close();
if (stream != null) stream.Close();
}
if (res == null)
res = new ScheduleDefinition();
// 4. Parse EndDate.
DateTime endDate = DateTime.Today;
if (!crgUtl.IsEmpty(endDateString))
{
IFormatProvider culture = new
CultureInfo("en-US", true);
endDate = DateTime.Parse(endDateString,
culture);
res.EndDate = endDate;
res.EndDateSpecified = true;
}
else
{
res.EndDateSpecified = false;
}
}
if (res == null)
{
res = new ScheduleDefinition();
res.StartDateTime = DateTime.Today;
res.EndDateSpecified = false;
}
return res;
}
static private string [] WHICH_WEEK_STRINGS = new string [] {
"FIRST_WEEK",
"SECOND_WEEK",
"THIRD_WEEK",
"FOURTH_WEEK",
"LAST_WEEK"
};
static private string [] WHICH_WEEK_ENUM = new string [] {
WeekNumberEnum.FirstWeek.ToString(),
WeekNumberEnum.SecondWeek.ToString(),
WeekNumberEnum.ThirdWeek.ToString(),
WeekNumberEnum.FourthWeek.ToString(),
WeekNumberEnum.LastWeek.ToString()};
Dmitry Nechipor.
"SouthFLBoiler@.discussions.microsoft.com"
<SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> wrote in
message news:83278D35-A056-4E12-91AF-67FA443CE248@.microsoft.com...
>I got deserializing to work, but the problem is; If I create the schedule
> using the web interface it will not work, but if I do it using my
> interface
> it works.
>
> The XML that is returned from my subscription reports:
>
> "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScheduleDefinition
> xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
> xmlns:xsi=\"/n">http://www.w3.org/2001/XMLSchema-instance\">\n <StartDateTime
> xmlns=\"2005-03-25T13:24:26.4506144-05:00</StartDateTime>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</StartDateTime>\n
> <EndDate
> xmlns=\"2005-03-25T13:24:26.4506144-05:00</EndDate>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</EndDate>\n
> <MinuteRecurrence
> xmlns=\"/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">\n
> <MinutesInterval>900</MinutesInterval>\n
> </MinuteRecurrence>\n</ScheduleDefinition>"
>
> The XML that is returned from a report scheduled using the web app:
>
> "<ScheduleDefinition><StartDateTime>2005-03-25T05:30:00.000-05:00</StartDateTime><MinuteRecurrence><MinutesInterval>105</MinutesInterval></MinuteRecurrence></ScheduleDefinition>"
>
>
> private wsReportingServices.ScheduleDefinition
> DeSerializeSchedule(string XMLString)
> {
>
> MemoryStream vStream = GetStreamFromString(XMLString);
>
> XmlAttributes attrs=new XmlAttributes();
>
> attrs.XmlElements.Add(new
> XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.MonthlyRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.MonthlyDOWRecurrence)));
>
> XmlAttributeOverrides attrOver=new
> XmlAttributeOverrides();
>
> attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefinition",attrs);
>
> XmlSerializer newSr=new
> XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);
>
> return
> (wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);
> }
>|||I tried the code, and it didnt seem to work.
You left out a couple of things though:
crgUtl. ' I repaced this to check if string was empty.
You also left out the code for GetScheduleOverrides();
I tried the following.. but didnt work: My item object was still null, and
the dates where 1/1/0001
private XmlAttributeOverrides GetScheduleOverrides()
{
XmlAttributes vXMLAtributes=new XmlAttributes();
vXMLAtributes.XmlElements.Add(new
XmlElementAttribute("MinuteRecurrence",typeof(MinuteRecurrence)));
vXMLAtributes.XmlElements.Add(new
XmlElementAttribute("DailyRecurrence",typeof(DailyRecurrence)));
vXMLAtributes.XmlElements.Add(new
XmlElementAttribute("WeeklyRecurrence",typeof(WeeklyRecurrence)));
vXMLAtributes.XmlElements.Add(new
XmlElementAttribute("MonthlyRecurrence",typeof(MonthlyRecurrence)));
vXMLAtributes.XmlElements.Add(new
XmlElementAttribute("MonthlyDOWRecurrence",typeof(MonthlyDOWRecurrence)));
vXMLAtributes.XmlElements.Add(new
XmlElementAttribute("RecurrencePattern",typeof(RecurrencePattern)));
XmlAttributeOverrides vAttrOverrides=new XmlAttributeOverrides();
vAttrOverrides.Add(typeof(ScheduleDefinition),"Item",vXMLAtributes);
return vAttrOverrides;
}
"msnews.microsoft.com" wrote:
> Here is the code that works:
>
> static public ScheduleDefinition GetScheduleDefinition(string
> matchData)
> {
> ScheduleDefinition res = null;
>
> if (!crgUtl.IsEmpty(matchData))
> {
> string endDateStart = "<EndDate>";
> string endDateEnd = "</EndDate>";
> string scheduleString = matchData;
> string endDateString = string.Empty;
> // 1. Find <EndDate> tag and parse it separately,
> because it is not serialized correctly by Microsoft.
> int posStart = matchData.IndexOf(endDateStart);
> int posEnd = matchData.IndexOf(endDateEnd);
> if (posStart != -1 && posEnd != -1)
> {
> endDateString = scheduleString.Substring(
> posStart + endDateStart.Length,
> posEnd - posStart - endDateStart.Length);
>
> scheduleString => scheduleString.Substring(0, posStart)
> + scheduleString.Substring(
> posEnd + endDateEnd.Length,
> scheduleString.Length - posEnd -
> endDateEnd.Length);
> }
>
> // 2. Replace True/False on true/false.
> scheduleString = scheduleString.Replace(">True</",
> ">true</");
> scheduleString = scheduleString.Replace(">False</",
> ">false</");
>
> // 2.1 Replace occurrences of which week item on
> serialized correct value:
> for (int i = 0; i < WHICH_WEEK_ENUM.Length; i++)
> scheduleString => scheduleString.Replace(WHICH_WEEK_STRINGS[i], WHICH_WEEK_ENUM[i]);
>
> // 3. Deserialize ScheduleDefinition.
> Stream stream = null;
> XmlReader xmlReader = null;
> try
> {
> // set overrides options to pass namespace tag
> during deserialization:
> XmlAttributeOverrides overrides => GetScheduleOverrides();
>
> stream = new
> MemoryStream(System.Text.Encoding.Default.GetBytes(scheduleString));
> xmlReader = new XmlTextReader(stream);
>
> XmlSerializer ser = new
> XmlSerializer(typeof(ScheduleDefinition), overrides);
> res => (ScheduleDefinition)ser.Deserialize(xmlReader);
> }
> finally
> {
> if (xmlReader != null) xmlReader.Close();
> if (stream != null) stream.Close();
> }
> if (res == null)
> res = new ScheduleDefinition();
>
> // 4. Parse EndDate.
> DateTime endDate = DateTime.Today;
> if (!crgUtl.IsEmpty(endDateString))
> {
> IFormatProvider culture = new
> CultureInfo("en-US", true);
> endDate = DateTime.Parse(endDateString,
> culture);
>
> res.EndDate = endDate;
> res.EndDateSpecified = true;
> }
> else
> {
> res.EndDateSpecified = false;
> }
> }
>
> if (res == null)
> {
> res = new ScheduleDefinition();
> res.StartDateTime = DateTime.Today;
> res.EndDateSpecified = false;
> }
>
> return res;
> }
>
> static private string [] WHICH_WEEK_STRINGS = new string [] {
> "FIRST_WEEK",
> "SECOND_WEEK",
> "THIRD_WEEK",
> "FOURTH_WEEK",
> "LAST_WEEK"
> };
> static private string [] WHICH_WEEK_ENUM = new string [] {
> WeekNumberEnum.FirstWeek.ToString(),
> WeekNumberEnum.SecondWeek.ToString(),
> WeekNumberEnum.ThirdWeek.ToString(),
> WeekNumberEnum.FourthWeek.ToString(),
> WeekNumberEnum.LastWeek.ToString()};
>
>
> Dmitry Nechipor.
> "SouthFLBoiler@.discussions.microsoft.com"
> <SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> wrote in
> message news:83278D35-A056-4E12-91AF-67FA443CE248@.microsoft.com...
> >I got deserializing to work, but the problem is; If I create the schedule
> > using the web interface it will not work, but if I do it using my
> > interface
> > it works.
> >
> >
> > The XML that is returned from my subscription reports:
> >
> >
> >
> > "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScheduleDefinition
> > xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
> > xmlns:xsi=\"/n">http://www.w3.org/2001/XMLSchema-instance\">\n <StartDateTime
> > xmlns=\"2005-03-25T13:24:26.4506144-05:00</StartDateTime>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</StartDateTime>\n
> > <EndDate
> > xmlns=\"2005-03-25T13:24:26.4506144-05:00</EndDate>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</EndDate>\n
> > <MinuteRecurrence
> > xmlns=\"/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">\n
> > <MinutesInterval>900</MinutesInterval>\n
> > </MinuteRecurrence>\n</ScheduleDefinition>"
> >
> >
> >
> > The XML that is returned from a report scheduled using the web app:
> >
> >
> >
> > "<ScheduleDefinition><StartDateTime>2005-03-25T05:30:00.000-05:00</StartDateTime><MinuteRecurrence><MinutesInterval>105</MinutesInterval></MinuteRecurrence></ScheduleDefinition>"
> >
> >
> >
> >
> >
> > private wsReportingServices.ScheduleDefinition
> > DeSerializeSchedule(string XMLString)
> >
> > {
> >
> >
> >
> > MemoryStream vStream = GetStreamFromString(XMLString);
> >
> >
> >
> > XmlAttributes attrs=new XmlAttributes();
> >
> >
> >
> > attrs.XmlElements.Add(new
> > XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteRecurrence)));
> >
> > attrs.XmlElements.Add(new
> > XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRecurrence)));
> >
> > attrs.XmlElements.Add(new
> > XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyRecurrence)));
> >
> > attrs.XmlElements.Add(new
> > XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.MonthlyRecurrence)));
> >
> > attrs.XmlElements.Add(new
> > XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.MonthlyDOWRecurrence)));
> >
> >
> >
> > XmlAttributeOverrides attrOver=new
> > XmlAttributeOverrides();
> >
> >
> > attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefinition",attrs);
> >
> >
> > XmlSerializer newSr=new
> > XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);
> >
> >
> >
> > return
> > (wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);
> >
> > }
> >
>
>|||This is a multi-part message in MIME format.
--=_NextPart_000_0007_01C532E3.673356F0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
1. static private XmlAttributeOverrides GetScheduleOverrides()
{
XmlAttributeOverrides overrides =3D new XmlAttributeOverrides();
XmlAttributes attrs =3D new XmlAttributes();
attrs.Xmlns =3D false;
overrides.Add(typeof(ScheduleDefinition), attrs);
overrides.Add(typeof(MinuteRecurrence), attrs);
overrides.Add(typeof(WeeklyRecurrence), attrs);
overrides.Add(typeof(MonthlyRecurrence), attrs);
overrides.Add(typeof(MonthlyDOWRecurrence), attrs);
overrides.Add(typeof(DaysOfWeekSelector), attrs);
overrides.Add(typeof(MonthsOfYearSelector), attrs);
return overrides;
}
2. static public bool IsEmpty(string s)
{
return (s =3D=3D null || s =3D=3D String.Empty);
}
I hope it will help you. I checked it with you string. It deserializes =correctly.
"SouthFLBoiler@.discussions.microsoft.com" =<SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> wrote =in message news:8F51D612-BC59-4547-A4EC-6D6A39BDE532@.microsoft.com...
>I tried the code, and it didnt seem to work.
> > You left out a couple of things though:
> crgUtl. ' I repaced this to check if string was empty.
> > You also left out the code for GetScheduleOverrides();
> > I tried the following.. but didnt work: My item object was still null, =and > the dates where 1/1/0001
> > private XmlAttributeOverrides GetScheduleOverrides()
> {
> XmlAttributes vXMLAtributes=3Dnew XmlAttributes();
> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("MinuteRecurrence",typeof(MinuteRecurrence)));
> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("DailyRecurrence",typeof(DailyRecurrence)));
> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("WeeklyRecurrence",typeof(WeeklyRecurrence)));
> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("MonthlyRecurrence",typeof(MonthlyRecurrence)));
> vXMLAtributes.XmlElements.Add(new > =XmlElementAttribute("MonthlyDOWRecurrence",typeof(MonthlyDOWRecurrence)))=;
> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("RecurrencePattern",typeof(RecurrencePattern)));
> > XmlAttributeOverrides vAttrOverrides=3Dnew XmlAttributeOverrides();
> vAttrOverrides.Add(typeof(ScheduleDefinition),"Item",vXMLAtributes);
> return vAttrOverrides;
> }
> > "msnews.microsoft.com" wrote:
> >> Here is the code that works:
>> >> >> >> static public ScheduleDefinition =GetScheduleDefinition(string >> matchData)
>> >> {
>> >> ScheduleDefinition res =3D null;
>> >> >> >> if (!crgUtl.IsEmpty(matchData))
>> >> {
>> >> string endDateStart =3D "<EndDate>";
>> >> string endDateEnd =3D "</EndDate>";
>> >> string scheduleString =3D matchData;
>> >> string endDateString =3D string.Empty;
>> >> // 1. Find <EndDate> tag and parse it =separately, >> because it is not serialized correctly by Microsoft.
>> >> int posStart =3D =matchData.IndexOf(endDateStart);
>> >> int posEnd =3D matchData.IndexOf(endDateEnd);
>> >> if (posStart !=3D -1 && posEnd !=3D -1)
>> >> {
>> >> endDateString =3D =scheduleString.Substring(
>> >> posStart + endDateStart.Length,
>> >> posEnd - posStart - =endDateStart.Length);
>> >> >> >> scheduleString =3D
>> >> scheduleString.Substring(0, =posStart)
>> >> + scheduleString.Substring(
>> >> posEnd + endDateEnd.Length,
>> >> scheduleString.Length - posEnd - >> endDateEnd.Length);
>> >> }
>> >> >> >> // 2. Replace True/False on true/false.
>> >> scheduleString =3D =scheduleString.Replace(">True</", >> ">true</");
>> >> scheduleString =3D =scheduleString.Replace(">False</", >> ">false</");
>> >> >> >> // 2.1 Replace occurrences of which week item =on >> serialized correct value:
>> >> for (int i =3D 0; i < WHICH_WEEK_ENUM.Length; =i++)
>> >> scheduleString =3D >> scheduleString.Replace(WHICH_WEEK_STRINGS[i], WHICH_WEEK_ENUM[i]);
>> >> >> >> // 3. Deserialize ScheduleDefinition.
>> >> Stream stream =3D null;
>> >> XmlReader xmlReader =3D null;
>> >> try
>> >> {
>> >> // set overrides options to pass =namespace tag >> during deserialization:
>> >> XmlAttributeOverrides overrides =3D >> GetScheduleOverrides();
>> >> >> >> stream =3D new >> MemoryStream(System.Text.Encoding.Default.GetBytes(scheduleString));
>> >> xmlReader =3D new XmlTextReader(stream);
>> >> >> >> XmlSerializer ser =3D new >> XmlSerializer(typeof(ScheduleDefinition), overrides);
>> >> res =3D >> (ScheduleDefinition)ser.Deserialize(xmlReader);
>> >> }
>> >> finally
>> >> {
>> >> if (xmlReader !=3D null) =xmlReader.Close();
>> >> if (stream !=3D null) stream.Close();
>> >> }
>> >> if (res =3D=3D null)
>> >> res =3D new ScheduleDefinition();
>> >> >> >> // 4. Parse EndDate.
>> >> DateTime endDate =3D DateTime.Today;
>> >> if (!crgUtl.IsEmpty(endDateString))
>> >> {
>> >> IFormatProvider culture =3D new >> CultureInfo("en-US", true);
>> >> endDate =3D =DateTime.Parse(endDateString, >> culture);
>> >> >> >> res.EndDate =3D endDate;
>> >> res.EndDateSpecified =3D true;
>> >> }
>> >> else
>> >> {
>> >> res.EndDateSpecified =3D false;
>> >> }
>> >> }
>> >> >> >> if (res =3D=3D null)
>> >> {
>> >> res =3D new ScheduleDefinition();
>> >> res.StartDateTime =3D DateTime.Today;
>> >> res.EndDateSpecified =3D false;
>> >> }
>> >> >> >> return res;
>> >> }
>> >> >> >> static private string [] WHICH_WEEK_STRINGS =3D new =string [] {
>> >> "FIRST_WEEK",
>> >> "SECOND_WEEK",
>> >> "THIRD_WEEK",
>> >> "FOURTH_WEEK",
>> >> "LAST_WEEK"
>> >> };
>> >> static private string [] WHICH_WEEK_ENUM =3D new string =[] {
>> >> WeekNumberEnum.FirstWeek.ToString(),
>> >> WeekNumberEnum.SecondWeek.ToString(),
>> >> WeekNumberEnum.ThirdWeek.ToString(),
>> >> WeekNumberEnum.FourthWeek.ToString(),
>> >> WeekNumberEnum.LastWeek.ToString()};
>> >> >> >> >> Dmitry Nechipor.
>> >> "SouthFLBoiler@.discussions.microsoft.com" >> <SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> =wrote in >> message news:83278D35-A056-4E12-91AF-67FA443CE248@.microsoft.com...
>> >I got deserializing to work, but the problem is; If I create the =schedule
>> > using the web interface it will not work, but if I do it using my >> > interface
>> > it works.
>> >
>> >
>> > The XML that is returned from my subscription reports:
>> >
>> >
>> >
>> > "<?xml version=3D\"1.0\" =encoding=3D\"utf-8\"?>\n<ScheduleDefinition
>> > xmlns:xsd=3D\"http://www.w3.org/2001/XMLSchema\"
>> > xmlns:xsi=3D\"/n">http://www.w3.org/2001/XMLSchema-instance\">\n =<StartDateTime
>> > =xmlns=3D\"http://schemas.microsoft.com/sqlserver/2003/12/reporting/report=
ingservices\">2005-03-25T13:24:26.4506144-05:00</StartDateTime>\n
>> > <EndDate
>> > =xmlns=3D\"http://schemas.microsoft.com/sqlserver/2003/12/reporting/report=
ingservices\">2005-03-25T13:24:26.4506144-05:00</EndDate>\n
>> > <MinuteRecurrence
>> > =xmlns=3D\"http://schemas.microsoft.com/sqlserver/2003/12/reporting/report=
ingservices\">\n
>> > <MinutesInterval>900</MinutesInterval>\n
>> > </MinuteRecurrence>\n</ScheduleDefinition>"
>> >
>> >
>> >
>> > The XML that is returned from a report scheduled using the web app:
>> >
>> >
>> >
>> > ="<ScheduleDefinition><StartDateTime>2005-03-25T05:30:00.000-05:00</StartD=ateTime><MinuteRecurrence><MinutesInterval>105</MinutesInterval></MinuteR=ecurrence></ScheduleDefinition>"
>> >
>> >
>> >
>> >
>> >
>> > private wsReportingServices.ScheduleDefinition
>> > DeSerializeSchedule(string XMLString)
>> >
>> > {
>> >
>> >
>> >
>> > MemoryStream vStream =3D =GetStreamFromString(XMLString);
>> >
>> >
>> >
>> > XmlAttributes attrs=3Dnew XmlAttributes();
>> >
>> >
>> >
>> > attrs.XmlElements.Add(new
>> > =XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteR=ecurrence)));
>> >
>> > attrs.XmlElements.Add(new
>> > =XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRec=urrence)));
>> >
>> > attrs.XmlElements.Add(new
>> > =XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyR=ecurrence)));
>> >
>> > attrs.XmlElements.Add(new
>> > =XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.Monthl=yRecurrence)));
>> >
>> > attrs.XmlElements.Add(new
>> > =XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.Mon=thlyDOWRecurrence)));
>> >
>> >
>> >
>> > XmlAttributeOverrides attrOver=3Dnew >> > XmlAttributeOverrides();
>> >
>> >
>> > =attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefi=nition",attrs);
>> >
>> >
>> > XmlSerializer newSr=3Dnew
>> > =XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);
>> >
>> >
>> >
>> > return
>> > (wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);
>> >
>> > }
>> > >> >> --=_NextPart_000_0007_01C532E3.673356F0
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

1.
static =private =XmlAttributeOverrides GetScheduleOverrides()
{
XmlAttributeOverrides overrides =3D new XmlAttributeOverrides();
XmlAttributes attrs =3D new XmlAttributes();
attrs.Xmlns =3D false;
overrides.Add(typeof(ScheduleDefinition), attrs);
overrides.Add(typeof(MinuteRecurrence), attrs);
overrides.Add(typeof(WeeklyRecurrence), attrs);
overrides.Add(typeof(MonthlyRecurrence), attrs);
overrides.Add(typeof(MonthlyDOWRecurrence), attrs);
overrides.Add(typeof(DaysOfWeekSelector), attrs);
overrides.Add(typeof(MonthsOfYearSelector), attrs);
return overrides;
}
2.
static public bool =IsEmpty(string s)
{
return (s =3D=3D null || s =3D=3D String.Empty);
}
I hope it will help you. I checked it with you =string. It deserializes correctly.
"SouthFLBoiler@.discussions.microsoft.com" wrote in message news:8F51D612-BC59-4547-A4EC-6D6A39BDE532@.microsoft.com...>I =tried the code, and it didnt seem to work.> > You left out a couple of =things though:> crgUtl. ' I repaced this to check if string =was empty.> > You also left out the code for GetScheduleOverrides();> > I tried the following.. but =didnt work: My item object was still null, and > the dates where =1/1/0001> > private XmlAttributeOverrides GetScheduleOverrides()> ={> XmlAttributes vXMLAtributes=3Dnew XmlAttributes();> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("MinuteRecurrence",typeof(MinuteRecurrence)));>=; vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("DailyRecurrence",typeof(DailyRecurrence)));> =vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("WeeklyRecurrence",typeof(WeeklyRecurrence)));>=; vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("MonthlyRecurrence",typeof(MonthlyRecurrence)));&=gt; vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("MonthlyDOWRecurrence",typeof(MonthlyDOWRecurrence)))=;> vXMLAtributes.XmlElements.Add(new > XmlElementAttribute("RecurrencePattern",typeof(RecurrencePattern)));&=gt; > XmlAttributeOverrides vAttrOverrides=3Dnew XmlAttributeOverrides();> vAttrOverrides.Add(typeof(ScheduleDefinition),"Item",vXMLAtributes);&=gt; return vAttrOverrides;> }> > "msnews.microsoft.com" =wrote:> > Here is the code that works:> > > > &=nbsp; static public ScheduleDefinition GetScheduleDefinition(string => matchData)> > &=nbsp; {> > &=nbsp; ScheduleDefinition res =3D null;> > > > &=nbsp; if (!crgUtl.IsEmpty(matchData))> > &=nbsp; {> > &=nbsp; &n=bsp; string endDateStart =3D "";> > &=nbsp; &n=bsp; string endDateEnd =3D "";> > &=nbsp; &n=bsp; string scheduleString =3D matchData;> > &=nbsp; &n=bsp; string endDateString =3D string.Empty;> > &=nbsp; &n=bsp; // 1. Find tag and parse it separately, > =because it is not serialized correctly by Microsoft.> > &=nbsp; &n=bsp; int posStart =3D matchData.IndexOf(endDateStart);> > &=nbsp; &n=bsp; int posEnd =3D matchData.IndexOf(endDateEnd);> > &=nbsp; &n=bsp; if (posStart !=3D -1 && posEnd !=3D -1)> > &=nbsp; &n=bsp; {> > &=nbsp; &n=bsp; endDateString =3D scheduleString.Substring(> > &=nbsp; &n=bsp; &nb=sp; posStart + endDateStart.Length,> > &=nbsp; &n=bsp; &nb=sp; posEnd - posStart - endDateStart.Length);> > => > &=nbsp; &n=bsp; scheduleString =3D> > &=nbsp; &n=bsp; &nb=sp; scheduleString.Substring(0, posStart)> > &=nbsp; &n=bsp; &nb=sp; + scheduleString.Substring(> > &=nbsp; &n=bsp; &nb=sp; posEnd + endDateEnd.Length,> > &=nbsp; &n=bsp; &nb=sp; scheduleString.Length - posEnd - > =endDateEnd.Length);> > &=nbsp; &n=bsp; }> > > > &=nbsp; &n=bsp; // 2. Replace True/False on true/false.> > &=nbsp; &n=bsp; scheduleString =3D scheduleString.Replace(">True ">true > &=nbsp; &n=bsp; scheduleString =3D scheduleString.Replace(">False =">false > > > &=nbsp; &n=bsp; // 2.1 Replace occurrences of which week item on > serialized =correct value:> > &=nbsp; &n=bsp; for (int i =3D 0; i < WHICH_WEEK_ENUM.Length; i++)> > &=nbsp; &n=bsp; scheduleString =3D > =scheduleString.Replace(WHICH_WEEK_STRINGS[i], WHICH_WEEK_ENUM[i]);> > > > &=nbsp; &n=bsp; // 3. Deserialize ScheduleDefinition.> > &=nbsp; &n=bsp; Stream stream =3D null;> > &=nbsp; &n=bsp; XmlReader xmlReader =3D null;> > &=nbsp; &n=bsp; try> > &=nbsp; &n=bsp; {> > &=nbsp; &n=bsp; // set overrides options to pass namespace tag > during deserialization:> > &=nbsp; &n=bsp; XmlAttributeOverrides overrides =3D > GetScheduleOverrides();> > > > &=nbsp; &n=bsp; stream =3D new > MemoryStream(System.Text.Encoding.Default.GetBytes(scheduleString));&=gt;> > &=nbsp; &n=bsp; xmlReader =3D new XmlTextReader(stream);> > => > &=nbsp; &n=bsp; XmlSerializer ser =3D new > =XmlSerializer(typeof(ScheduleDefinition), overrides);> > &=nbsp; &n=bsp; res =3D > =(ScheduleDefinition)ser.Deserialize(xmlReader);> > &=nbsp; &n=bsp; }> > &=nbsp; &n=bsp; finally> > &=nbsp; &n=bsp; {> > &=nbsp; &n=bsp; if (xmlReader !=3D null) xmlReader.Close();> > &=nbsp; &n=bsp; if (stream !=3D null) stream.Close();> > &=nbsp; &n=bsp; }> > &=nbsp; &n=bsp; if (res =3D=3D null)> > &=nbsp; &n=bsp; res =3D new ScheduleDefinition();> > > > &=nbsp; &n=bsp; // 4. Parse EndDate.> > &=nbsp; &n=bsp; DateTime endDate =3D DateTime.Today;> > &=nbsp; &n=bsp; if (!crgUtl.IsEmpty(endDateString))> > &=nbsp; &n=bsp; {> > &=nbsp; &n=bsp; IFormatProvider culture =3D new > CultureInfo("en-US", true);> > &=nbsp; &n=bsp; endDate =3D DateTime.Parse(endDateString, > =culture);> > > > &=nbsp; &n=bsp; res.EndDate =3D endDate;> > &=nbsp; &n=bsp; res.EndDateSpecified =3D true;> > &=nbsp; &n=bsp; }> > &=nbsp; &n=bsp; else> > &=nbsp; &n=bsp; {> > &=nbsp; &n=bsp; res.EndDateSpecified =3D false;> > &=nbsp; &n=bsp; }> > &=nbsp; }> > > > &=nbsp; if (res =3D=3D null)> > &=nbsp; {> > &=nbsp; &n=bsp; res =3D new ScheduleDefinition();> > &=nbsp; &n=bsp; res.StartDateTime =3D DateTime.Today;> > &=nbsp; &n=bsp; res.EndDateSpecified =3D false;> > &=nbsp; }> > > > &=nbsp; return res;> > &=nbsp; }> > > > &=nbsp; static private string [] WHICH_WEEK_STRINGS =3D new string [] ={> > "FIRST_WEEK",> > "SECOND_WEEK",> > ="THIRD_WEEK",> > "FOURTH_WEEK",> > ="LAST_WEEK"> > };> > &=nbsp; static private string [] WHICH_WEEK_ENUM =3D new string [] {> => WeekNumberEnum.FirstWeek.ToString(),> > WeekNumberEnum.SecondWeek.ToString(),> > WeekNumberEnum.ThirdWeek.ToString(),> > WeekNumberEnum.FourthWeek.ToString(),> > WeekNumberEnum.LastWeek.ToString()};> > => > > Dmitry Nechipor.> > ="SouthFLBoiler@.discussions.microsoft.com" > wrote in > message news:83278D35-A056-4E12-91AF-67FA443CE248@.microsoft.com...> >I got deserializing to work, =but the problem is; If I create the schedule> > using the web =interface it will not work, but if I do it using my > > =interface> > it works.> >> >> > The =XML that is returned from my subscription reports:> >> >> >> > "\n > xmlns:xsd=3D\""> > xmlns:xsi=3D\"http://www.w3.org/2001/XMLSchema-instance\">\n'>/nhttp://www.w3.org/2001/XMLSchema-instance\">\n > =xmlns=3D\"2005-03-25T13:24:26.4506144-05:00\n'>http://schemas.microsoft.com/sqlserver/2003/12/reporting/reporti=ngservices\">2005-03-25T13:24:26.4506144-05:00\n=> > > =xmlns=3D\"2005-03-25T13:24:26.4506144-05:00\n'>http://schemas.microsoft.com/sqlserver/2003/12/reporting/reporti=ngservices\">2005-03-25T13:24:26.4506144-05:00\n> > => xmlns=3D\"\n'>http://schemas.microsoft.com/sqlserver/2003/12/reporting/reporti=ngservices\">\n> > 900\n> > \n"> >> >> >> > The XML that is =returned from a report scheduled using the web app:> >> >> >> > "2005-03-25T05:30:00.000-0=5:00=105"> >> >> >> >> >> > =private wsReportingServices.ScheduleDefinition> > DeSerializeSchedule(string XMLString)> >> > &nb=sp; {> >> >> >> > &nb=sp; MemoryStream vStream =3D GetStreamFromString(XMLString);> >> >> >> > &nb=sp; XmlAttributes attrs=3Dnew XmlAttributes();> >> >> >> > &nb=sp; attrs.XmlElements.Add(new> > XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteR=ecurrence)));> >> > &nb=sp; attrs.XmlElements.Add(new> > XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRec=urrence)));> >> > &nb=sp; attrs.XmlElements.Add(new> > XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyR=ecurrence)));> >> > &nb=sp; attrs.XmlElements.Add(new> > XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.Monthl=yRecurrence)));> >> > &nb=sp; attrs.XmlElements.Add(new> > XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.Mon=thlyDOWRecurrence)));> >> >> >> > &nb=sp; XmlAttributeOverrides attrOver=3Dnew > > XmlAttributeOverrides();> >> >> => attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefi=nition",attrs);> >> >> > &nb=sp; XmlSerializer newSr=3Dnew> > XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);> >> >> >> > &nb=sp; return> > (wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);&g=t;> >> > &nb=sp; }> > > > =>

--=_NextPart_000_0007_01C532E3.673356F0--|||Ok.. that worked on the Schedules made by the web app, but it errors on the
schedules I make with my serialization.
So im check to see if the xml starts with <?xml .. if so, I use my original
deserializion, im not, I use the one you posted
Thanks
"Dmitry Nechipor. [MCDBA]" wrote:
> 1.
> static private XmlAttributeOverrides GetScheduleOverrides()
> {
> XmlAttributeOverrides overrides = new XmlAttributeOverrides();
> XmlAttributes attrs = new XmlAttributes();
> attrs.Xmlns = false;
> overrides.Add(typeof(ScheduleDefinition), attrs);
> overrides.Add(typeof(MinuteRecurrence), attrs);
> overrides.Add(typeof(WeeklyRecurrence), attrs);
> overrides.Add(typeof(MonthlyRecurrence), attrs);
> overrides.Add(typeof(MonthlyDOWRecurrence), attrs);
> overrides.Add(typeof(DaysOfWeekSelector), attrs);
> overrides.Add(typeof(MonthsOfYearSelector), attrs);
> return overrides;
> }
> 2.
> static public bool IsEmpty(string s)
> {
> return (s == null || s == String.Empty);
> }
> I hope it will help you. I checked it with you string. It deserializes correctly.
> "SouthFLBoiler@.discussions.microsoft.com" <SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> wrote in message news:8F51D612-BC59-4547-A4EC-6D6A39BDE532@.microsoft.com...
> >I tried the code, and it didnt seem to work.
> >
> > You left out a couple of things though:
> > crgUtl. ' I repaced this to check if string was empty.
> >
> > You also left out the code for GetScheduleOverrides();
> >
> > I tried the following.. but didnt work: My item object was still null, and
> > the dates where 1/1/0001
> >
> > private XmlAttributeOverrides GetScheduleOverrides()
> > {
> > XmlAttributes vXMLAtributes=new XmlAttributes();
> > vXMLAtributes.XmlElements.Add(new
> > XmlElementAttribute("MinuteRecurrence",typeof(MinuteRecurrence)));
> > vXMLAtributes.XmlElements.Add(new
> > XmlElementAttribute("DailyRecurrence",typeof(DailyRecurrence)));
> > vXMLAtributes.XmlElements.Add(new
> > XmlElementAttribute("WeeklyRecurrence",typeof(WeeklyRecurrence)));
> > vXMLAtributes.XmlElements.Add(new
> > XmlElementAttribute("MonthlyRecurrence",typeof(MonthlyRecurrence)));
> > vXMLAtributes.XmlElements.Add(new
> > XmlElementAttribute("MonthlyDOWRecurrence",typeof(MonthlyDOWRecurrence)));
> > vXMLAtributes.XmlElements.Add(new
> > XmlElementAttribute("RecurrencePattern",typeof(RecurrencePattern)));
> >
> > XmlAttributeOverrides vAttrOverrides=new XmlAttributeOverrides();
> > vAttrOverrides.Add(typeof(ScheduleDefinition),"Item",vXMLAtributes);
> > return vAttrOverrides;
> > }
> >
> > "msnews.microsoft.com" wrote:
> >
> >> Here is the code that works:
> >>
> >>
> >>
> >> static public ScheduleDefinition GetScheduleDefinition(string
> >> matchData)
> >>
> >> {
> >>
> >> ScheduleDefinition res = null;
> >>
> >>
> >>
> >> if (!crgUtl.IsEmpty(matchData))
> >>
> >> {
> >>
> >> string endDateStart = "<EndDate>";
> >>
> >> string endDateEnd = "</EndDate>";
> >>
> >> string scheduleString = matchData;
> >>
> >> string endDateString = string.Empty;
> >>
> >> // 1. Find <EndDate> tag and parse it separately,
> >> because it is not serialized correctly by Microsoft.
> >>
> >> int posStart = matchData.IndexOf(endDateStart);
> >>
> >> int posEnd = matchData.IndexOf(endDateEnd);
> >>
> >> if (posStart != -1 && posEnd != -1)
> >>
> >> {
> >>
> >> endDateString = scheduleString.Substring(
> >>
> >> posStart + endDateStart.Length,
> >>
> >> posEnd - posStart - endDateStart.Length);
> >>
> >>
> >>
> >> scheduleString => >>
> >> scheduleString.Substring(0, posStart)
> >>
> >> + scheduleString.Substring(
> >>
> >> posEnd + endDateEnd.Length,
> >>
> >> scheduleString.Length - posEnd -
> >> endDateEnd.Length);
> >>
> >> }
> >>
> >>
> >>
> >> // 2. Replace True/False on true/false.
> >>
> >> scheduleString = scheduleString.Replace(">True</",
> >> ">true</");
> >>
> >> scheduleString = scheduleString.Replace(">False</",
> >> ">false</");
> >>
> >>
> >>
> >> // 2.1 Replace occurrences of which week item on
> >> serialized correct value:
> >>
> >> for (int i = 0; i < WHICH_WEEK_ENUM.Length; i++)
> >>
> >> scheduleString => >> scheduleString.Replace(WHICH_WEEK_STRINGS[i], WHICH_WEEK_ENUM[i]);
> >>
> >>
> >>
> >> // 3. Deserialize ScheduleDefinition.
> >>
> >> Stream stream = null;
> >>
> >> XmlReader xmlReader = null;
> >>
> >> try
> >>
> >> {
> >>
> >> // set overrides options to pass namespace tag
> >> during deserialization:
> >>
> >> XmlAttributeOverrides overrides => >> GetScheduleOverrides();
> >>
> >>
> >>
> >> stream = new
> >> MemoryStream(System.Text.Encoding.Default.GetBytes(scheduleString));
> >>
> >> xmlReader = new XmlTextReader(stream);
> >>
> >>
> >>
> >> XmlSerializer ser = new
> >> XmlSerializer(typeof(ScheduleDefinition), overrides);
> >>
> >> res => >> (ScheduleDefinition)ser.Deserialize(xmlReader);
> >>
> >> }
> >>
> >> finally
> >>
> >> {
> >>
> >> if (xmlReader != null) xmlReader.Close();
> >>
> >> if (stream != null) stream.Close();
> >>
> >> }
> >>
> >> if (res == null)
> >>
> >> res = new ScheduleDefinition();
> >>
> >>
> >>
> >> // 4. Parse EndDate.
> >>
> >> DateTime endDate = DateTime.Today;
> >>
> >> if (!crgUtl.IsEmpty(endDateString))
> >>
> >> {
> >>
> >> IFormatProvider culture = new
> >> CultureInfo("en-US", true);
> >>
> >> endDate = DateTime.Parse(endDateString,
> >> culture);
> >>
> >>
> >>
> >> res.EndDate = endDate;
> >>
> >> res.EndDateSpecified = true;
> >>
> >> }
> >>
> >> else
> >>
> >> {
> >>
> >> res.EndDateSpecified = false;
> >>
> >> }
> >>
> >> }
> >>
> >>
> >>
> >> if (res == null)
> >>
> >> {
> >>
> >> res = new ScheduleDefinition();
> >>
> >> res.StartDateTime = DateTime.Today;
> >>
> >> res.EndDateSpecified = false;
> >>
> >> }
> >>
> >>
> >>
> >> return res;
> >>
> >> }
> >>
> >>
> >>
> >> static private string [] WHICH_WEEK_STRINGS = new string [] {
> >>
> >> "FIRST_WEEK",
> >>
> >> "SECOND_WEEK",
> >>
> >> "THIRD_WEEK",
> >>
> >> "FOURTH_WEEK",
> >>
> >> "LAST_WEEK"
> >>
> >> };
> >>
> >> static private string [] WHICH_WEEK_ENUM = new string [] {
> >>
> >> WeekNumberEnum.FirstWeek.ToString(),
> >>
> >> WeekNumberEnum.SecondWeek.ToString(),
> >>
> >> WeekNumberEnum.ThirdWeek.ToString(),
> >>
> >> WeekNumberEnum.FourthWeek.ToString(),
> >>
> >> WeekNumberEnum.LastWeek.ToString()};
> >>
> >>
> >>
> >>
> >> Dmitry Nechipor.
> >>
> >> "SouthFLBoiler@.discussions.microsoft.com"
> >> <SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> wrote in
> >> message news:83278D35-A056-4E12-91AF-67FA443CE248@.microsoft.com...
> >> >I got deserializing to work, but the problem is; If I create the schedule
> >> > using the web interface it will not work, but if I do it using my
> >> > interface
> >> > it works.
> >> >
> >> >
> >> > The XML that is returned from my subscription reports:
> >> >
> >> >
> >> >
> >> > "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScheduleDefinition
> >> > xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
> >> > xmlns:xsi=\"/n">http://www.w3.org/2001/XMLSchema-instance\">\n <StartDateTime
> >> > xmlns=\"2005-03-25T13:24:26.4506144-05:00</StartDateTime>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</StartDateTime>\n
> >> > <EndDate
> >> > xmlns=\"2005-03-25T13:24:26.4506144-05:00</EndDate>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</EndDate>\n
> >> > <MinuteRecurrence
> >> > xmlns=\"/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">\n
> >> > <MinutesInterval>900</MinutesInterval>\n
> >> > </MinuteRecurrence>\n</ScheduleDefinition>"
> >> >
> >> >
> >> >
> >> > The XML that is returned from a report scheduled using the web app:
> >> >
> >> >
> >> >
> >> > "<ScheduleDefinition><StartDateTime>2005-03-25T05:30:00.000-05:00</StartDateTime><MinuteRecurrence><MinutesInterval>105</MinutesInterval></MinuteRecurrence></ScheduleDefinition>"
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > private wsReportingServices.ScheduleDefinition
> >> > DeSerializeSchedule(string XMLString)
> >> >
> >> > {
> >> >
> >> >
> >> >
> >> > MemoryStream vStream = GetStreamFromString(XMLString);
> >> >
> >> >
> >> >
> >> > XmlAttributes attrs=new XmlAttributes();
> >> >
> >> >
> >> >
> >> > attrs.XmlElements.Add(new
> >> > XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteRecurrence)));
> >> >
> >> > attrs.XmlElements.Add(new
> >> > XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRecurrence)));
> >> >
> >> > attrs.XmlElements.Add(new
> >> > XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyRecurrence)));
> >> >
> >> > attrs.XmlElements.Add(new
> >> > XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.MonthlyRecurrence)));
> >> >
> >> > attrs.XmlElements.Add(new
> >> > XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.MonthlyDOWRecurrence)));
> >> >
> >> >
> >> >
> >> > XmlAttributeOverrides attrOver=new
> >> > XmlAttributeOverrides();
> >> >
> >> >
> >> > attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefinition",attrs);
> >> >
> >> >
> >> > XmlSerializer newSr=new
> >> > XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);
> >> >
> >> >
> >> >
> >> > return
> >> > (wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);
> >> >
> >> > }
> >> >
> >>
> >>
> >>|||Here's a nice example of serializing ScheduleDefinition:
http://www.odetocode.com/Articles/114.aspx
--
Adrian M.
MCP
"SouthFLBoiler@.discussions.microsoft.com"
<SouthFLBoilerdiscussionsmicrosoftcom@.discussions.microsoft.com> wrote in
message news:83278D35-A056-4E12-91AF-67FA443CE248@.microsoft.com...
>I got deserializing to work, but the problem is; If I create the schedule
> using the web interface it will not work, but if I do it using my
> interface
> it works.
>
> The XML that is returned from my subscription reports:
>
> "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScheduleDefinition
> xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
> xmlns:xsi=\"/n">http://www.w3.org/2001/XMLSchema-instance\">\n <StartDateTime
> xmlns=\"2005-03-25T13:24:26.4506144-05:00</StartDateTime>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</StartDateTime>\n
> <EndDate
> xmlns=\"2005-03-25T13:24:26.4506144-05:00</EndDate>/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">2005-03-25T13:24:26.4506144-05:00</EndDate>\n
> <MinuteRecurrence
> xmlns=\"/n">http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices\">\n
> <MinutesInterval>900</MinutesInterval>\n
> </MinuteRecurrence>\n</ScheduleDefinition>"
>
> The XML that is returned from a report scheduled using the web app:
>
> "<ScheduleDefinition><StartDateTime>2005-03-25T05:30:00.000-05:00</StartDateTime><MinuteRecurrence><MinutesInterval>105</MinutesInterval></MinuteRecurrence></ScheduleDefinition>"
>
>
> private wsReportingServices.ScheduleDefinition
> DeSerializeSchedule(string XMLString)
> {
>
> MemoryStream vStream = GetStreamFromString(XMLString);
>
> XmlAttributes attrs=new XmlAttributes();
>
> attrs.XmlElements.Add(new
> XmlElementAttribute("MinuteRecurrence",typeof(wsReportingServices.MinuteRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("DailyRecurrence",typeof(wsReportingServices.DailyRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("WeeklyRecurrence",typeof(wsReportingServices.WeeklyRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("MonthlyRecurrence",typeof(wsReportingServices.MonthlyRecurrence)));
> attrs.XmlElements.Add(new
> XmlElementAttribute("MonthlyDOWRecurrence",typeof(wsReportingServices.MonthlyDOWRecurrence)));
>
> XmlAttributeOverrides attrOver=new
> XmlAttributeOverrides();
>
> attrOver.Add(typeof(wsReportingServices.ScheduleDefinition),"ScheduleDefinition",attrs);
>
> XmlSerializer newSr=new
> XmlSerializer(typeof(wsReportingServices.ScheduleDefinition),attrOver);
>
> return
> (wsReportingServices.ScheduleDefinition)newSr.Deserialize(vStream);
> }
>

Deserialize ScheduleDefinition

I'm attempting to pull the Matchdata that is retrieved from the
GetSubscriptionProperties call into an object. According to the
documentation, matchdata is XML that is a represents a ScheduleDefinition
object. What I'd like to do is deserialize the XML string into a
ScheduleDefinition object. Something like this ...
Dim a As New Serialization.XmlRootAttribute("ScheduleDefinition")
Dim requestSerializer As Xml.Serialization.XmlSerializer
requestSerializer = New
Xml.Serialization.XmlSerializer(GetType(CorporateReporting.RS.ScheduleDefini
tion), a)
rs.GetSubscriptionProperties(subscription.SubscriptionID, extSettings, desc,
active, status, eventType, matchData, values)
Dim stm As New System.IO.MemoryStream
Dim msg As New Xml.XmlTextWriter(stm, System.Text.Encoding.UTF8)
msg.WriteRaw(matchData)
msg.Flush()
Dim readStream As New StreamReader(stm, Encoding.UTF8)
Dim r As CorporateReporting.RS.ScheduleDefinition = CType(requestSerializer.Deserialize(readStream),
CorporateReporting.RS.ScheduleDefinition)
It keeps throwing an XML exception. Any ideas on how I should be doing
this'
Thx,What exception are you seeing? There is a known issue with Monthly Day of
Week schedules, you may be running into this. Have you tried other
schedules?
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message
news:OB9fmYOdEHA.1644@.tk2msftngp13.phx.gbl...
> I'm attempting to pull the Matchdata that is retrieved from the
> GetSubscriptionProperties call into an object. According to the
> documentation, matchdata is XML that is a represents a ScheduleDefinition
> object. What I'd like to do is deserialize the XML string into a
> ScheduleDefinition object. Something like this ...
> Dim a As New Serialization.XmlRootAttribute("ScheduleDefinition")
> Dim requestSerializer As Xml.Serialization.XmlSerializer
> requestSerializer = New
>
Xml.Serialization.XmlSerializer(GetType(CorporateReporting.RS.ScheduleDefini
> tion), a)
> rs.GetSubscriptionProperties(subscription.SubscriptionID, extSettings,
desc,
> active, status, eventType, matchData, values)
> Dim stm As New System.IO.MemoryStream
> Dim msg As New Xml.XmlTextWriter(stm, System.Text.Encoding.UTF8)
> msg.WriteRaw(matchData)
> msg.Flush()
> Dim readStream As New StreamReader(stm, Encoding.UTF8)
> Dim r As CorporateReporting.RS.ScheduleDefinition => CType(requestSerializer.Deserialize(readStream),
> CorporateReporting.RS.ScheduleDefinition)
> It keeps throwing an XML exception. Any ideas on how I should be doing
> this'
> Thx,
>|||I'm doing the same thing. I can deserialize but I'm currently
figuring out how to get the info out of the definition and onto a
form. Not too many people helping out on this subject, here's what
I've done (snippet):
ScheduleDefinition objDef;
StringReader strRead = new
StringReader(Request.Cookies["Schedule"].Value);
XmlSerializer objXMLSerial = new
XmlSerializer(typeof(ScheduleDefinition));
objDef = (ScheduleDefinition) objXMLSerial.Deserialize(strRead);
// Working on this part...
setScheduleForm(objDef);
Let me know if this helps any?
Frank
"Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message news:<OB9fmYOdEHA.1644@.tk2msftngp13.phx.gbl>...
> I'm attempting to pull the Matchdata that is retrieved from the
> GetSubscriptionProperties call into an object. According to the
> documentation, matchdata is XML that is a represents a ScheduleDefinition
> object. What I'd like to do is deserialize the XML string into a
> ScheduleDefinition object. Something like this ...
> Dim a As New Serialization.XmlRootAttribute("ScheduleDefinition")
> Dim requestSerializer As Xml.Serialization.XmlSerializer
> requestSerializer = New
> Xml.Serialization.XmlSerializer(GetType(CorporateReporting.RS.ScheduleDefini
> tion), a)
> rs.GetSubscriptionProperties(subscription.SubscriptionID, extSettings, desc,
> active, status, eventType, matchData, values)
> Dim stm As New System.IO.MemoryStream
> Dim msg As New Xml.XmlTextWriter(stm, System.Text.Encoding.UTF8)
> msg.WriteRaw(matchData)
> msg.Flush()
> Dim readStream As New StreamReader(stm, Encoding.UTF8)
> Dim r As CorporateReporting.RS.ScheduleDefinition => CType(requestSerializer.Deserialize(readStream),
> CorporateReporting.RS.ScheduleDefinition)
> It keeps throwing an XML exception. Any ideas on how I should be doing
> this'
> Thx,|||Frank,
Yes!! Thanks for the help.
I can now deserialize the matchdata into an ScheduleDefinition object
without any errors
However, the object is not deserializing properly?!?
My matchdata is:
"<ScheduleDefinition><StartDateTime>2004-07-28T09:00:00.000-07:00</StartDate
Time><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Sunday>T
rue</Sunday><Monday>True</Monday><Tuesday>True</Tuesday><Wednesday>True</Wed
nesday><Thursday>True</Thursday><Friday>True</Friday><Saturday>True</Saturda
y></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"
However, my object (during quickwatch) looks like
r - ScheduleDefinition (my object)
EndDate: #12:00:00AM#
EndDateSpecified: False
Item: Nothing
StartDateTime: #12:00:00AM#
At least the StartDateTime should deserialize properly!
I've only tried one schedule at this point in time. I'm going to try a
couple others and see if they do the same thing. I'll post back any
different results
Could this be the known bug that Daniel Reib mentioned?
Thx so much for getting me this far!!
-Joel
"Stoma_Kalos" <fzuma@.yahoo.com> wrote in message
news:e876e3c8.0408030931.7eec518e@.posting.google.com...
> I'm doing the same thing. I can deserialize but I'm currently
> figuring out how to get the info out of the definition and onto a
> form. Not too many people helping out on this subject, here's what
> I've done (snippet):
> ScheduleDefinition objDef;
> StringReader strRead = new
> StringReader(Request.Cookies["Schedule"].Value);
> XmlSerializer objXMLSerial = new
> XmlSerializer(typeof(ScheduleDefinition));
> objDef = (ScheduleDefinition) objXMLSerial.Deserialize(strRead);
> // Working on this part...
> setScheduleForm(objDef);
> Let me know if this helps any?
> Frank
> "Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message
news:<OB9fmYOdEHA.1644@.tk2msftngp13.phx.gbl>...
> > I'm attempting to pull the Matchdata that is retrieved from the
> > GetSubscriptionProperties call into an object. According to the
> > documentation, matchdata is XML that is a represents a
ScheduleDefinition
> > object. What I'd like to do is deserialize the XML string into a
> > ScheduleDefinition object. Something like this ...
> >
> > Dim a As New Serialization.XmlRootAttribute("ScheduleDefinition")
> >
> > Dim requestSerializer As Xml.Serialization.XmlSerializer
> >
> > requestSerializer = New
> >
Xml.Serialization.XmlSerializer(GetType(CorporateReporting.RS.ScheduleDefini
> > tion), a)
> >
> > rs.GetSubscriptionProperties(subscription.SubscriptionID, extSettings,
desc,
> > active, status, eventType, matchData, values)
> >
> > Dim stm As New System.IO.MemoryStream
> >
> > Dim msg As New Xml.XmlTextWriter(stm, System.Text.Encoding.UTF8)
> >
> > msg.WriteRaw(matchData)
> >
> > msg.Flush()
> >
> > Dim readStream As New StreamReader(stm, Encoding.UTF8)
> >
> > Dim r As CorporateReporting.RS.ScheduleDefinition => > CType(requestSerializer.Deserialize(readStream),
> > CorporateReporting.RS.ScheduleDefinition)
> >
> > It keeps throwing an XML exception. Any ideas on how I should be doing
> > this'
> >
> > Thx,|||I believe the error that Daniel Reib mentioned is of no consequence as
to why your Item method is empty. I've gotten that far w/ the code
below, however the retrieving of the information under each type is
still eluding me. I know how to figure out what type of definition as
can be seen below, but I don't know how to pull the info out of the
specific types. I'm sure it has to be under the Item method
somewhere...there aren't many other choices. I'm surprised there
hasn't been a Microsoft rep all over this, maybe they don't know
either?
Anyway let me know you get along...
private void setScheduleForm(ScheduleDefinition def)
{
DateTime strStartDT = def.StartDateTime;
int month = strStartDT.Month;
int day = strStartDT.Day;
int year = strStartDT.Year;
int hour = strStartDT.Hour;
int minute = strStartDT.Minute;
int second = 0;
this.pnlHourly.Visible = false;
this.pnlDaily.Visible = false;
this.pnlWeekly.Visible = false;
this.pnlMonthly.Visible = false;
this.txtStartDate.Value = def.StartDateTime;
if (def.EndDateSpecified)
this.txtEndDate.Value = def.EndDate;
// This looks at what type of definition is stored...since there are
multiple
switch (def.Item.GetType().Name)
{
case "Hourly":
this.pnlHourly.Visible = true;
case "Daily":
this.pnlDaily.Visible = true;
case "WeeklyRecurrence":
WeeklyRecurrence recurrence = new WeeklyRecurrence();
DaysOfWeekSelector days = new DaysOfWeekSelector();
this.pnlWeekly.Visible = true;
this.txtWeeklyStartMinutes.Text = minute.ToString();
if (hour >= 12)
{
hour = hour - 12;
this.txtWeeklyStartHour.Text = hour.ToString();
this.radWeeklyPM.Checked = true;
}
else
{
this.txtWeeklyStartHour.Text = hour.ToString();
this.radWeeklyAM.Checked = true;
}
/*this.chkWeeklyMonday.Checked = ;
this.chkWeeklyTuesday.Checked = ;
this.chkWeeklyWednesday.Checked = ;
this.chkWeeklyThursday.Checked = ;
this.chkWeeklyFriday.Checked = ;
this.chkWeeklySaturday.Checked = ;
this.chkWeeklySunday.Checked = ;
*/
//recurrence.DaysOfWeek = days;
if (recurrence.WeeksIntervalSpecified)
this.txtWeeklyRepeatWeeks.Text =recurrence.WeeksInterval.ToString();
break;
case "MonthlyRecurrence":
case "MonthlyDOWRecurrence":
}
}
Frank
"Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message news:<eRPnmOYeEHA.1656@.TK2MSFTNGP09.phx.gbl>...
> Frank,
> Yes!! Thanks for the help.
> I can now deserialize the matchdata into an ScheduleDefinition object
> without any errors
> However, the object is not deserializing properly?!?
> My matchdata is:
> "<ScheduleDefinition><StartDateTime>2004-07-28T09:00:00.000-07:00</StartDate
> Time><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Sunday>T
> rue</Sunday><Monday>True</Monday><Tuesday>True</Tuesday><Wednesday>True</Wed
> nesday><Thursday>True</Thursday><Friday>True</Friday><Saturday>True</Saturda
> y></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"
> However, my object (during quickwatch) looks like
> r - ScheduleDefinition (my object)
> EndDate: #12:00:00AM#
> EndDateSpecified: False
> Item: Nothing
> StartDateTime: #12:00:00AM#
> At least the StartDateTime should deserialize properly!
> I've only tried one schedule at this point in time. I'm going to try a
> couple others and see if they do the same thing. I'll post back any
> different results
> Could this be the known bug that Daniel Reib mentioned?
> Thx so much for getting me this far!!
> -Joel|||Ok, FINALLY figured it out...I was not casting the object correctly.
You can refer to my previous post to see some of the outer portions of
code. By the way, I looked at where you got, it appears that you are
not getting any info at all. That definition looks empty, one thing
to note in my first posting is I use a cookie and not the MatchData
variable. So be sure you are using MD instead of my cookie value.
Also be sure you have string XML in your MD variable at that point.
Let me know if you need more clarifcation...and post some code so I
can see more of what you are doing.
case "WeeklyRecurrence":
// THIS WAS THE KICKER FOR ME...that damn def.Item cast.
WeeklyRecurrence recurrence =(TXU.Online.Reports.Web.Objects.WeeklyRecurrence)def.Item;
DaysOfWeekSelector days = recurrence.DaysOfWeek;
this.pnlWeekly.Visible = true;
this.radRecurrence.SelectedValue = "Weekly";
this.txtWeeklyStartMinutes.Text = minute.ToString("00");
if (hour > 12)
{
hour = hour - 12;
this.txtWeeklyStartHour.Text = hour.ToString();
this.radWeeklyPM.Checked = true;
}
else
{
if (hour == 0)
this.txtWeeklyStartHour.Text = "12";
else
this.txtWeeklyStartHour.Text = hour.ToString();
this.radWeeklyAM.Checked = true;
}
this.chkWeeklyMonday.Checked = days.Monday;
this.chkWeeklyTuesday.Checked = days.Tuesday;
this.chkWeeklyWednesday.Checked = days.Wednesday;
this.chkWeeklyThursday.Checked = days.Thursday;
this.chkWeeklyFriday.Checked = days.Friday;
this.chkWeeklySaturday.Checked = days.Saturday;
this.chkWeeklySunday.Checked = days.Sunday;
if (recurrence.WeeksIntervalSpecified)
this.txtWeeklyRepeatWeeks.Text =recurrence.WeeksInterval.ToString();
break;
case "MonthlyRecurrence":
case "MonthlyDOWRecurrence":
}
Frank
"Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message news:<eRPnmOYeEHA.1656@.TK2MSFTNGP09.phx.gbl>...
> Frank,
> Yes!! Thanks for the help.
> I can now deserialize the matchdata into an ScheduleDefinition object
> without any errors
> However, the object is not deserializing properly?!?
> My matchdata is:
> "<ScheduleDefinition><StartDateTime>2004-07-28T09:00:00.000-07:00</StartDate
> Time><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Sunday>T
> rue</Sunday><Monday>True</Monday><Tuesday>True</Tuesday><Wednesday>True</Wed
> nesday><Thursday>True</Thursday><Friday>True</Friday><Saturday>True</Saturda
> y></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"
> However, my object (during quickwatch) looks like
> r - ScheduleDefinition (my object)
> EndDate: #12:00:00AM#
> EndDateSpecified: False
> Item: Nothing
> StartDateTime: #12:00:00AM#
> At least the StartDateTime should deserialize properly!
> I've only tried one schedule at this point in time. I'm going to try a
> couple others and see if they do the same thing. I'll post back any
> different results
> Could this be the known bug that Daniel Reib mentioned?
> Thx so much for getting me this far!!
> -Joel|||Frank,
Thanks so much for the code snippets. Once I get my object to start
deserializing properly at all, I will be able to plugin the code you wrote.
However, you are correct in that the definition once deserialized is empty.
Here's the code I'm using to retrieve and deserialize the object
subscriptions = rs.ListSubscriptions(Nothing, nUserObj.UserName.ToString)
Dim requestSerializer As Xml.Serialization.XmlSerializer
Dim a As New Serialization.XmlRootAttribute("ScheduleDefinition")
requestSerializer = New
Xml.Serialization.XmlSerializer(GetType(CorporateReporting.RS.ScheduleDefini
tion), a)
For Each subscription As RS.Subscription In subscriptions
rs.GetSubscriptionProperties(subscription.SubscriptionID, extSettings,
desc, active, status, eventType, matchData, values)
extensionParams = extSettings.ParameterValues
Dim obj As Object = requestSerializer.Deserialize(New
StringReader(matchData))
Dim r As CorporateReporting.RS.ScheduleDefinition = CType(obj,
CorporateReporting.RS.ScheduleDefinition)
When I look at the MatchData I get the XML listed below:
"<ScheduleDefinition><StartDateTime>2004-08-03T08:00:00.000-07:00</StartDate
Time><EndDate>08/20/2004</EndDate><WeeklyRecurrence><WeeksInterval>3</WeeksI
nterval><DaysOfWeek><Monday>True</Monday><Wednesday>True</Wednesday></DaysOf
Week></WeeklyRecurrence></ScheduleDefinition>"
When you say "be sure you have string XML in your MD variable at that point
..." do you mean that I need to add an <?xml version='1.0'?> tag to the
beginning of the string? (I tried that, but it didn't change the object.)
Any help is always appreciated!!
"Stoma_Kalos" <fzuma@.yahoo.com> wrote in message
news:e876e3c8.0408051117.539a5442@.posting.google.com...
> Ok, FINALLY figured it out...I was not casting the object correctly.
> You can refer to my previous post to see some of the outer portions of
> code. By the way, I looked at where you got, it appears that you are
> not getting any info at all. That definition looks empty, one thing
> to note in my first posting is I use a cookie and not the MatchData
> variable. So be sure you are using MD instead of my cookie value.
> Also be sure you have string XML in your MD variable at that point.
> Let me know if you need more clarifcation...and post some code so I
> can see more of what you are doing.
> case "WeeklyRecurrence":
> // THIS WAS THE KICKER FOR ME...that damn def.Item cast.
> WeeklyRecurrence recurrence => (TXU.Online.Reports.Web.Objects.WeeklyRecurrence)def.Item;
> DaysOfWeekSelector days = recurrence.DaysOfWeek;
> this.pnlWeekly.Visible = true;
> this.radRecurrence.SelectedValue = "Weekly";
> this.txtWeeklyStartMinutes.Text = minute.ToString("00");
> if (hour > 12)
> {
> hour = hour - 12;
> this.txtWeeklyStartHour.Text = hour.ToString();
> this.radWeeklyPM.Checked = true;
> }
> else
> {
> if (hour == 0)
> this.txtWeeklyStartHour.Text = "12";
> else
> this.txtWeeklyStartHour.Text = hour.ToString();
> this.radWeeklyAM.Checked = true;
> }
> this.chkWeeklyMonday.Checked = days.Monday;
> this.chkWeeklyTuesday.Checked = days.Tuesday;
> this.chkWeeklyWednesday.Checked = days.Wednesday;
> this.chkWeeklyThursday.Checked = days.Thursday;
> this.chkWeeklyFriday.Checked = days.Friday;
> this.chkWeeklySaturday.Checked = days.Saturday;
> this.chkWeeklySunday.Checked = days.Sunday;
> if (recurrence.WeeksIntervalSpecified)
> this.txtWeeklyRepeatWeeks.Text => recurrence.WeeksInterval.ToString();
> break;
> case "MonthlyRecurrence":
> case "MonthlyDOWRecurrence":
> }
>
> Frank
>
> "Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message
news:<eRPnmOYeEHA.1656@.TK2MSFTNGP09.phx.gbl>...
> > Frank,
> >
> > Yes!! Thanks for the help.
> >
> > I can now deserialize the matchdata into an ScheduleDefinition object
> > without any errors
> >
> > However, the object is not deserializing properly?!?
> >
> > My matchdata is:
> >
"<ScheduleDefinition><StartDateTime>2004-07-28T09:00:00.000-07:00</StartDate
> >
Time><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Sunday>T
> >
rue</Sunday><Monday>True</Monday><Tuesday>True</Tuesday><Wednesday>True</Wed
> >
nesday><Thursday>True</Thursday><Friday>True</Friday><Saturday>True</Saturda
> > y></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"
> >
> > However, my object (during quickwatch) looks like
> >
> > r - ScheduleDefinition (my object)
> > EndDate: #12:00:00AM#
> > EndDateSpecified: False
> > Item: Nothing
> > StartDateTime: #12:00:00AM#
> >
> > At least the StartDateTime should deserialize properly!
> >
> > I've only tried one schedule at this point in time. I'm going to try a
> > couple others and see if they do the same thing. I'll post back any
> > different results
> >
> > Could this be the known bug that Daniel Reib mentioned?
> >
> > Thx so much for getting me this far!!
> >
> > -Joel|||Joel,
Be careful with your "New" statements...this is just a guess, but you
may try whackin'(removing) that "New" statement in the line below.
You're matchdata looks good, so i'm assuming you are getting a blank
object because your re-initializing your StringReader? I'm not
sure...I have to play with different lines to figure out my code
sometimes. It doesn't help that i'm in C# and you in VB, if I get
time I will VB it, but i'm wading in code as it is.
If at the point of this line you have good data in matchData
(hover/use immediate/watch in Debug), and after that line (step
through) the obj object is empty then that line is your problem. I
always step through in debug and follow my data, once you find out
where it goes wrong that's 75% of the battle. Try that and let me
know how you do.
Dim obj As Object = requestSerializer.Deserialize(New
StringReader(matchData))
Frank
"Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message news:<u$R6W5yeEHA.644@.tk2msftngp13.phx.gbl>...
> Frank,
> Thanks so much for the code snippets. Once I get my object to start
> deserializing properly at all, I will be able to plugin the code you wrote.
> However, you are correct in that the definition once deserialized is empty.
> Here's the code I'm using to retrieve and deserialize the object
> subscriptions = rs.ListSubscriptions(Nothing, nUserObj.UserName.ToString)
> Dim requestSerializer As Xml.Serialization.XmlSerializer
> Dim a As New Serialization.XmlRootAttribute("ScheduleDefinition")
> requestSerializer = New
> Xml.Serialization.XmlSerializer(GetType(CorporateReporting.RS.ScheduleDefini
> tion), a)
> For Each subscription As RS.Subscription In subscriptions
> rs.GetSubscriptionProperties(subscription.SubscriptionID, extSettings,
> desc, active, status, eventType, matchData, values)
> extensionParams = extSettings.ParameterValues
> Dim obj As Object = requestSerializer.Deserialize(New
> StringReader(matchData))
> Dim r As CorporateReporting.RS.ScheduleDefinition = CType(obj,
> CorporateReporting.RS.ScheduleDefinition)
> When I look at the MatchData I get the XML listed below:
> "<ScheduleDefinition><StartDateTime>2004-08-03T08:00:00.000-07:00</StartDate
> Time><EndDate>08/20/2004</EndDate><WeeklyRecurrence><WeeksInterval>3</WeeksI
> nterval><DaysOfWeek><Monday>True</Monday><Wednesday>True</Wednesday></DaysOf
> Week></WeeklyRecurrence></ScheduleDefinition>"
> When you say "be sure you have string XML in your MD variable at that point
> ..." do you mean that I need to add an <?xml version='1.0'?> tag to the
> beginning of the string? (I tried that, but it didn't change the object.)
> Any help is always appreciated!!