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.
Solved! Go to Solution.
Solved by Daniel.Du. Go to Solution.
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>
It's perfect. I found now where I'm wrong regarding the vcet.config file.
Thanks a lot.