IEdmBatchUnlock Interface

Still digging, man they didn’t make this process straight forward! Makes me wonder what it actually looks like on the other side of “The API Wall.”

Anyway, take a look at this:

EdmRefItemProperty Enumeration - 2019 - SOLIDWORKS API Help

found it from here:

SetProperty Method (IEdmRefItem) - 2019 - SOLIDWORKS API Help

from here:

IEdmRefItem Interface Members - 2019 - SOLIDWORKS API Help

from here:
GetItems Method (IEdmRefItemContainer) - 2019 - SOLIDWORKS API Help

IEdmRefItemContainer Interface - 2019 - SOLIDWORKS API Help

Example:
Prevent Admin from Checking In File Example (C#) - 2019 - SOLIDWORKS API Help

 private void UpdateBatchCheckInButton_Click(object sender, EventArgs e)
        {
             try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
 
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                   IEdmRefItemContainer container = null;
                   if (bUnlock == null)
                    {
                        MessageBox.Show("No checked-out files selected to check in. Please try again.");
                        return;
                    }
                    else
                    {
                    container = (IEdmRefItemContainer)bUnlock;
                    object[] items = null;
                    IEdmRefItem theItem = null;
                    container.GetItems(EdmRefItemType.Edmrit_All, out items);
                    int j = 0;
                    while (j < items.Length)
                    {
                        IEdmRefItem aItem = null;
                        theItem = (IEdmRefItem)items[j];
                        aItem = theItem;
                        object value = null;
                        **aItem.SetProperty(EdmRefItemProperty.Edmrip_CheckKeepLocked, value);**
                        j = j + 1;
                    }
	     }
                    MessageBox.Show("Check-in flags updated.");
             }
                
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
 
        }
4 Likes