新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Can't fetch file's created_On and created_By property, while calling Get Folder’s Items

新規投稿

コメント

1件のコメント

  • kendomen

    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;
           }
    }
    0
    コメントアクション Permalink

サインインしてコメントを残してください。