/// <summary> /// Returns the collection of OneDriveItem objects that are parented to the current item. The current item /// must be a folder or album, otherwise this command will fail. /// </summary> /// <returns></returns> public async Task <OneDriveItem[]> GetChildItemsAsync() { var result = await Client.LiveClient.GetAsync(string.Format("/{0}/files", this.Identifier)); System.Diagnostics.Debug.WriteLine("json: {0}", result.RawResult); return(OneDriveClient.ConvertDataResponseToItems(result.RawResult, this.Client)); }
internal static OneDriveItem CreateFromRawJson(string rawJsonData, OneDriveClient sourceClient) { OneDriveItem item = JsonConvert.DeserializeObject <OneDriveItem>(rawJsonData); item.Client = sourceClient; return(item); }
internal static OneDriveItem[] ConvertDataResponseToItems(string jsonWithData, OneDriveClient client) { JObject obj = (JObject)JsonConvert.DeserializeObject(jsonWithData); var dataReader = obj["data"].CreateReader(); var serializer = new JsonSerializer(); var objects = serializer.Deserialize <List <OneDriveItem> >(dataReader); foreach (OneDriveItem item in objects) { item.Client = client; } return(objects.ToArray()); }