Expiration dates for Shared Link through API

新規投稿

コメント

1件のコメント

  • kendomen

     

    string url = "https://api.box.com/2.0/files/" + file_id + "/";
    
    HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);
    webrequest.Method = "PUT";
    webrequest.ContentType = "application/json";
    webrequest.Headers.Add("Authorization", "Bearer " + TOKEN);
    webrequest.Headers.Add("As-User", user_id);
    
    using (var streamWriter = new StreamWriter(webrequest.GetRequestStream()))
    {
          string json = "{\"shared_link\": " +
                        "{\"unshared_at\": null}}";  // sets expiration to none
          streamWriter.Write(json);
          streamWriter.Flush();
          streamWriter.Close();
    }
    
    try
    {
          var response = (HttpWebResponse)webrequest.GetResponse();
          using (var streamReader = new StreamReader(response.GetResponseStream()))
          {
               var result = streamReader.ReadToEnd();
               Console.WriteLine("Success: " + url);
          }
    }
    catch (Exception e)
    {
          Console.WriteLine(e.Message);
    }
    }

     

    0
    コメントアクション パーマリンク

投稿コメントは受け付けていません。