none
Issue in using Visio Interop with sharepoint 2010 (programatically) RRS feed

  • Question

  • Hi,

    I am facing difficulty in opening a Visio document(.vdw) programatically, which is published under sharepoint 2010 document library.

    Idea is to have a sharepoint site page, which will execute below code to generate and display the visio diragram dynamically.

    Code:

    SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    GenerateDiagram();
                });
    public void GenerateDiagram()
            {
                try
                {
                    Microsoft.Office.Interop.Visio.Application application = new Microsoft.Office.Interop.Visio.Application();
                    application.Visible = false;
                    Microsoft.Office.Interop.Visio.Document doc = application.Documents.Open("http://ssp/sites/portal/Visio Library/sam.vdw"); 
    // I have tried the path like : @"E:\Visio\sam.vdw".

    Right now above code throws an error like "File not found" (if i specify absolute URL) , and invalid file format(in case of relative URL).

    FYI , same code works when i execute in console or class library application (removing RunWithElevatedPrivileges).

    If you have any alternatives, please suggest me.

    I had gone through the thread http://social.technet.microsoft.com/Forums/en-US/sharepointdevelopmentprevious/thread/8a34d1dd-2625-47f2-8bc8-bf45b09de6d7.

    and also http://support.microsoft.com/kb/257757

    which says interop cant be used in sharepoint server side.

    If i can do the same task in client side(Java script or JQuery), please enlighten me with how to do it.

    Any help in this regard is much appreciated.

    Thanks in advance. 
    Ravi Bhat




    Thursday, May 2, 2013 12:22 PM

Answers

All replies