RadScheduler array exported and imported are always 0. But size changes

1 Answer 81 Views
Scheduler and Reminder
Benjamin
Top achievements
Rank 1
Benjamin asked on 23 Jan 2023, 12:04 PM | edited on 23 Jan 2023, 12:21 PM

 

I fixed the array issue but its still not importing. I might figure it out but if anyone knows what might be wrong a solution would be appricieted. All the numbers seem to be correct in the string when i look it over and the size.



Exception thrown: 'Telerik.WinControls.UI.Scheduler.ICalendar.CalendarParseException'

 

        public async void exportSchedulerDataFile()
        {
            string exportResult = this.workScheduler.Export(new SchedulerICalendarExporter());

            await FirebaseHelper.uploadCalenderFile(exportResult);

        }

        public async Task importSchedulerDataFile()
        {
       
        
            string s = await FirebaseHelper.downloadCalanderFile();

            workScheduler.Import(s, new SchedulerICalendarImporter());

            Console.WriteLine("DID IT WORK?");
            workScheduler.Refresh();
        }

 

Im not sure what im doing wrong here.

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 23 Jan 2023, 12:34 PM

Hi Benjamin,

Thank you for the provided code snippet.

I am not familiar with what FirebaseHelper.downloadCalanderFile() method returns. My guess is that this method returns the file name (or path) not the file content which leads to this error. I have tested the same approach and got the same error if I pass a not valid string. If I pass the content of the file as a string and pass it to the GenerateStreamFromString() method no error appears. You can check the following code snippet:

private void radButton1_Click(object sender, EventArgs e)
{
    using (FileStream stream = File.OpenRead("schedule.ics"))
    {
        using (StreamReader reader = new StreamReader(stream))
        {
            this.radScheduler1.Import(GenerateStreamFromString(reader.ReadToEnd()), new SchedulerICalendarImporter());
        }             
    }
}

private void radButton2_Click(object sender, EventArgs e)
{
    using (FileStream stream = File.Create("./schedule.ics"))
    {
        this.radScheduler1.Export(stream, new SchedulerICalendarExporter());
    }
}
public static Stream GenerateStreamFromString(string s)
{
    var stream = new MemoryStream();
    var writer = new StreamWriter(stream);
    writer.Write(s);
    writer.Flush();
    stream.Position = 0;
    return stream;
}

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Benjamin
Top achievements
Rank 1
commented on 23 Jan 2023, 12:39 PM

Hey sorry. I changed the question because i figured out the problem.


{"0":66,"1":69,"2":71,"3":73,"4":78,"5":58,"6":86,"7":67,"8":65,"9":76,"10":69,"11":78,"12":68,"13":65,"14":82,"15":13,"16":10,"17":80,"18":82,"19":79,"20":68,"21":73,"22":68,"23":58,"24":45,"25":47,"26":47,"27":84,"28":101,"29":108,"30":101,"31":114,"32":105,"33":107,"34":32,"35":73,"36":110,"37":99,"38":46,"39":47,"40":47,"41":78,"42":79,"43":78,"44":83,"45":71,"46":77,"47":76,"48":32,"49":82,"50":97,"51":100,"52":83,"53":99,"54":104,"55":101,"56":100,"57":117,"58":108,"59":101,"60":114,"61":47,"62":47,"63":69,"64":78,"65":13,"66":10,"67":86,"68":69,"69":82,"70":83,"71":73,"72":79,"73":78,"74":58,"75":50,"76":46,"77":48,"78":13,"79":10,"80":67,"81":65,"82":76,"83":83,"84":67,"85":65,"86":76,"87":69,"88":58,"89":71,"90":82,"91":69,"92":71,"93":79,"94":82,"95":73,"96":65,"97":78,"98":13,"99":10,"100":77,"101":69,"102":84,"103":72,"104":79,"105":68,"106":58,"107":80,"108":85,"109":66,"110":76,"111":73,"112":83,"113":72,"114":13,"115":10,"116":66,"117":69,"118":71,"119":73,"120":78,"121":58,"122":86,"123":84,"124":73,"125":77,"126":69,"127":90,"128":79,"129":78,"130":69,"131":13,"132":10,"133":84,"134":90,"135":73,"136":68,"137":58,"138":87,"139":46,"140":32,"141":69,"142":117,"143":114,"144":111,"145":112,"146":101,"147":32,"148":83,"149":116,"150":97,"151":110,"152":100,"153":97,"154":114,"155":100,"156":32,"157":84,"158":105,"159":109,"160":101,"161":13,"162":10,"163":66,"164":69,"165":71,"166":73,"167":78,"168":58,"169":83,"170":84,"171":65,"172":78,"173":68,"174":65,"175":82,"176":68,"177":13,"178":10,"179":84,"180":90,"181":78,"182":65,"183":77,"184":69,"185":58,"186":86,"187":195,"188":164,"189":115,"190":116,"191":101,"192":117,"193":114,"194":111,"195":112,"196":97,"197":44,"198":32,"199":110,"200":111,"201":114,"202":109,"203":97,"204":108,"205":116,"206":105,"207":100,"208":13,"209":10,"210":84,"211":90,"212":79,"213":70,"214":70,"215":83,"216":69,"217":84,"218":84,"219":79,"220":58,"221":43,"222":48,"223":49,"224":48,"225":48,"226":13,"227":10,"228":84,"229":90,"230":79,"231":70,"232":70,"233":83,"234":69,"235":84,"236":70,"237":82,"238":79,"239":77,"240":58,"241":43,"242":48,"243":50,"244":48,"245":48,"246":13,"247":10,"248":82,"249":82,"250":85,"251":76,"252":69,"253":58,"254":70,"255":82,"256":69,"257":81,"258":61,"259":89,"260":69,"261":65,"262":82,"263":76,"264":89,"265":59,"266":66,"267":89,"268":68,"269":65,"270":89,"271":61,"272":83,"273":85,"274":59,"275":66,"276":89,"277":77,"278":79,"279":78,"280":84,"281":72,"282":61,"283":49,"284":48,"285":59,"286":66,"287":89,"288":83,"289":69,"290":84,"291":80,"292":79,"293":83,"294":61,"295":45,"296":49,"297":59,"298":87,"299":75,"300":83,"301":84,"302":61,"303":77,"304":79,"305":13,"306":10,"307":68,"308":84,"309":83,"310":84,"311":65,"312":82,"313":84,"314":58,"315":49,"316":54,"317":48,"318":49,"319":48,"320":49,"321":48,"322":49,"323":84,"324":48,"325":51,"326":48,"327":48,"328":48,"329":48,"330":13,"331":10,"332":69,"333":78,"334":68,"335":58,"336":83,"337":84,"338":65,"339":78,"340":68,"341":65,"342":82,"343":68,"344":13,"345":10,"346":66,"347":69,"348":71,"349":73,"350":78,"351":58,"352":68,"353":65,"354":89,"355":76,"356":73,"357":71,"358":72,"359":84,"360":13,"361":10,"362":84,"363":90,"364":79,"365":70,"366":70,"367":83,"368":69,"369":84,"370":70,"371":82,"372":79,"373":77,"374":58,"375":43,"376":48,"377":49,"378":48,"379":48,"380":13,"381":10,"382":84,"383":90,"384":79,"385":70,"386":70,"387":83,"388":69,"389":84,"390":84,"391":79,"392":58,"393":43,"394":48,"395":50,"396":48,"397":48,"398":13,"399":10,"400":68,"401":84,"402":83,"403":84,"404":65,"405":82,"406":84,"407":58,"408":48,"409":48,"410":48,"411":49,"412":48,"413":49,"414":48,"415":49,"416":84,"417":48,"418":50,"419":48,"420":48,"421":48,"422":48,"423":13,"424":10,"425":82,"426":82,"427":85,"428":76,"429":69,"430":58,"431":70,"432":82,"433":69,"434":81,"435":61,"436":89,"437":69,"438":65,"439":82,"440":76,"441":89,"442":59,"443":66,"444":89,"445":68,"446":65,"447":89,"448":61,"449":83,"450":85,"451":59,"452":66,"453":89,"454":77,"455":79,"456":78,"457":84,"458":72,"459":61,"460":51,"461":59,"462":66,"463":89,"464":83,"465":69,"466":84,"467":80,"468":79,"469":83,"470":61,"471":45,"472":49,"473":59,"474":87,"475":75,"476":83,"477":84,"478":61,"479":77,"480":79,"481":13,"482":10,"483":84,"484":90,"485":78,"486":65,"487":77,"488":69,"489":58,"490":86,"491":195,"492":164,"493":115,"494":116,"495":101,"496":117,"497":114,"498":111,"499":112,"500":97,"501":44,"502":32,"503":115,"504":111,"505":109,"506":109,"507":97,"508":114,"509":116,"510":105,"511":100,"512":13,"513":10,"514":69,"515":78,"516":68,"517":58,"518":68,"519":65,"520":89,"521":76,"522":73,"523":71,"524":72,"525":84,"526":13,"527":10,"528":69,"529":78,"530":68,"531":58,"532":86,"533":84,"534":73,"535":77,"536":69,"537":90,"538":79,"539":78,"540":69,"541":13,"542":10,"543":66,"544":69,"545":71,"546":73,"547":78,"548":58,"549":86,"550":69,"551":86,"552":69,"553":78,"554":84,"555":13,"556":10,"557":68,"558":84,"559":83,"560":84,"561":65,"562":82,"563":84,"564":59,"565":86,"566":65,"567":76,"568":85,"569":69,"570":61,"571":68,"572":65,"573":84,"574":69,"575":58,"576":50,"577":48,"578":50,"579":51,"580":48,"581":49,"582":50,"583":52,"584":13,"585":10,"586":68,"587":84,"588":69,"589":78,"590":68,"591":59,"592":86,"593":65,"594":76,"595":85,"596":69,"597":61,"598":68,"599":65,"600":84,"601":69,"602":58,"603":50,"604":48,"605":50,"606":51,"607":48,"608":49,"609":50,"610":53,"611":13,"612":10,"613":83,"614":85,"615":77,"616":77,"617":65,"618":82,"619":89,"620":58,"621":97,"622":115,"623":100,"624":97,"625":115,"626":100,"627":13,"628":10,"629":68,"630":69,"631":83,"632":67,"633":82,"634":73,"635":80,"636":84,"637":73,"638":79,"639":78,"640":58,"641":13,"642":10,"643":85,"644":73,"645":68,"646":58,"647":55,"648":98,"649":50,"650":101,"651":101,"652":102,"653":100,"654":57,"655":45,"656":97,"657":55,"658":99,"659":54,"660":45,"661":52,"662":57,"663":51,"664":54,"665":45,"666":97,"667":52,"668":100,"669":54,"670":45,"671":48,"672":48,"673":98,"674":99,"675":51,"676":49,"677":53,"678":54,"679":53,"680":53,"681":102,"682":56,"683":13,"684":10,"685":76,"686":79,"687":67,"688":65,"689":84,"690":73,"691":79,"692":78,"693":58,"694":97,"695":115,"696":100,"697":97,"698":115,"699":100,"700":13,"701":10,"702":88,"703":45,"704":77,"705":73,"706":67,"707":82,"708":79,"709":83,"710":79,"711":70,"712":84,"713":45,"714":67,"715":68,"716":79,"717":45,"718":66,"719":85,"720":83,"721":89,"722":83,"723":84,"724":65,"725":84,"726":85,"727":83,"728":58,"729":66,"730":85,"731":83,"732":89,"733":13,"734":10,"735":66,"736":65,"737":67,"738":75,"739":71,"740":82,"741":79,"742":85,"743":78,"744":68,"745":58,"746":66,"747":85,"748":83,"749":89,"750":13,"751":10,"752":69,"753":78,"754":68,"755":58,"756":86,"757":69,"758":86,"759":69,"760":78,"761":84,"762":13,"763":10,"764":69,"765":78,"766":68,"767":58,"768":86,"769":67,"770":65,"771":76,"772":69,"773":78,"774":68,"775":65,"776":82,"777":13,"778":10}

This is the string that gets downloaded. But im not sure how its being exported because right now its a byte array string and needs to be a string. are the string numbers just next to eachother? Or is there any system to the string that you export?
Dinko | Tech Support Engineer
Telerik team
commented on 23 Jan 2023, 12:50 PM

You can place a breakpoint and check the content of the exportResult variable. I have checked this on my side and the exported string is in quite a different format than the one you have shared. It seems to me that something changes the content. Here is what I get when exporting the control with one appointment.

BEGIN:VCALENDAR
PRODID:-//Telerik Inc.//NONSGML RadScheduler//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:FLE Standard Time
BEGIN:STANDARD
TZNAME:FLE Standard Time
TZOFFSETTO:+0200
TZOFFSETFROM:+0300
RRULE:FREQ=YEARLY;BYDAY=SU;BYMONTH=10;BYSETPOS=-1;WKST=MO
DTSTART:16010101T040000
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+0200
TZOFFSETTO:+0300
DTSTART:00010101T030000
RRULE:FREQ=YEARLY;BYDAY=SU;BYMONTH=3;BYSETPOS=-1;WKST=MO
TZNAME:FLE Daylight Time
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=FLE Standard Time:20230123T142456
DTEND;TZID=FLE Standard Time:20230123T152456
SUMMARY:Summary
DESCRIPTION:Description
UID:9635914e-a410-4ef6-b459-6ace78a6b77f
LOCATION:
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
BACKGROUND:MUSTATTEND
END:VEVENT
END:VCALENDAR

 

 

Benjamin
Top achievements
Rank 1
commented on 23 Jan 2023, 12:59 PM

Ah okay thanks. Yah i read it as a byte array. But i need to convert everything to an string and it should look like this too. Because if you look at the values and convert to ASCII it seems to be correct letters. Thanks a lot. Will have to do a bit of work convering the string. But should work.
Tags
Scheduler and Reminder
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or