ecSDK C# Development

I am writing a c# winforms application where I want to be able to call the EC open dialog box and save dialog box and pass a particular path and filename to it and to then open/save a document.

I have a reference to ECSDK64.dll (C:\program files (x86)\OpenText\Enterprise Connect\ECSDK64.dll) and have imported the EnterpriseConnectSDK namespace.

Using the Dev Guide examples I have the following code:

OpenDialog Code:

private void OpenLiveLink()
        {
            object o = null;
            object Plugin = null;

            EnterpriseConnectSDK.IEnterpriseConnectSDK oSDK = null;

            oSDK = o as EnterpriseConnectSDK.IEnterpriseConnectSDK;

            EnterpriseConnectSDK.ICallContext context = oSDK.CreateContext();

            Plugin = oSDK.GetPlugin(context,"plugID");

            if (Plugin == null)
            {
                MessageBox.Show("Plugin object Creation failed. Exiting script");
                    return;
            }
            string ECItemID="";

            try
            {
                

            }
            catch
            {

            }

            finally
            {

            }
        }

 

SaveDialog Code

private void SaveLiveLink(string iFilePath, string iFileName)
        {
            object o = null;
            EnterpriseConnectSDK.IEnterpriseConnectSDK oSDK = null;
            EnterpriseConnectSDK.IPlugin plugin = null;
            EnterpriseConnectSDK.ICallContext context = null;

            oSDK = o as EnterpriseConnectSDK.IEnterpriseConnectSDK;

            context = oSDK.CreateContext();
            
            context.ParentWindow = 0;

            plugin = oSDK.GetPlugin(context, "pluginID");
            
            string FilePath = iFilePath;
            string initialFileName = iFileName;
            string[] ar = new string[]
            {
            "Word Document (*.docx)||.docx",
            "Word Macro-Enabled Document (*.docm)||.docm",
            "Word 97-2003 Document (*.doc)||.doc",
            "Word Template (*.dotx)||.dotx"
            };
            
            EnterpriseConnectSDK.ISaveContext SaveInfo = null;
            
            SaveInfo = oSDK.SaveDialog(context, ar, initialFileName);
            if (SaveInfo == null)
            {
            MessageBox.Show("Save Info object is null. Exiting script.", "");
            }
            else
            {
                                        
            }
        }

 

Both sets of code fail on the following line

EnterpriseConnectSDK.ICallContext context = oSDK.CreateContext();

with the error:

System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=IPSLivelink
  StackTrace:
       at IPSLivelink.Form1.OpenLiveLink() in d:\UK950153\Documents\Visual Studio 2013\Projects\IPSLivelink\IPSLivelink\Form1.cs:line 153
       at IPSLivelink.Form1.cmdOpenLL_Click(Object sender, EventArgs e) in d:\UK950153\Documents\Visual Studio 2013\Projects\IPSLivelink\IPSLivelink\Form1.cs:line 183
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at IPSLivelink.Program.Main() in d:\UK950153\Documents\Visual Studio 2013\Projects\IPSLivelink\IPSLivelink\Program.cs:line 18
  InnerException: 

I can't see what I have done wrong here. Any advise is welcomed.

 

Tony D

 

 

Comments

  • Hello Tony,
    first of all, your object "o" is null, than you are casting it to EnterpriseConnectSDK.IEnterpriseConnectSDK
    So where does the "o" comes from ?

    Have you seen this?
    https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=77371225&objAction=browse

    I'm also trying to use EC SDK.

  • Dear all,
    We have EnterpriseConnect (EC) in our compagny and I am searching how to do excatly the same as Tony request. To open an EC dialog box (using VBA or Python). I have the ECSDK64.DLL installed but no documentation. And for now it is not foreseen to use the help of our IT department. So I don't know if we have a support contract.

    In the example of Tony we have all information excepted how to get a link with the EnterpriseConnect server. The remark of Lukas is relevant; where does the "o" comes from ? I would say How to initialize the EnterpriseConnectSDK.IEnterpriseConnectSDK object oSDK in the program of Tony ?

    If someone could help by showing us an example (in any computer language) to initiate a link with EC that would be really nice.

    Thank you
    Lawrence
     




  • Has anyone ever managed to get this to work?

    I just want to display the SaveAs dialog from a VBA sub (in Excel). Surely that ought to be easy, but I can't work out the correct syntax, and there seems to be zero information out there.