I am working on an application, and trying to get it to install itself into the toolbar on the first time it is run. Using ClientAutomation, I can view existing structures as well as add Custom Buttons. However, adding a toolbar or button results in the following error:
"The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"}
[System.Runtime.InteropServices.COMException]: {"The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"}
Data: {System.Collections.ListDictionaryInternal}
I am currently using the 9.0 SDK (mainly to avoid an additional install to update users PCs once this app is done).
An example of my code is as follows:
// Check if toolbar exists int nToolbarCount = doctoolbarmgr.GetToolbarCount(); bool foundBar = false; for (int x = 0; x < nToolbarCount; x++) { string strToolbar = doctoolbarmgr.GetToolbarName(x); if (strToolbar == "___ County Tools") { foundBar = true; } } // If not, add it if (!foundBar) { doctoolbarmgr.AddToolbar("___ County Tools", ToolbarPosition.Top); } // See if our custom tool exists & remove if it does int nCustomButtons = doctoolbarmgr.GetCustomToolbarButtonCount(); for (int x = 0; x < nCustomButtons; x++) { if (doctoolbarmgr.GetCustomToolbarButton(x).Description == "Certificate Printer") { doctoolbarmgr.RemoveCustomToolbarButton(x); } } String app_path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); String application = app_path + "\\LFCertificatePrinter.exe"; String icon = app_path + "\\print.ico"; String parameters = "%(DocumentID)"; // Create new custom button CustomButtonInfo mybutton = new CustomButtonInfo(); mybutton.Description = "Certificate Printer"; mybutton.Command = application + " " + parameters; mybutton.IconPath = icon; int toolid = doctoolbarmgr.AddCustomToolbarButton(mybutton); // Add to menubar ToolbarButtonInfo tbbutton = new ToolbarButtonInfo(); tbbutton.Id = toolid; tbbutton.IsSeparator = true; doctoolbarmgr.AddButton("___County Tools", tbbutton, -1);
Thanks for any suggestions if you might have seen this before. I did see another thread suggesting that the RPC error in another area was caused by antivirus, so I did attempt this with my antivirus turned off to verify it didn't change anything.
Jonathan