I use C#.Net where poCmd.mbCancel flag is short type, in API documentation mbCancel is bool ?
How to use this flag or how to Cancel Change State ?
I use C#.Net where poCmd.mbCancel flag is short type, in API documentation mbCancel is bool ?
How to use this flag or how to Cancel Change State ?
Hi Ulf,
poCmd.mbCancel = 0; 'false
poCmd.mbCancel = 1; 'true
doesn't work, i also try short.maxvalue and other value.
I think there is a bug in epdm interface api.
Thanks Michael for example, but mbCancel flag is bool there.
Hi Tomasz
Add a hook for EdmCmd_PreRename and set in this poCmd.mbCancel = 1. Now try to rename a file in the vault. It shouldn't work anymore.
Thanks Ulf,
but for me this don`t stop rename process, i can rename any file i vault.
I use SW PDM Professional 2018.
Hi Tomasz
A last try. Can you compile and test this add-in? It works very well with SW2017 SP5 on my workstation.
using System;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;
namespace EpdmTest{
[Guid(""), ComVisible(true)]
public class BiIEpdmAddIn : IEdmAddIn5 {
public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr){
poInfo.mlAddInVersion = 1;
poInfo.mlRequiredVersionMajor = 14;
poInfo.mlRequiredVersionMinor = 1;
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreRename);
}
public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData){
IEdmVault5 vault = poCmd.mpoVault as IEdmVault5;
try{
switch (poCmd.meCmdType){
case EdmCmdType.EdmCmd_PreRename:
poCmd.mbCancel = 1;
break;
default:
break;
}
}
catch (COMException ex){
string errorName, errorDesc;
vault.GetErrorString(ex.ErrorCode, out errorName, out errorDesc);
vault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);
}
}
}
}
Hi Tomasz
A last try. Can you compile and test this add-in? It works very well with SW2017 SP5 on my workstation.
using System;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;
namespace EpdmTest{
[Guid(""), ComVisible(true)]
public class BiIEpdmAddIn : IEdmAddIn5 {
public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr){
poInfo.mlAddInVersion = 1;
poInfo.mlRequiredVersionMajor = 14;
poInfo.mlRequiredVersionMinor = 1;
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreRename);
}
public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData){
IEdmVault5 vault = poCmd.mpoVault as IEdmVault5;
try{
switch (poCmd.meCmdType){
case EdmCmdType.EdmCmd_PreRename:
poCmd.mbCancel = 1;
break;
default:
break;
}
}
catch (COMException ex){
string errorName, errorDesc;
vault.GetErrorString(ex.ErrorCode, out errorName, out errorDesc);
vault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);
}
}
}
}
BiI SAP-PDM