66import com .microsoft .graph .extensions .INotebookCollectionPage ;
77import com .microsoft .graph .extensions .INotebookGetRecentNotebooksCollectionPage ;
88import com .microsoft .graph .extensions .IOnenotePageCollectionPage ;
9- import com .microsoft .graph .extensions .IOnenoteResourceCollectionPage ;
109import com .microsoft .graph .extensions .IOnenoteSectionCollectionPage ;
1110import com .microsoft .graph .extensions .ISectionGroupCollectionPage ;
1211import com .microsoft .graph .extensions .Notebook ;
13- import com .microsoft .graph .extensions .Onenote ;
1412import com .microsoft .graph .extensions .OnenoteOperation ;
1513import com .microsoft .graph .extensions .OnenotePage ;
1614import com .microsoft .graph .extensions .OnenotePagePreview ;
17- import com .microsoft .graph .extensions .OnenoteResource ;
15+ import com .microsoft .graph .extensions .OnenotePatchActionType ;
16+ import com .microsoft .graph .extensions .OnenotePatchContentCommand ;
17+ import com .microsoft .graph .extensions .OnenotePatchInsertPosition ;
1818import com .microsoft .graph .extensions .OnenoteSection ;
1919import com .microsoft .graph .extensions .SectionGroup ;
20- import com .microsoft .graph .extensions .User ;
2120import com .microsoft .graph .options .HeaderOption ;
2221import com .microsoft .graph .options .Option ;
2322import com .microsoft .graph .options .QueryOption ;
2423
2524import org .junit .*;
2625
27- import java .io .BufferedInputStream ;
2826import java .io .BufferedReader ;
29- import java .io .ByteArrayInputStream ;
3027import java .io .ByteArrayOutputStream ;
31- import java .io .DataOutputStream ;
3228import java .io .InputStream ;
3329import java .io .InputStreamReader ;
34- import java .io .OutputStream ;
3530import java .math .BigInteger ;
36- import java .net .HttpURLConnection ;
37- import java .net .URL ;
38- import java .net .URLConnection ;
39- import java .nio .charset .StandardCharsets ;
4031import java .security .SecureRandom ;
4132import java .util .ArrayList ;
4233import java .util .List ;
4334
44- // @Suppress
35+ @ Suppress
4536public class OneNoteTests extends AndroidTestCase {
4637
4738 private TestBase testBase ;
@@ -56,7 +47,7 @@ public void setUp() {
5647 testBase = new TestBase ();
5748 testNotebook = testBase .graphClient .getMe ().getOnenote ().getNotebooks ("1-525fe350-0199-4c02-879d-e5b142ae8632" ).buildRequest ().get ();
5849 testSection = testBase .graphClient .getMe ().getOnenote ().getNotebooks (testNotebook .id ).getSections ().buildRequest ().get ().getCurrentPage ().get (0 );
59- // testPage = testBase.graphClient.getMe().getOnenote().getPages().buildRequest().get().getCurrentPage().get(0);
50+ testPage = testBase .graphClient .getMe ().getOnenote ().getPages ().buildRequest ().get ().getCurrentPage ().get (0 );
6051
6152 // For copy scenarios
6253 testNotebook2 = testBase .graphClient .getMe ().getOnenote ().getNotebooks ("1-491df90f-b45b-477f-b297-032f000e6f1e" ).buildRequest ().get ();
@@ -274,6 +265,18 @@ public void testMultipartPost(){
274265 }
275266 }
276267
268+ @ Test
269+ public void testPatchContent () {
270+ List <OnenotePatchContentCommand > commands = new ArrayList <>();
271+ OnenotePatchContentCommand command = new OnenotePatchContentCommand ();
272+ command .target = "body" ;
273+ command .action = OnenotePatchActionType .Append ;
274+ command .position = OnenotePatchInsertPosition .After ;
275+ command .content = "<img src=\" https://en.wikipedia.org/wiki/File:Alexander_Hamilton_portrait_by_John_Trumbull_1806.jpg\" alt=\" New image from a URL\" />" ;
276+ commands .add (command );
277+ testBase .graphClient .getMe ().getOnenote ().getPages (testPage .id ).getOnenotePatchContent (commands ).buildRequest ().post ();
278+ }
279+
277280 public byte [] getByteArray (InputStream in ) {
278281 try {
279282 ByteArrayOutputStream buffer = new ByteArrayOutputStream ();
0 commit comments