API no return for the actual Save() method

API do not return for the actual Save() method

This is using the SWDocManager API and unfortunately there is no return for the actual Save() method, so you can’t tell if it was successful or not.   No exceptions are thrown if failed.

The only way I could do it was deleting the original file and doing a swDoc.SaveAs() instead.  I could not reproduce the failed Save() on new PLMWorx files.  Not sure if this helps….

File.SetAttributes(sDocFileName, FileAttributes.Normal);

swDoc = (SwDMDocument15)swDocMgr.GetDocument(sDocFileName, nDocType, true, out nRetVal);

retValTemp = swDoc.AddCustomProperty("PLM_ItemNumber", SwDmCustomInfoType.swDmCustomInfoText, PLM_ItemNumber);

retValTemp = swDoc.AddCustomProperty("PLM_ItemMajorRevision", SwDmCustomInfoType.swDmCustomInfoText, PLM_ItemMajorRevision);

retValTemp = swDoc.AddCustomProperty("PLM_ItemMinorRevision", SwDmCustomInfoType.swDmCustomInfoText, PLM_ItemMinorRevision);

swDoc.Save();

SolidworksApi macros