public bool CreateFolder(string name, string parentFolder) { var folder = DriveApi.createDirectory(_service, name, name, parentFolder); foreach (var user in _grantedUsers) { DriveApi.InsertPermission(_service, folder.Id, user, "user", "writer"); } return(true); }
public bool UploadFile(string uploadFile, string uploadFolder) { File mySqlFolder; var mySqlFolderSearch = DriveApi.GetFiles(_service, $"name='{uploadFolder}'"); if (mySqlFolderSearch.Count == 1) { mySqlFolder = mySqlFolderSearch.FirstOrDefault(); } else { throw new ArgumentException("Folder not found.", "uploadFolder"); } var file = DriveApi.UploadFile(_service, uploadFile, mySqlFolder.Id); foreach (var user in _grantedUsers) { DriveApi.InsertPermission(_service, file.Id, user, "user", "writer"); } return(true); }