You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since July 2014, Dropbox Core API supports Modifier data for files in personal accounts. This is available only to those apps that requested permission for that, but this is a very, very useful feature.
HttpClientHandler handler = new HttpClientHandler();
// OAuth
DropNetRT.Authentication.OAuthMessageHandler oauthHandler =
new DropNetRT.Authentication.OAuthMessageHandler(handler, apiKey, apiSecret, client.UserLogin.Token, client.UserLogin.Secret);
HttpClient c = new HttpClient(oauthHandler);
string str = string.Format("https://api.dropbox.com/1/metadata/auto/{0}", webFilePath);
HttpRequest httpRequest = new HttpRequest(HttpMethod.Get, str);
// we don't need list
httpRequest.Parameters.Add(new HttpParameter("list", (object)false));
//httpRequest.Parameters.Add(new HttpParameter("include_deleted", (object)includeDeleted));
// we need membership data
httpRequest.Parameters.Add(new HttpParameter("include_membership", (object)true));
HttpResponseMessage httpResponseMessage;
oauthHandler.Authenticate(httpRequest);
try
{
httpResponseMessage = await c.SendAsync(httpRequest);
}
catch (Exception exception)
{
//throw new DropboxException(exception);
return null;
}
if (httpResponseMessage.StatusCode != HttpStatusCode.OK)
{
return null;
//throw new DropboxException(httpResponseMessage);
}
string responseString = await httpResponseMessage.Content.ReadAsStringAsync();
var metadataEx = JsonConvert.DeserializeObject<DropboxMetadataEx>(responseString);
return metadataEx;
}
extended metadata class:
public class DropboxMetadataEx : DropNetRT.Models.Metadata
{
[JsonProperty("modifier")]
public Modifier Modifier
{
get;
set;
}
} // class
public class Modifier
{
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("uid")]
public string Uid { get; set; }
} // class
Since July 2014, Dropbox Core API supports Modifier data for files in personal accounts. This is available only to those apps that requested permission for that, but this is a very, very useful feature.
For now, I used the following approach:
private async Task GetMetadataEx(string relativePath)
{
string webFilePath = relativePath.Replace("", "/");
extended metadata class:
{
[JsonProperty("modifier")]
public Modifier Modifier
{
get;
set;
}
} // class
public class Modifier
{
[JsonProperty("display_name")]
public string DisplayName { get; set; }
[JsonProperty("uid")]
public string Uid { get; set; }
} // class