@@ -22,16 +22,18 @@ public async Task OneDriveUploadLargeFile()
2222 using ( System . IO . MemoryStream ms = new System . IO . MemoryStream ( buff ) )
2323 {
2424 // Describe the file to upload. Pass into CreateUploadSession, when the service works as expected.
25- // var props = new DriveItemUploadableProperties();
25+ var props = new DriveItemUploadableProperties ( ) ;
2626 //props.Name = "_hamilton.png";
2727 //props.Description = "This is a pictureof Mr. Hamilton.";
2828 //props.FileSystemInfo = new FileSystemInfo();
2929 //props.FileSystemInfo.CreatedDateTime = System.DateTimeOffset.Now;
3030 //props.FileSystemInfo.LastModifiedDateTime = System.DateTimeOffset.Now;
31+ props . AdditionalData = new Dictionary < string , object > ( ) ;
32+ props . AdditionalData . Add ( "@microsoft.graph.conflictBehavior" , "rename" ) ;
3133
3234 // Get the provider.
3335 // POST /v1.0/drive/items/01KGPRHTV6Y2GOVW7725BZO354PWSELRRZ:/_hamiltion.png:/microsoft.graph.createUploadSession
34- // The CreateUploadSesssion action doesn't seem to support the options stated in the metadata.
36+ // The CreateUploadSesssion action doesn't seem to support the options stated in the metadata. This issue has been filed.
3537 var uploadSession = await graphClient . Drive . Items [ "01KGPRHTV6Y2GOVW7725BZO354PWSELRRZ" ] . ItemWithPath ( "_hamilton.png" ) . CreateUploadSession ( ) . Request ( ) . PostAsync ( ) ;
3638
3739 var maxChunkSize = 320 * 1024 ; // 320 KB - Change this to your chunk size. 5MB is the default.
@@ -97,6 +99,34 @@ public async Task OneDriveNextPageRequest()
9799 }
98100 }
99101
102+ // Addressing https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/issues/71
103+ //[TestMethod]
104+ //public async Task OneDriveNextPageRequestRootItemWithPath()
105+ //{
106+ // try
107+ // {
108+ // // This calls contains the correct URL structure:
109+ // var path = "Community Service";
110+ // var driveItemsPage = await graphClient.Me.Drive.Root.ItemWithPath(path).Children.Request().Top(1).GetAsync(); // DriveItemChildrenCollectionRequest.GetAsync()
111+ // // https://graph.microsoft.com/v1.0/me/drive/root:/Community%20Service:/children?$top=1
112+ // // BUG: the nextLink returned by the service is incorrect.
113+
114+ // // Assert that path is being added to the request URL.
115+ // StringAssert.Contains(driveItemsPage.NextPageRequest.RequestUrl, path, $"The path, '{path}' was not appended to the request URL.");
116+
117+ // // This call does not issue the correct URL. Notice that ":/Community%20Service:" segment is missing.
118+ // driveItemsPage = await driveItemsPage.NextPageRequest.GetAsync();
119+ // // Actual nextLink value used to populate the NextPageRequest URL
120+ // // https://graph.microsoft.com/v1.0/me/drive/root/children?$top=1&$skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_FileRef%3dpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service%252fBook%252exlsx%26p_ID%3d390%26RootFolder%3d%252fpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service
121+ // // Expected nextLink value used to populate the NextPageRequest URL
122+ // // https://graph.microsoft.com/v1.0/me/drive/root:/Community%20Service:/children?$top=1&$skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_FileRef%3dpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service%252fBook%252exlsx%26p_ID%3d390%26RootFolder%3d%252fpersonal%252fgarthf%255fmod810997%255fonmicrosoft%255fcom%252fDocuments%252fCommunity%2520Service
123+ // }
124+ // catch (Microsoft.Graph.ServiceException e)
125+ // {
126+ // Assert.Fail("Something happened, check out a trace. Error code: {0}", e.Error.Code);
127+ // }
128+ //}
129+
100130 // http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_downloadcontent
101131 [ TestMethod ]
102132 public async Task OneDriveGetContent ( )
0 commit comments