%3CLINGO-SUB%20id%3D%22lingo-sub-1264957%22%20slang%3D%22en-US%22%3EOrchestration%20Scheduling%20in%20BizTalk%20with%20Office%20365%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1264957%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EScheduling%20BizTalk%20processing%20to%20run%20at%20predetermined%20time%20intervals%20has%20been%20a%20discussion%20topic%20in%20user%20forums.%20As%20was%20recently%20announced%20in%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Fadvanced-scheduling-in-receive-locations%2Fba-p%2F1218750%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAdvanced%20Scheduling%20in%20Receive%20Locations%3C%2FA%3E%2C%20BizTalk%202020%20expanded%20on%20the%20existing%20built-in%20functionality%20at%20the%20receive%20location%20level.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThis%20article%20presents%20by%20a%20detailed%20example%20an%20integration%20pattern%20that%20leverages%20the%20calendar%20functionality%20of%20Office%20365%20to%20schedule%20workload%20processing%20in%20orchestrations.%20In%20the%20demo%20scenario%2C%20The%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fbiztalk%2Fcore%2Foffice365-calendar-adapter%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOffice%20365%20Outlook%20Calendar%20adapter%3C%2FA%3E%20is%20used%20to%20communicate%20with%20an%20Office%20365%20calendar%20which%20then%20acts%20as%20a%20%22remote%20control%22%20of%20when%20and%20how%20long%20an%20orchestration%20should%20be%20running.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThe%20advantages%20of%20this%20pattern%20are%3A%3CBR%20%2F%3E-%20Different%20schedules%20can%20be%20accommodated%20without%20changes%20to%20the%20configuration%20of%20receive%20locations%20as%20is%20required%20in%20the%20receive%20location%20scheduling.%3CBR%20%2F%3E-%20No%20need%20for%20custom%20adapters%20or%20%22trigger%20messages%22%20such%20as%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F25101.biztalk-server-scheduling-orchestration-using-trigger-message.aspx%23BizTalk_Scheduled_Task_Adapter%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EBizTalk%20Scheduled%20Task%20Adapter%3C%2FA%3E.%3CBR%20%2F%3E-%20Full-fledged%20support%20for%20every%20scheduling%20pattern%20that%20Office%20365%20can%20offer.%3CBR%20%2F%3E-%20Schedule%20is%20conveyed%20by%20a%20calendar%20event%20message%2C%20which%20gives%20the%20ability%20to%20transmit%20additional%20information%20to%20the%20orchestration%20and%20customize%20business%20processes.%20A%20calendar%20event%20is%20more%20than%20just%20a%20start%2Fend%20datetimes.-%20Concurrent%20processing%20of%20events%20with%20different%20schedules%2C%20even%20when%20the%20schedules%20overlap.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EBusiness%20Scenario%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20school%20teacher%20uses%20BizTalk%20to%20conduct%20timed%20assignments%20remotely%3A%20an%20email%20is%20sent%20to%20the%20students%20at%20start%20time%2C%20with%20the%20assignment%20material%20attached.%20Students%20submit%20their%20answers%20by%20email%20within%20the%20allotted%20time%20and%20receive%20a%20response%20with%20their%20grades.%26nbsp%3B%20At%20the%20end%20of%20the%20assignment%20time%2C%20everyone%20gets%20notified%20by%20email.%20A%20grade%20report%20is%20saved%20for%20the%20teacher.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAssignments%20are%20scheduled%20by%20creating%20calendar%20events%20in%20advance%20in%20an%20Office%20365%20school%20calendar%20that%20only%20the%20teacher%20or%20the%20school%20has%20access%20to.%20For%20the%20sake%20of%20simplicity%20in%20the%20demo%2C%20we%20assume%20that%20the%20calendar%20events%20contain%20the%20assignment%20id%20in%20the%20subject%2C%20and%20the%20assignment%20answer%20in%20the%20body.%20This%20is%20illustrated%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingScheduledEvent.JPG%22%20style%3D%22width%3A%20908px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180592i1CB5FB8DC80F5484%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingScheduledEvent.JPG%22%20alt%3D%22O365SchedulingScheduledEvent.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EAssignment%20sheets%20are%20placed%20by%20the%20teacher%20in%20a%20location%20accessible%20by%20BizTalk%2C%20for%20example%20in%20a%20local%20folder.%20When%20the%20assignment%20is%20about%20to%20start%2C%20students%20receive%20the%20following%20email%20with%20the%20assignment%20material%20attached%20(123.pdf)%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingStartEmail.JPG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180599i6812349C83DBE961%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingStartEmail.JPG%22%20alt%3D%22O365SchedulingStartEmail.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EStudents%20can%20then%20email%20their%20answer%20and%20receive%20their%20grade%20%22on%20the%20fly%22.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20lightgrey%3B%20width%3A%20100%25%3B%22%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2230px%22%3E%3CFONT%20size%3D%223%22%3E%3CSTRONG%3E%3CEM%3EStudent%20sends%20in%20plain-text%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2230px%22%3E%3CFONT%20size%3D%223%22%3E%3CSTRONG%3E%3CEM%3EStudent%20receives%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%22141px%22%3E%3CP%3E%3CFONT%20size%3D%223%22%3E%3CASSIGNMENT%20ns0%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2FOrchestrationScheduling.Assignment%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2FOrchestrationScheduling.Assignment%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2FOrchestrationScheduling.Assignment%3C%2FA%3E%22%26gt%3B%3C%2FASSIGNMENT%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%26nbsp%3B%20%3CASSIGNMENTID%3E123%3C%2FASSIGNMENTID%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%26nbsp%3B%20%3CSTRONG%3E%3CANSWER%3EABC%3C%2FANSWER%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%22141px%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%223%22%3E%3CASSIGNMENTGRADED%20ns0%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2FOrchestrationScheduling.AssignmentGraded%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2FOrchestrationScheduling.AssignmentGraded%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2FOrchestrationScheduling.AssignmentGraded%3C%2FA%3E%22%26gt%3B%3C%2FASSIGNMENTGRADED%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%223%22%3E%3CASSIGNMENTID%3E123%3C%2FASSIGNMENTID%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%223%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%3CPASS%3Etrue%3C%2FPASS%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%223%22%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20the%20end%20of%20the%20assignment%20period%2C%20an%20email%20is%20sent%20to%20all%20students%20to%20notify%20them%20that%20submissions%20are%20closed.%20Grades%20are%20saved%20for%20the%20teacher%20in%20a%20file%20that%20contains%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20style%3D%22background-color%3A%20lightgrey%3B%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3E%3CQUIZSUMMARY%20ns0%3D%22%26quot%3B%26lt%3BA%22%20href%3D%22http%3A%2F%2FOrchestrationScheduling.QuizSummary%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%22%3E%3CA%20href%3D%22http%3A%2F%2FOrchestrationScheduling.QuizSummary%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2FOrchestrationScheduling.QuizSummary%3C%2FA%3E%22%26gt%3B%3C%2FQUIZSUMMARY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3CASSIGNMENTID%3E123%3C%2FASSIGNMENTID%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3CSUMMARY%3E%3C%2FSUMMARY%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Student1%20True%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Student2%20True%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%E2%80%A6%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%3C%2FP%3E%0A%3CP%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EScheduled%20Orchestration%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20BizTalk%20orchestration%20consists%20of%20three%20parts%3A%3C%2FP%3E%0A%3CP%3E1.%20Activation%20and%20assignment%20extraction%20(schedule%20and%20answer).%3C%2FP%3E%0A%3CP%3E2.%20Receive%20assignment%2Fsend%20grade%20loop.%3C%2FP%3E%0A%3CP%3E3.%20Post-assignment%20tasks.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThe%20full%20orchestration%20view%20is%20shown%20below.%20The%20work%20being%20scheduled%20(ReceiveAssignments%2FSendGradeToStudent)%20is%20encapsulated%20in%20a%20listen%20shape%2C%20but%20decoupled%20from%20the%20scheduling%20logic.%20In%20the%20general%20case%2C%20a%20more%20complicated%20business%20application%20could%20be%20done%20in%20one%20or%20more%20separate%20orchestrations%20to%20be%20called%20from%20the%20calendar-event-activated%20orchestration.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingWholeOrchestration.jpg%22%20style%3D%22width%3A%20903px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180605i73EA88DDEECA7DE9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingWholeOrchestration.jpg%22%20alt%3D%22O365SchedulingWholeOrchestration.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThe%20schema%20of%20the%20initializing%20receive%20shape%20CalendarEvent%20is%20a%20copy%20of%20Office365OutlookCalendarReceive.xsd%2C%20which%20is%20available%20in%20the%20BizTalk%20installation%20folder%20(C%3A%5CProgram%20Files%20(x86)%5CMicrosoft%20BizTalk%20Server%5CSDK%5CSchemas).%20The%20subject%20field%20corresponds%20to%20the%20assignment%20id%2C%20which%20was%20used%20as%20correlation%20in%20order%20to%20have%20the%20same%20orchestration%20instance%20process%20all%20sends%20and%20receives%20for%20the%20same%20assignment.%20As%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F13729.walkthrough-correlations-in-biztalk-orchestration.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ecorrelations%20walkthrough%3C%2FA%3E%2C%20we%20used%20a%20property%20schema%20with%20a%20common%20id%20for%20the%20assignment%20id%20field%20of%20all%20send%20and%20receive%20shapes.%20Schemas%20are%20shown%20below.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingCommonIdHighlighted.JPG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180649iB704F1E1571AA684%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingCommonIdHighlighted.JPG%22%20alt%3D%22O365SchedulingCommonIdHighlighted.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThe%20orchestration%20design%20shows%20a%20sequential%20convoy%20with%20different%20ports%20for%20receiving.%20By%20having%20send%20shapes%20interleaved%20with%20receive%20shapes%2C%20the%20design%20does%20not%20have%20the%20compile%20time%26nbsp%3Berror%20%3CEM%3E%E2%80%9Cin%20a%20sequential%20convoy%20the%20ports%20must%20be%20identical%E2%80%9D%3C%2FEM%3E.%20%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%20color%3A%20%23333333%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EScheduled%20assignments%20can%20be%20processed%20concurrently.%20There%20is%20one%20orchestration%20instance%20per%20scheduled%20event%2C%20which%20can%20therefore%20overlap%20with%20others.%20This%20extra%20flexibility%20to%20accommodate%20multiple%20schedules%20at%20once%20is%20not%20readily%20available%20with%20other%20scheduling%20alternatives%20such%20as%20receive%20location%20scheduling.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPart%201%3A%20Orchestration%20Activation%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20logical%20flow%2C%20illustrated%20in%20the%20next%20picture%2C%20can%20be%20divided%20into%206%20chronological%20steps%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EReceive%20a%20calendar%20event%2C%20with%20the%20subject%20containing%20the%20assignment%20id%2C%20used%20as%20orchestration%20correlation.%20The%20receive%20location%20is%20to%20be%20configured%20to%20listen%20to%20a%20specific%20non-default%20calendar.%20More%20information%20on%20the%20calendar%20receive%20location%20properties%20is%20available%20at%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Ffiltering-in-office-365-outlook-adapters%2Fba-p%2F1209763%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EFiltering%20in%20Office%20365%20Outlook%20Adapters%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3EExtract%20the%20assignment%20answer%20from%20the%20body%20of%20the%20event%20message.%20The%20body%20preview%20field%20was%20used%20as%20distinguished%20field%20instead%20of%20the%20entire%20body%20field%2C%20since%20all%20we%20need%20is%20the%20first%20line%20of%20the%20body%2C%20not%20the%20entire%20body%20with%20html%20markup.%3C%2FLI%3E%0A%3CLI%3ETransform%20the%20event%20message%20to%20a%20message%20which%20contains%20local%20start%20and%20end%20datetimes.%20Note%20that%20we%20used%20a%20script%20functoid%20to%20map%20the%20received%20start%2Fend%20event%20datetimes%20which%20were%20in%20UTC%20to%20local%20time.%26nbsp%3B%20In%20the%20general%20case%2C%20start%20and%20end%20time%20zones%20are%20available%20if%20needed.%3C%2FLI%3E%0A%3CLI%3EUse%20a%20delay%20shape%20to%20wait%20for%20the%20assignment%20start%20local%20datetime%20extracted%20in%20the%20previous%20step%2C%20before%20proceeding%20with%20the%20assignment.%3C%2FLI%3E%0A%3CLI%3EConstruct%20the%20email%20to%20be%20sent%20at%20the%20start%20of%20the%20assignment%20period%20for%20students%20notifications%20and%20provide%20the%20assignment%20material.%20In%20our%20case%2C%20the%20email%20also%20contains%20an%20attachment%2C%20the%20assignment%20material.%20Email%20attachments%20in%20the%20mail%20adapter%20are%20presented%20in%20greater%20detail%20in%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Fattachments-in-the-office-365-outlook-email-adapter%2Fba-p%2F1218209%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAttachments%20in%20the%20Office%20365%20Outlook%20Email%20Adapter%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3ESend%20the%20email%20using%20the%20Office%20365%20Outlook%20Mail%20adapter.%20In%20the%20send%20port%20configuration%2C%20the%20default%20%22To%3A%22%20field%20was%20set%20to%20the%20class%20mail%20alias.%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Foffice-365-outlook-adapters-in-action%2Fba-p%2F1230054%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EOffice%20365%20Outlook%20Adapters%20in%20Action%3C%2FA%3E%20is%20a%20good%20starting%20point%20for%20background%20and%20general%20information%20on%20the%20various%20Office%20365%20Outlook%20adapters%20used%20together.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingReceiveScheduleOrchPart.JPG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180614iA94D10D3F1629ECF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingReceiveScheduleOrchPart.JPG%22%20alt%3D%22O365SchedulingReceiveScheduleOrchPart.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EPart%202%3A%20Scheduled%20Workload%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20the%20heart%20of%20the%20design%2C%20the%20scheduled%20workload%20corresponds%20to%20a%20branch%20of%20a%20listen%20shape%20with%20a%20timeout%20branch%20set%20to%20the%20scheduled%20end%20date.%20A%20loop%20shape%20ensures%20that%20the%20orchestration%20processes%20all%20assignments%20received%20from%20students%20until%20the%20end%20datetime.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20logical%20flow%20of%20each%20loop%20iteration%20can%20be%20divided%20into%205%20steps%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20Receive%20assignments%20solutions%20from%20students%2C%20sent%20in%20plain-text%20email%20as%20mentioned%20earlier.%20The%20receive%20location%20is%20configured%20with%20Office%20365%20Outlook%20Email%20as%20transport%20type%20and%20the%20default%20XML%20receive%20pipeline.%3C%2FP%3E%0A%3CP%3E2.%20Construct%20the%20assignment%20grade%20email.%20The%20%22To%3A%22%20field%20corresponds%20to%20the%20%3CEM%3ESenderAddress%3C%2FEM%3E%20field%20of%20the%20received%20assignment.%3C%2FP%3E%0A%3CP%3E3.%20Send%20the%20email%20constructed%20in%20step%202.%20The%20send%20port%20is%20configured%20with%20Office%20365%20Outlook%20Email%20transport%20type.%3C%2FP%3E%0A%3CP%3E4.%20Record%20the%20student's%20grade%20by%20using%20a%20%3CEM%3EGradesInfo%3C%2FEM%3E%20helper%20class%20defined%20in%20an%20external%20assembly.%20The%20code%20is%20presented%20at%20the%20end%20of%20this%20article.%3C%2FP%3E%0A%3CP%3E5.%20Check%20if%20the%20assignment%20schedule%20has%20ended.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%205%20step%20are%20indicated%20in%20the%20following%20picture%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingLoopOrchPart.JPG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180617i85853DC06B77F782%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingLoopOrchPart.JPG%22%20alt%3D%22O365SchedulingLoopOrchPart.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20a%20student%20sends%20her%20assignment%20before%20the%20start%20datetime%2C%20there%20are%20two%20variations%20to%20the%20scenario%3A%3C%2FP%3E%0A%3CP%3E-%20If%20there%20is%20no%20listener%20for%20the%20mail%20receive%20port%20ReceiveAssignments%2C%20the%20student's%20answer%20will%20be%20suspended%20until%20an%20orchestration%20instance%20starts%20and%20reaches%20the%20start%20datetime.%20A%20teacher%20could%20choose%20this%20option%20to%20accommodate%20early%20submissions.%3C%2FP%3E%0A%3CP%3E-%20If%20there%20is%20a%20listener%20for%20the%20ReceiveAssignments%20port%2C%20for%20instance%20a%20send%20port%20with%20file%20transport%20type%20filtering%20on%20ReceiveAssignments%2C%20the%20student's%20assignment%20will%20be%20already%20processed%20(published)%20by%20the%20time%20the%20orchestration%20instance%20reaches%20start%20datetime.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20a%20student%20sends%20her%20email%20in%20html%2C%20or%20without%20following%20the%20relevant%20XML%20schema%2C%20the%20email%20will%20be%26nbsp%3B%20suspended%20-%20as%20expected%20-%20with%20for%20instance%3A%3C%2FP%3E%0A%3CP%3E%3CI%3EThere%20was%20a%20failure%20executing%20the%20receive%20pipeline%3A%20%22Microsoft.BizTalk.DefaultPipelines.XMLReceive%2C%20Microsoft.BizTalk.DefaultPipelines%2C%20%E2%80%A6%22%20Source%3A%20%22XML%20disassembler%22%20Receive%20Port%3A%20%22MailReceivePort%22%20URI%3A%20%22O365Mail%3A%2F%2F%E2%80%A6%40outlook.com%2FInbox%22%20Reason%3A%20Finding%20the%20document%20specification%20by%20message%20type%20%22html%22%20failed.%20Verify%20the%20schema%20deployed%20properly.%26nbsp%3B%26nbsp%3B%20%3C%2FI%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EPart%203%3A%20Post-Assignment%20Tasks%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2012.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20the%20assignment%20deadline%2C%20the%20following%20tasks%20happen%20in%20parallel%3A%3C%2FP%3E%0A%3CP%3E1.%20An%20email%20is%20sent%20again%20to%20everyone%20in%20the%20class%3B%3C%2FP%3E%0A%3CP%3E2.%20A%20summary%20is%20saved%20locally%20for%20instance%20with%20a%20file%20send%20port%2C%20for%20the%20teacher%20to%20use%20at%20a%20later%20time.%20The%20%3CEM%3EGradesInfo%3C%2FEM%3E%20helper%20class%20provides%20the%20grades%20report.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CI%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22O365SchedulingEndTasksPart.JPG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F180618iDDC1EB8BB0FF5C89%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22O365SchedulingEndTasksPart.JPG%22%20alt%3D%22O365SchedulingEndTasksPart.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FI%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EHelper%20Class%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EA%20serializable%20helper%20class%20was%20added%20to%20the%20project%20for%20saving%20students'%20grades.%20Note%20that%20protected%20constructor%20and%20GetObjectData%20method%20with%20sufficient%20privileges%20need%20to%20be%20provided%20for%20the%20class%20to%20be%20serializable.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Eusing%20System%3B%0Ausing%20System.Collections.Generic%3B%0Ausing%20System.Runtime.Serialization%3B%0Ausing%20System.Security.Permissions%3B%0A%0Anamespace%20StudentsGrades%0A%7B%0A%20%20%20%20%5BSerializable%5D%0A%20%20%20%20public%20class%20GradesInfo%20%3A%20Dictionary%3CSTRING%3E%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20public%20GradesInfo()%20%7B%20%7D%0A%0A%20%20%20%20%20%20%20%20public%20void%20AddOrUpdate(string%20key%2C%20bool%20value)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(!this.ContainsKey(key))%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this.Add(key%2C%20value)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this%5Bkey%5D%20%3D%20value%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20public%20string%20GetPrintableSummary()%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20string%20result%20%3D%20Environment.NewLine%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20foreach%20(var%20student%20in%20this.Keys)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20result%20%2B%3D%20string.Join(%22%20%22%2C%20student%2C%20this%5Bstudent%5D%2C%20Environment.NewLine)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20result%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20protected%20GradesInfo(SerializationInfo%20info%2C%20StreamingContext%20context)%20%3A%20base(info%2C%20context)%20%7B%7D%0A%0A%20%20%20%20%20%20%20%20%5BSecurityPermissionAttribute(SecurityAction.Demand%2C%20SerializationFormatter%20%3D%20true)%5D%0A%20%20%20%20%20%20%20%20public%20override%20void%20GetObjectData(SerializationInfo%20info%2C%20StreamingContext%20context)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20base.GetObjectData(info%2C%20context)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0A%3C%2FSTRING%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EConcluding%20Remarks%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThe%20objective%20of%20the%20demo%20scenario%20is%20to%20showcase%20a%20reusable%20way%20to%20implement%20scheduling%20in%20orchestrations.%20More%20error%20handling%20would%20normally%20be%20part%20of%20a%20%22real-life%22%20application.%20For%20instance%2C%20emails%20sent%20to%20the%20teacher%20need%20to%20be%20filtered%20so%20that%20only%20the%20ones%20with%20assignment%20answers%20are%20processed%2C%20and%20the%20other%20emails%20ignored.%20One%20way%20to%20accomplish%20that%20is%20to%20use%20server-side%20rules%20to%20direct%20emails%20to%20a%20specific%20folder%2C%20and%20have%20a%20receive%20location%20poll%20the%20folder.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EThe%20scheduled%20events%20should%20also%20come%20from%20a%20non-default%20calendar%20rather%20than%20the%20default%20calendar%20since%20we%20don't%20want%20any%20meeting%20request%20sent%20to%20the%20teacher's%20account%20to%20initiate%20new%20orchestration%20instances.%20More%20information%20on%20filtering%20in%20the%20Office%20365%20Outlook%20adapters%20may%20be%20found%20in%20the%20related%20post%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Ffiltering-in-office-365-outlook-adapters%2Fba-p%2F1209763%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EFiltering%20in%20Office%20365%20Outlook%20Adapters%3C%2FA%3E.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EAttachments%20to%20calendar%20events%20are%20currently%20ignored%20by%20the%20Office%20365%20Outlook%20Calendar%20adapter%20but%20they%20could%20be%20supported%20in%20future%20BizTalk%20releases%20if%20there%20is%20demand%20for%20the%20feature.%20In%20the%20demo%20scenario%2C%20the%20teacher%20would%20be%20able%20to%20attach%20assignment%20material%20directly%20to%20the%20scheduled%20event%20and%20let%20the%20orchestration%20send%20it%20out.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3ESample%20Code%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EAll%20code%20used%20in%20this%20article%20is%20attached.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3EWhen%20building%20the%20BizTalk%20solution%2C%20the%20following%20warnings%20can%20be%20safely%20ignored%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010.0pt%3B%22%3E...%5COrchestrationScheduling%5COrchestrationScheduling%5CScheduledOrchestration.odx(678%2C35)%3A%20warning%20X4014%3A%20convoy%20processing%20will%20not%20occur%20--%20check%20your%20protocol%20if%20you%20were%20expecting%20it%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010.0pt%3B%22%3E...%5COrchestrationScheduling%5COrchestrationScheduling%5CScheduledOrchestration.odx(647%2C30)%3A%20convoy%20found%20at%20'activate%20receive(ReceiveScheduledQuiz.Operation_1%2C%20TriggerAssignmentTask%2C%20initialize%20AssignmentId)'%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010.0pt%3B%22%3E...%5COrchestrationScheduling%5COrchestrationScheduling%5CScheduledOrchestration.odx(678%2C35)%3A%20and%20'receive(ReceiveAssignments.Operation_1%2C%20AssignmentSubmitted%2C%20AssignmentId)'%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%20color%3A%20%230070c0%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EReferences%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fbiztalk%2Fcore%2Foffice365-calendar-adapter%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOffice%20365%20Outlook%20Calendar%20adapter%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fbiztalk%2Fcore%2Foffice365-mail-adapter%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOffice%20365%20Outlook%20Email%20adapter%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Fadvanced-scheduling-in-receive-locations%2Fba-p%2F1218750%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAdvanced%20Scheduling%20in%20Receive%20Locations%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Fattachments-in-the-office-365-outlook-email-adapter%2Fba-p%2F1218209%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAttachments%20in%20the%20Office%20365%20Outlook%20Email%20Adapter%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Ffiltering-in-office-365-outlook-adapters%2Fba-p%2F1209763%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EFiltering%20in%20Office%20365%20Outlook%20Adapters%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CFONT%20size%3D%224%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fbiztalk-server-team-blog%2Foffice-365-outlook-adapters-in-action%2Fba-p%2F1230054%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EOffice%20365%20Outlook%20Adapters%20in%20Action%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F13729.walkthrough-correlations-in-biztalk-orchestration.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CFONT%20size%3D%224%22%3ECorrelations%20in%20BizTalk%20Orchestrations%3C%2FFONT%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1264957%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EThis%20article%20presents%20by%20an%20example%20an%20integration%20pattern%20that%20leverages%20the%20calendar%20functionality%20of%20Office%20365%20to%20schedule%20workload%20processing%20in%20orchestrations.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1264957%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ebiztalk%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBizTalk%20Adapters%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBTS%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIntegration%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOrchestrations%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Escheduling%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

Scheduling BizTalk processing to run at predetermined time intervals has been a discussion topic in user forums. As was recently announced in Advanced Scheduling in Receive Locations, BizTalk 2020 expanded on the existing built-in functionality at the receive location level.

 

This article presents by a detailed example an integration pattern that leverages the calendar functionality of Office 365 to schedule workload processing in orchestrations. In the demo scenario, The Office 365 Outlook Calendar adapter is used to communicate with an Office 365 calendar which then acts as a "remote control" of when and how long an orchestration should be running.

 

The advantages of this pattern are:
- Different schedules can be accommodated without changes to the configuration of receive locations as is required in the receive location scheduling.
- No need for custom adapters or "trigger messages" such as in the BizTalk Scheduled Task Adapter.
- Full-fledged support for every scheduling pattern that Office 365 can offer.
- Schedule is conveyed by a calendar event message, which gives the ability to transmit additional information to the orchestration and customize business processes. A calendar event is more than just a start/end datetimes.
- Concurrent processing of events with different schedules, even when the schedules overlap.

 

Business Scenario

 

A school teacher uses BizTalk to conduct timed assignments remotely: an email is sent to the students at start time, with the assignment material attached. Students submit their answers by email within the allotted time and receive a response with their grades.  At the end of the assignment time, everyone gets notified by email. A grade report is saved for the teacher.

 

Assignments are scheduled by creating calendar events in advance in an Office 365 school calendar that only the teacher or the school has access to. For the sake of simplicity in the demo, we assume that the calendar events contain the assignment id in the subject, and the assignment answer in the body. This is illustrated below:

 

O365SchedulingScheduledEvent.JPG

 

Assignment sheets are placed by the teacher in a location accessible by BizTalk, for example in a local folder. When the assignment is about to start, students receive the following email with the assignment material attached (123.pdf):

 

O365SchedulingStartEmail.JPG

 

Students can then email their answer and receive their grade "on the fly".

 

Student sends in plain-text Student receives

<ns0:Assignment xmlns:ns0="http://OrchestrationScheduling.Assignment">

  <AssignmentId>123</AssignmentId>

  <Answer>ABC</Answer>

</ns0:Assignment>

<ns0:AssignmentGraded xmlns:ns0="http://OrchestrationScheduling.AssignmentGraded">

<AssignmentId>123</AssignmentId>

<Pass>true</Pass>

</ns0:AssignmentGraded>

 

At the end of the assignment period, an email is sent to all students to notify them that submissions are closed. Grades are saved for the teacher in a file that contains the following:

 

<ns0:QuizSummary xmlns:ns0="http://OrchestrationScheduling.QuizSummary">

  <AssignmentId>123</AssignmentId>

  <Summary>

    Student1 True

    Student2 True

    …

  </Summary>

</ns0:QuizSummary>

 

Scheduled Orchestration

 

The BizTalk orchestration consists of three parts:

1. Activation and assignment extraction (schedule and answer).

2. Receive assignment/send grade loop.

3. Post-assignment tasks.

 

The full orchestration view is shown below. The work being scheduled (ReceiveAssignments/SendGradeToStudent) is encapsulated in a listen shape, but decoupled from the scheduling logic. In the general case, a more complicated business application could be done in one or more separate orchestrations to be called from the calendar-event-activated orchestration.

 

O365SchedulingWholeOrchestration.jpg

 

The schema of the initializing receive shape CalendarEvent is a copy of Office365OutlookCalendarReceive.xsd, which is available in the BizTalk installation folder (C:\Program Files (x86)\Microsoft BizTalk Server\SDK\Schemas). The subject field corresponds to the assignment id, which was used as correlation in order to have the same orchestration instance process all sends and receives for the same assignment. As in the correlations walkthrough, we used a property schema with a common id for the assignment id field of all send and receive shapes. Schemas are shown below.

 

O365SchedulingCommonIdHighlighted.JPG

 

The orchestration design shows a sequential convoy with different ports for receiving. By having send shapes interleaved with receive shapes, the design does not have the compile time error “in a sequential convoy the ports must be identical”.

 

Scheduled assignments can be processed concurrently. There is one orchestration instance per scheduled event, which can therefore overlap with others. This extra flexibility to accommodate multiple schedules at once is not readily available with other scheduling alternatives such as receive location scheduling.

 

Part 1: Orchestration Activation

 

The logical flow, illustrated in the next picture, can be divided into 6 chronological steps:

 

  1. Receive a calendar event, with the subject containing the assignment id, used as orchestration correlation. The receive location is to be configured to listen to a specific non-default calendar. More information on the calendar receive location properties is available at Filtering in Office 365 Outlook Adapters.
  2. Extract the assignment answer from the body of the event message. The body preview field was used as distinguished field instead of the entire body field, since all we need is the first line of the body, not the entire body with html markup.
  3. Transform the event message to a message which contains local start and end datetimes. Note that we used a script functoid to map the received start/end event datetimes which were in UTC to local time.  In the general case, start and end time zones are available if needed.
  4. Use a delay shape to wait for the assignment start local datetime extracted in the previous step, before proceeding with the assignment.
  5. Construct the email to be sent at the start of the assignment period for students notifications and provide the assignment material. In our case, the email also contains an attachment, the assignment material. Email attachments in the mail adapter are presented in greater detail in Attachments in the Office 365 Outlook Email Adapter.
  6. Send the email using the Office 365 Outlook Mail adapter. In the send port configuration, the default "To:" field was set to the class mail alias. Office 365 Outlook Adapters in Action is a good starting point for background and general information on the various Office 365 Outlook adapters used together.

 

O365SchedulingReceiveScheduleOrchPart.JPG

 

Part 2: Scheduled Workload

 

At the heart of the design, the scheduled workload corresponds to a branch of a listen shape with a timeout branch set to the scheduled end date. A loop shape ensures that the orchestration processes all assignments received from students until the end datetime.

 

The logical flow of each loop iteration can be divided into 5 steps:

 

1. Receive assignments solutions from students, sent in plain-text email as mentioned earlier. The receive location is configured with Office 365 Outlook Email as transport type and the default XML receive pipeline.

2. Construct the assignment grade email. The "To:" field corresponds to the SenderAddress field of the received assignment.

3. Send the email constructed in step 2. The send port is configured with Office 365 Outlook Email transport type.

4. Record the student's grade by using a GradesInfo helper class defined in an external assembly. The code is presented at the end of this article.

5. Check if the assignment schedule has ended.

 

The 5 step are indicated in the following picture:

 

O365SchedulingLoopOrchPart.JPG

 

If a student sends her assignment before the start datetime, there are two variations to the scenario:

- If there is no listener for the mail receive port ReceiveAssignments, the student's answer will be suspended until an orchestration instance starts and reaches the start datetime. A teacher could choose this option to accommodate early submissions.

- If there is a listener for the ReceiveAssignments port, for instance a send port with file transport type filtering on ReceiveAssignments, the student's assignment will be already processed (published) by the time the orchestration instance reaches start datetime.

 

If a student sends her email in html, or without following the relevant XML schema, the email will be  suspended - as expected - with for instance:

There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, …" Source: "XML disassembler" Receive Port: "MailReceivePort" URI: "O365Mail://…@outlook.com/Inbox" Reason: Finding the document specification by message type "html" failed. Verify the schema deployed properly.  

 

Part 3: Post-Assignment Tasks

 

After the assignment deadline, the following tasks happen in parallel:

1. An email is sent again to everyone in the class;

2. A summary is saved locally for instance with a file send port, for the teacher to use at a later time. The GradesInfo helper class provides the grades report.

 

O365SchedulingEndTasksPart.JPG

 

Helper Class

 

A serializable helper class was added to the project for saving students' grades. Note that protected constructor and GetObjectData method with sufficient privileges need to be provided for the class to be serializable.

 

using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Security.Permissions;

namespace StudentsGrades
{
    [Serializable]
    public class GradesInfo : Dictionary<string, bool>
    {
        public GradesInfo() { }

        public void AddOrUpdate(string key, bool value)
        {
            if (!this.ContainsKey(key))
            {
                this.Add(key, value);
            }
            else
            {
                this[key] = value;
            }
        }

        public string GetPrintableSummary()
        {
            string result = Environment.NewLine;

            foreach (var student in this.Keys)
            {
                result += string.Join(" ", student, this[student], Environment.NewLine);
            }

            return result;
        }

        protected GradesInfo(SerializationInfo info, StreamingContext context) : base(info, context) {}

        [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
        }
    }
}

 

 

Concluding Remarks

 

The objective of the demo scenario is to showcase a reusable way to implement scheduling in orchestrations. More error handling would normally be part of a "real-life" application. For instance, emails sent to the teacher need to be filtered so that only the ones with assignment answers are processed, and the other emails ignored. One way to accomplish that is to use server-side rules to direct emails to a specific folder, and have a receive location poll the folder.

The scheduled events should also come from a non-default calendar rather than the default calendar since we don't want any meeting request sent to the teacher's account to initiate new orchestration instances. More information on filtering in the Office 365 Outlook adapters may be found in the related post Filtering in Office 365 Outlook Adapters.

 

Attachments to calendar events are currently ignored by the Office 365 Outlook Calendar adapter but they could be supported in future BizTalk releases if there is demand for the feature. In the demo scenario, the teacher would be able to attach assignment material directly to the scheduled event and let the orchestration send it out.

 

Sample Code

All code used in this article is attached.

When building the BizTalk solution, the following warnings can be safely ignored:

...\OrchestrationScheduling\OrchestrationScheduling\ScheduledOrchestration.odx(678,35): warning X4014: convoy processing will not occur -- check your protocol if you were expecting it

...\OrchestrationScheduling\OrchestrationScheduling\ScheduledOrchestration.odx(647,30): convoy found at 'activate receive(ReceiveScheduledQuiz.Operation_1, TriggerAssignmentTask, initialize AssignmentId)'

...\OrchestrationScheduling\OrchestrationScheduling\ScheduledOrchestration.odx(678,35): and 'receive(ReceiveAssignments.Operation_1, AssignmentSubmitted, AssignmentId)'

 

References

Office 365 Outlook Calendar adapter

Office 365 Outlook Email adapter

Advanced Scheduling in Receive Locations

Attachments in the Office 365 Outlook Email Adapter

Filtering in Office 365 Outlook Adapters

Office 365 Outlook Adapters in Action

Correlations in BizTalk Orchestrations