Exemplo n.º 1
0
 public Box(OAuth2Info oauth)
 {
     AuthInfo         = oauth;
     FolderID         = "0";
     Share            = true;
     ShareAccessLevel = BoxShareAccessLevel.Open;
 }
Exemplo n.º 2
0
        public string CreateSharedLink(string id, BoxShareAccessLevel accessLevel)
        {
            string response = SendRequest(HttpMethod.PUT, "https://api.box.com/2.0/files/" + id, "{\"shared_link\": {\"access\": \"" + accessLevel.ToString().ToLower() + "\"}}", headers: GetAuthHeaders());

            if (!string.IsNullOrEmpty(response))
            {
                BoxFileEntry fileEntry = JsonConvert.DeserializeObject <BoxFileEntry>(response);

                if (fileEntry != null && fileEntry.shared_link != null)
                {
                    return(fileEntry.shared_link.url);
                }
            }

            return(null);
        }