Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy Design Event

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
xavier_dumont2
709 Views, 2 Replies

Copy Design Event

Hi all,

 

I want to get a list of all new files created by a Copy-Design command.

 

Then I need to create a Vault add-in who can hook CommandEnd Event and if the command is CopyDesign, get the list on new file.

 

But I don't find any list of file.ids when this command event fire.

 

I found this link, but don't understand how can I do that because I think it's two kind of add-in (IWebServiceExtension + IExplorerExtension).

http://justonesandzeros.typepad.com/blog/2011/09/vault-explorer-command-events.html

 

Sorry, I'm not a developper, maybe the solution is very easy but I don't find a way to do that.

 

Thanks in advance and hav a nice day.

2 REPLIES 2
Message 2 of 3
Daniel.Du
in reply to: xavier_dumont2

Yes, as Doug said in the blog post, it can be a combination of explorer command events and web service command events, I did a quick demo as below, without error checking, just for your reference: 

 

    public class Class1 : IExplorerExtension
    {


        #region IExplorerExtenion implemenation
//some methods are ommited

        public void OnStartup(IApplication application)
        {
            application.CommandBegin += application_CommandBegin;
            application.CommandEnd += application_CommandEnd;

        }

        void application_CommandEnd(object sender, CommandEndEventArgs e)
        {
            if (String.Compare(e.CommandId,"CopyDesign") == 0)
            {
                string filenames = WebServiceEventHandler.fileNames.ToString();
                MessageBox.Show(filenames);
            }
        }


        TextDialog m_commandBox;
        void application_CommandBegin(object sender, CommandBeginEventArgs e)
        {


            if (String.Compare(e.CommandId, "CopyDesign") == 0)
            {
                WebServiceEventHandler.fileNames.Clear();
             
            }
        }
        #endregion

}



    class WebServiceEventHandler : IWebServiceExtension
    {

        public static StringBuilder fileNames = new StringBuilder();
        public void OnLoad()
        {
            DocumentService.AddFileEvents.Post += AddFileEvents_Post;
        }

        void AddFileEvents_Post(object sender, AddFileCommandEventArgs e)
        {
            fileNames.Append(e.FileName + "\n");
        }
    }


and here is vcet.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectivity.ExtensionSettings3>
    <extension
      interface="Autodesk.Connectivity.Explorer.Extensibility.IExplorerExtension, Autodesk.Connectivity.Explorer.Extensibility, Version=18.0.0.0, Culture=neutral, PublicKeyToken=aa20f34aedd220e1"
      type="ExplorerEventSample.Class1, ExplorerEventSample">
    </extension>
    <extension
        interface="Autodesk.Connectivity.WebServices.IWebServiceExtension, Autodesk.Connectivity.WebServices, Version=18.0.0.0, Culture=neutral, PublicKeyToken=aa20f34aedd220e1"
        type="ExplorerEventSample.WebServiceEventHandler, ExplorerEventSample">
    </extension>
  </connectivity.ExtensionSettings3>
</configuration>









Daniel Du
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

It's perfect. I found now where I'm wrong regarding the vcet.config file.

 

Thanks a lot.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report