private WLID_FolderItem FindFolder(string folder, string parentfolder = null) { if (string.IsNullOrWhiteSpace(parentfolder)) { parentfolder = ROOT_FOLDER_ID; } var url = string.Format("{0}/{1}?access_token={2}", WLID_SERVER, string.Format(FOLDER_TEMPLATE, parentfolder), Library.Utility.Uri.UrlEncode(m_oauth.AccessToken)); var res = m_oauth.GetJSONData <WLID_DataItem>(url, x => x.UserAgent = USER_AGENT); if (res == null || res.data == null) { return(null); } foreach (var r in res.data) { if (string.Equals(r.name, folder, StringComparison.OrdinalIgnoreCase)) { return(r); } } return(null); }
public void Delete(string remotename) { try { // Prevent repeated fileid lookups if (m_filecache.Count == 0) { List(); } var fileid = GetFileId(remotename); var url = string.Format("{0}/files/{1}", DRIVE_API_URL, Library.Utility.Uri.UrlPathEncode(fileid)); m_oauth.GetJSONData <object>(url, x => { x.Method = "DELETE"; }); m_filecache.Remove(remotename); } catch { m_filecache.Clear(); throw; } }
public void Delete(string remotename) { try { foreach (var fileid in from n in GetFileEntries(remotename) select n.id) { var url = string.Format("{0}/files/{1}", DRIVE_API_URL, Library.Utility.Uri.UrlPathEncode(fileid)); m_oauth.GetJSONData <object>(url, x => { x.Method = "DELETE"; }); } m_filecache.Remove(remotename); } catch { m_filecache.Clear(); throw; } }
public void Delete(string remotename) { try { foreach (var fileid in from n in GetFileEntries(remotename) select n.id) { var url = WebApi.GoogleDrive.DeleteUrl(Library.Utility.Uri.UrlPathEncode(fileid), m_useTeamDrive); m_oauth.GetJSONData <object>(url, x => { x.Method = "DELETE"; }); } m_filecache.Remove(remotename); } catch { m_filecache.Clear(); throw; } }