private void checkSSIDPassword() { Excel.Application exApp = Globals.ThisAddIn.Application as Excel.Application; Excel.Workbook wb = exApp.ActiveWorkbook as Excel.Workbook; Channel ch = new Channel(); if (!TokenStore.checkTokenInStore()) { LoginForm frm = new LoginForm(); frm.Show(); } else { ch.setAuthToken(TokenStore.getTokenFromStore()); } if (ch.checkSpreadSheetID(wb) == "0") { string id = ch.getSpreadSheetID(wb.Name.ToString()); spreadSheetID = Convert.ToInt32(id); //write to wb property when a new ID is obtained Microsoft.Office.Core.DocumentProperties properties; properties = (Office.DocumentProperties)wb.CustomDocumentProperties; properties.Add("Excalibur ID", false, Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString, id); } else { string id = ch.checkSpreadSheetID(wb); spreadSheetID = Convert.ToInt32(id); } }
public void onRegButton(Office.IRibbonControl control) { Excel.Application exApp = Globals.ThisAddIn.Application as Excel.Application; Excel.Workbook wb = exApp.ActiveWorkbook as Excel.Workbook ; string filename = wb.Name.ToString(); Microsoft.Office.Core.DocumentProperties properties; properties = (Office.DocumentProperties)wb.CustomDocumentProperties; Channel ch = new Channel(); ch.setAuthToken(TokenStore.getTokenFromStore()); if (ch.checkSpreadSheetID(wb) == "0") { string fileID = ch.getSpreadSheetID(filename); MessageBox.Show(fileID, "File ID"); properties.Add("Excalibur ID", false, Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString, fileID); } else { MessageBox.Show("ID Exists - Excalibur ID: " + ch.checkSpreadSheetID(wb), "File Already Registered"); } }