public static string GetGoogleSheetId(ModelInfo modelInfo) { string sheetId = ""; try { ProjectReplicatorSettings settings = DataStorageUtil.ReadSettings(modelInfo.Doc); /* * sheetId = settings.GoogleSheetId; * if (!string.IsNullOrEmpty(sheetId)) * { * FilesResource.GetRequest getRequest = service.Files.Get(sheetId); * File sheetFile = getRequest.Execute(); * if (null != sheetFile) * { * if (null == sheetFile.ExplicitlyTrashed) * { * return sheetFile.Id; * } * } * } */ sheetId = FindGoogleSheetId(modelInfo); settings.GoogleSheetId = sheetId; bool updated = DataStorageUtil.UpdateSettings(modelInfo.Doc, settings); } catch (Exception ex) { MessageBox.Show("Failed to get google sheet Id\n" + ex.Message, "Google Drive : File ID", MessageBoxButton.OK, MessageBoxImage.Warning); } return(sheetId); }
public ModelInfo(Document doc) { m_doc = doc; docTitle = doc.Title; prefixes.Add("E-CAD", "E-CAD"); prefixes.Add("E-BIM", "E-BIM"); prefixes.Add("REVIT", "REVIT"); docCentralPath = GetCentralPath(); GetProjectInfo(); GetFileLocation(); GetUserLocation(); if (string.IsNullOrEmpty(fileLocation) && userLocation == "UNKNOWN") { hokStandard = false; string regValue = RegistryUtil.GetRegistryKey("CompanyName"); if (!string.IsNullOrEmpty(regValue)) { companyName = regValue; } } else { hokStandard = true; } ProjectReplicatorSettings settings = DataStorageUtil.ReadSettings(doc); revitDocumentId = settings.RevitDocumentId; if (string.IsNullOrEmpty(revitDocumentId)) { revitDocumentId = Guid.NewGuid().ToString(); settings.RevitDocumentId = revitDocumentId; DataStorageUtil.UpdateSettings(doc, settings); } }