Can't fetch file's created_On and created_By property, while calling Get Folder’s Items
While calling Get Folder’s Items method, i am getting all the items in a folder, but i am not getting all the details about folder and files, like when that file was created and was created_by, any help, how can i achieve this ?
-
It would be another api call. This example is takes an ID from the above call and gets the folder or file info.
public static JObject getFileInfo(string type, string id, string user_id) { string url = "https://api.box.com/2.0/files/" + id; if (type == "folder") url = "https://api.box.com/2.0/folders/" + id; HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url); webrequest.Method = "GET"; webrequest.ContentType = "application/json"; webrequest.Headers.Add("Authorization", "Bearer " + TOKEN); webrequest.Headers.Add("As-User", user_id); try { HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse(); Encoding enc = System.Text.Encoding.GetEncoding("utf-8"); StreamReader responseStream = new StreamReader(webresponse.GetResponseStream()); string result = string.Empty; result = responseStream.ReadToEnd(); JObject jResponse = JObject.Parse(result); return jResponse; } catch (Exception e) { Console.WriteLine(e); if (e.Message.Contains("403")) { Console.WriteLine("*************** 403 user_id: " + user_id); } return null; } }
サインインしてコメントを残してください。
コメント
1件のコメント