2 Replies Latest reply on Dec 2, 2008 4:16 PM by Michael Dekoning

    Anyone familiar with IEdmRawReferenceMgr?

    Michael Dekoning
      Looking at the 2008 API documentation, this appears to be a way to add a reference count for a file in PDM. However, there is no example of usage and I have not yet determined how to use it. Anyone know how and have an example to share?
        • Anyone familiar with IEdmRawReferenceMgr?
          I tried messing around with this, but I get an error I can't get past. I think you'll have to talk to api support.

          Using the code below throws an error on calling UpdateReferences(), System.Runtime.InteropServices.COMException: Not all the objects requested could be removed (Exception from HRESULT: 0x8004020B)

          Give it a shot and see if you can figure out what causes it. (Sorry about the formatting.)

          
          
          public void UpdateReferenceCount(string filePath, string referenceName, int newCount)
                  {
                      IEdmRawReferenceMgr refMgr = (IEdmRawReferenceMgr)m_vault.CreateUtility(EdmUtility.EdmUtil_RawReferenceMgr);

                      try
                      {
                          if (refMgr.Open(filePath))
                          {
                              Array references = Array.CreateInstance(typeof(EdmRawReference), 99);
                              refMgr.GetReferences(ref references);

                              for (int i = 0; i < references.Length; i++)
                              {
                                  EdmRawReference reference = (EdmRawReference)references.GetValue(i);
                                  if (reference.mbsRefName == referenceName)
                                  {
                                      reference.mlCount = newCount;
                                      references.SetValue(reference, i);
                                      break;
                                  }
                              }
                              refMgr.UpdateReferences(newReferences);
                          }
                      }
                      catch (Exception)
                      {
                          throw;
                      }
                      finally
                      {
                          refMgr.Close();
                      }
                  }
          • Anyone familiar with IEdmRawReferenceMgr?
            Michael Dekoning
            I changed your code to just run the GetReferences method and got the same error you did. I looked in the return codes list and saw that 0x8004020B is E_EDM_FILE_SHARE_ERROR. Figured I needed to have the file checked out. Re-ran and was able to get the references for a SolidWorks assembly file. This interface apparently gets the information directly from the file, thus "Raw." Unfortunately my objective was to work with our dwg files and since we don't use xrefs, there are no references to read from the dwg file. Thanks anyway.