22
33import static org .junit .Assert .assertFalse ;
44import static org .junit .Assert .assertNotNull ;
5+ import static org .junit .Assert .assertTrue ;
56
67import java .io .ByteArrayOutputStream ;
78import java .io .File ;
1213import java .util .ArrayList ;
1314import java .util .Arrays ;
1415import java .util .List ;
16+ import java .util .UUID ;
1517
1618import javax .xml .datatype .DatatypeFactory ;
1719import javax .xml .datatype .Duration ;
3638import com .microsoft .graph .models .extensions .MeetingTimeSuggestionsResult ;
3739import com .microsoft .graph .models .extensions .Message ;
3840import com .microsoft .graph .models .extensions .Recipient ;
41+ import com .microsoft .graph .models .extensions .SingleValueLegacyExtendedProperty ;
3942import com .microsoft .graph .models .extensions .UploadSession ;
4043import com .microsoft .graph .models .extensions .User ;
4144import com .microsoft .graph .models .generated .AttachmentType ;
4447import com .microsoft .graph .requests .extensions .AttachmentCollectionPage ;
4548import com .microsoft .graph .requests .extensions .IMessageCollectionPage ;
4649import com .microsoft .graph .requests .extensions .IUserCollectionPage ;
50+ import com .microsoft .graph .requests .extensions .SingleValueLegacyExtendedPropertyCollectionPage ;
51+ import com .microsoft .graph .requests .extensions .SingleValueLegacyExtendedPropertyCollectionRequestBuilder ;
52+ import com .microsoft .graph .requests .extensions .SingleValueLegacyExtendedPropertyCollectionResponse ;
4753import com .microsoft .graph .requests .extensions .AttachmentCollectionResponse ;
54+ import com .microsoft .graph .requests .extensions .IEventCollectionPage ;
4855
4956@ Ignore
5057public class OutlookTests {
@@ -313,5 +320,33 @@ public void testSendDraftWithLargeAttachements() throws FileNotFoundException, I
313320
314321 //Send the drafted message
315322 testBase .graphClient .me ().mailFolders ("Drafts" ).messages (newMessage .id ).send ().buildRequest ().post ();
316- }
323+ }
324+ @ Test
325+ public void testSingleValuesExtendedProperties () {
326+ final TestBase testBase = new TestBase ();
327+ final IEventCollectionPage arrangePage = testBase .graphClient .me ().events ().buildRequest ().top (1 ).get ();
328+ final String eventId = arrangePage .getCurrentPage ().get (0 ).id ;
329+ final Event updatedEvent = new Event ();
330+ final String uuid = UUID .randomUUID ().toString ();
331+ final SingleValueLegacyExtendedProperty prop = new SingleValueLegacyExtendedProperty ();
332+ prop .id = "String {" +uuid +"} Name fun" ;
333+ prop .value = "some value" ;
334+ final SingleValueLegacyExtendedPropertyCollectionResponse response = new SingleValueLegacyExtendedPropertyCollectionResponse ();
335+ response .value = new ArrayList <SingleValueLegacyExtendedProperty >();
336+ response .value .add (prop );
337+ updatedEvent .singleValueExtendedProperties = new SingleValueLegacyExtendedPropertyCollectionPage (response , new SingleValueLegacyExtendedPropertyCollectionRequestBuilder (null , null , null ));
338+
339+ testBase .graphClient .me ().events (eventId ).buildRequest ().patch (updatedEvent );
340+ final IEventCollectionPage page = testBase .graphClient .me ()
341+ .events ()
342+ .buildRequest ()
343+ .expand ("singleValueExtendedProperties" )
344+ .top (1 )
345+ // .filter("singleValueExtendedProperties/Any(ep: ep/id eq '"+prop.id+"' and ep/value eq '"+prop.value+"')")
346+ .get ();
347+ assertNotNull (page );
348+ final List <Event > events = page .getCurrentPage ();
349+ assertTrue (events .size () == 1 );
350+ assertNotNull (events .get (0 ).singleValueExtendedProperties );
351+ }
317352}
0 commit comments