11import { useCustomPromise , useCustomXhr , Uri , AttendeeInfo , TimeZoneDefinition , TimeWindow , DateTime , TimeSpan , DateTimeKind , TimeZoneInfo , AvailabilityData , EmailMessageSchema , ItemSchema , AggregateType , SortDirection , AutodiscoverService , ExchangeVersion , ExchangeCredentials , ExchangeService ,
2- UserSettingName , DomainSettingName , BasePropertySet , PropertySet , EnumHelper , FolderId , WellKnownFolderName , DOMParser , ItemView , Grouping ,
3- EwsLogging , AppointmentSchema , CalendarActionResults , EwsUtilities , MeetingCancellation , MeetingRequest , MeetingResponse , Appointment , Item , StringHelper ,
4- ResolveNameSearchLocation , ExtendedPropertyDefinition , MapiPropertyType , ConflictResolutionMode , Guid , DefaultExtendedPropertySet , SendInvitationsMode , MessageBody } from "../../src/js/ExchangeWebService" ;
2+ UserSettingName , DomainSettingName , BasePropertySet , PropertySet , EnumHelper , FolderId , WellKnownFolderName , DOMParser , ItemView , Grouping , EmailMessage ,
3+ EwsLogging , AppointmentSchema , CalendarActionResults , EwsUtilities , MeetingCancellation , MeetingRequest , MeetingResponse , Appointment , Item , StringHelper ,
4+ ResolveNameSearchLocation , ExtendedPropertyDefinition , MapiPropertyType , ConflictResolutionMode , Guid , DefaultExtendedPropertySet , SendInvitationsMode , MessageBody } from "../../src/js/ExchangeWebService" ;
55
66import { MockXHRApi } from "../MockXHRApi" ;
77import { MockXHRData } from "../MockXHRData" ;
@@ -27,7 +27,22 @@ export class Greeter {
2727 var exch = new ExchangeService ( ExchangeVersion . Exchange2013 ) ;
2828 exch . Credentials = new ExchangeCredentials ( credentials . userName , credentials . password ) ;
2929 exch . Url = new Uri ( "https://outlook.office365.com/Ews/Exchange.asmx" ) ;
30- EwsLogging . DebugLogEnabled = true ;
30+ EwsLogging . DebugLogEnabled = false ;
31+
32+ var msgattach = new EmailMessage ( exch ) ;
33+ msgattach . Subject = "Dentist Appointment" ;
34+ msgattach . Body = new MessageBody ( "The appointment is with Dr. Smith." ) ;
35+ msgattach . ToRecipients . Add ( "grouptest@mysupport.in" )
36+ var file = msgattach . Attachments . AddFileAttachment ( "filename to attach.txt" , "c29tZSB0ZXh0" ) ;
37+ //file.
38+ msgattach . Send ( ) . then ( ( ) => {
39+ console . log ( "------------" ) ;
40+ } , ( ei ) => {
41+ EwsLogging . Log ( ei , true , true ) ;
42+ console . log ( ei . stack , ei . stack . split ( "\n" ) ) ;
43+ console . log ( "------------" ) ;
44+ } ) ;
45+ return ;
3146
3247 var appointment = new Appointment ( exch ) ;
3348 appointment . Subject = "Dentist Appointment" ;
@@ -41,7 +56,7 @@ export class Greeter {
4156 console . log ( ei . stack , ei . stack . split ( "\n" ) ) ;
4257 console . log ( "------------" ) ;
4358 } ) ;
44- return ;
59+ return ;
4560
4661
4762 exch . TimeZoneDefinition = new TimeZoneDefinition ( ) ;
@@ -58,7 +73,7 @@ return;
5873 exch . GetUserAvailability ( ats , tmw , AvailabilityData . FreeBusyAndSuggestions )
5974 . then ( ( fi ) => {
6075 //console.log("------found folder------" + fi.DisplayName + "--" + WellKnownFolderName[sr.ParentFolderId.FolderName]);
61- EwsLogging . Log ( fi , true , true ) ;
76+ EwsLogging . Log ( fi , true , true ) ;
6277 console . log ( "------------" ) ;
6378 } , ( ei : any ) => {
6479 EwsLogging . Log ( ei , true , true ) ;
@@ -75,8 +90,8 @@ return;
7590 mockXhr . responseXml = [ MockXHRData . Operations . ItemOperations . FindItemRequest1ItemViewResponse ] ;
7691 var PR_TRANSPORT_MESSAGE_HEADERS = new ExtendedPropertyDefinition ( MapiPropertyType . String , 0x007D ) ;
7792 var EX_normalized_Subject = new ExtendedPropertyDefinition ( MapiPropertyType . String , 0x0E1D ) ; //https://willcode4foodblog.wordpress.com/2012/04/14/understanding-sharing-invitation-requests-ews-managed-api-1-2-part-2/
78- var EX_prop2 = new ExtendedPropertyDefinition ( DefaultExtendedPropertySet . InternetHeaders , "Content-Class" , MapiPropertyType . String ) ;
79- var psPropSet = new PropertySet ( BasePropertySet . IdOnly , [ PR_TRANSPORT_MESSAGE_HEADERS , EX_normalized_Subject ] ) ;
93+ var EX_prop2 = new ExtendedPropertyDefinition ( DefaultExtendedPropertySet . InternetHeaders , "Content-Class" , MapiPropertyType . String ) ;
94+ var psPropSet = new PropertySet ( BasePropertySet . IdOnly , [ PR_TRANSPORT_MESSAGE_HEADERS , EX_normalized_Subject ] ) ;
8095 exch . FindItems ( WellKnownFolderName . Inbox , new ItemView ( 1 ) )
8196 . then ( ( response ) => {
8297 for ( var item of response . Items ) {
@@ -201,8 +216,8 @@ return;
201216 . then ( ( fi ) => {
202217 //console.log("------found folder------" + fi.DisplayName + "--" + WellKnownFolderName[sr.ParentFolderId.FolderName]);
203218 EwsLogging . Log ( fi , true , true ) ;
204- for ( var res in fi . SuggestionsResponse )
205- console . log ( "------------" ) ;
219+ for ( var res in fi . SuggestionsResponse )
220+ console . log ( "------------" ) ;
206221 } , ( ei : any ) => {
207222 EwsLogging . Log ( ei , true , true ) ;
208223 console . log ( ei . stack , ei . stack . split ( "\n" ) ) ;
0 commit comments