Reply

Revision Manager API - Reading File Properties (C#) Example doesn't work

[ Edited ]

 

Hi,

On the ".NET Programmer's Guide" of SE ST 

propertySets.Open(@"C:\Part1.par", true);

line of the code gives an error message "Object reference not set to an instance of an object". Any idea for what could be the reason?

Ozlem ILDAY

 

RevisionManager.Application application = null;

RevisionManager.PropertySets propertySets = null;

RevisionManager.Properties properties = null;

RevisionManager.Property property = null;

string strFormat1 = "[{0}]";

string strFormat2 = "{0} = {1}";

 

try

{

 // Create new instance of the Revision Manager Application object

 application = new RevisionManager.Application();

 // Open a file

 propertySets.Open(@"C:\Part1.par", true);

 

Posted by: Ozlem ILDAY
Post date: 4/24/2009 7:16:27 AM

4 REPLIES

RE: Revision Manager API - Reading File Properties (C#) Example doesn't work

[ Edited ]

Seems you've found an error in the documentation. If you will go up a page or two and look at the VB.NET version, you'll see the correct syntax. Should be something like application.Open() instead of propertySets.Open().

 

You need to send an email to seedumedia@ugs.com to nofity them of the error.

 

Posted by: Jason Newell
Post date: 4/24/2009 7:22:37 AM

RE: Revision Manager API - Reading File Properties (C#) Example doesn't work

[ Edited ]

 

Thanks Jason,

I will take a look at  the VB version of the example.

Ozlem ILDAY

 

Posted by: Ozlem ILDAY
Post date: 4/24/2009 7:39:08 AM

RE: Revision Manager API - Reading File Properties (C#) Example doesn't work

[ Edited ]

 

Hope this helps you:

 

Dim oRevMgr As RevisionManager.Application

Dim RevMgrDoc As RevisionManager.Document

Dim oRevlinkedDocs As RevisionManager.LinkedDocuments

Dim oRevlinkedDoc As Object

Dim i As Integer

Dim name As String

 

oRevMgr = CreateObject("RevisionManager.Application")

RevMgrDoc = oRevMgr.Open(FileName)

oRevlinkedDocs = RevMgrDoc.LinkedDocuments

 

For i = 1 To oRevlinkedDocs.Count

oRevlinkedDoc = oRevlinkedDocs.Item(i)

name = oRevlinkedDoc.FullName

Next

 

RevMgrDoc.SaveAllLinks()

oRevMgr.Quit()

oRevlinkedDoc = Nothing

oRevlinkedDocs = Nothing

RevMgrDoc = Nothing

oRevMgr = Nothing

 

Posted by: Prasad Pawar
Post date: 4/24/2009 6:33:17 PM

RE: Revision Manager API - Reading File Properties (C#) Example doesn't work

[ Edited ]

Prasad,

 

Thank you for your reply. I've already using a similar code for linked documents. I don't have problems for the filenames. The question is how we can read the properties of linked documents.

 

Jason,

 

I tried to apply the same method of VB.NET version in my C# code, but unfortunatelly server threw an exception. Am I missing something?

 

// Create new instance of the Revision Manager Application object

application = new RevisionManager.Application();

 

// Open a file

application.Open(FileName, 0, true);

 

//Get a reference to the property sets collection

propertySets = (RevisionManager.PropertySets)application.PropertySets;

 

Posted by: Ozlem ILDAY
Post date: 4/27/2009 1:10:07 AM