S
sorgy
I got a trouble using Visio 2003 SP1 ORGANIZATION CHART WIZARD.
I want to import org data from Exchange using ORGANIZATION CHART WIZARD
and customize the fields to load and draw in the shapes.
So, I found HOWTO articles in MSDN and also in Office Online
Assistance. The article name - "Create an organization chart from a
data file using the command line or Run method"
http://office.microsoft.com/en-us/assistance/HP010384221033.aspx.
Also I used examples from Microsoft Office Visio Code Librarian to
write a C# solution. This solution will help me to automate the process
of generation org charts.
So the trouble: I couldn't customize the fields in parameter
DISPLAY-FIELDS even if I use the correct syntax. If I add the parameter
LAUNCHGUI, execute the ORGANIZATION CHART WIZARD AddOn and manually
select the fields which will be displayed in each box in the
organization chart than the result would be OK. If I define any custom
fields in DISPLAY-FIELDS such as Department Name or Company Name than
wizard'll draw only Name field in each box in the org chart.
Help me? I couldn't find the difference between the actions that I do
in my solution and using drawing-definition organization chart wizard
pages.
Furthermore, I tried to run my solution using Visio 2002 and it works
after renaming the properties in DISPLAY-FIELDS. And even in Visio 2003
import CUSTOM-PROPERTY-FIELDS using my solution were done OK...
Any ideas?
This is the code of solution:
const string ORGANIZATION_CHART_WIZARD = "OrgCWiz";
Microsoft.Office.Interop.Visio.Addon chartWizard;
string command;
string commandPart;
bool returnValue;
try
{
// Get a reference to the Organization Chart Wizard add-on.
chartWizard =
theApplication.Addons.get_ItemU(ORGANIZATION_CHART_WIZARD);
// Initialize the wizard and prepare it to accept a series of
// arguments.
command = @"/S-INIT";
chartWizard.Run(command);
// Tell the wizard that the following string contains arguments.
command = @" /S-ARGSTR ";
// Specify that the organization chart information is from
// Microsoft Exchange.
commandPart = @"/MICROSOFT-EXCHANGE";
chartWizard.Run (command + commandPart);
// Specify which field represents the name.
// /NAME-FIELD="Name"
commandPart = @"/NAME-FIELD="
+ @StringToFormulaForString("Name");
chartWizard.Run (command + commandPart);
// Specify which field represents the manager.
// /MANAGER-FIELD="Manager"
commandPart = @"/MANAGER-FIELD="
+ @StringToFormulaForString("Manager");
chartWizard.Run (command + commandPart);
// Specify which fields to display on the organization chart.
// DISPLAY-FIELDS="Name","Title"
commandPart = @"/DISPLAY-FIELDS="
+ @StringToFormulaForString("Department Name") + ","
+ @StringToFormulaForString("Name");
chartWizard.Run (command + commandPart);
// Specify which custom properties are to be created.
// /CUSTOM-PROPERTY-FIELDS=
commandPart = @"/CUSTOM-PROPERTY-FIELDS="
+ @StringToFormulaForString("UniqueID") + "HIDDEN,"
+ @StringToFormulaForString("Name") + ","
+ @StringToFormulaForString("Manager") + "HIDDEN,"
+ @StringToFormulaForString("Title") + ","
+ @StringToFormulaForString("Department Name") + ","
+ @StringToFormulaForString("Company Name") + ","
+ @StringToFormulaForString("Telephone") + ","
+ @StringToFormulaForString("Address");
chartWizard.Run (command + commandPart);
// Specify which field represents the Unique ID.
// /UNIQUEID-FIELD="UniqueID"
commandPart = @"/UNIQUEID-FIELD="
+ @StringToFormulaForString("UniqueID");
chartWizard.Run (command + commandPart);
// Specify which field represents the manager.
// /FIRSTNAME-FIELD="givenName"
commandPart = @"/FIRSTNAME-FIELD="
+ @StringToFormulaForString("Name");
chartWizard.Run (command + commandPart);
//
commandPart = @"/HYPERLINK-ACROSS-PAGES";
command = command + commandPart;
//
commandPart = @" /SYNC-ACROSS-PAGES";
command = command + commandPart;
chartWizard.Run (command);
// Show dialog wizard
//commandPart = @"/LAUNCHGUI";
//command = command + commandPart;
//chartWizard.Run (command);
// Specify the name or entry id of the manager to display at
// the top of organization chart on the first page.
commandPart = @"/PAGES=";
command = command + commandPart;
commandPart = @StringToFormulaForString(
exchangeIdOfManager);
command = command + commandPart;
// If the caller of the method does not want to include
// all the subordinates on the organization chart, specify
// number of levels to include.
if (allSubordinates == false)
{
commandPart = @Convert.ToString(numAdditionalLevels,
System.Globalization.CultureInfo.InvariantCulture);
command = command + " " + commandPart;
}
// If the caller of the method passed in a page name, then
// that name will be displayed as the page name for this
// organization chart.
if (pageName.Length > 0)
{
commandPart = @StringToFormulaForString(pageName);
command = command + " PAGENAME=" + commandPart;
}
chartWizard.Run (command);
// Begin creating the organization chart.
command = @"/S-RUN";
chartWizard.Run (command);
}
catch (Exception err)
{
returnValue = false;
}
I want to import org data from Exchange using ORGANIZATION CHART WIZARD
and customize the fields to load and draw in the shapes.
So, I found HOWTO articles in MSDN and also in Office Online
Assistance. The article name - "Create an organization chart from a
data file using the command line or Run method"
http://office.microsoft.com/en-us/assistance/HP010384221033.aspx.
Also I used examples from Microsoft Office Visio Code Librarian to
write a C# solution. This solution will help me to automate the process
of generation org charts.
So the trouble: I couldn't customize the fields in parameter
DISPLAY-FIELDS even if I use the correct syntax. If I add the parameter
LAUNCHGUI, execute the ORGANIZATION CHART WIZARD AddOn and manually
select the fields which will be displayed in each box in the
organization chart than the result would be OK. If I define any custom
fields in DISPLAY-FIELDS such as Department Name or Company Name than
wizard'll draw only Name field in each box in the org chart.
Help me? I couldn't find the difference between the actions that I do
in my solution and using drawing-definition organization chart wizard
pages.
Furthermore, I tried to run my solution using Visio 2002 and it works
after renaming the properties in DISPLAY-FIELDS. And even in Visio 2003
import CUSTOM-PROPERTY-FIELDS using my solution were done OK...
Any ideas?
This is the code of solution:
const string ORGANIZATION_CHART_WIZARD = "OrgCWiz";
Microsoft.Office.Interop.Visio.Addon chartWizard;
string command;
string commandPart;
bool returnValue;
try
{
// Get a reference to the Organization Chart Wizard add-on.
chartWizard =
theApplication.Addons.get_ItemU(ORGANIZATION_CHART_WIZARD);
// Initialize the wizard and prepare it to accept a series of
// arguments.
command = @"/S-INIT";
chartWizard.Run(command);
// Tell the wizard that the following string contains arguments.
command = @" /S-ARGSTR ";
// Specify that the organization chart information is from
// Microsoft Exchange.
commandPart = @"/MICROSOFT-EXCHANGE";
chartWizard.Run (command + commandPart);
// Specify which field represents the name.
// /NAME-FIELD="Name"
commandPart = @"/NAME-FIELD="
+ @StringToFormulaForString("Name");
chartWizard.Run (command + commandPart);
// Specify which field represents the manager.
// /MANAGER-FIELD="Manager"
commandPart = @"/MANAGER-FIELD="
+ @StringToFormulaForString("Manager");
chartWizard.Run (command + commandPart);
// Specify which fields to display on the organization chart.
// DISPLAY-FIELDS="Name","Title"
commandPart = @"/DISPLAY-FIELDS="
+ @StringToFormulaForString("Department Name") + ","
+ @StringToFormulaForString("Name");
chartWizard.Run (command + commandPart);
// Specify which custom properties are to be created.
// /CUSTOM-PROPERTY-FIELDS=
commandPart = @"/CUSTOM-PROPERTY-FIELDS="
+ @StringToFormulaForString("UniqueID") + "HIDDEN,"
+ @StringToFormulaForString("Name") + ","
+ @StringToFormulaForString("Manager") + "HIDDEN,"
+ @StringToFormulaForString("Title") + ","
+ @StringToFormulaForString("Department Name") + ","
+ @StringToFormulaForString("Company Name") + ","
+ @StringToFormulaForString("Telephone") + ","
+ @StringToFormulaForString("Address");
chartWizard.Run (command + commandPart);
// Specify which field represents the Unique ID.
// /UNIQUEID-FIELD="UniqueID"
commandPart = @"/UNIQUEID-FIELD="
+ @StringToFormulaForString("UniqueID");
chartWizard.Run (command + commandPart);
// Specify which field represents the manager.
// /FIRSTNAME-FIELD="givenName"
commandPart = @"/FIRSTNAME-FIELD="
+ @StringToFormulaForString("Name");
chartWizard.Run (command + commandPart);
//
commandPart = @"/HYPERLINK-ACROSS-PAGES";
command = command + commandPart;
//
commandPart = @" /SYNC-ACROSS-PAGES";
command = command + commandPart;
chartWizard.Run (command);
// Show dialog wizard
//commandPart = @"/LAUNCHGUI";
//command = command + commandPart;
//chartWizard.Run (command);
// Specify the name or entry id of the manager to display at
// the top of organization chart on the first page.
commandPart = @"/PAGES=";
command = command + commandPart;
commandPart = @StringToFormulaForString(
exchangeIdOfManager);
command = command + commandPart;
// If the caller of the method does not want to include
// all the subordinates on the organization chart, specify
// number of levels to include.
if (allSubordinates == false)
{
commandPart = @Convert.ToString(numAdditionalLevels,
System.Globalization.CultureInfo.InvariantCulture);
command = command + " " + commandPart;
}
// If the caller of the method passed in a page name, then
// that name will be displayed as the page name for this
// organization chart.
if (pageName.Length > 0)
{
commandPart = @StringToFormulaForString(pageName);
command = command + " PAGENAME=" + commandPart;
}
chartWizard.Run (command);
// Begin creating the organization chart.
command = @"/S-RUN";
chartWizard.Run (command);
}
catch (Exception err)
{
returnValue = false;
}