But there's a minor error, you should add JsonProperty for Permissions of SharedLink
[JsonProperty(PropertyName = "permissions")]
public Permissions Permissions { get; set; }
Because if Permissions is not specified json property permissions, then when you do something like this
var client = new RestClient("https://api.box.com/2.0/files/" + fileId);
RestRequest request = new RestRequest(Method.PUT);
request.RequestFormat = DataFormat.Json;
//request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer " + accessToken);
request.AddHeader("Content-type", "application/json");
var sharedLinkOption = new SharedLink()
{
Access = Model.Enum.Access.Open,
Permissions = new Permissions() { CanDownload = false, CanPreview = false },
//UnsharedAt = DateTime.Now.AddYears(1)
};
Although CanDownload = false but the result.Permission,CanDownload is always true because Box API doesn't know about the Permission (in json), so it should be permissions
A great tool.
But there's a minor error, you should add JsonProperty for Permissions of SharedLink [JsonProperty(PropertyName = "permissions")] public Permissions Permissions { get; set; }
Because if Permissions is not specified json property permissions, then when you do something like this
var client = new RestClient("https://api.box.com/2.0/files/" + fileId); RestRequest request = new RestRequest(Method.PUT); request.RequestFormat = DataFormat.Json; //request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Bearer " + accessToken); request.AddHeader("Content-type", "application/json"); var sharedLinkOption = new SharedLink() { Access = Model.Enum.Access.Open, Permissions = new Permissions() { CanDownload = false, CanPreview = false }, //UnsharedAt = DateTime.Now.AddYears(1) };
Although CanDownload = false but the result.Permission,CanDownload is always true because Box API doesn't know about the Permission (in json), so it should be permissions