Here is another section of VBA examples converted to C#. These functions are related to using occurrences in assemblies. This group was fairly easy to migrate compared to some of the other sections I did for previous posts. Also there were several C# examples already in the help file. I added them to the project for completeness.
This project has the following functions.
Here is the AddOccurrencesToFolder function:"
// Add assembly occurrences to a new folder API Sample
//Demonstrates assembly occurrences to a new folder
//Have an assembly with at least one occurrence in it
//and run the sample.
public void AddOccurrencesToFolder()
AssemblyDocument oDoc =
oDoc = (AssemblyDocument)
AssemblyComponentDefinition oDef =
oDef = oDoc.ComponentDefinition;
BrowserPane oPane = default(BrowserPane);
oPane = oDoc.BrowserPanes.ActivePane;
ObjectCollection oOccurrenceNodes =
oOccurrenceNodes = (ObjectCollection)
foreach (ComponentOccurrence oOcc
BrowserNode oNode = default(BrowserNode);
oNode = oPane.GetBrowserNodeFromObject(oOcc);
BrowserFolder oFolder = default(BrowserFolder);
oFolder = oPane.AddBrowserFolder
("My Occurrence Folder", oOccurrenceNodes);