Welcome

SOLIDWORKS PDM Professional API Help
Welcome
Send Feedback

Glossary Item Box

SOLIDWORKS PDM Professional is a product data management application designed to run both natively inside of the SOLIDWORKS environment and as a standalone application.

The SOLIDWORKS PDM Professional Application Programming Interface (API) is an OLE programming interface to SOLIDWORKS PDM Professional, which allows you to automate and customize SOLIDWORKS PDM Professional. The API contains functions that you can call from VB.NET, C#, and C++/CLI. These functions provide direct access to the SOLIDWORKS PDM Professional environment. It is assumed that you are familiar with at least one of these programming languages.

This online reference manual documents the interfaces available in the SOLIDWORKS PDM Professional API, including their structures, methods, properties, and enumerations.

All of the sample code supplied is provided on an as-is basis and is only intended to demonstrate ways of using the SOLIDWORKS PDM Professional API. SOLIDWORKS makes no representations or warranties regarding these samples. Any licensed user of SOLIDWORKS PDM Professional is free to use any or all of these samples in connection with building applications related to SOLIDWORKS PDM Professional and is granted a royalty-free, non-exclusive license for these samples or parts thereof. Intellectual property rights of the samples remain with SOLIDWORKS. Any confidentiality provisions of the SOLIDWORKS PDM Professional license apply to the samples. Some sample code might contain obsolete APIs.


Release Notes

SOLIDWORKS PDM Professional API Help
Release Notes
Send Feedback

Glossary Item Box

This topic provides you with quick access to the enhancements made to SOLIDWORKS PDM Professional API.

  • SOLIDWORKS PDM Professional API 2025
  • SOLIDWORKS PDM Professional API 2024
  • SOLIDWORKS PDM Professional API 2023 SP01
  • SOLIDWORKS PDM Professional API 2022
  • SOLIDWORKS PDM Professional API 2021 SP04
  • SOLIDWORKS PDM Professional API 2021 SP03
  • SOLIDWORKS PDM Professional API 2021
  • SOLIDWORKS PDM Professional API 2020
  • SOLIDWORKS PDM Professional API 2019 SP04
  • SOLIDWORKS PDM Professional API 2019 SP03
  • SOLIDWORKS PDM Professional API 2019
  • SOLIDWORKS PDM Professional API 2018 SP04
  • SOLIDWORKS PDM Professional API 2018 SP03
  • SOLIDWORKS PDM Professional API 2018
  • SOLIDWORKS PDM Professional API 2017 SP01
  • SOLIDWORKS PDM Professional API 2017
  • SOLIDWORKS PDM Professional API 2016
  • SOLIDWORKS PDM Professional API 2015 SP04
  • SOLIDWORKS PDM Professional API 2015 SP03
  • SOLIDWORKS PDM Professional API 2015 SP02
  • SOLIDWORKS PDM Professional API 2015
  • SOLIDWORKS PDM Professional API 2014
  • SOLIDWORKS PDM Professional API 2013
  • SOLIDWORKS PDM Professional API 2012
  • SOLIDWORKS PDM Professional API 2011
  • SOLIDWORKS PDM Professional API 2010
  • SOLIDWORKS PDM Professional API 2009
  • SOLIDWORKS PDM Professional API 2008
  • SOLIDWORKS PDM Professional API 2007 SP03
  • SOLIDWORKS PDM Professional API 2007
  • SOLIDWORKS PDM Professional API version 6.5
  • SOLIDWORKS PDM Professional API version 6.4
  • SOLIDWORKS PDM Professional API version 6.3

SOLIDWORKS PDM Professional API 2025

New interfaces

  • IEdmBomMgr4
  • IEdmHistory4
SOLIDWORKS PDM Professional API 2024

New interfaces and methods

  • IEdmBatchChangeState6
  • IEdmVault22::ADRunSync
  • IEdmVault22::ClearLogs
  • IEdmVault22::GetColumnSets
  • IEdmVault22::GetCurrentColumnSet
  • IEdmVault22::SetColumnSetID

New structure

  • EdmColumnSet
SOLIDWORKS PDM Professional API 2023 SP01

New interface and method

  • IEdmFile18::GetThumbnail3 (retrieves a file's thumbnail handle; obsoletes IEdmFile15::GetThumbnail2)
SOLIDWORKS PDM Professional API 2022

New interfaces

  • IEdmBomView4 (rename a named BOM)
  • IEdmFolder13 (destroy deleted files by specifying EDMDeletedItems)
  • IEdmSerNoGen8 (set the next counter value for serial numbers)
  • IEdmUser11 (specify user settings)
  • IEdmUserGroup9 (specify user group settings)
SOLIDWORKS PDM Professional API 2021 SP04

New interface

  • IEdmRefItem2 (get old and new paths for references that have been moved or renamed by another client)

New structure

  • EdmUpdatedRefPath
SOLIDWORKS PDM Professional API 2021 SP03

New interfaces

  • IEdmBomMgr3 (create a SOLIDWORKS BOM with any number of rows and columns and add it to a non-SOLIDWORKS document)
  • IEdmSWBom
  • IEdmSWBomCell
  • IEdmSWBomColumn
  • IEdmSWBomRow
SOLIDWORKS PDM Professional API 2021

New functionality and interfaces

  • Ability to display minor progress during callbacks. See IEdmCallback8.
  • Ability to retrieve results of a specified favorite search. See IEdmSearch10 and IEdmSearchResult6.
SOLIDWORKS PDM Professional API 2020

New functionality and interfaces

  • Support for BOM in Web 2. Get whether a specified user has permission to see a specified layout and get all of the BOM layouts in the vault. See IEdmBomMgr2::CanSeeBomLayout and IEdmBomMgr2::GetBomLayouts2.
  • Support for file history in Web 2. Get the sorted history and the event description for a specified history item. See IEdmHistory3::GetEventDescription and IEdmHistory3::GetSortedHistory.
  • Extended search functionality includes the ability to:
    • Create an extended search object. See IEdmVault21::CreateSearch2.
    • Use new search syntax. See Search Syntax.
    • Add a multi-variable search condition. See IEdmSearch9::AddMultipleVariableCondition.
    • Get search syntax errors. See IEdmSearch9::GetSyntaxErrors.
    • Use search syntax in existing IEdmSearch* properties and method parameters. See IEdmSearch5::FileName, IEdmSearch5::VersionComment, IEdmSearch5::State, IEdmSearch6::SetToken, and IEdmSearch8::AddVariable2.
  • Get whether a document has cut list items. See IEdmFile17::HasCutlistItems.
  • Get and set whether focus is on the data card view. See IEdmCardView64::IsFocusOnDataCard and IEdmCardView64::SetFlagIsFocusOnDataCard.
  • Get whether a BOM row is a virtual component. See IEdmBomCell2::IsVirtual.

New structure

  • EdmBomLayout2
SOLIDWORKS PDM Professional API 2019 SP04

New functionality and interface

  • Create a file label. See IEdmFile16::CreateLabel.
SOLIDWORKS PDM Professional API 2019 SP03

New functionality and interface

  • Get all controls in a file or folder data card. See IEdmCard7:GetAllControls.
SOLIDWORKS PDM Professional API 2019

New functionality and interfaces

  • Add users by login type to the vault. See IEdmUserMgr10::AddUsers3.
  • Get whether a specified user must add a state change comment for specified workflow transitions for specified documents. See IEdmVault20::GetTransitionCommentPermissions.
  • Get specified files from a vault. See IEdmVault20::GetFiles.
  • Get the archive server log. See IEdmVault20::GetArchiveServerLog.

New structure

  • EdmDocIds

Back to top

SOLIDWORKS PDM Professional API 2018 SP04

New functionality and interfaces

  • Get and run a task add-in that is installed in the Administration tool. See IEdmTaskMgr.
  • Get a file's thumbnail by file version. See IEdmFile15::GetThumbnail2.

New structure

  • EdmTaskInfo
SOLIDWORKS PDM Professional API 2018 SP03

New functionality and interfaces

  • Create configuration values for drawings or other files lacking properties at the configuration level. See IEdmFile14::GenerateDefaultConfigValues.
  • Get the ID of the view in which a file is checked out. See IEdmFile14::LockedOnViewID.
SOLIDWORKS PDM Professional API 2018

New functionality and interfaces

  • Remove a PDM add-in. See IEdmAddInMgr9.
  • Get a list of values associated with a drop-down control on a data card. See IEdmCardControl7.
  • Add custom tabs to a PDM vault view in File Explorer using a PDM add-in. The add-in:
    • implements hooks to allow third-parties to display their user interfaces in a custom tab.
    • supports custom tab names and icons.
    • supports multiple custom tabs.
    • programmatically removes custom tabs.
    • See IEdmCmdMgr6.
  • Change the state of a file using a specific transition. See IEdmFile13.
  • Get the thumbnail of a file. See IEdmFile13.
  • Restore deleted items from the recycle bin to the vault view. See IEdmFolder11.
  • Construct more complicated search criteria using comparators and boolean operators. See IEdmSearch8.
  • Call the Set Revision command to update a revision table in a SOLIDWORKS drawing in this vault. See IEdmVault19.
  • Copy an assembly tree of referenced parts and drawings to a destination folder. See IEdmVault19

New structures

  • EdmCopyTreeOptions
  • EdmDeletedItems
  • EdmSimpleXRefInfo

SOLIDWORKS PDM Professional API 2017 SP01

New interfaces

  • IEdmVault18
SOLIDWORKS PDM Professional API 2017

New interfaces

  • IEdmBatchListing4
  • IEdmBomView3
  • IEdmEnumeratorCustomReference7
  • IEdmEnumeratorVersion7
  • IEdmFile12
  • IEdmFolder10
  • IEdmHistory2
  • IEdmRevision7
  • IEdmTemplate6
  • IEdmUserMgr9
  • IEdmVersion8
  • IEdmVault17

New structures

  • EdmListFile2
  • EdmStatePermission
  • EdmTransitionPermission

SOLIDWORKS PDM Professional API 2016
  • SOLIDWORKS Enterprise PDM is now called SOLIDWORKS PDM, and the API is only available in SOLIDWORKS PDM Professional.

New interfaces

  • IEdmFolder9
  • IEdmReference11
  • IEdmVault16

SOLIDWORKS PDM Professional API 2015 SP04

New interfaces

  • IEdmBatchChangeState5
  • IEdmEnumeratorVariable10

SOLIDWORKS PDM Professional API 2015 SP03

New interface

  • IEdmVault15

Back to top

SOLIDWORKS PDM Professional API 2015 SP02

New interfaces

  • IEdmBatchChangeState4
  • IEdmCardControl6
  • IEdmFile10
  • IEdmFile11
  • IEdmTransition10

Back to top

SOLIDWORKS PDM Professional API 2015
  • In:
    • 2015 SP0 and later, licenses are shared among all vaults that use the same SolidNetwork License Server (SNL). See IEdmVault14::InstallLicense2.
    • 2014 and earlier, licenses were shared among all vaults that were in the same SQL Server instance. IEdmVault14::InstallLicense2 obsoletes and replaces IEdmVault11::InstallLicense.I
  • Includes a new primary interop assembly (also called an interop) called EPDM.Interop.EPDMResultCode.dll for return codes and for use with stand-alone applications. See Using .NET Framework 4.0 in Stand-alone Applications for more information.

New interfaces

  • IEdmEnumeratorVersion6
  • IEdmFile9
  • IEdmFolder8
  • IEdmReference10
  • IEdmRevision6
  • IEdmVault14
  • IEdmVersion6
  • IEdmVersion7
SOLIDWORKS PDM Professional API 2014
  • SOLIDWORKS Enterprise PDM API Help has been upgraded to be consistent with all of the other SOLIDWORKS API Help systems. For example, SOLIDWORKS Enterprise PDM API Help now includes syntax for VB.NET, C#, and managed C++ and a Send Feedback link on most Help topics. Additionally, SOLIDWORKS Enterprise PDM API Help:
    • contains updated Stand-alone Applications and Add-in Applications books and Help topics.
    • includes C# and VB.NET add-in and stand-alone code samples that you can recreate in Microsoft Visual Studio. If you use the local version of SOLIDWORKS Enterprise PDM API Help, then click the Index tab and type C# add-ins, C# examples, VB.NET add-ins, or VB.NET examples to quickly locate these examples. Additional examples will appear in subsequent releases.
    • is now available on the:
      • SOLIDWORKS Help menu, Help > API Help > SOLIDWORKS Enterprise PDM API Help.
      • internet, help.solidworks.com > API Help (English only) > SOLIDWORKS Enterprise PDM API Help.
    • SOLIDWORKS Enterprise PDM includes a primary interop assembly (also called an interop) called EPDM.Interop.epdm.dll for use with stand-alone applications. See Using .NET Framework 4.0 in Stand-alone Applications for more information.
  • Any application not supplied and supported by SOLIDWORKS Corporation that logs into SOLIDWORKS Enterprise PDM or directly accesses the database must ensure that sufficient SOLIDWORKS Enterprise PDM licenses are available when the same user is not logged into a local view.

    To make this easier to program and to comply with the SOLIDWORKS End User License Agreement (EULA), SOLIDWORKS Enterprise PDM API 2014 includes a new login method called IEdmVault13::LoginEx. This method ensures that licenses are properly consumed by the application.

New structure

  • EdmListRef

New method

  • IEdmVault13::LoginEx

Back to top

SOLIDWORKS PDM Professional API 2013

New interfaces

  • IEdmAddCustomRefs2
  • IEdmBatchUnlock2
  • IEdmEnum
  • IEdmEnumeratorCustomReference6
  • IEdmFindUser
  • IEdmImage
  • IEdmTransition8
  • IEdmUser10
  • IEdmUserMgr8
  • IEdmBatchChangeState2

Back to top

SOLIDWORKS PDM Professional API 2012

New interfaces

  • IEdmBatchDelete3
  • IEdmEnumeratorVariable9
  • IEdmFolder7

Back to top

SOLIDWORKS PDM Professional API 2011

New interfaces

  • IEdmCmdNode
  • IEdmLabel6
  • IEdmMenu7
  • IEdmUpdateReferences
  • IEdmVariableMgr7
  • IEdmGetOpCallback2
  • IEdmReference8
  • IEdmReference9
  • IEdmState7
  • IEdmTransition7
  • IEdmUser8
  • IEdmUserGroup7
  • IEdmVault12

Back to top

SOLIDWORKS PDM Professional API 2010

New functionality

You can now program items and tasks.

New interfaces

  • IEdmAddInMgr8
  • IEdmBatchItemGeneration
  • IEdmBatchItemGeneration2
  • IEdmBatchItemReferenceUpdate
  • IEdmBatchRefVars
  • IEdmClearLocalCache2
  • IEdmFile8
  • IEdmItem
  • IEdmReference7
  • IEdmSelectionList6
  • IEdmTaskInstance
  • IEdmTaskProperties
  • IEdmUser7
  • IEdmUserGroup6
  • IEdmUserMgr7
  • IEdmVault11

Back to top

SOLIDWORKS PDM Professional API 2009

New interfaces

  • IEdmBatchAdd2
  • IEdmBatchChangeState
  • IEdmBatchDelete2
  • IEdmBatchListing2
  • IEdmBom
  • IEdmBomCell
  • IEdmBomMgr
  • IEdmBomView
  • IEdmFile7
  • IEdmMenu6

Back to top

SOLIDWORKS PDM Professional API 2008

New and changed functionality

  • Visual Basic 6 is no longer supported. All add-ins must now be multi-threaded; for example, create your add-ins using the Visual Studio .NET development environment.
  • The recommended way of accessing variables has changed. See IEdmEnumeratorVariable8::CloseFile.

New interfaces

  • IEdmBatchDelete
  • IEdmClearLocalCache
  • IEdmAddInMgr7
  • IEdmHistoryUpdate
  • IEdmEnumeratorVariable8

    Back to top

SOLIDWORKS PDM Professional API 2007 SP03

New functionality

Support for 64-bit add-ins for the 64-bit version is included in this release.

New interface

  • IEdmRevisionMgr2

SOLIDWORKS PDM Professional API 2007

New interfaces

  • IEdmRevisionMgr
  • IEdmSearch6
  • IEdmUserMgr6
  • IEdmVariableMgr6

Back to top

SOLIDWORKS PDM Professional API version 6.5

Conisio has been re-branded as SOLIDWORKS Enterprise PDM; however, an OEM-version of the product sold under the name Conisio still exists. Both of these products share the same API.

New and changed functionality

  • The name of the type library has changed from ConisioLib to EdmLib.
  • The name of the API has changed from Conisio 6.4 Type Library to PDMWorks Enterprise 6.5 Type Library.

    NOTE: The change in the name of the type library might require you to recompile existing applications. However, the names of all interfaces, structures, methods, properties, and enumerations are unchanged.

Back to top

SOLIDWORKS PDM Professional version 6.4

New functionality

  • Debugging add-ins has improved.
  • You can create add-ins:
    • using the Microsoft Visual Studio.NET development environment.
    • that add menu commands to the SOLIDWORKS PDM Professional Administration tool menu.

New interfaces

  • IEdmBatchAdd
  • IEdmBatchListing
  • IEdmCard6
  • IEdmHistory
  • IEdmRawReferenceMgr
  • IEdmRefItem
  • IEdmRefItemContainer
  • IEdmSerNoGen7
  • IEdmSerNoValue
  • IEdmVariableValue6
  • IEdmVault8

Back to top

SOLIDWORKS PDM Professional API version 6.3

New interfaces

  • IEdmAddCustomRefs
  • IEdmBatchAddFolders
  • IEdmBatchGet
  • IEdmBatchUnlock
  • IEdmBatchUpdate2
  • IEdmCardView63
  • IEdmUnlockOpCallback

    Back to top


Getting Started

SOLIDWORKS PDM Professional API Help
Getting Started
Send Feedback

Glossary Item Box

SOLIDWORKS PDM Professional Application Programming Interface

SOLIDWORKS PDM Professional’s application programming interface (API) gives you access to most of the functionality in SOLIDWORKS PDM Professional. For example, you can programmatically:

  • Manage:
    • Vaults and their views
    • Users and user groups
    • File and folder cards and their views
    • File references
    • Card variables and attributes
    • Workflows, states, and transitions
    • Tasks
  • Access:
    • Vault items
    • History of files and folders
    • Versions and revisions of files
    • Templates installed in the vault
  • Search vaults and browse vault folders
  • Check files in and out of the vault
  • Send messages to users
  • Create add-ins

See the Release Notes for the updates made to recent releases of the SOLIDWORKS PDM Professional API.

Applications

You can write two types of applications using this API:

  1. Stand-alone applications (.exe and .dll) that are called by other programs to use various features of SOLIDWORKS PDM Professional.
  2. Add-in applications that are called by SOLIDWORKS PDM Professional when users perform actions like check in or check out of a file, add a file to the vault, change the state of a file, etc.

Primary Assembly Interops

SOLIDWORKS PDM Professional includes two primary interop assemblies (also called interops) for use with stand-alone SOLIDWORKS PDM Professional applications:

  • EPDM.Interop.epdm.dll
  • EPDM.interop.EPDMResultCode.dll

The interops are stored in the top folder of your SOLIDWORKS PDM Professional installation.

  • 32-bit interops are shipped with the 32-bit version of SOLIDWORKS PDM Professional.
  • 64-bit interops are shipped with the 64-bit version of SOLIDWORKS PDM Professional.

See Using .NET Framework 4.0 in Stand-alone Applications for more information.

See Also

Return Codes

TroubleShooting Guide


Search Syntax

SOLIDWORKS PDM Professional API Help
Search Syntax
Send Feedback

Glossary Item Box

Before now you searched for documents in the vault using text, comparison operators, and wildcards. As of SOLIDWORKS PDM Professional 2020, you can search using a richer syntax set. To do this, create a new search object using IEdmVault21::CreateSearch2. The new search object gives all IEdmSearch* properties and method parameters the enhanced search syntax capability outlined below.

Summary of Syntax Kernel Logic

Basic Syntax - Details

  • Syntax expressions
  • Patterns (Variable, Search, and Complex)
  • Encapsulated expressions and complex patterns
  • Patterns and comparisons
  • Explicit/implicit data types
  • Colon-attached specifiers

Advanced Syntax - Details

  • Advanced specifiers
  • Multi-value specifiers
  • Variable (@) and configuration (@@) bindings
  • Colon-attached bindings

Examples

  • Using Basic Search Syntax (VB.NET)
  • Using Basic Search Syntax (C#)

Summary of Syntax Kernel Logic

A. The basic rules - preparing variable names and search values

  • Comparison operators: =, <, >, <>, <=, >=.
  • Contains patterns (P) and comparisons (<= Q) can be combined using logical operators AND (&), OR (|) and NOT (!) and parentheses ().
  • Negated comparisons are similar to negated simple patterns. For example, !=P is the same as !{=P}. <>P is the same as {!=P} and (< P | > P).
  • Spaces may be used to divide operands and operators for readability.
  • AND is implicit in patterns. For example, (P Q R) means P & Q & R.
  • The order of logical operator processing is NOT, AND, OR.
  • To search for spaces and special characters, quote them with " or escape them with \.
  • A quotation mark inside a pattern is not interpreted. To recognize ", escape it with \.
  • A backslash inside a pattern must also be escaped with \.
  • \ escapes both inside and outside of quotations.
  • * and ? are wildcards both inside and outside of quotations, but only in the context of Contains or !Contains.
  • \ is not required before * and ? in variable/configuration names or with comparison operators.
  • Numeric constants are compared as numbers only if the variable has a numeric data type.
  • Correctly represented dates (as quoted or unquoted strings) are compared as dates only if the variable has the DATE data type.

- Back to top -

B. Patterns and comparisons (explicit and implicit data types)

  • Single-value search logic is the default search logic. All conditions are implicitly contained in {} (see Encapsulated expressions and complex patterns). You can use braces, but they do not change the underlying logic. In single-value search logic, condtions target single variables/condigurations. For example,

A & B and {A B} both find documents containing variable values that contain both A and B

  • : !P finds documents even if they have no variable values.
  • {!P} only finds documents with existing variable values.
  • : !P or !{...} finds all those documents that aren't found by P (or {...})
  • Patterns can be negated indirectly. For example,

!(!P | Q) is the same as P & !Q

  • Comparisons (including =, < , ...), even combined with AND/OR, always work over a single value, whether negated or not (directly or indirectly).
  • Data type specifiers (TEXT, INT, ...) explicitly set how patterns should be compared.
  • TEXT and the other data types have the same priority as NOT. For example, in condition INT A B, INT operates only on A. To extend the scope of INT, INT(A & B) should be used.
  • The common data type of a multi-variable field is detected implicitly:

If texts are mixed with non-texts, then the data type is TEXT.

If dates are mixed with non-dates, then it is TEXT.

If integers are mixed with floats, then it is FLOAT.

- Back to top -

C. Variables (@) and configurations (@@)

  • @ introduces a variable, e.g., @Comment, @"Document number". Quotation/escaping is needed in case of spaces or special characters. Case is not detected.
  • @ can also be used with a numeric constant representing a variable ID.
  • @ can also be a binder that binds a certain variable to a syntax expression that follows. For example,

@Author!=Pete

  • A binding can be multi-variable (like @(...)) with several variables inside that are delimited by OR (|). For example,

@(Author | Creator) != Pete

  • "" or 0 represents a multiple "variable" that includes all common variables in the database. It corresponds to <Any Variable> in tab Variables.
  • _Name is a special "variable" which corresponds to the file/folder name criterion.
  • A binding has the same priority as NOT, !, TEXT, DATE, etc. For example,

In @Version P Q, Version must contain P, and Q must be found in another variable specified in the attached variable list.

In @Variable1 (@Variable2 P & Q), P must be found in Variable2 and Q must be found in Variable1.

  • @Var1 @Var2 P results in a syntax error. To set multiple variables, use @(Var1|Var2) P.
  • Parentheses can change the binding's operation, e.g., @Version(P Q) means Version must contain both P and Q.
  • Bindings are directly applied to positive patterns in a distributive fashion (either simple (P), or complex { ... }). For example,

@Number(!P &{ Q | R }) is the same as !@Number(P) & @Number{Q | R}

  • @ is not allowed inside encapsulation braces { ... }.
  • In addition to | , variables can be combined with AND (&), NOT (!), and parentheses. For example,

@("" & !Comment) P means at least one of the database variables, but not Comment, contains P.

  • @@ introduces configurations in the same way that @ introduces variables. For example,

@@"@" P means search only the default configuration ("@") to find P.

  • "" or 0 represents a multiple "configuration" which includes all configurations from the database.
  • Default configuration is "@".
  • Configuration 1 has a predefined name " " (a single space), no matter what its name is in the database.
  • @() and @@() represent the initial setting of variables / configurations.
  • @() means no variables (as initially in tab Variables).
  • @@() means the same as @@"" or @@0. By default all configurations are searched.

- Back to top -

D. Colon-attached (:) specifiers and variables

  • Some keywords and operators at the beginning of (sub)-formula can have a colon attached, e.g., AND:, OR:, NOT:, &:, |:, !:, TEXT:, INT:, FLOAT:, DATE:. Such specifiers have the lowest priority and are processed after (), {}, NOT, AND, OR. For example,

TEXT: a | b is the same as TEXT(a | b)

(TEXT: a) & (INT: 1) is the same as TEXT a INT 1

NOT: a b is the same as NOT(a b)

  • OR: implicitly sets spaces as ORs inside a given (sub-)formula.
  • AND: implicitly sets spaces as ANDs inside a given (sub-)formula.
  • You can use a colon in place of @ for variable binding. Instead of @(Author|Comment|_Name|52) (john|smith) you can use Author:Comment:_Name:52: john|smith.
  • You can use two colons in place of @@ for configuration binding. For example, "@":: 1:: 3:: john|smith.

E. The advanced and multi-value specifiers (@: and :)

  • The basic search syntax can be restrictive (i.e., no variable/configuration binding, no syntax error reporting, no explicit variable/config names/ids in conditions).
  • @: placed at the beginning of a condition permits:
    • Variable/configuration binding, including the colon-attached format. For example, @:Comment:city finds documents where Comment contains city.
    • Multi-value search logic in which conditions target multiple variables/configurations. Braces are needed to specify single-value complex patterns.
    • Syntax error reporting.
    • Using _Name to represent a file/folder name.
    • Using virtual variables, including "" and 0 which represent all variables or configurations.
  • : (colon) placed at the beginning of a condition permits:
    • Multi-value search logic in which conditions target multiple variables/configurations. Braces are needed to specify local single-value complex patterns within the multi-value condition.

- Back to top -

Basic Syntax - Details

Syntax expressions

Syntax expressions and patterns are the new search values. The former search value Metal is exactly the same as the new corresponding pattern Metal. Syntax expressions include conditions with logical operators AND/OR/NOT or their shortcuts & | !. For example, Ferrous & Metal means a document should contain both substrings, Metal and Ferrous.

Single-value search logic is the default search logic. In single-value search logic conditions target single variables/configurations. Documents that contain a variable/configuration which satisfies the single-value complex pattern are found. Any condition that is passed as a second argument to IEdmSearch8::AddVariable2 or IEdmSearch9::AddMultiVariableCondition is also implicitly enclosed in {} and is processed as a single-value complex pattern. (For multi-value search logic, see the Advanced Syntax - Details section.)

The logical AND can be applied implicitly by omitting AND (&). For example, Ferrous Metal. However, the old search value, Ferrous Metal, meant an exact phrase to be searched inside a variable value. According to the new rules, you should apply quotation marks to set the exact phrase, "Ferrous Metal". The quotation marks are auxiliary here - they don't belong to the searched text itself. This is similar to Google Search where Metal and Ferrous can be found in different places of the document, in any order, in any number of instances, and so on. If we want to search for the phrase Ferrous Metal in Google Search, then we must quote it. The same is now true with SOLIDWORKS PDM Pro 2020.

If a quotation mark itself belongs to the searched text, then it has to be preceded by an auxiliary backslash. For example, \". Each searched backslash has to be also preceded by another backslash - the first is an auxiliary one, the second is an actual character. In fact, any character can be escaped in that way. Special characters like &, | and others cannot be searched directly: A&B means "A" AND "B" but not "A&B". So they should be either quoted or escaped, or both, if searched, e.g. "A&B" or A\&B or "A\&B".

You can avoid using quotes in favor of escaping. For example, Ferrous\ Metal (the space is escaped). On the contrary, you can always use auxiliary quotes, even if they are not really needed. For example, "Metal".

When quoting, the searched text should be between the beginning and the ending quote, so "" means an empty string. Quoted and unquoted pieces cannot be attached to each other. For example, "("abc")" is incorrect.

- Back to top -

Patterns (Variable, Search, and Complex types)

A pattern is any quoted or unquoted searched (as a whole unit) text. For example, Ferrous Metal contains two patterns, and "Ferrous Metal" is a single one.

A pattern is a syntax expression that represents a searched value or a variable/configuration name or ID. Though we sometimes say "Document number" is a variable name, that is not correct. The variable name is actually Document number. It is quoted, "Document number", to represent the variable name. We can represent the variable name in different ways, e.g. Document\ number.

Simple names (or searched values) can be identical to their representations: Author, Comment, etc. However, even simple names can be represented by different patterns: Author, "Author", \Author, Au\thor, "\Author" represent the same name, Author. Document number cannot be identical to its representation because of the space inside its name.

When talking about variables and configurations, numeric constants are database IDs. If a variable name in the database is identical to a numeric constant (i.e., constituted of digits), then you should use quotation marks or backslashes in its representation to differentiate it from numeric constants, i.e., "51", \82. If a name in the database begins with _, it must also to be represented using " or \ because initial-underscored names are reserved for syntax usage.

Patterns may require another set of quotes as are required in C# or VB applications to escape their own reserved characters.

Spaces can be used or not between patterns and comparison/logical signs and parentheses to improve readability.

Without a comparison sign, any pattern is interpreted in the context of "Contains". In such cases, * and ? (if not escaped) work as wildcards "any number of characters" and "a single arbitrary character", e.g. "(*)" means a variable value should begin with "(" and end with ")". If no explicit non-escaped wildcards, they are meant implicitly. For example, Metal is equivalent to *Metal* (if no comparison sign, of course). Due to the explicit wildcard, "(*)" represents the whole variable value, not a substring inside it.

When talking about searched values (i.e. not about variable/configuration names), patterns can include wildcards, but only in the context of Contains, i.e. without =, <, >, etc. A pattern with wildcards represents a multitude of values. Again different patterns with wildcards can be equivalent to one other, even without " and \. For example, a*z represents the same set of values as a**z. Of course, \ and " give other equivalent representations: "a**z", \a*z, "a*\z", etc. Note, you cannot use \ before wildcards if they are expected to work as wildcards. For example, a\*z represents exactly one word of three characters: a, *, and z. A backslash (\) before * and ? makes them common characters, no matter in what context. \ is not required before * and ? in variable/configuration names or with =, <, >, etc.

A complex pattern is any expression of the kind of {...}. Variables and configurations cannot be represented by complex patterns, and comparison operators cannot stand before them. Complex patterns are always considered in the context of Contains. For example,

{a* & *z} is interpreted as "Contains a value that satisfies the condition inside {...}"

It's clear that a complex pattern {a* & *z} and a simple one a*z can both represent the same set of searched values.

It's easy to find examples where a pattern is equivalent to a non-pattern: Ferrous is equivalent to (Ferrous) and to {Ferrous}, and to (Ferrous & Ferrous), and to !!Ferrous.

Positive patterns only work over existing document values. If a document contains a value that satisfies the given pattern, then the document is found. Any encapsulated complex sub-condition {...} is also a positive pattern. {!P}, being a positive complex pattern, only works on existing values. If one value/configuration of the document contains P but another one does not, the document is found. If a pattern is in the scope of a single variable and a single configuration, then {!P} AND P cannot be satisfied. If several variable/configurations are inolved, :{!P} & P may find some documents.

Negative patterns are patterns that are under negation. For example, !Metal. Negation can be indirect. For example, !(A !B) means that A is negated and B is not negated. Negative patterns find all those documents that are not found by corresponding positive patterns.

For example,

: !P yields every document that doesn't contain P in any of its variables/configurations. It may find documents that don't have any values at all, because emptiness also does not contain P.

{!P}, being a positive complex pattern, only works on existing values.

!{!P} returns all documents where each existing value contains P, including those documents without values.

P & !P returns no documents.

: P | !P returns all documents.

- Back to top -

Encapsulated expressions and complex patterns

A complex pattern is any expression of the kind of {...}. Variables and configurations cannot be represented by complex patterns, and comparison operators cannot appear before them. Complex patterns are always considered in the context of Contains. For example,

{a* & *z} is interpreted as "Contains a value that satisfies the condition inside {...}"

It's clear that a complex pattern {a* & *z} and a simple pattern (a*z) can both represent the same set of searched values.

Braces ({}) show that the whole sub-formula inside them should be searched for within a single variable value (for a given combination of variable and configuration). {Metal Ferrous} means that both substrings Metal and Ferrous should belong to the same variable value in the same configuration (in any order, in any places, and in any number of instances). Without braces, Ferrous can be found in one variable (or configuration) and Metal in a different variable (of the same document, of course).

Encapsulated expressions {...} can be considered complex patterns. You can write a*b or {a* & *b}. Both mean the same and both are checked inside the same single value.

{!=100} only finds a document that has a certain value not equal to 100, though some other value can be equal to 100. <>100 works the same as {!=100}. !{=100} or just !=100 only finds those documents that don't have any values equal to 100 (multi-value context).

Basic search syntax employs single-value search logic that implicitly encapsulates conditions in braces. You can use braces, but they do not change the underlying logic.

Advanced search syntax employs multi-value search logic that does not implicitly encapsulate conditions in braces. You must use braces to specify complex patterns. (See the Advanced Syntax- Details section.)

- Back to top -

Patterns and comparisons

A comparison is a combination of a sign like =, <, >= etc. and a pattern like =Ferrous.

Patterns and comparisons are simple operands (i.e. terms) that can be combined with AND, OR, NOT. To set the logical order, use parentheses: (sldptr | txt) & attachment. Without parentheses, NOT has the highest priority and OR has the lowest.

Spaces can be used or not between patterns and comparison/logical signs and parentheses to improve readability.

Without a comparison sign, any pattern is interpreted in the context of "Contains". In that case, * and ? (if not escaped) work as wildcards (* = "any number of characters" and ? = "a single arbitrary character"). For example, "(*)" means a variable value should begin with "(" and end with ")". If no explicit non-escaped wildcards, they are meant implicitly. For example, Metal is equivalent to *Metal* (if no comparison sign, of course). Due to the explicit wildcard, "(*)" represents the whole variable value, not a substring inside it.

- Back to top -

Explicit/implicit data types

Expressions are processed under a certain data type that has been inherited from the field variable. You can explicitly set a different data type. For example, in DATE >="Jan 15, 2005" , "Jan 15, 2005" will be considered a date type, not a string type. In the DATE context, patterns will be compared as texts if they don't represent correct dates. A correct date representation can be quoted or have escaped characters.

Each of data type specifiers (TEXT, INT, FLOAT, DATE) has the same priority as NOT.

In the TEXT context, all patterns are considered as string values.

In the INT or FLOAT context, each pattern which represents a correct numeric constant is compared as a number, otherwise as text. E.g. "123" and \123 aren't correct constants, so they will be compared as string values.

In the case of multi-variable search syntax, the common implicit field data type is automatically detected from variables. For example, if dates are mixed with non-dates (or texts mixed with non-texts), then the date type will be TEXT; when INT is mixed with FLOAT, then the date type will be FLOAT. Booleans are considered as INTs (0 or 1). Automatic types are only used if there are no explicit type specifiers.

Colons can be used to change the priority of NOT and specifiers, e.g. INT: >=1 <=10 sets the integer type for the whole expression. Without the colon, INT would have operated only on >=1.

Such "colon-attached" specifiers as AND: and OR: (&: |:) set spaces as the implicit AND or the implicit OR. For example,

OR: a b c (&: d e f) is equivalent to a | B | c | d & e & f.

By default AND is the implicit operator.

The full list of "colon-attached" specifiers (no space before the colon):

TEXT: INT: FLOAT: DATE: AND: OR: NOT: &: |: !:

Data type specifiers and bindings are applied directly to positive patterns inside the linked expression. A data type specifier or binding just sets the scope. Units which a type/binding act on are only positive patterns. For example,

TEXT ( !1 & (200 | 300) ) is actually processed as ! TEXT 1 & (TEXT 200 | TEXT 300)

It would be similar if there had been a single-variable or multi-variable binding in place of TEXT.

Data types operate the same between () and {}, so you can write {INT 1 & TEXT a}. However, for bindings each {...} is considered a large atomic positive pattern.

- Back to top -

Colon-attached specifiers and variables

Consider INT( >=1 <=10 ). The parentheses are required because INT has the same priority as NOT. Without them, INT would only affect >=1, the whole expression being equivalent to INT( >=1 ) <=10.

INT: has the lowest priority. It is processed after NOT, AND and OR. Thus, INT: >=1 <=10 is the same as INT: (>=1 <=10). Owing to the colon, you can omit parentheses, making the expression simpler.

All the colon-attached specifiers have the same lowest priority. They are especially convenient when you apply them to the whole condition. However, when applying to simple operands (e.g. to terms containing patterns and comparisons), colon-attached specifiers may be unnecessary. For example,

(INT: 100) | (TEXT: abc) is equivalent to a much simpler INT 100 | TEXT abc

Because of their lowest priority and for the sake of avoiding ambiguities, all the colon-attached specifiers have to be used one by one on the left of the subsequent expression. They are placed at the very beginning of the whole condition or between "(" and the expression. The scope of such specifiers extend to the end of the condition or up to the corresponding ")". For example,

Comment: 1:: "Document number": 2:: 123 & abc

has four specifiers followed by the syntax expression, 123 & abc. In the case of several colon-attached variables before the same syntax expression, all variables are implicitly grouped in a single binding with | between variable names. All the colon-attached configurations are similarly grouped in their own binding. The order of names/IDs/variables/configurations is not important.

- Back to top -

Advanced Syntax - Details

Advanced specifiers (@:)

Single-value search logic is the default search logic (see the Basic Syntax - Details section.) In some cases, multi-value search logic is needed. In multi-value search logic, conditions target multiple variables/configurations. To turn on multi-value search logic, you must use either the multi-value specifier, :, or the advanced specifier, @:. Advanced specifiers allow you to use variable/configuration names/identifiers inside conditions. They also turn on syntax checking and reporting. To turn on multi-value search logic and syntax checking, a condition must begin with @:. Because @ has a special meaning, it should be quoted or escaped if it is being searched for in patterns. The advanced specifier forces you to write safer and less ambiguous expressions. It forbids risky syntax elements such as inch (") constants. For example, it requires you to use 4\" instead of 4". With the advanced specifier, you must use {} to specify local single-value complex patterns within multi-value conditions (see Encapsulated expressions and complex patterns).

Multi-value specifiers (:)

The multi-value specifier (:) is a light version of the advanced specifier (@:). Like @:, the multi-value specifier (:) placed before a condition turns on multi-value search logic and indicates that you must use {} to specify local single-value complex patterns within multi-value condition. Unlike @:, the multi-value specifier (:) does not allow explicit variables/configurations and does not support syntax error messaging. For example,

A B is equivalent to :{A B}

: {=5 =10} returns no documents

If you want a document with 5 in one variable/configuration and 10 in another variable/configuration, use:

: =5 =10

To check whether a value is in a range, curly braces should be applied:

:{>=1 <=10}

Braces are not necessary for ranges if there is no multi-value specifier:

>=1 <=10

Variable and configuration bindings

@ is called "variable binder", because it binds a variable to a pattern or representation. It indicates that the subsequent pattern represents a variable name or identifier (if a numeric constant). For example, @Comment, @"Document number". A combination of a variable binder and a pattern is a binding. The binding has the same priority as DATE or NOT. The binding acts on the subsequent operand, i.e., it indicates that it needs to be compared with the given variable, e.g. @Number=100, @Author Johns.

A binding can contain multiple variables. For example, @(Comment | "Document number") 123 which is equivalent to @Comment 123 | @"Document number" 123. We can also use the other logical operators inside a binding. For example, @(V & !U) P is the same as @V(P) & !@U(P). Multi-variable bindings provide better performance when compared to equivalent expressions where all bindings are single-variable ones.

If a variable name begins with an underscore, then it should be quoted/escaped, e.g. @"_SpecialVar". Initial-underscore names are reserved for future syntax extensions. Currently only _Name has a special meaning in the syntax. _Name is a virtual variable indicating the file/folder name of a searched document/project. _Name can be used in any place where common variable names are used. _Name and _name are equivalent.

An empty string "" or numeric constant 0 represents one or more "virtual" variables. It can be used to specify the whole set of the database variables. @"" is like @(var1 | var2 | ... | varN) which enumerates all of the common variable names. @("" | _Name) includes file/folder names in that enumeration.

A configuration binder @@ is similar to @ but deals with names and IDs of configurations. Again, @@0 or @"" searches over all configurations (and is assumed implicitly). Configuration 1 is present in projects and non-SOLIDWORKS documents and has a predefined name " ", i.e. a single space. Configuration 2 (commonly named "@") represents the default configuration.

@() and @@() set the initial (default) binding state: @() indicates that no variables are defined, so they should be explicitly present in the subsequent sub-formula. @@() is the same as @@0 and indicates that all configurations are searched.

You can think of data type specifiers and bindings as applied directly to positive patterns inside linked expressions. A data type specifier or binding just sets the scope. Units that a type/binding acts on are positive patterns.

@(var1|var2) (>=100 !150 <=200) is equivalent to @(var1|var2) {>=100 <=200} & !@(var1|var2) 150.

Colon-attached bindings

Bindings can be set in the "colon-attached" format. For example,

Comment: 1:: "Document number": 2:: 123 & abc is the same as @(Comment | "Document number") @@(1|2) (123 & abc)

Configuration bindings use colons to differentiate them from variable bindings.

@ and @@ are not applied at all if colons are used.

- Back to top -


SOLIDWORKS PDM Professional API Help

Stand-alone Applications (C++)

This topic describes how to create a C++ Windows MFC stand-alone application that logs into a SOLIDWORKS PDM Professional file vault and lists the files in the root folder.

  1. Start up Microsoft Visual Studio.
  2. Click File > New > Project > C++, Windows, Desktop > MFC App.
    1. Enter Project Name and Solution name.
    2. For Location, click ... and browse to the folder where to create your project.
    3. Click Create.
    4. Select Dialog based in Application type dropdown.
    5. Click Next, Next, Next, and Next.
    6. Click Finish.
  3. Click Build > Build Solution.
    4.
  4. Copy C:\Program Files\SOLIDWORKS PDM\EdmInterface.dll to the project folder.
  5. Drag a button from the Toolbox onto the form.
  6. Double-click Button1 on the form.
  7. Add the following code after the #include statements:
    #import "Edminterface.dll" no_namespace
  8. Find and replace
    //TODO: Add your control
    notification handler code
    here, which appears
    in the button's command handler, with the following code. Fix the formatting
    of the code if needed.
//Initialize COM (Usually done just once, for
    instance in InitInstance.)
CoInitialize(0);

IEdmVault5Ptr poVault;
HRESULT hRes = poVault.CreateInstance( __uuidof(EdmVault5), NULL );
try
{
//Create a vault interface.
if( FAILED(hRes) )
_com_issue_error(hRes);

//Log in on the vault.
poVault->LoginAuto( "MyVault", (long)m_hWnd );

//Get a pointer to the root folder.
IEdmFolder5Ptr poFolder;
poFolder = poVault->RootFolder;

//Get position of first file in the folder.
IEdmPos5Ptr poPos;
poPos = poFolder->GetFirstFilePosition();

CString oMessage;
if( poPos->IsNull )
oMessage = "The root folder of your vault does not contain any files.";
else
oMessage = "The root folder of your vault contains these files:\n";

while( poPos->IsNull == VARIANT_FALSE )
{
IEdmFile5Ptr poFile = poFolder->GetNextFile( poPos );
oMessage += (LPCTSTR)poFile->GetName();
oMessage += "\n";
}

AfxMessageBox( oMessage );
}
catch( const _com_error &roError )
{
//We get here if one of the methods above failed.
if( poVault == NULL )
{
AfxMessageBox( _T("Could not create vault interface." ));
}
else
{
BSTR bsName = NULL;
BSTR bsDesc = NULL;
poVault->GetErrorString( (long)roError.Error(), &bsName, &bsDesc );
bstr_t oName( bsName, false );
bstr_t oDesc( bsDesc, false );

bstr_t oMsg = "Something went wrong.\n";
oMsg += oName;
oMsg += "\n";
oMsg += oDesc;
AfxMessageBox( oMsg );
}
}

//Deinitialize COM.
CoUninitialize();
  9. Replace MyVault in the code with the name of a SOLIDWORKS PDM Professional vault on your computer.
  10. If creating this project on a 64-bit computer, change the platform to x64:
    1. Right-click the name of your project in the Solution Explorer and click Properties.
    2. Click the Configuration Manager button.
    3. Click the down-arrow button in the Platform column and select New.
    4. Select x64 in New platform and click OK.
    5. Click Close. If Active(x64) is not shown in Platform, then repeat Steps 2 - 5 until it is.
    6. Click OK.
  11. Specify the project configuration properties:
    1. Right-click the name of your project in the Solution Explorer and click Properties.
    2. Click Configuration Properties > General.
    3. Set Use of MFC to Use MFC in a Shared DLL.
    4. Set Character Set to Use Unicode Character Set.
  12. Click Build > Clean Solution.
  13. Click Build > Rebuild Solution.
  14. Click Debug > Start Debugging or press F5.
    1. Click Button1.

A message box is displayed that either contains the names of the files in the root folder of the specified vault or informs you that the root folder of the specified vault does not contain any files.
    2. Close the form.
  15. Click File > Save All.

See Also

Stand-alone Applications (VB.NET)

Destroy Deleted Files in Vault Example (C++)

Destroy Deleted Files in Vault Example (VB.NET)


SOLIDWORKS PDM Professional API Help

Stand-alone Applications (C#)

This topic describes how to create a C# stand-alone application that logs into a SOLIDWORKS PDM Professional file vault and lists the files in the root folder.

  1. Start up Microsoft Visual Studio.

  2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App (.NET Framework).

    1. Type StandaloneApplicationCSharp in Project n ame. Enter Solution and Solution name.

    2. For Location, click ... and navigate to the folder where to create the project.

    3. Click Create.

    4. Right-click the name of your project in the Solution Explorer and select Add > Reference... to add the SOLIDWORKS PDM Professional primary assembly interop to your project.

      1. Click Browse... to navigate to the top folder of your SOLIDWORKS PDM Professional installation.
      2. Locate and click EPDM.Interop.epdm.dll.
      3. Click Add.
      4. Click OK.

  3. Change the version of the .NET Framework and the platform target.

    1. From the VS menu, click Project > StandaloneApplicationCSharp Properties > Build and set Platform target to Any CPU and de-select Prefer 32-bit.
    2. Click the Application tab and keep suggested Target framework or change it to .NET Framework 4.7.2 (or later).
    3. Save the project.

  4. Right-click Form1.cs in the Solution Explorer and click View Designer.

  5. Click View > Toolbox.

  6. Drag a button from the Toolbox onto the form.

  7. Double-click the button to open Form1.cs and replace all of the code in the code window with the following code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace StandaloneApplicationCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(System.Object sender, System.EventArgs e)
        {
            try
            {

                //Create a file vault interface and log into a vault
                IEdmVault5 vault = new EdmVault5();
                vault.LoginAuto("MyVaultName", this.Handle.ToInt32());

                //Get the vault's root folder interface
                string message = "";
                IEdmFile5 file = null;
                IEdmFolder5 folder = null;
                folder = vault.RootFolder;

                //Get position of first file in the root folder
                IEdmPos5 pos = null;
                pos = folder.GetFirstFilePosition();
                if (pos.IsNull)
                {
                    message = ("The root folder of your vault does not contain any files.");
                    MessageBox.Show(message);
                    return;
                }
                message = ("The root folder of your vault contains these files: " + "\n");
                while (!pos.IsNull)
                {
                    file = folder.GetNextFile(pos);
                    message = message + file.Name + "\n";
                }

                //Show the names of all files in the root folder
                MessageBox.Show(message);

            }

            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

  8. Replace MyVaultName in the code with the name of a SOLIDWORKS PDM Professional vault on your computer.

  9. Click Debug > Start Debugging or press F5.

    1. Click Button1 on the form.

      A message box is displayed that either contains the names of the files in the root folder of the specified vault or informs you that the root folder of the specified vault does not contain any files.

    2. Close the form.

  10. Click File > Save All.

See Also

Stand-alone Applications (VB.NET)

Stand-alone Applications (C++)


SOLIDWORKS PDM Professional API Help

Stand-alone Applications (VB.NET)

This topic describes how to create a VB.NET stand-alone application that logs into a SOLIDWORKS PDM Professional file vault and lists the files in the root folder.

  1. Start up Microsoft Visual Studio.

  2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App (.NET Framework).

    1. Type StandaloneApplicationVBNET in Project name. Enter Solution name.

    2. For Location, click ... and navigate to the folder where to create the project.

    3. Click Create.

    4. Right-click the name of your project in the Solution Explorer and select Add > Reference... to add the SOLIDWORKS PDM Professional primary assembly interop to your project.

      1. Click Browse... to navigate to the top folder of your SOLIDWORKS PDM Professional installation.
      2. Locate and click EPDM.Interop.epdm.dll.
      3. Click Add.
      4. Click OK.

  3. Change the version of the .NET Framework and the platform target.

    1. From the VS menu, click Project > StandaloneApplicationVBNET Properties > Compile.
    2. Set Target CPU to AnyCPU.
    3. De-select Prefer 32-bit.
    4. Click the Application tab and Keep suggested Target framework (all configurations) or change it to .NET Framework 4.7.2 (or later).
    5. Save the project.

  4. Right-click Form1.vb in the Solution Explorer and click View Designer.

  5. Click View > Toolbox.

  6. Drag a button from the Toolbox onto the form.

  7. Double-click the button to open Form1.vb and replace all of the code in the code window with the following code.

Imports EPDM.Interop.epdm

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        On Error GoTo ErrHandler

        'Create a file vault interface and log in to a vault
        Dim vault As IEdmVault5 = New EdmVault5
        vault.LoginAuto("MyVaultName", Me.Handle.ToInt32)

        'Get the vault's root folder interface
        Dim message As String
        Dim file As IEdmFile5
        Dim folder As IEdmFolder5
        folder = vault.RootFolder

        'Get position of first file in the root folder
        Dim pos As IEdmPos5
        pos = folder.GetFirstFilePosition
        If pos.IsNull Then
            message = "The root folder of your vault does not contain any files."
        Else
            message = "The root folder of your vault contains these files:" + vbLf
        End If

        'For all files in the root folder, append the name to the message
        While Not pos.IsNull
            file = folder.GetNextFile(pos)
            message = message + file.Name + vbLf
        End While

        'Show the names of all files in the root folder
        MsgBox(message)

        Exit Sub

ErrHandler:
        If vault Is Nothing Then
            MsgBox("Could not create vault interface.")
        Else
            Dim ErrName As String
            Dim ErrDesc As String
            vault.GetErrorString(Err.Number, ErrName, ErrDesc)
            MsgBox("Something went wrong." + vbLf + ErrName + vbLf + ErrDesc)
        End If

    End Sub

End Class

  8. Replace MyVaultName in the code with the name of a SOLIDWORKS PDM Professional vault on your computer.

  9. Click Debug > Start Debugging or press F5.

    1. Click Button1 on the form.

      A message box is displayed that either contains the names of the files in the root folder of the specified vault or informs you that the root folder of the specified vault does not contain any files.

    2. Close the form.

  10. Click File > Save All.

See Also

Stand-alone Applications (C#)

Stand-alone Applications (C++)


SOLIDWORKS PDM Professional API Help

Using VB.NET

Versions of SOLIDWORKS PDM Professional before 2008 supported Visual Basic 6. SOLIDWORKS PDM Professional 2008, and later, support VB.NET. Users who want to port their Visual Basic 6 applications to VB.NET applications need to know how to:

  • Create stand-alone and add-in applications in VB.NET.
  • Add dependencies EPDM.Interop.epdm.dll and EPDM.Interop.EPDMResultCode.dll by:
    1. Opening your project in Visual Studio.
    2. Right-clicking the project name in the Solution Explorer.
    3. Selecting Add > Project Reference.
    4. Clicking Browse tab > Browse... and navigating to the top folder of your SOLIDWORKS PDM Professional installation.
    5. Locating and selecting EPDM.Interop.epdm.dll.
    6. Clicking Add and OK.
    7. Repeating step 3.
    8. Locating and selecting EPDM.Interop.EPDMResultCode.dll.
    9. Repeating step 5.
  • Obtain window handles:
    • Visual Basic 6 syntax:

Me.hWnd

  • VB.NET syntax:

Me.Handle.ToInt32()

  • Keep add-in windows in the foreground.


SOLIDWORKS PDM Professional API Help

Using .NET Framework in Stand-alone Applications

If your Visual Studio project uses the primary interop assembly provided with SOLIDWORKS PDM Professional, add the following dependencies to your project:

  • EPDM.Interop.epdm.dll and EPDM.Interop.EPDMResultCode.dll:
    1. Right-click the project name in the Solution Explorer.
    2. Select Add > Project Reference.
    3. Click Browse tab > Browse... and navigate to the top folder of your SOLIDWORKS PDM Professional installation.
    4. Locate and select EPDM.Interop.epdm.dll.
    5. Click Add and OK.
    6. Repeat step 3.
    7. Locate and select EPDM.Interop.EPDMResultCode.dll.
    8. Repeat step 5.
  • Include the following statements at the top of your code:
    • VB.NET:

      Imports EPDM.Interop.epdm
      Imports EPDM.Interop.EPDM.Interop.EPDMResultCode

    • C#:

      using EPDM.Interop.epdm;
      using EPDM.Interop.EPDMResultCode;
  • Change the version of .NET Framework, select the platform target Any CPU, and for .NET Frameworks 4.5 or later de-select Prefer 32-bit:
    • VB.NET:
      • In Project > your_project_name Properties... > Application, set Target framework to .NET Framework 4.0 or later (or keep your Visual Studio's default setting)
      • In Project > your_project_name Properties... > Compile > Compile Options:
        • Set Target CPU to AnyCPU
        • If the .NET Framework version is 4.5 or later, de-select Prefer 32-bit
    • C#:
      • In Project > your_project_name Properties... > Application, set Target framework to .NET Framework 4.0 or later (or keep your Visual Studio's default setting)
      • In Project > your_project_name Properties... > Build:
        • Set General > Platform target to Any CPU
        • If the .NET Framework version is 4.5 or later, d e-select Prefer 32-bit
  • Prevent failures when calling methods that pass arrays of structures by:
    1. Opening the project in Visual Studio.
    2. Right-clicking Dependencies > Assemblies > EPDM.Interop.epdm in the Solution Explorer and selecting Properties.
    3. Setting Embed Interop Types to No.
    4. Right-clicking Dependencies > Assemblies > EPDM.Interop.EPDMResultCode in the Solution Explorer and selecting Properties.
    5. Setting Embed Interop Types to No.
    6. Initializing arrays of structures in your code to:
      • VB.NET: Nothing
      • C#: null

See Also

Using .NET Framework in Add-in Applications


SOLIDWORKS PDM Professional API Help

Creating Add-ins (C++)

This topic shows how to create a C++ add-in using Microsoft Visual Studio 2022. The add-in adds a menu item to the context-sensitive and Tools menus of vaults in File Explorer.

  1. Create the C++ project.
    1. Start Microsoft Visual Studio as Administrator.
    2. Select File > New > Project.
    3. From the dropdowns, select C++, All platforms, All project types.
    4. Select ATL Project.
    5. Click Next.
    6. Enter Project name, Solution (Create new solution or Add to solution), Solution name (if Create new solution).
    7. For Location, click ... and navigate to the folder where to create your project.
    8. Click Create.

    9. Select Support options > Support MFC in the ATL Project dialog.

    10. Click OK to generate the project. If the ATL Project is missing, the Visual Studio Installer will suggest that you install any frameworks, SDKs, and tools that you need. For example, you may need to install the Desktop development with C++ workload. The workloads can be found by clicking Tools > Get Tools and Features > Desktop & Mobile. After installation, you may be asked to reboot to continue with updates to Visual Studio.

    11. You will see two projects in Solution Explorer, project_name and project_name PS. The project referenced in the following steps is project_name.

  2. Modify the project's settings.

    1. Right-click the project in Solution Explorer, and select Add > New Item.

    2. Select ATL.

    3. Select ATL Simple Object.

    4. Click Add.

    5. Type MyAddIn in Short name.

    6. Click Next and Next.

    7. Select Custom in the Interface and Both in the Threading Model.

    8. Click Finish.

    9. Select View > Class View and expand your project in the Class View window.

    10. Right-click CMyAddIn and select Add > Implement Interface.

    11. Select Project and select the most recent SOLIDWORKS PDM Professional type library, Edm.tlb, from the Available type libraries list.

      NOTE: If the type library is not in the list, you must copy Edm.tlb from the installation API folder to project_path\project_name\project_name. Then select File, browse to project_path\project_name\project_name, and select Edm.tlb.

    12. Select IEdmAddIn5 in Interfaces .

    13. Click the single right-arrow button to move IEdmAddIn5 to Implement Interfaces, and click Finish.

      Two new methods, IEdmAddIn5::GetAddInInfo and IEdmAddIn5::OnCmd, are added to your class.

    14. Select File > Save All.

  3. Implement
    IEdmAddIn5::GetAddInInfo by replacing
    STDMETHOD(GetAddInInfo)in MyAddin.h with the following code.

STDMETHOD(GetAddInInfo)(EdmAddInInfo
  * poInfo, IEdmVault5 * poVault, IEdmCmdMgr5 * poCmdMgr)
{

AFX_MANAGE_STATE(AfxGetStaticModuleState());

if (poInfo == NULL || poCmdMgr == NULL )
return E_POINTER;

//Return some information
    to the Properties dialog box
poInfo->mbsAddInName= SysAllocString( L"My first
  add-in" );
poInfo->mbsCompany = SysAllocString( L"The name of my
  company" );
poInfo->mbsDescription= SysAllocString( L"This is a very
  nice add-in." );
poInfo->mlAddInVersion = 1;

//SOLIDWORKS PDM Professional 5.2
    (or later) is
    required by this add-in
poInfo->mlRequiredVersionMajor = 5;
poInfo->mlRequiredVersionMinor= 2;

//Add hooks and menu commands to
    SOLIDWORKS PDM Professional
//Below is a menu command that
    appears in the Tools
//and context-sensitive menus of a
    vault in File Explorer
poCmdMgr->AddCmd( 1, bstr_t("My first menu
  command"), EdmMenu_Nothing, bstr_t(""), bstr_t(""),
  0, 0 );

return S_OK;
}

  4. Implement IEdmAddIn5::OnCmd by replacing STDMETHOD(OnCmd)in MyAddin.h with the following code.

    STDMETHOD(OnCmd)(EdmCmd * poCmd, SAFEARRAY * * ppoData)
    {

       AFX_MANAGE_STATE(AfxGetStaticModuleState());

       if (poCmd == NULL ||ppoData == NULL)
         return E_POINTER;

       MessageBox((HWND)poCmd->mlParentWnd,     bstr_t("Hello World!"), bstr_t("SOLIDWORKS PDM Professional"), MB_OK );

       return S_OK;
    }

    NOTE: If you copy the code from this topic and paste it into the IDE, delete any characters or spaces that offend the compiler. On a 64-bit computer, you must replace L with bstr_t() for the strings in the MessageBox.

  5. Specify the project configuration properties:

    1. Right-click the project name in Solution Explorer and select Properties.

    2. Select Configuration Properties > General and Advanced.

      Ensure that the properties on those two tabs are configured as:

      • Output Directory: $(SolutionDir)$(Platform)\$(Configuration)\

      • Configuration Type: Dynamic Library (.dll)

      • Use of MFC: Use MFC in a Shared DLL

      • Character Set: Use Unicode Character Set

    3. Select Linker > General.

      Ensure Output File is:

      • $(SolutionDir)$(Platform)\$(Configuration)\$(TargetName)$(TargetExt)

    4. Select Linker > Input.

      Ensure that Module Definition File is .\project_name.def.

    5. Select Linker > Embedded IDL.

      Ensure the properties are configured as follows:

      • Type Library: $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName).tlb

      • TypeLib Resource ID should be empty. Delete any characters appearing in this row.

    6. Select MIDL > General.

      Select the environment in the Target Environment dropdown that most closely matches your environment.

    7. Select MIDL > Output.

      Ensure the properties are configured as follows:

      • Output Directory: $(SolutionDir)$(Platform)\$(Configuration)\

      • Type Library: $(IntDir)project_name.tlb

  6. Click OK.

  7. To change the project's type of configuration to Release:

    1. In the Solution Explorer, right-click Solution 'project_name' and select Configuration Manager.

    2. Click the down-arrow key in the project's Configuration column and select Release.

    3. Click Close.

  8. Save the project. Compile the project for x64 to create and register an add-in DLL that is compatible with your system.

    NOTE: See Using .NET Framework in Add-in Applications if a problem occurs at runtime.

  9. Add the new add-in, project_name.dll, to the file vault:

    1. Start up the SOLIDWORKS PDM Professional Administration tool as Administrator.
    2. Expand the vault where you want to install this add-in. Log in, if prompted.
    3. Right-click Add-ins and select New Add-in.
    4. Select:
      • If x32: project_path\project_name\Release\project_name.dll, and click Open.
      • If x64: project_path\project_name\x64\Release\project_name.dll, and click Open.

        The add-in Properties dialog displays the add-in's name, company, add-in version, required version of SOLIDWORKS PDM Professional, package, and description.
    5. Click OK.

  10. Right-click the vault directory in File Explorer to show the context menu:

    The new menu item, "My first menu command", appears in the context menu.

  11. Select My first menu command on the context-sensitive menu.

  12. A message box is displayed.

Use your new add-in to create more advanced menu commands or add-in hooks that allow you to check files in and out of the vault.

If you experience difficulties compiling the C++ add-in after following all the steps outlined above, you should submit a service request using the API Support App. An API Support Engineer can provide you with assistance.


SOLIDWORKS PDM Professional API Help

Creating Add-ins (C#)

This topic shows how to create a debug add-in using C# in Microsoft Visual Studio.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Start Microsoft Visual Studio.
  2. Click File > New > Project.
  3. Language dropdown: C#, Platform dropdown: Windows, Project type dropdown: Library
  4. Select Class Library (.NET Framework).
  5. Click Next.
  6. Enter Project name, Location (click ... to browse), Solution (Create new solution or Add to solution), and Solution name (if Create new solution).
  7. In the Framework dropdown at the bottom, keep the default version (recommended) or select .NET Framework 4.7.2 or later. See Using .NET Framework for Add-in Applications for more information.
  8. Click Create.

    Class1.cs containing empty class, Class1, is created.
  9. Right-click the project name in the Solution Explorer and click Add > Reference....
    1. Click Browse in the left-hand panel, click Browse... and navigate to and select EPDM.Interop.epdm.dll, and click OK.

    2. Right-click E pdm.Interop.epdm in the Solution Explorer, select Properties, and set Embed Interop Types to False to handle methods that pass arrays of structures.

    3. Click Assemblies > Framework in the left-hand panel, select System.Windows.Forms, and click OK.
  10. Right-click the project name in the Solution Explorer and click Properties.
    1. On the Application tab, click Assembly Information....
    2. De-select Make assembly COM-Visible. Click OK.
    3. On the Build tab, select AnyCPU for the Platform target, de-select Prefer 32-bit, and select Register for COM interop in the Output section.
    4. On the Debug tab, select Start external program and type C:\Windows\System32\notepad.exe in the text field.
    5. Save the properties.
  11. In Notepad, edit project_path\project_name\project_name\project_name.csproj:
    1. Insert the following line below <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> and below <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">.

      <PlatformTarget>AnyCPU</PlatformTarget>

    2. Save the file and exit Notepad.
  12. Double-click Class1.cs in the Solution Explorer to open the code window.
  13. At the top of the code window, type:

    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using EPDM.Interop.epdm;

  14. Replace:

    15. public class Class1

    with:

    [Guid(""), ComVisible(true)]

    public class Class1 : IEdmAddIn5

  15. To populate the GUID attribute above, click Tools > Create GUID in the IDE, select GUID Format 5, click Copy, and click Exit. Populate [Guid(""), ...] with the copied string.
  16. Implement IEdmAddIn5::GetAddInInfo by adding the following to Class1:

            public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{
//Specify
    information to display in the add-in's Properties dialog box
poInfo.mbsAddInName = "C# Add-in";
poInfo.mbsCompany = "My Company";
poInfo.mbsDescription = "Menu add-in that shows a message box.";
poInfo.mlAddInVersion = 1;

//Specify
    the minimum required version of SolidWorks PDM
    Professional
poInfo.mlRequiredVersionMajor = 6;
poInfo.mlRequiredVersionMinor = 4;

// Register a menu command
poCmdMgr.AddCmd(1, "C# Add-in", (int)EdmMenuFlags.EdmMenu_Nothing);

}

  17. Implement IEdmAddIn5::OnCmd by adding the following to Class1:

    18. 		public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{

// Handle the menu command
if (poCmd.meCmdType == EdmCmdType.EdmCmd_Menu)
{
if (poCmd.mlCmdID == 1)
        {
System.Windows.Forms.MessageBox.Show("C# Add-in");
}
}
}

  18. Implement your own window handle wrapper by right-clicking the project name in the Solution Explorer and clicking Add > Class:
    1. Type WindowHandle.cs in Name.
    2. Click Add.
    3. Replace the code in the code window with the following code.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;

    namespace Addin_CSharp
    {
        //Wrapper class to use SOLIDWORKS PDM Professional as the parent window
        class WindowHandle : IWin32Window
        {
            private IntPtr mHwnd;

            public WindowHandle(int hWnd)
            {
                mHwnd = new IntPtr(hWnd);
            }
            public IntPtr Handle
            {
                get { return mHwnd; }
            }
        }
    }

    Your add-in uses the new wrapper in the menu command handler to show the message box by calling System.Windows.Forms.MessageBox.Show in Class1::OnCmd in Class1.cs.

  19. On the Visual Studio menu, click Build > Build Solution to build the add-in.
  20. Install the add-in for debugging through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and select Debug Add-ins.
    4. Click Add Add-in, browse to project_path\project_name\project_name\bin\Debug, click project_name.dll, and click Open.

      Your add-in's name, path, and class ID should appear in the Add-ins installed for debugging on this machine list.
    5. Click OK.
  21. In Microsoft Visual Studio, click Debug > Start Debugging or press F5.
  22. Open Notepad and click File > Open.
  23. In the Open dialog, click the name of the vault where you installed this add-in.
  24. Right-click inside the vault view and click C# Add-in.

    Displays the message, C# Add-in.
  25. Click OK to close the message box.
  26. Click Cancel.
  27. Close Notepad.

    Complete Source Code

    //Class1.cs

    using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;

[Guid(""),
        ComVisible(true)]
        // See step 14 above to create the GUID
public class Class1 : IEdmAddIn5
{

public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{

poInfo.mbsAddInName = "C# Add-in";
poInfo.mbsCompany = "My Company";
poInfo.mbsDescription = "Menu add-in that shows a message box.";
poInfo.mlAddInVersion = 1;

poInfo.mlRequiredVersionMajor = 6;
poInfo.mlRequiredVersionMinor = 4;

poCmdMgr.AddCmd(1, "C# Add-in", (int)EdmMenuFlags.EdmMenu_Nothing);

}

        public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {

            if (poCmd.meCmdType == EdmCmdType.EdmCmd_Menu)
            {
                if (poCmd.mlCmdID == 1)
                {
                    System.Windows.Forms.MessageBox.Show("C# Add-in");
                }
            }
        }
    }

    //WindowHandle.cs

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;

    namespace Addin_CSharp
    {
        class WindowHandle : IWin32Window
        {
            private IntPtr mHwnd;

            public WindowHandle(int hWnd)
            {
                mHwnd = new IntPtr(hWnd);
            }
            public IntPtr Handle
            {
                get { return mHwnd; }
            }
        }
    }


SOLIDWORKS PDM Professional API Help

Creating Add-ins (VB.NET)

This topic shows how to create a debug add-in using VB.NET in Microsoft Visual Studio.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in VB.NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Start Microsoft Visual Studio.
  2. Click File > New > Project.
  3. In the dropdowns, select Visual Basic, Windows, and Library.
  4. Select Class Library (.NET Framework).
  5. Enter Project name, Solution (Create new solution or Add to solution), and Solution name (if Create new Solution).
  6. For Location, click ... and navigate to the folder where to create your project.
  7. Click Create.

    Class1.vb containing an empty class called Class1 is created.
  8. Right-click the name of your project in the Solution Explorer to add the SOLIDWORKS PDM Professional type library and the Systems.Windows.Forms assembly:
    1. Select Add Reference....
    2. Click Browse... in the left-hand panel, navigate to and select EPDM.Interop.epdm.dll, and click OK.
    3. Select Add Reference....
    4. Click Assemblies > Framework in the left-hand panel, select System.Windows.Forms, and click OK.
    5. Click Close.
  9. At the top of the Class1.vb code window, type on separate lines Imports System.Windows.Forms, Imports EPDM.Interop.epdm, and Imports System.Runtime.InteropServices.
  10. Type before Public Class Class1:
    <Guid("")> _
    <ComVisible(True)> _
  11. To populate the GUID attribute above, click Tools > Create GUID in the IDE, select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with the copied string.
  12. Type below Public Class Class1:

    Implements IEdmAddIn5
  13. Implement IEdmAddIn5::GetAddInInfo by pasting the following code between Implements IEdmAddIn5 and End Class:

Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

      ' Specify add-in information

      poInfo.mbsAddInName = "VB.NET Add-in"

      poInfo.mbsCompany = "My Company"

      poInfo.mbsDescription = "Menu add-in that shows a message box."

      poInfo.mlAddInVersion = 1

      ' Specify minimum version of SOLIDWORKS PDM Professional

      poInfo.mlRequiredVersionMajor = 6

      poInfo.mlRequiredVersionMinor = 4

      ' Register a menu command

      poCmdMgr.AddCmd(1, "VB.NET Add-in", EdmMenuFlags.EdmMenu_Nothing)

   End Sub

  11. Implement IEdmAddIn5::OnCmd by pasting the following code between End Sub and End Class:

    NOTE: IEdmVault8::GetWin32Window is used to convert the parent window handle to a window handle that .NET can use    .

Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

      ' Handle the menu command

      If poCmd.meCmdType = EdmCmdType.EdmCmd_Menu Then

         If poCmd.mlCmdID = 1 Then

            Dim v8 as IEdmVault8

            V8 = poCmd.mpoVault

            System.Windows.Forms.MessageBox.Show(v8.GetWin32Window(poCmd.mlParentWnd), "VB.NET Add-in")

         End If

      End If

   End Sub

  12. Implement your own window handle wrapper by right-clicking the name of your project in the Solution Explorer and selecting Add > New Item > Class:
    1. Type WindowHandle in Name.
    2. Click Add.
    3. Replace the code in the code window with the following code.

Imports System.Windows.Forms

' Wrapper class to use SOLIDWORKS PDM Professional as a parent window to VB forms

Public Class WindowHandle

   Implements IWin32Window

   Private mHwnd As IntPtr

   Public Sub New(ByVal hWnd As Integer)

      mHwnd = New IntPtr(hWnd)

   End Sub

   Public ReadOnly Property Handle() As IntPtr Implements System.Windows.Forms.IWin32Window.Handle

      Get

         Return mHwnd

      End Get

   End Property

End Class

Your add-in uses the new wrapper in the menu command handler to show the message box by calling System.Windows.Forms.MessageBox.Show in Class1::OnCmd in Class1.vb.

  13. Right-click the name of your project in the Solution Explorer and select Properties.
    1. On the Application tab, keep the suggested target framework or select .NET Framework 4.7.2 in the Target framework dropdown.
    2. On the Application tab, click Assembly Information and de-select Make assembly COM-Visible.
    3. On the Compile tab, select AnyCPU for the target CPU, de-select Prefer 32-bit and select Register for COM interop.
    4. On the Debug tab, select Start external program and type C:\Windows\System32\notepad.exe in the text field.
    5. Save the properties.

  17. Right-click E pdm.Interop.epdm in the Solution Explorer, select Properties, and set Embed Interop Types to False to handle methods that pass arrays of structures.
  18. In Notepad, edit project_path\project_name\project_name\project_name.vbproj:
    1. Insert the following line below <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> and below <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">.

      <PlatformTarget>AnyCPU</PlatformTarget>

    2. Save the file and exit Notepad.

  19. On the Visual Studio menu, click Build > Build Solution to build the add-in.
  20. Install the add-in as a Debug Add-in using the SOLIDWORKS PDM Professional Administration tool:
    1. Start up the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in. Log in if prompted.
    3. Right-click Add-ins and select Debug Add-ins.
    4. Click Add Add-in, browse to project_path\project_name\project_name\bin\Debug, select project_name.dll, and click Open.

      Your add-in's name, path, and class ID should appear in Add-ins installed for debugging on this machine.
    5. Click OK.
  21. In Microsoft Visual Studio, click Debug > Start Debugging or press F5.
  22. Click File > Open in Notepad.
  23. Click the name of the vault where you installed your add-in.
  24. Right-click inside the vault in File Explorer and select VB.NET Add-in.

    A message box is displayed with the message VB.NET Add-in.
  25. Click OK to close the message box.

Complete Source Code

'Class1.vb

Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports EPDM.Interop.epdm

<Guid("")> _   ' See step 10 above to create the GUID
<ComVisible(True)> _
Public Class Class1
    Implements IEdmAddIn5

    Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo
        ' Fill in the add-in's description
        poInfo.mbsAddInName = "VB.NET Add-in"
        poInfo.mbsCompany = "My Company"
        poInfo.mbsDescription = "Menu add-in that shows a message box."
        poInfo.mlAddInVersion = 1

        ' Minimum SOLIDWORKS PDM Professional version needed for VB.NET add-ins is 6.4
        poInfo.mlRequiredVersionMajor = 6
        poInfo.mlRequiredVersionMinor = 4

        ' Register a menu command
        poCmdMgr.AddCmd(1, "VB.NET Add-in", EdmMenuFlags.EdmMenu_Nothing)

    End Sub

    Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

        ' Handle the menu command
        If poCmd.meCmdType = EdmCmdType.EdmCmd_Menu Then
            If poCmd.mlCmdID = 1 Then
                Dim v8 As IEdmVault8
                v8 = poCmd.mpoVault
                System.Windows.Forms.MessageBox.Show(v8.GetWin32Window(poCmd.mlParentWnd), "VB.NET Add-in")
            End If
        End If

    End Sub

End Class

'WindowHandle.vb

Imports System.Windows.Forms

Public Class WindowHandle
    Implements IWin32Window
    Private mHwnd As IntPtr

    Public Sub New(ByVal hWnd As Integer)
        mHwnd = New IntPtr(hWnd)
    End Sub
    Public ReadOnly Property Handle() As IntPtr Implements System.Windows.Forms.IWin32Window.Handle
        Get
            Return mHwnd
        End Get
    End Property
End Class


SOLIDWORKS PDM Professional API Help

Creating Menu Commands (C++)

This topic shows how to create a C++ add-in in Microsoft Visual Studio that adds menu commands to the context-sensitive and Tools menus of vaults in File Explorer.

  1. Create an add-in as described in the basic framework sample.

  2. Replace your add-in's implementation of IEdmAddIn5::GetAddInInfo with the following code:

    STDMETHOD(GetAddInInfo)(EdmAddInInfo
  * poInfo, IEdmVault5 * poVault, IEdmCmdMgr5 * poCmdMgr)
{
//The AFX_MANAGE_STATE macro is needed for MFC
  applications but should not
//be used for applications that are MFC-free.
AFX_MANAGE_STATE(AfxGetStaticModuleState());

if (poInfo == NULL || poCmdMgr == NULL )
return E_POINTER;

//Return some information for the
    Administrate Add-ins dialog box
poInfo->mbsAddInName = SysAllocString( L"Menu command
  sample" );
poInfo->mbsCompany = SysAllocString( L"SOLIDWORKS Corporation"
  );
poInfo->mbsDescription= SysAllocString( L"Adds menu items" );
poInfo->mlAddInVersion = 1;

//SOLIDWORKS PDM Professional
    5.2 or later is required to
    install this add-in
poInfo->mlRequiredVersionMajor = 5;
poInfo->mlRequiredVersionMinor = 2;

//Add a command for each of the buttons
  (the command ID numbers 1000 and 1001 are
//arbitrary; SOLIDWORKS PDM Professional
    does not use them; instead, it only passes them to
      your
//implementation of OnCmd so that it knows which command was selected)
poCmdMgr->AddCmd( 1000, bstr_t("First command"),
  EdmMenu_Nothing,

                    bstr_t("This is the first command"),

                    bstr_t("First command"), -1, 0 );

  poCmdMgr->AddCmd( 1001, bstr_t("Second command"), EdmMenu_MustHaveSelection,

                    bstr_t("This is the second command"),

                    bstr_t("Second command"), -1, 0 );

  return S_OK;
}

The flag EdmMenuFlags.EdmMenu_MustHaveSelection indicates that only the second command is available to the user if the user selects one or more files or folders.

  3. Replace your add-in's implementation of IEdmAdd5::OnCmd with the following code:

            STDMETHOD(OnCmd)(EdmCmd *
  poCmd, SAFEARRAY * * ppoData)
{
//The AFX_MANAGE_STATE macro is needed for MFC
  applications but should not
//be used for applications that are MFC-free
AFX_MANAGE_STATE(AfxGetStaticModuleState());

if (poCmd == NULL ||ppoData == NULL)
return E_POINTER;

//Check the command ID to see which
        command was selected
//(this only affects the caption of the message box below)
CString oName;
if( poCmd->mlCmdID = = 1000 )
oName = "The first command";
else
oName = "The second command";

if( SafeArrayGetDim( *ppoData ) != 1 )
return E_INVALIDARG;

//Get a pointer to the actual array
    elements
EdmCmdData *poElements = NULL;
HRESULT hRes = SafeArrayAccessData( *ppoData, (void**)&poElements
  );
if( FAILED(hRes) )
return hRes;

//Create a message showing the names and
    IDs of all selected files and folders
CString oRow;
CString oMessage = "You have selected the following files and
  folders:\n";
int iCount=(*ppoData)->rgsabound->cElements;
for( int i = 0; i < iCount; ++i )
{
if(poElements->mlObjectID1 == 0 )
{
oRow.Format( "Folder: (ID= %d)
  ",poElements->mlObjectID2 );
}
else
{
oRow.Format( "File: (ID= %d)
  ",poElements->mlObjectID1 );
}
oMessage += oRow + (LPCTSTR)bstr_t(poElements->mbsStrData1
  );
oMessage += "\n";
++poElements;
}

//Release the array data and display the
  message
SafeArrayUnaccessData( *ppoData );
MessageBox((HWND)poCmd->mlParentWnd, oMessage, oName, MB_OK );
return S_OK;
}

  4. Save and compile the project.

  5. Add the add-in DLL to the file vault using the Administration tool.

  6. The first menu command appears in the context-sensitive and Tools menus of vaults in File Explorer. The second menu command appears in the context-sensitive menus only when one or more files or folders are selected. Right-click a file in the vault and select Second command. A dialog similar to the following is displayed:


SOLIDWORKS PDM Professional API Help

Creating Menu Commands (C#)

This topic shows how to create a C# add-in that adds menu commands to the context-sensitive menus of File Explorer vault views.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Start Microsoft Visual Studio.

  2. Select File > New > Project > C#, Windows, Library.

  3. Select Class Library (.NET Framework) as the template.

  4. In the .NET Framework dropdown, keep the default version (recommended) or select another version. See Using .NET Framework for Add-in Applications for more information.

  5. Enter Project name, Solution, and Solution name.

  6. For Location, click Browse... and navigate to the folder where to create the project.

  7. C lick Create.

  8. Right-click the project name in the Solution Explorer and click Add > Reference.

    1. Click Browse... in the left-side panel, navigate to and select EPDM.Interop.epdm.dll, and click OK.

    2. Right-click E pdm.Interop.epdm in the Solution Explorer, select Properties, and set Embed Interop Types to False to handle methods that pass arrays of structures.

    3. Click Assemblies > Framework in the left-hand panel, select System.Windows.Forms, and click OK.

  9. Right-click the project name in the Solution Explorer and click Properties.

    1. On the Application tab, click Assembly Information....

    2. De-select Make assembly COM-Visible. Click OK.

    3. On the Build tab, select Any CPU for Platform target, de-select Prefer 32-bit, and select Register for COM interop.

  10. Save the project.

  11. Double-click Class1.cs in the Solution Explorer to open the code window.

  12. At the top of the code window, type:

    using EPDM.Interop.epdm;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

  13. Replace:

    public class Class1

    with:

    [Guid(""), ComVisible(true)]

    public class Class1 : IEdmAddIn5

  14. To populate the GUID attribute above, click Tools > Create GUID in the IDE, select GUID Format 5, click Copy, and click Exit. Populate [Guid(""), ...] with the copied string.

  15. Implement IEdmAddIn5::GetAddInInfo by adding the following code to Class1:

    16. 		public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{
//Specify
        information to
        display in the add-in's Properties dialog box
poInfo.mbsAddInName = "Menu command sample";
poInfo.mbsCompany = "SOLIDWORKS Corporation";
poInfo.mbsDescription = "Adds menu command items";
poInfo.mlAddInVersion = 1;

//Specify the
        minimum required version of SOLIDWORKS PDM
        Professional
poInfo.mlRequiredVersionMajor = 5;
poInfo.mlRequiredVersionMinor = 2;

//Register
        menu commands; SOLIDWORKS PDM Professional passes command IDs, 1000 and 1001,
//to IEdmAddIn5::OnCmd to indicate which command the
        user selects
poCmdMgr.AddCmd(1000, "First command", (int)EdmMenuFlags.EdmMenu_Nothing, "This is the first command", "First command", 0, 99);
poCmdMgr.AddCmd(1001, "Second command", (int)EdmMenuFlags.EdmMenu_MustHaveSelection, "This is the second command", "Second command", 1, 99);
}

    The flag EdmMenuFlags.EdmMenu_MustHaveSelection means that the second command is only available if the user has selected one or more files or folders.

  16. IEdmAddIn5::OnCmd is called when a menu command is selected by the user. Implement IEdmAddIn5::OnCmd by adding the following code to Class1:

    17. 	public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
//Handle
    the menu command
{
string CommandName = null;
if (poCmd.mlCmdID == 1000)
{
CommandName = "The first command.";
}
else
{
CommandName = "The second command.";
}
//Retrieve the bounds of the array containing the selected files and folders
int index = 0;
int last = 0;
index = ppoData.GetLowerBound(0);
last = ppoData.GetUpperBound(0);
string StrID = null;

//Create a message showing the names and IDs of all selected files and folders
string message = null;
message = "You have selected the following files and folders: " + "\r\n";
while (index <= last)
{
if (((EdmCmdData)ppoData.GetValue(index)).mlObjectID1 == 0)
{
message = message + "Folder: (ID=";
StrID = ((EdmCmdData)ppoData.GetValue(index)).mlObjectID2.ToString();
message = message + StrID + ") ";
}
else
{
message = message + "File: (ID=";
StrID = ((EdmCmdData)ppoData.GetValue(index)).mlObjectID1.ToString();
message = message + StrID + ") ";
}

message = message + ((EdmCmdData)ppoData.GetValue(index)).mbsStrData1 + "\r\n";
index = index + 1;
}

//Display the message
EdmVault5 v = default(EdmVault5);
v = (EdmVault5)poCmd.mpoVault;
v.MsgBox(poCmd.mlParentWnd, message, EdmMBoxType.EdmMbt_OKOnly, CommandName);
}
}

  17. Click Build > Build Solution to build the add-in.

  18. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  19. Right-click inside a vault view in File Explorer. First command appears in the context-sensitive menu.

  20. Right-click a file in the vault view and click Second command. The add-in displays a dialog similar to the following:

Complete Source Code

// Class1.cs

using System;
using System.Collections.Generic;
using System.Text;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;

namespace CreateMenuCommand_CSharp
{

            [Guid(""),
        ComVisible(true)]
        // See step 13 above to create the GUID
public class Class1 : IEdmAddIn5
{
#region IEdmAddIn5 Members

public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{

poInfo.mbsAddInName = "Menu command sample";
poInfo.mbsCompany = "SOLIDWORKS Corporation";
poInfo.mbsDescription = "Adds menu command items";
poInfo.mlAddInVersion = 1;
poInfo.mlRequiredVersionMajor = 5;
poInfo.mlRequiredVersionMinor = 2;

poCmdMgr.AddCmd(1000, "First command", (int)EdmMenuFlags.EdmMenu_Nothing, "This is the first command", "First command", 0, 99);
poCmdMgr.AddCmd(1001, "Second command", (int)EdmMenuFlags.EdmMenu_MustHaveSelection, "This is the second command", "Second command", 1, 99);
}

public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{

{
string CommandName = null;
if (poCmd.mlCmdID == 1000)
{
CommandName = "The first command.";
}
else
{
CommandName = "The second command.";
}

int index = 0;
int last = 0;
index = ppoData.GetLowerBound(0);
last = ppoData.GetUpperBound(0);
string StrID = null;

string message = null;
message = "You have selected the following files and folders: " + "\r\n";
while (index <= last)
{
if (((EdmCmdData)ppoData.GetValue(index)).mlObjectID1 == 0)
{
message = message + "Folder: (ID=";
StrID = ((EdmCmdData)ppoData.GetValue(index)).mlObjectID2.ToString();
message = message + StrID + ") ";
}
else
{
message = message + "File: (ID=";
StrID = ((EdmCmdData)ppoData.GetValue(index)).mlObjectID1.ToString();
message = message + StrID + ") ";
}

message = message + ((EdmCmdData)ppoData.GetValue(index)).mbsStrData1 + "\r\n";
index = index + 1;
}

EdmVault5 v = default(EdmVault5);
v = (EdmVault5)poCmd.mpoVault;
v.MsgBox(poCmd.mlParentWnd, message, EdmMBoxType.EdmMbt_OKOnly, CommandName);
}
}

#endregion
}
}


SOLIDWORKS PDM Professional API Help

Creating Menu Commands (VB.NET)

This topic shows how to create a VB.NET add-in in Microsoft Visual Studio that adds menu commands to the context-sensitive and Tools menus of vaults in File Explorer.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Start Microsoft Visual Studio.

  2. Click File > New > Project > Visual Basic, Windows, Library.

  3. Select Class Library (.NET Framework) as the template.

  4. Enter Project n ame, Location, Solution, Solution name, and click Create.

  5. From the VS menu, click Project > Add Reference... > Browse..., locate and select EPDM.Interop.epdm.dll, and click OK.

  6. From the Solution Explorer, right-click E pdm.Interop.epdm, select Properties, and set Embed Interop Types to False to handle methods that pass arrays of structures.

  7. From the VS menu, click Project > Add Reference... > Assemblies > Framework, select System.Drawing, and click OK.

  8. Right-click the name of the project in the Solution Explorer and select Properties.

    1. On the Application tab, click Assembly Information....

    2. De-select Make assembly COM-Visible. Click OK.

    3. On the Compile tab, select AnyCPU for the Target CPU, de-select Prefer 32-bit, and select Register for COM interop.

  9. Save the project.

  10. Double-click Class1.vb in the Solution Explorer to open the code window.

    1. Before Public Class Class1 type:

       Imports EPDM.Interop.epdm
             Imports System.Runtime.InteropServices
      <Guid("")> _
      <ComVisible(True)> _

    2. To populate the GUID attribute above, click Tools > Create GUID in the IDE, select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with the copied string.

    3. Type Implements IEdmAddIn5 after Public Class Class1 and make sure that the GetAddInInfo and OnCmd methods are generated after you press Enter.

    4. Replace your add-in's implementation of the IEdmAddIn5::GetAddInInfo method with the following code:

    Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As EIEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

      'Specify the add-in information
      poInfo.mbsAddInName = "Menu command sample"
      poInfo.mbsCompany = "SOLIDWORKS Corporation"
      poInfo.mbsDescription = "Adds menu command items"
      poInfo.mlAddInVersion = 1
      poInfo.mlRequiredVersionMajor = 5
      poInfo.mlRequiredVersionMinor = 2

      'Add menu command items (the command-ID numbers 1000 and 1001 are
      'arbitrary; PDM does not use them; instead, PDM only passes them to the
      'implementation of OnCmd to know which command was selected)
      poCmdMgr.AddCmd(1000, "First command", EdmMenuFlags.EdmMenu_Nothing, "This is the first command", "First command", 0, 99)
      poCmdMgr.AddCmd(1001, "Second command", EdmMenuFlags.EdmMenu_MustHaveSelection, "This is the second command", "Second command", 1, 99)

    End Sub

    The flag     EdmMenuFlags.EdmMenu_MustHaveSelection means that the second command is only available if the user has selected one or more files or folders.

    5. Replace your add-in's implementation of the IEdmAddIn5::OnCmd method with the following code (IEdmAddIn5::OnCmd is called when a menu command is selected by the user):

    Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

      'Check the command ID to see which command was selected
      '(This only affects the caption of the message box below)
          Dim CommandName As String

      If poCmd.mlCmdID = 1000 Then
        CommandName = "The first command."

      Else
        CommandName = "The second command."

      End If

      'Retrieve the bounds of the array containing the selected files and folders
          Dim index As Long

      Dim last As Long

      index = LBound(ppoData)

      last = UBound(ppoData)

      Dim StrID As String

      'Create a message showing the names and IDs of all selected files and folders
      Dim message As String

      message = "You have selected the following files and folders: " + vbLf

      While index <= last
        If ppoData(index).mlObjectID1 = 0 Then
          message = message + "Folder: (ID="

          StrID = ppoData(index).mlObjectID2

          message = message + StrID + ") "
        Else
            message = message + "File: (ID="

            StrID = ppoData(index).mlObjectID1

            message = message + StrID + ") "
        End If

        message = message + ppoData(index).mbsStrData1 + vbLf
        index = index + 1
      End While

      'Display the message
      Dim v As EdmVault5
      v = poCmd.mpoVault
      v.MsgBox(poCmd.mlParentWnd, message, EdmMBoxType.EdmMbt_OKOnly, CommandName)

    End Sub

  11. Click Build > Build Solution to build the add-in.

  12. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  13. The first menu command appears in the context-sensitive and Tools menus of vault files in File Explorer. The second menu command appears in the context-sensitive menus only when one or more files or folders are selected. Right-click a file in the vault and select Second command. A dialog similar to the following is displayed:


SOLIDWORKS PDM Professional API Help

Creating Add-in Hooks (C++)

This topic shows how to implement IEdmAddIn5::GetAddInInfo and IEdmAddIn5::OnCmd in your add-in to have SOLIDWORKS PDM Professional notify your add-in whenever a file is added, checked out, or checked in.

  1. Call IEdmCmdMgr5::AddHook from your add-in's GetAddInInfo method for each activity you want your add-in to know about. Implement IEdmAddIn5::GetAddInInfo in your add-in as follows:

    2. 	STDMETHOD(GetAddInInfo)(EdmAddInInfo * poInfo, IEdmVault5 * poVault, IEdmCmdMgr5 * poCmdMgr)
{
//The AFX_MANAGE_STATE macro is needed for MFC applications but should not
//be used for applications that are MFC-free
AFX_MANAGE_STATE(AfxGetStaticModuleState());

if (poInfo == NULL || poCmdMgr == NULL )
return E_POINTER;

//Return information to the Administrate Add-ins dialog box
poInfo->mbsAddInName=  SysAllocString( L"My first add-in" );
poInfo->mbsCompany = SysAllocString( L"The name of my company" );
poInfo->mbsDescription=  SysAllocString( L"This is a very nice add-in." );
poInfo->mlAddInVersion = 1;

//SOLIDWORKS PDM Professional 5.2 is
    required to install this add-in
poInfo->mlRequiredVersionMajor = 5;
poInfo->mlRequiredVersionMinor=  2;

//Notify when a file has been added
poCmdMgr->AddHook( EdmCmd_PostAdd, NULL );
//Notify when a file has been checked out
poCmdMgr->AddHook( EdmCmd_PostLock, NULL );
//Notify when a file is about to be checked in
poCmdMgr->AddHook( EdmCmd_PreUnlock, NULL );
//Notify when a file has been checked in
poCmdMgr->AddHook( EdmCmd_PostUnlock, NULL );

return S_OK;
}

  2. Implement IEdmAddIn5::OnCmd in your add-in as follows:

    3. 	STDMETHOD(OnCmd)(EdmCmd * poCmd, SAFEARRAY * * ppoData)
{
//The AFX_MANAGE_STATE macro is needed for MFC applications but should not
//be used for applications that are MFC-free
AFX_MANAGE_STATE(AfxGetStaticModuleState());

if (poCmd == NULL ||ppoData == NULL)
return E_POINTER;

//Check the type of hook that triggered
    this call
CString oName;
switch(poCmd->meCmdType )
{
case EdmCmd_PostAdd: oName =
             "PostAdd"; break;
case EdmCmd_PostLock:   oName = "PostLock"; break;
case EdmCmd_PreUnlock:  oName = "PreUnlock"; break;
case EdmCmd_PostUnlock: oName = "PostUnlock"; break;
default: oName = "?"; break;
}

//Obtain a pointer to the array data
if( SafeArrayGetDim( *ppoData ) != 1 )
return E_INVALIDARG;

EdmCmdData *poElements = NULL;
HRESULT hRes =
       SafeArrayAccessData( *ppoData, (void**)&poElements );
if( FAILED(hRes) )
return hRes;

//Append the paths of all files to a string
CString oMessage =
       "The following files were affected by a " + oName + " hook:\n";
int  iCount=(*ppoData)->rgsabound->cElements;
for( int i =
      0;  i <  iCount; ++i )
{
oMessage +=  (LPCTSTR)bstr_t(poElements->mbsStrData1 );
oMessage += "\n";
++poElements;
}

//Release the array data and display a message to the user
SafeArrayUnaccessData( *ppoData );

MessageBox((HWND)poCmd->mlParentWnd, oMessage, "SOLIDWORKS PDM Professional", MB_OK );
return S_OK;
}

    OnCmd is called for each of the hooks registered in GetAddInInfo. You can tell which hook triggered the call by inspecting the meCmdType member of the EdmCmd structure that is passed as poCmd in OnCmd. meCmdType contains an EdmCmdType constant that indicates the triggering hook.

    The second argument to OnCmd is an array of EdmCmdData structures. There is one element in the array for each file that is affected by the call. The contents of the structure members vary depending on the type of hook that triggers the call. See EdmCmdData for a complete list of members and their descriptions.

  3. B uild the add-in DLL and add it to the file vault using the Administration tool.

  4. Try adding, checking out, and checking in vault files.

NOTE: OnCmd is not called during check-in if the file is not modified before it is checked in. During check-in of unmodified files, SOLIDWORKS PDM Professional triggers an "undo check-out" event. To handle this "undo check-out" event, add hooks for EdmCmdType.EdmCmd_PreUndoLock and EdmCmdType.EdmCmd_PostUndoLock to your add-in's GetAddInInfo.

See Also

Creating Add-ins (C++)

Creating Add-in Hooks (VB.NET)


SOLIDWORKS PDM Professional API Help

Creating Add-in Hooks (C#)

This topic shows how to program an add-in to have SOLIDWORKS PDM Professional notify your add-in whenever a file is added, checked out, or checked in to a vault.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Follow Creating Menu Commands (C#) to create a basic add-in.
  2. In your add-in's IEdmAddIn5::GetAddInInfo implementation, call IEdmCmdMgr5::AddHook for each SOLIDWORKS PDM Professional activity that you want your add-in to be notified about. Implement IEdmAddIn5::GetAddInInfo as follows:

    3. 	public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{
//Specify information to display
    in the add-in's Properties dialog box
poInfo.mbsAddInName = "My first add-in";
poInfo.mbsCompany = "The name of my company";
poInfo.mbsDescription = "This is a very nice add-in.";
poInfo.mlAddInVersion = 1;

//Specify the
    minimum required version of SolidWorks PDM
    Professional
poInfo.mlRequiredVersionMajor = 5;
poInfo.mlRequiredVersionMinor = 2;

//Register hooks

//Notify the add-in when a file has been added
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAdd);

//Notify the add-in when a file has been checked out
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostLock);

//Notify the add-in when a file is about to be checked in
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreUnlock);

//Notify the add-in when a file has been checked in
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostUnlock);
}

  3. Implement IEdmAddIn5::OnCmd as follows:

    4. 	public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
//Handle the hook
string name = null;
switch (poCmd.meCmdType)
{
case EdmCmdType.EdmCmd_PostAdd:
name = "PostAdd";
break;
case EdmCmdType.EdmCmd_PostLock:
name = "PostLock";
break;
case EdmCmdType.EdmCmd_PreUnlock:
name = "PreUnlock";
break;
case EdmCmdType.EdmCmd_PostUnlock:
name = "PostUnlock";
break;
default:
name = "?";
break;
}

//Check the upper and lower bounds of the array
string message = null;
message = "";
int index = 0;
index = ppoData.GetLowerBound();
int last = 0;
last = ppoData.GetUpperBound();

//Append the paths of all files to a message
    string
while (index <= last)
{
message = message + ((EdmCmdData)(ppoData.GetValue(index))).mbsStrData1 + "\r\n";
index = index + 1;
}

//Display a message to the user
message = "The following files were affected by a " + name + " hook:" + "\r\n" + message;

EdmVault5 vault = default(EdmVault5);
vault = (EdmVault5)poCmd.mpoVault;
vault.MsgBox(poCmd.mlParentWnd, message);
}

    SOLIDWORKS PDM Professional calls OnCmd whenever one of the hooks registered in GetAddInInfo triggers an event. You can tell which hook triggered the call by inspecting EdmCmd.meCmdType that is returned in OnCmd's poCmd argument. meCmdType contains an EdmCmdType constant that indicates which hook triggered the call.

    The second argument to OnCmd, ppoData, contains an array of EdmCmdData structures. The array contains one structure for each file that is affected by the hook. The contents of the structure members vary, depending on the hook. See EdmCmdData for a complete list of members and their descriptions.

  4. Click Build > Build Solution to build the add-in.

  5. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  6. Add, check out, or check in one or more vault files. A message box displays with the files added, checked out, or checked in.

NOTE: OnCmd is not called during check-in if the file is not modified. During check-in of unmodified files, SOLIDWORKS PDM Professional triggers an "undo check-out" event. To handle this "undo check-out" event, register EdmCmdType.EdmCmd_PreUndoLock and EdmCmdType.EdmCmd_PostUndoLock hooks in your add-in's implementation of IEdmAddIn5::GetAddInInfo.


SOLIDWORKS PDM Professional API Help

Creating Add-in Hooks (VB.NET)

This topic shows how to implement IEdmAddIn5::GetAddInInfo and IEdmAddIn5::OnCmd in your add-in to have SOLIDWORKS PDM Professional notify your add-in whenever a file is added, checked out, or checked in.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Call IEdmCmdMgr5::AddHook from your add-in's GetAddInInfo method for each activity you want your add-in to know about. Implement IEdmAddIn5::GetAddInInfo in your add-in as follows:

    2. Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

          'Specify add-in information
      poInfo.mbsAddInName = "My first add-in"
      poInfo.mbsCompany = "The name of my company"

      poInfo.mbsDescription = "This is a very nice add-in."
      poInfo.mlAddInVersion = 1

          'Specify minimum version of SOLIDWORKS PDM Professional
      poInfo.mlRequiredVersionMajor = 5
      poInfo.mlRequiredVersionMinor = 2

      'Notify when a file has been added
      poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAdd)

      'Notify when a file has been checked out
      poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostLock)

      'Notify when a file is about to be checked in
      poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreUnlock)

      'Notify when a file has been checked in
      poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostUnlock)

    End Sub

  2. Implement IEdmAddIn5::OnCmd in your add-in as follows:

    3. Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

      'Check the type of hook that triggered this call
      Dim name As String
      Select Case poCmd.meCmdType
        Case EdmCmdType.EdmCmd_PostAdd
          name = "PostAdd"
        Case EdmCmdType.EdmCmd_PostLock
          name = "PostLock"
        Case EdmCmdType.EdmCmd_PreUnlock
          name = "PreUnlock"
        Case EdmCmdType.EdmCmd_PostUnlock
          name = "PostUnlock"
        Case Else
          name = "?"
      End Select

      'Check the upper and lower bounds of the array
      Dim message As String
      message = ""
      Dim index As Long
      index = LBound(ppoData)
      Dim last As Long
      last = UBound(ppoData)

          'Append the paths of all files to a string
      While index <= last
        message = message + ppoData(index).mbsStrData1 + vbLf
        index = index + 1
      End While

      'Display a message to the user
      message = "The following files were affected by a " + name + " hook:" + vbLf + message

      Dim vault As EdmVault5
      vault = poCmd.mpoVault
      vault.MsgBox(poCmd.mlParentWnd, message)

    End Sub

    OnCmd is called for each of the hooks registered in GetAddInInfo. You can tell which hook triggered the call to OnCmd by inspecting the meCmdType member of the EdmCmd structure that is passed as poCmd in OnCmd. meCmdType contains an EdmCmdType constant that indicates the triggering hook.

    The second argument to OnCmd is an array of EdmCmdData structures. There is one element in the array for each file that is affected by the call. The contents of the structure members vary depending on the type of hook that is executed. See EdmCmdData for a complete list of members and their descriptions.

  3. Click Build > Build Solution to build the add-in.

  4. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  5. Try adding, checking out, and checking in vault files.

NOTE: OnCmd is not called during check-in if the file is not modified before it is checked in. During check-in of unmodified files, SOLIDWORKS PDM Professional triggers an "undo check-out" event. To handle this "undo check-out" event, add hooks for EdmCmdType.EdmCmd_PreUndoLock and EdmCmdType.EdmCmd_PostUndoLock to your add-in's GetAddInInfo.


SOLIDWORKS PDM Professional API Help

Creating Serial Numbers (VB.NET)

This sample shows how to generate serial numbers for file data cards using an add-in written in VB.NET.

NOTES:

  • Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  • SOLIDWORKS PDM Professional recommends that serial numbers be generated using the built-in format strings or lists. They provide better performance than serial numbers generated by add-ins or serial numbers from files. Only write an add-in to generate the serial number if built-in format strings or lists are insufficient.

  • The differences between serial number generation and other types of hooks are:

    • Hook you register in your IEdmAddIn5::GetAddInInfo method.

    • Contents of your IEdmAddIn5::OnCmd method.

  1. Follow Creating Menu Commands (VB.NET) to create a basic add-in.

  2. Register a hook to notify your add-in when a serial number needs to be generated. Implement IEdmAddIn5::GetAddInInfo as follows:

    3. Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

      'Specify add-in information
      poInfo.mbsAddInName = "My serial number generator"
      poInfo.mbsCompany = "The name of my company"
      poInfo.mbsDescription = "Implements serial numbers"
      poInfo.mlAddInVersion = 1
      poInfo.mlRequiredVersionMajor = 5
      poInfo.mlRequiredVersionMinor = 2

      'Register that a serial number needs to be generated
      poCmdMgr.AddHook(EdmCmdType.EdmCmd_SerialNo)

    End Sub

  3. Implement IEdmAddIn5::OnCmd as follows:

    4. Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

      'Check the upper and lower bounds of the array
      Dim index As Long index = LBound(ppoData)
      Dim last As Long last = UBound(ppoData)

      If index <= last Then
        Dim cnt As Integer
        cnt = last - index + 1

        'Create a temporary array to which you have full access
        Dim tmpArr(cnt) As EdmCmdData
        tmpArr = ppoData

        'Generate serial numbers for all of the affected files
        Dim CounterVal As String

        While index <= last
          CounterVal = tmpArr(index).mlLongData1
          Dim s As String
          s = "My serno(" + CounterVal + ")"
          tmpArr(index).mbsStrData1 = s
          index = index + 1
        End While

        'Return the updated data
        ppoData = tmpArr
      End If

    End Sub

     The second argument to OnCmd is an array of EdmCmdData structures. There is one element in the array for each file that is affected by the call. See EdmCmdData for a complete list of members and their descriptions.

  4. Click Build > Build Solution to build the add-in.

  5. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  6. Right-click the Serial Numbers node in the tree and click New Serial Number.

  7. Create a new serial number in the Name field and select Serial number from add-in in the Type dropdown.

    The name of your add-in is displayed in Name of add-in.

  8. After ensuring that your add-in is selected, click OK.

    Now you can connect the add-in serial number to controls in your file data cards.

  9. Click Cards > File Cards, double-click Text Card, and click the Title control.

  10. In the Default value group box on the Edit-box properties panel, click Serial number and select the serial number that you created in step 7.

  11. Save the card and exit the Card Editor.

  12. C reate a new text file by right-clicking in a File Explorer vault view and clicking New > Text Document.

    The file data card displays a serial number in Title of the newly added file.


SOLIDWORKS PDM Professional API Help

Creating Serial Numbers (C#)

This sample shows how to generate serial numbers for file data cards using an add-in written in Visual C#.

NOTES:

  • Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  • SOLIDWORKS PDM Professional recommends that serial numbers be generated using the built-in format strings or lists. They provide better performance than serial numbers generated by add-ins or serial numbers from files. Write an add-in to generate the serial number only if built-in format strings or lists are insufficient.

  • The differences between serial number generation and other types of hooks are:

    • Hook you register in your IEdmAddIn5::GetAddInInfo method.

    • Contents of your IEdmAddIn5::OnCmd method.

  1. Follow Creating Menu Commands (C#) to create a basic add-in.

  2. Register a hook to notify your add-in when a serial number needs to be generated. Implement IEdmAddIn5::GetAddInInfo as follows:

    public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
    {
           //Return information about this add-in to the Administrate Add-ins dialog
           poInfo.mbsAddInName = "My serial number generator";
           poInfo.mbsCompany = "The name of my company";
           poInfo.mbsDescription = "Implements serial numbers";
           poInfo.mlAddInVersion = 1;
           poInfo.mlRequiredVersionMajor = 5;
           poInfo.mlRequiredVersionMinor = 2;

           //Notify that a serial number needs to be generated
           poCmdMgr.AddHook(EdmCmdType.EdmCmd_SerialNo);
    }

  3. Implement IEdmAddIn5::OnCmd as follows:

    4. public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
    {
           //Check the upper and lower bounds of the array
           int Index = ppoData.GetLowerBound(0);
           int last = ppoData.GetUpperBound(0);

           if (Index <= last) {
               int cnt;
               cnt = last - Index + 1 ;

               //Create a temporary array to which you have full access
               EdmCmdData[] tmpArr;
               tmpArr = (EdmCmdData[])ppoData;

               //Generate serial numbers for all of the affected files
               String CounterVal;

               while (Index <= last) {
                   CounterVal = tmpArr[Index].mlLongData1.ToString() ;
                   String s;
                   s = "My serno(" + CounterVal + ")" ;
                        tmpArr[Index].mbsStrData1 = s ;
                        Index = Index + 1 ;
               }

               //Return the updated data
                ppoData = tmpArr;
           }
    }

     The second argument to OnCmd is an array of EdmCmdData structures. There is one element in the array for each file that is affected by the call. See EdmCmdData for a complete list of members and their descriptions.

  4. Click Build > Build Solution to build the add-in.

  5. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS PDM Professional Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  6. Right-click the Serial Numbers node in the tree and click New Serial Number.

  7. Create a new serial number in the Name field and select Serial number from add-in in the Type dropdown.

    The name of your add-in is displayed in Name of add-in.

  8. After ensuring that your add-in is selected, click OK.

    Now you can connect the add-in serial number to controls in your file data cards.

  9. Click Cards > File Cards, double-click Text Card, and click the Title control.

  10. In the Default value group box on the Edit-box properties panel, click Serial number and select the serial number that you created in step 7.

  11. Save the card and exit the Card Editor.

  12. C reate a new text file by right-clicking in a File Explorer vault view and clicking New > Text File.

    The file data card displays a serial number in Title of the newly added file.


SOLIDWORKS PDM Professional API Help

Calling Add-ins (C#)

This sample shows how to implement IEdmAddIn5::GetAddInInfo and IEdmAddIn5::OnCmd to create a Visual C# add-in that is called when the user clicks a button in a file data card. The add-in opens a dialog box in which the user browses for the file whose data card is displayed. The add-in copies the path of the selected file to a text field in the file's data card.

 NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Follow Creating Menu Commands (C#) to create a basic add-in.

  2. R egister a hook to notify your add-in when a user clicks a button in a file data card. Implement IEdmAddIn5::GetAddInInfo as follows:

    3. public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
    {
           //Specify information to display in the add-in's Properties dialog box
           poInfo.mbsAddInName = "My serial number generator";
           poInfo.mbsCompany = "The name of my company";
           poInfo.mbsDescription = "Implements serial numbers";
           poInfo.mlAddInVersion = 1;
           poInfo.mlRequiredVersionMajor = 5;
           poInfo.mlRequiredVersionMinor = 2;

           //Notify the add-in when a file data card button is clicked
           poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardButton);
    }

  3. Implement IEdmAddIn5::OnCmd as follows:

         public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
         {
                //Respond only to a specific button command
                //The button command to respond to begins with "MyButton:" and ends with the name of the
                //variable to update in the card
                if (Strings.Left(poCmd.mbsComment, 9) == "MyButton:")
                {
                    //Get the name of the variable to update.
                    string VarName = null;
                    VarName = Strings.Right(poCmd.mbsComment, Strings.Len(poCmd.mbsComment) - 9);

                    //Let the user select the file whose path will be copied to the card variable
                    EdmVault5 vault = default(EdmVault5);
                    vault = (EdmVault5)poCmd.mpoVault;
                    IEdmStrLst5 PathList = default(IEdmStrLst5);
                    PathList = vault.BrowseForFile(poCmd.mlParentWnd, (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "", "", "", "", "Select File for " + VarName);

                    if ((PathList != null))
                    {
                        string path = null;
                        path = PathList.GetNext(PathList.GetHeadPosition());

                        //Store the path in the card variable
                        IEdmEnumeratorVariable5 vars = default(IEdmEnumeratorVariable5);
                        vars = (IEdmEnumeratorVariable5)poCmd.mpoExtra;
                        object VariantPath = null;
                        VariantPath = path;
                        vars.SetVar(VarName, "", VariantPath);
                    }
                }

                return;
         }

    4. The second argument to OnCmd, ppoData, is an array of EdmCmdData structures. There is one element in the array when it is called from the file data card. See EdmCmdData for information.

  4. Click Build > Build Solution to build the add-in.

  5. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS Professional PDM Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  6. Click Cards > File Cards.

  7. Double-click Text Card.

  8. Add a button to the card.

  9. Click the button.

  10. In Caption, type Browse....

  11. In Command type, select Run Add-in.

  12. In Name of add-in, type MyButton:Title.

  13. Save the card and exit the Card Editor.

  14. Open File Explorer on the vault and select a checked-out text file.

  15. Click Browse in the file's data card.

  16. The Select File for Title dialog box pops up.

  17. Browse to and select the checked-out text file.

  18. Click Open to copy the path of the selected file to the Title field of the file's data card.

Remarks

In this example, the value of a variable is set using IEdmEnumeratorVariable5::SetVar. You can also read values using IEdmEnumeratorVariable5::GetVar.

Using a button handler like this add-in, you can also:

  • Retrieve the number of configurations, layouts, or both, in the file by inspecting the EdmCmdData::mpoExtra variable, which contains IEdmStrLst5 of file interfaces.

  • Switch the active configuration.

  • Set focus to a certain control using the members of EdmCmdData.

  • Close the card automatically after the button handler returns by setting the EdmCmdData::mlLongData1 variable to one of the EdmCardFlag constants.


SOLIDWORKS PDM Professional API Help

Calling Add-ins (VB.NET)

This sample shows how to implement IEdmAddIn5::GetAddInInfo and IEdmAddIn5::OnCmd to create a Visual Basic add-in that is called when the user clicks a button in a file data card. The add-in opens a dialog box in which the user browses for the file whose data card is displayed. The add-in copies the path of the selected file to a text field in the file's data card.

NOTE: Because SOLIDWORKS PDM Professional cannot force a reload of add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.

  1. Follow Creating Menu Commands (VB.NET) to create a basic add-in.

  2. R egister a hook to notify your add-in when a user clicks a button in a file data card. Implement IEdmAddIn5::GetAddInInfo as follows:

    3. Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

         '    Specify information to display in the add-in's Properties dialog box
         poInfo.mbsAddInName = "My serial number generator"
         poInfo.mbsCompany = "The name of my company"
         poInfo.mbsDescription = "Implements serial numbers"
         poInfo.mlAddInVersion = 1
         poInfo.mlRequiredVersionMajor = 5
         poInfo.mlRequiredVersionMinor = 2

         'Notify the add-in when a file data card button is clicked
         poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardButton)

    End Sub

  3. Implement IEdmAddIn5::OnCmd as follows:

    4. Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd
      On Error GoTo ErrHand

        'Respond only to a specific button command
        'The button command to respond to begins with "MyButton:" and ends with the name of the
        'variable to update in the card
        If Left(poCmd.mbsComment, 9) = "MyButton:" Then
          'Get the name of the variable to update.
          Dim VarName As String
          VarName = Right(poCmd.mbsComment, Len(poCmd.mbsComment) - 9)

          'Let the user select the file whose path will be copied to the card variable
          Dim vault As EdmVault5
          vault = poCmd.mpoVault
          Dim PathList As IEdmStrLst5
          PathList = vault.BrowseForFile(poCmd.mlParentWnd, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "", "", "", "", "Select File for " + VarName)

             If Not PathList Is Nothing Then
               Dim path As String
               path = PathList.GetNext(PathList.GetHeadPosition)

               'Store the path in the card variable
               Dim vars As IEdmEnumeratorVariable5
               vars = poCmd.mpoExtra
               Dim VariantPath As Object
               VariantPath = path
               vars.SetVar(VarName, "", VariantPath)
             End If
           End If

           Exit Sub

         'Handle errors
         ErrHand:
           Dim ErrVault As EdmVault5
           ErrVault = poCmd.mpoVault
           Dim ErrName As String
           Dim ErrDesc As String
           ErrVault.GetErrorString(Err.Number, ErrName, ErrDesc)
           ErrVault.MsgBox(poCmd.mlParentWnd, "Error in my card button." + vbLf + ErrDesc)

    End Sub

     The second argument to OnCmd, ppoData, is an array of EdmCmdData structures. There is one element in the array when it is called from the file data card. See EdmCmdData for information about the structure.

  4. Click Build > Build Solution to build the add-in.

  5. Install the add-in through the SOLIDWORKS PDM Professional Administration tool:
    1. Open the SOLIDWORKS Professional PDM Administration tool.
    2. Expand the vault where you want to install this add-in and log in as Admin.
    3. Right-click Add-ins and click New Add-in.
    4. Browse to project_path\project_name\project_name\bin\Debug, click project_name.dll and EPDM.Interop.epdm.dll.
    5. Click Open.
    6. Click OK.
    7. Click OK.

  6. Click Cards > File Cards.

  7. Double-click Text Card.

  8. Add a button to the card.

  9. Click the button.

  10. In Caption, type Browse....

  11. In Command type, select Run Add-in.

  12. In Name of add-in, type MyButton:Title.

  13. Save the card and exit the Card Editor.

  14. Open File Explorer on the vault and select a checked-out text file.

  15. Click Browse in the file's data card.

  16. The Select File for Title dialog box pops up.

  17. Browse to and select the checked-out text file.

  18. Click Open to copy the path of the selected file to the Title field of the file's data card.

Remarks

In this example, the value of a variable is set using IEdmEnumeratorVariable5::SetVar. You can also read values using IEdmEnumeratorVariable5::GetVar.

Using a button handler like this add-in, you can also:

  • Retrieve the number of configurations, layouts, or both, in the file by inspecting the EdmCmdData::mpoExtra variable, which contains IEdmStrLst5 of file interfaces.

  • Switch the active configuration.

  • Set focus to a certain control using the members of EdmCmdData.

  • Close the card automatically after the button handler returns by setting the EdmCmdData::mlLongData1 variable to one of the EdmCardFlag constants.


SOLIDWORKS PDM Professional API Help

C++ Add-ins and Windows Vista

Add-ins written in .NET should work in Windows Vista. However, native add-ins written in C++ that register type libraries might encounter problems. The Windows Vista operating system has a limitation that prevents registration of such add-ins.

If you do not need the type library, the best solution is to remove its registration from the code. Do this in C++ by setting the bRegTypeLib argument to FALSE in CAtlDllModuleT::DllRegisterServer() and CAtlDllModuleT::DLLUnregisterServer():

// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// registers object
HRESULT hr = _AtlModule.DllRegisterServer(
    FALSE );
return hr;
}

// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT hr = _AtlModule.DllUnregisterServer(
    FALSE );
return hr;
}


SOLIDWORKS PDM Professional API Help

Debugging Add-ins

Add-ins are stored in the file vault and are downloaded to and COM-registered on the client computer when they are needed. This presents a problem when developing a new add-in that you want to debug, because the add-in is re-registered in a folder that is different than the compiler’s output folder. Testing an add-in in a production vault can also be a problem, because it affects all users of the vault.

SOLIDWORKS PDM Professional provides a menu command that solves these two problems, Debug Add-ins.

When an add-in is installed as a debug add-in, it is registered only on your machine. No other users are affected by it. The add-in is also loaded from the location where it is registered.

To debug an add-in using File Explorer:

  1. Open the Windows Task Manager.

  2. Kill the explorer.exe process.

  3. Right-click the project name in the Solution Explorer of Visual Studio and click Properties.

  4. Click the Debug tab.

  5. Click Start external program and type the File Explorer executable's path. For example:

     C:\windows\explorer.exe

  6. Click Debug > Start Debugging.


SOLIDWORKS PDM Professional API Help

Keeping Add-in Windows in the Foreground

When an add-in displays a dialog box, the add-in needs to keep the dialog box in front of whatever window launched it. Failure to do so may result in the dialog box disappearing and the user becoming confused.

C++

To keep the dialog box in the foreground, you can specify a parent window handle when the new dialog box is created.

VB.NET or C#

Window handling is supported in SOLIDWORKS PDM Professional 6.4 and later. In SOLIDWORKS PDM Professional 6.4 only, you must also enable the Multithreaded Add-ins Threading policy.

Unlike Visual Basic 6, VB.NET and C# allow you to create add-in modules that support multi-threading. When SOLIDWORKS PDM Professional runs a multi-threaded NET add-in, it executes it in the same thread as the parent window. Calls to IEdmVault5::SetAddInWnd, which were previously recommended for Visual Basic 6, are no longer necessary.

To keep an add-in window in the foreground, call IEdmVault8::GetWin32Window in the .NET form of your add-in to specify the handle of the parent window.


SOLIDWORKS PDM Professional API Help

Using .NET Framework in Add-in Applications

Many versions of .NET Framework may be installed with your Windows operating system or Visual Studio. See https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx.

SOLIDWORKS PDM Professional supports one or more versions of .NET Framework.

SOLIDWORKS PDM Professional versions... | Support .NET Framework...
2013 and later | 4.0 and later
2009 - 2012 | 3.5, 3.0, and 2.0
2008 and earlier | 2.0

If using .NET Framework 4.0 or later, prevent failures when calling methods that pass arrays of structures by:

  1. Opening the project in Visual Studio.
  2. Right-clicking Dependencies > Assemblies > EPDM.Interop.epdm in the Solution Explorer and selecting Properties.
  3. Setting Embed Interop Types to No.
  4. Right-clicking Dependencies > Assemblies > EPDM.Interop.EPDMResultCode in the Solution Explorer and selecting Properties.
  5. Setting Embed Interop Types to No.
  6. Initializing arrays of structures in your code to:
    • VB.NET: Nothing
    • C#: null

If your SOLIDWORKS PDM Professional 2012 or earlier version add-in application is compiled using Microsoft Visual Studio and a .NET Framework version other than version 2.0, then SOLIDWORKS PDM Professional may show the following message when you try to load the add-in:

“The Archive Server could not open the Windows Registry.”

  • C# or VB.NET

    To solve this problem, try changing your add-in project’s target framework to .NET Framework 2.0:

  1. Right-click the project in the Solution Explorer.
  2. Select Properties.
  3. Click Compile > Advanced Compile Options.
  4. Select .NET Framework 2.0.
  5. Click OK.

After changing your project’s target framework to .NET Framework 2.0, you might no longer be able to reference the SOLIDWORKS PDM Professional nnnn Type Library (EdmInterface.dll), because Visual Studio created the DLL using the latest version of .NET Framework, but you just changed the project to target an earlier version of .NET Framework (2.0). If you encounter this problem, you can generate a compatible SOLIDWORKS PDM Professional primary interop assembly by using the Microsoft's Type Library Importer (TlbImp.exe) that is included in an earlier version of the Microsoft .NET Framework SDK.

  1. Download and install a version of .NET Framework SDK that is compatible with your add-in project's version.
  2. Open a Windows Command Prompt.
  3. Navigate to C:\Program Files\Microsoft SDKs\Windows\v x.x\Bin in which the earlier .NET Framework version of TlbImp.exe is installed.
  4. Type TlbImp.exe install_dir\EdmInterface.dll /sysarray /out:Interop.EdmLib.dll /namespace:EdmLib.
  5. Modify all add-in examples in this help file to use the new interop assembly.
  • C++

    This problem can occur at runtime if the add-in failed to register its DLL during the build process. To solve this problem, ensure that your add-in registers the DLL:
    1. Open your C++ add-in project.
    2. Right-click the project in the Solution Explorer.
    3. Select Properties.
    4. Click Linker > Input.
    5. Configure Module Definition File to point to the add-in's project_name.def.
    6. Save the project.
    7. Click Build > Clean Solution.
    8. Click Build > Build Solution.

See Also

Using .NET Framework in Stand-alone Applications


SOLIDWORKS PDM Professional API Help

Programming Tasks

In SOLIDWORKS PDM Professional 2009 and earlier, add-ins work only on single client machines:

  • A change-state hook calls the add-in on the machine where the change state command is executed.

- or -

  • A menu command executes the add-in on the computer where the menu command is selected.

Although this is often desirable, there are times when you want to execute the add-in on different machines. SOLIDWORKS PDM Professional and later allow you to program tasks to execute add-ins on other machines.

A task consists of:

  • Add-in to execute.
  • Dialog or form to show when the task is launched.
  • User credentials to use to execute the add-in.
  • Computers on which to execute the add-in.
  • Optional scheduling of the add-in.
  • Credentials of users who have permission to run the add-in.
  • Error and success notifications.

You can read more about the task execution system in the SOLIDWORKS PDM Professional Help.

To program your own task:

  1. Write an add-in DLL that supports task execution.
  2. Add the add-in to the vault using the Administration tool.
  3. Enable execution of the add-in on one or more servers by selecting the Task Host Configuration command from the context-sensitive menu on the SOLIDWORKS PDM Professional icon in the task bar navigation area (system tray).
  4. Right-click the tasks node in the Administration tool and select New Task from the menu.
  5. Select your add-in in the task wizard.
  6. Select other options in the task wizard.

The task is executed in one of the following ways:

  • A task definition spawns task instances according to a defined schedule.
  • A workflow change state action executes the task.
  • Start the Administration tool, expland Tasks, double-click Task List, and click Add Task.
  • Right-click a file vault view and select the task on the context-sensitive menu.

Using the Standard Task Add-in

You do not need to program your own task add-in if you only need to open files in SOLIDWORKS and execute scripts on them. To do that, use the standard task add-in that is shipped with SOLIDWORKS PDM Professional.

Code Samples

  • Task Add-in Sample (VB.NET)
  • Task Add-in Sample (C#)

Interfaces

  • IEdmAddIn5
  • IEdmTaskInstance
  • IEdmTaskProperties

Structures and Constants

  • EdmTaskFlag
  • EdmTaskMenuCmd
  • EdmTaskSel
  • EdmTaskSetupPage
  • EdmTaskStatus


SOLIDWORKS PDM Professional API Help

Task Add-in Sample

The following shows the entire source code of a task add-in written in VB.NET. The add-in:

  • Implements IEdmAddIn5.
  • Creates custom pages in the Task property dialog box.
  • Customizes the task details page.
  • Displays a message box on launch.

NOTE: To populate the GUID attribute below, click Tools > Create GUID in the IDE, select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with the copied string.

Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("")> _
<ComVisible(True)> _
Public Class TaskAddIn
Implements IEdmAddIn5

Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo
On Error GoTo ErrHand
  ' Fill in the add-in's description
  poInfo.mbsAddInName = "Task Test Add-in"
  poInfo.mbsCompany = "SOLIDWORKS"
  poInfo.mbsDescription = "Add-in used to test the task execution system"
  poInfo.mlAddInVersion = 1

  ' Minimum SOLIDWORKS PDM Professional version needed for VB.NET add-ins is 2010
  poInfo.mlRequiredVersionMajor = 10
  poInfo.mlRequiredVersionMinor = 0

  'Register this task add-in hook to run a task add-in
  poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskRun)

  'Register this task add-in hook to append information to the task property pages in the Administration tool
  poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetup)

  'Register this task add-in hook to display a dialog or form before the task is launched on the client computer
  poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskLaunch)

  'Register this task add-in hook to provide extra details in the Details dialog box in the task list in the Administration tool
  poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskDetails)

  'Register this task add-in hook to perform some action after a task launch dialog box or form button is clicked
  poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskLaunchButton)

  'Register this task add-in hook to be called when the task set-up wizard is closed
  poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetupButton)

Exit Sub

ErrHand:
Dim v11 As IEdmVault11
v11 = poVault
MsgBox(v11.GetErrorMessage(Err.Number))
End Sub
Private Sub OnTaskDetails(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[])
  Dim inst As IEdmTaskInstance
  inst = poCmd.mpoExtra

  'Create a custom page in the task properties dialog box; TaskDetailsPage is a
  'user control; TaskDetailsPage::LoadData fills in some edit boxes with
  'values from IEdmTaskInstance::GetValEx
  Dim myPage As TaskDetailsPage
  myPage = New TaskDetailsPage
  myPage.CreateControl()
  poCmd.mpoExtra = myPage

  poCmd.mlParentWnd = myPage.Handle.ToInt32
  poCmd.mbsComment = "My Test Page"

  myPage.LoadData(inst)

End Sub
Private Sub OnTaskLaunch(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[])

  'Display a message box on task launch
  'You can also display a form to collect data to pass back to the task add-in
  Dim v11 As IEdmVault11
  v11 = poCmd.mpoVault
  If v11.MsgBox(poCmd.mlParentWnd, "Hello!" + vbLf + "Are you sure you want to launch the test task?", EdmMBoxType.EdmMbt_YesNo) <> EdmMBoxResult.EdmMbr_Yes Then
    poCmd.mbCancel = True
    Exit Sub
  End If

End Sub
Private Sub OnTaskLaunchButton(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[])

'Code here is executed when the user clicks OK or Cancel in the dialog returned by OnTaskLaunch

  If poCmd.mbsComment = "OK"

         poCmd.mbCancel = False;

  Else

         poCmd.mbCancel = True;

  End If

End Sub
Private Sub OnTaskRun(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[])

  'Get the property interface used to access the framework
  Dim inst As IEdmTaskInstance
  inst = poCmd.mpoExtra

  On Error GoTo ErrHand
  'Inform the framework that the task has started
  inst.SetStatus(EdmTaskStatus.EdmTaskStat_Running)

  'Format a message to be displayed in the task list
  Dim msg As String
  msg = "Test is running:"
  msg = msg + " MyTestSetupVar='" + CStr(inst.GetValEx("MyTestSetupVar"))
  msg = msg + "' MyLaunchVar='" + inst.GetValEx("MyLaunchVar")
  msg = msg + "' Idx="

  'This is the main worker loop that does all of the important work;
  'it just beeps and sleeps
  Dim idx As Integer
  idx = 1
  Dim maxPos As Integer
  maxPos = 200
  inst.SetProgressRange(maxPos, 0, msg + CStr(idx))
  While idx < maxPos
    'Update progress bar that shows in the task list
    inst.SetProgressPos(idx, msg + CStr(idx))
    idx = idx + 1

    'Do some important work here
    System.Media.SystemSounds.Beep.Play()
    System.Threading.Thread.Sleep(60000 / maxPos)

    'Handle the cancel button in the task list
    If inst.GetStatus() = EdmTaskStatus.EdmTaskStat_CancelPending Then
      inst.SetStatus(EdmTaskStatus.EdmTaskStat_DoneCancelled)
      Exit Sub
    End If

    'Handle temporary suspension of the task
    If inst.GetStatus() = EdmTaskStatus.EdmTaskStat_SuspensionPending Then
      inst.SetStatus(EdmTaskStatus.EdmTaskStat_Suspended)
      While inst.GetStatus() = EdmTaskStatus.EdmTaskStat_Suspended
        System.Threading.Thread.Sleep(1000)
      End While
      If inst.GetStatus() = EdmTaskStatus.EdmTaskStat_ResumePending Then
        inst.SetStatus(EdmTaskStatus.EdmTaskStat_Running)
      End If
    End If
  End While

  'Inform the framework that the task has successfully completed
  inst.SetStatus(EdmTaskStatus.EdmTaskStat_DoneOK)
  Exit Sub

ErrHand:
  'Return errors to the framework by failing the task
  inst.SetStatus(EdmTaskStatus.EdmTaskStat_DoneFailed, Err.Number, "The test task failed!")
End Sub
'Store the custom set-up page here so it can be accessed from both OnTaskSetup and OnTaskSetupButton
Dim currentSetupPage As SetupPage
Private Sub OnTaskSetup(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[])
  'Get the property interface used to access the framework
  Dim props As IEdmTaskProperties
  props = poCmd.mpoExtra

  'Turn on some properties, e.g., the task can be launched during a
  'state change, can extend the details page, is called when the
  'task is launched, and supports scheduling
  props.TaskFlags = EdmTaskFlag.EdmTask_SupportsChangeState + EdmTaskFlag.EdmTask_SupportsDetails + EdmTaskFlag.EdmTask_SupportsInitExec + EdmTaskFlag.EdmTask_SupportsScheduling

  'Set menu commands that launch this task from File Explorer
  Dim cmds(0) As EdmTaskMenuCmd
  cmds(0).mbsMenuString = "Run the test task"
  cmds(0).mbsStatusBarHelp = "This command runs the task add-in"
  cmds(0).mlCmdID = 1
  cmds(0).mlEdmMenuFlags = EdmMenuFlags.EdmMenu_Nothing
  props.SetMenuCmds(cmds)

  'Add a custom setup page; SetupPage is a user control with an
  'edit box; SetupPage::LoadData populates the edit box from a
  'variable in IEdmTaskProperties; saving of properties is handled
  'by OnTaskSetupButton
  currentSetupPage = New SetupPage
  currentSetupPage.CreateControl()
  currentSetupPage.LoadData(poCmd)

  Dim pages(0) As EdmTaskSetupPage
  pages(0).mbsPageName = "Test Add-in page"
  pages(0).mlPageHwnd = currentSetupPage.Handle.ToInt32
  pages(0).mpoPageImpl = currentSetupPage

  props.SetSetupPages(pages)
End Sub
'Called when the user clicks OK or Cancel in the
'task property dialog box
Private Sub OnTaskSetupButton(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[])
  'The custom set-up page in currentSetupPage
  'was created in method OnTaskSetup;
  'StoreData saves the contents of the edit
  'box in the user control to
  'IEdmTaskProperties in poCmd.mpoExtra
  If poCmd.mbsComment = "OK" And Not currentSetupPage Is Nothing Then
    currentSetupPage.StoreData(poCmd)
  End If
  currentSetupPage = Nothing
End Sub
'Main entry point of the add-in; called by SOLIDWORKS
'PDM Professional for all task-related events
Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd
On Error GoTo ErrHand

  'Check the command type and call the right procedure
  Select Case poCmd.meCmdType
    Case EdmCmdType.EdmCmd_TaskDetails
      OnTaskDetails(poCmd, ppoData)
    Case EdmCmdType.EdmCmd_TaskLaunch
      OnTaskLaunch(poCmd, ppoData)
    Case EdmCmdType.EdmCmd_TaskLaunchButton
      OnTaskLaunchButton(poCmd, ppoData)
    Case EdmCmdType.EdmCmd_TaskRun
      OnTaskRun(poCmd, ppoData)
    Case EdmCmdType.EdmCmd_TaskSetup
      OnTaskSetup(poCmd, ppoData)
    Case EdmCmdType.EdmCmd_TaskSetupButton
      OnTaskSetupButton(poCmd, ppoData)
  End Select
  Exit Sub

ErrHand:
  Dim v11 As IEdmVault11
  v11 = poCmd.mpoVault
  MsgBox(v11.GetErrorMessage(Err.Number))
End Sub

End Class

The following is a resource template of the custom set-up page that is displayed in the Task property dialog box by TaskAddIn::OnTaskSetup. It is a user control in Visual Studio with an edit box named TextBox1 and a button named TestButton.

The code behind the custom set-up page is as follows.

Imports EPDM.Interop.epdm

Public Class SetupPage

'Button handler for a button on the page
Private Sub TestButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TestButton.Click
  MsgBox("You pressed the test button")
End Sub

Public Sub LoadData(ByRef poCmd As EdmCmd)

'Get the property interface used to access the framework
 Dim props As IEdmTaskProperties
props = poCmd.mpoExtra

'Populate the edit box from a variable
 TextBox1.Text = props.GetValEx("MyTestSetupVar")

End Sub

Public Sub StoreData(ByRef poCmd As EdmCmd)

  'Get the property interface used to access the framework
  Dim props As IEdmTaskProperties
  props = poCmd.mpoExtra

  'Make sure the user has typed a value in the edit box
  If TextBox1.Text = "" Then
    MsgBox("Enter a test value for the add-in!")
    poCmd.mbCancel = True
    Exit Sub
  End If

  'Save the value entered by the user
  props.SetValEx("MyTestSetupVar", TextBox1.Text)

End Sub

End Class

The following is the r esource template of the extra details page added by TaskAddIn::OnTaskDetails. It is a user control in Visual Studio that displays two task variables:

The code behind the extra details page:

Imports EPDM.Interop.epdm
Public Class TaskDetailsPage

Public Sub LoadData(ByRef inst As IEdmTaskInstance)

  'Populate the editboxes from the variables in the task
  TextBoxSetupVar.Text = CStr(inst.GetValEx("MyTestSetupVar"))
  TextBoxLaunchVar.Text = CStr(inst.GetValEx("MyLaunchVar"))

End Sub
End Class

The following is the set-up page when the add-in is used in a task.

The following is the task details page when opened from the task list.

The following is the task list during task execution.

See Also

Programming Tasks

Standard Task Add-in

Task Sample (C#)


SOLIDWORKS PDM Professional API Help

Task Add-in Sample (C#)

The following shows the entire source code of a task add-in written in C#. The add-in:

  • Is created using a C# class library (.NET Framework) project in Visual Studio.
  • Implements IEdmAddIn5.
  • Displays a message box on task launch.
  • Creates custom pages in the Task property dialog box.
  • Customizes the task details page.

NOTE: To populate the GUID attribute below, click Tools > Create GUID in the IDE, select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with the copied string.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;
using System.Windows.Forms;

[Guid(""), ComVisible(true)]
    public class Class1 : IEdmAddIn5
    {

        RunPage m_runPage;;

         SetupPage SetupPageObj;
        public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
        {

            try
            {
                poInfo.mbsAddInName = "C# Workflow State Age Task Add-In";
                poInfo.mbsCompany = "Dassault Systemes";
                poInfo.mbsDescription = "Example demonstrates a task that finds files that have been in selected workflow states a selected number of days";
                poInfo.mlAddInVersion = 1;
                //Minimum SOLIDWORKS PDM Professional version
                //needed for Tasks is 10.0
                poInfo.mlRequiredVersionMajor = 10;
                poInfo.mlRequiredVersionMinor = 0;

                //Register to call OnCmd on task-related events
                poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetup);
                poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetupButton);
                poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskRun);
                poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskDetails);

                poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskLaunch);

                poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskLaunchButton);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

private void OnTaskLaunchButton(ref EdmCmd poCmd)

        {

            if (poCmd.mbsComment == "OK")

            {

                poCmd.mbCancel = false;

            }

            else

            {

                poCmd.mbCancel = 1true;

            }

        }

 private void OnTaskLaunch(ref EdmCmd poCmd, EdmCmdData[] poData)

        {

            'Display a message box on task launch
            'You can also display a form to collect data to pass back to the task add-in
            IEdmVault7 v11;
            v11 = (IEdmVault7)poCmd.mpoVault;
            if (v11.MsgBox(poCmd.mlParentWnd, "Hello!" + " Are you sure you want to launch the test task?", EdmMBoxType.EdmMbt_YesNo) <> EdmMBoxResult.EdmMbr_Yes)

            {
                poCmd.mbCancel = false;

            }

        }
private void OnTaskDetails(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            try
            {
                IEdmTaskInstance TaskInstance = (IEdmTaskInstance)poCmd.mpoExtra;
                if ((TaskInstance != null))
                {
                    SetupPageObj = new SetupPage((IEdmVault7)poCmd.mpoVault, TaskInstance);
                    //Force immediate creation of the control
                    //and its handle
                    SetupPageObj.CreateControl();
                    SetupPageObj.LoadData(poCmd);
                    SetupPageObj.DisableControls();
                    poCmd.mbsComment = "State Age Details";
                    poCmd.mlParentWnd = SetupPageObj.Handle.ToInt32();
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

private void OnTaskRun(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            try
            {
                IEdmTaskInstance TaskInstance = default(IEdmTaskInstance);
                TaskInstance = (IEdmTaskInstance)poCmd.mpoExtra;
                if ((TaskInstance != null))
                {
                    TaskInstance.SetStatus(EdmTaskStatus.EdmTaskStat_Running);
                    TaskInstance.SetProgressRange(100, 0, "Task is running.");

                    string NoDays = null;
                    NoDays = (string)TaskInstance.GetValEx("NoDaysVar");

                    string States = "";
                    States = (string)TaskInstance.GetValEx("SelectedStatesVar");

                    List<EdmSelItem2> Items = new List<EdmSelItem2>();

                    DoSearch((IEdmVault11)poCmd.mpoVault, States, NoDays, Items);

                    EdmSelItem2[] NotificationArray = new EdmSelItem2[Items.Count];

                    Items.CopyTo(NotificationArray);

                    string ProgresssMsg = null;
                    if ((Items.Count > 0))
                    {
                        ProgresssMsg = "Found " + Items.Count.ToString() + " files.";
                    }
                    else
                    {
                        ProgresssMsg = ("No files found.");
                    }

                    TaskInstance.SetProgressPos(100, ProgresssMsg);
                    TaskInstance.SetStatus(EdmTaskStatus.EdmTaskStat_DoneOK, 0, "", NotificationArray, ProgresssMsg);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
'Store the custom set-up page here so it can be accessed from both OnTaskSetup and OnTaskSetupButton
SetupPage SetupPageObj;
private void OnTaskSetup(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            try
            {
                IEdmTaskProperties props = (IEdmTaskProperties)poCmd.mpoExtra;
                if ((props != null))
                {
                    //Set the task properties
                    props.TaskFlags = (int)EdmTaskFlag.EdmTask_SupportsScheduling + (int)EdmTaskFlag.EdmTask_SupportsDetails;

                    SetupPageObj = new SetupPage((IEdmVault7)poCmd.mpoVault, props);
                    //Force immediate creation of the control
                    //and its handle
                    SetupPageObj.CreateControl();
                    SetupPageObj.LoadData(poCmd);

                    EdmTaskSetupPage[] pages = new EdmTaskSetupPage[1];
                    //Page name that appears in the
                    //navigation pane of the Add Task dialog
                    //in the Administration tool
                    pages[0].mbsPageName = "Choose states to check";
                    pages[0].mlPageHwnd = SetupPageObj.Handle.ToInt32();
                    pages[0].mpoPageImpl = SetupPageObj;

                    props.SetSetupPages(pages);

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
'Called when the user clicks OK or Cancel in the
'task property dialog box
private void OnTaskSetupButton(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            try
            {
                //Custom setup page, SetupPageObj, is created
                //in method Class1::OnTaskSetup; SetupPage::StoreData
                //saves the contents of the list box to poCmd.mpoExtra
                //in the IEdmTaskProperties interface
                if (poCmd.mbsComment == "OK" & (SetupPageObj != null))
                {
                    SetupPageObj.StoreData();
                }
                SetupPageObj = null;

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
'Main entry point of the add-in; called by SOLIDWORKS
'PDM Professional for all task-related events
 public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {

            try
            {
                switch (poCmd.meCmdType)
                {

                    //Display a task launch dialog box
                    case EdmCmdType.EdmCmd_TaskLaunch:
                        OnTaskLaunch(ref poCmd, ref ppoData);

                        break;
                    //Sent when the user clicks OK or
                    //Cancel in the task launch dialog box
                    case EdmCmdType.EdmCmd_TaskLaunchButton:
                        OnTaskLaunchButton(ref poCmd, ref ppoData);

                        break;
                    //Called from the Administration tool when
                    //the user selects this task add-in from the
                    //drop-down list and whenever this task is
                    //subsequently edited in the Administration tool
                    case EdmCmdType.EdmCmd_TaskSetup:
                        OnTaskSetup(ref poCmd, ref ppoData);

                        break;
                    //Sent when the user clicks OK or
                    //Cancel in the task property dialog box
                    case EdmCmdType.EdmCmd_TaskSetupButton:
                        OnTaskSetupButton(ref poCmd, ref ppoData);

                        break;
                    //Called when an instance of the
                    //task is run
                    case EdmCmdType.EdmCmd_TaskRun:
                        OnTaskRun(ref poCmd, ref ppoData);

                        break;
                    //Called from the Task List in the
                    //Administration tool when the task details
                    //dialog is displayed
                    case EdmCmdType.EdmCmd_TaskDetails:
                        OnTaskDetails(ref poCmd, ref ppoData);
                        break;
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

The following is a resource template of the custom set-up page that is displayed in the Task property dialog box by TaskAddIn::OnTaskSetup. It also appears in the Task Details page added by TaskAddIn::OnTaskDetails. It is a user control in Visual Studio.

The code behind the custom set-up page is as follows:

using System;

using System.Collections;

using System.Collections.Generic;

using System.Data;

using System.Diagnostics;

using System.Windows.Forms;

using EPDM.Interop.epdm;

namespace StateAgeTask_CSharp

{

    // Setup page used in the task setup and task details dialogs must be a System.Windows.Forms.UserControl

    public partial class SetupPage

    {

        private IEdmVault7 mVault;

        private IEdmTaskProperties mTaskProps;

        private IEdmTaskInstance mTaskInst;

        // Constructor called from task setup

        public SetupPage(IEdmVault7 Vault, IEdmTaskProperties Props)

        {

            try

            {

                InitializeComponent();

                mVault = Vault;

                mTaskProps = Props;

                mTaskInst = null;

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        // Constructor called from task details

        public SetupPage(IEdmVault7 Vault, IEdmTaskInstance Props)

        {

            try

            {

                InitializeComponent();

                mVault = Vault;

                mTaskProps = null;

                mTaskInst = Props;

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        public void LoadData(EdmCmd poCmd)

        {

            try

            {

                //Add the names of the available workflows

                //to WorkflowsComboBox

                WorkflowsComboBox.Items.Clear();

                IEdmWorkflowMgr6 WorkflowMgr = default(IEdmWorkflowMgr6);

                WorkflowMgr = (IEdmWorkflowMgr6)mVault.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr);

                IEdmPos5 WorkflowPos = WorkflowMgr.GetFirstWorkflowPosition();

                while (!WorkflowPos.IsNull)

                {

                    IEdmWorkflow6 Workflow = default(IEdmWorkflow6);

                    Workflow = WorkflowMgr.GetNextWorkflow(WorkflowPos);

                    WorkflowsComboBox.Items.Add(Workflow.Name);

                }

                string SelectedWorkflow = "";

                string NoDays = "";

                if ((mTaskProps != null))

                {

                    //Retrieve the name of the workflow that was

                    //selected by the user

                    SelectedWorkflow = (string)mTaskProps.GetValEx("SelectedWorkflowVar");

                    //Retrieve the number of days in a state

                    //before sending a message

                    NoDays = (string)mTaskProps.GetValEx("NoDaysVar");

                }

                else if ((mTaskInst != null))

                {

                    //Retrieve the name of the workflow that

                    //was selected by the user

                    SelectedWorkflow = (string)mTaskInst.GetValEx("SelectedWorkflowVar");

                    //Retrieve the number of days in a state

                    //before sending a message

                    NoDays = (string)mTaskInst.GetValEx("NoDaysVar");

                }

                //Select the workflow to display in

                //WorkflowsComboBox; setting this also

                //causes SetupPage::WorkflowsComboBox_SelectedIndexChanged

                //to be called to fill StatesListBox

                //with the available states for this workflow

                if (string.IsNullOrEmpty(SelectedWorkflow))

                {

                    WorkflowsComboBox.SelectedIndex = 0;

                }

                else

                {

                    WorkflowsComboBox.Text = SelectedWorkflow;

                }

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        public void StoreData()

        {

            try

            {

                //Add the selected states to StatesList

                string StatesList = "";

                foreach (int SelectedStateIndex in StatesListBox.SelectedIndices)

                {

                    StatesList += StatesListBox.Items[SelectedStateIndex] + "";

                }

                //Save the states selected by the user

                mTaskProps.SetValEx("SelectedStatesVar", StatesList);

                //Save the workflow selected by the user

                mTaskProps.SetValEx("SelectedWorkflowVar", WorkflowsComboBox.Text);

                //Save the number of days selected by the user

                mTaskProps.SetValEx("NoDaysVar", DaysNumericUpDown.Value.ToString());

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        private void WorkflowsComboBox_SelectedIndexChanged(System.Object sender, System.EventArgs e)

        {

            try

            {

                //Find the IEdmWorkflow corresponding to the

                //selected workflow name

                IEdmWorkflowMgr6 WorkflowMgr = default(IEdmWorkflowMgr6);

                WorkflowMgr = (IEdmWorkflowMgr6)mVault.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr);

                IEdmPos5 WorkflowPos = WorkflowMgr.GetFirstWorkflowPosition();

                IEdmWorkflow6 Workflow = null;

                IEdmWorkflow6 SelectedWorkflow = null;

                while (!WorkflowPos.IsNull)

                {

                    Workflow = WorkflowMgr.GetNextWorkflow(WorkflowPos);

                    if (Workflow.Name == WorkflowsComboBox.Text)

                    {

                        SelectedWorkflow = Workflow;

                        break;

                    }

                }

                //Add the names of the available states for the

                //selected workflow to StatesListBox

                StatesListBox.Items.Clear();

                if (SelectedWorkflow != null)

                {

                    IEdmPos5 StatePos = SelectedWorkflow.GetFirstStatePosition();

                    while (!(StatePos.IsNull))

                    {

                        IEdmState6 State = default(IEdmState6);

                        State = SelectedWorkflow.GetNextState(StatePos);

                        StatesListBox.Items.Add(State.Name);

                    }

                }

                string SelectedStates = "";

                if ((mTaskProps != null))

                {

                    SelectedStates = (string)mTaskProps.GetValEx("SelectedStatesVar");

                }

                else if ((mTaskInst != null))

                {

                    SelectedStates = (string)mTaskInst.GetValEx("SelectedStatesVar");

                }

string[]
States = SelectedStates.Split(new
string[] {
"\\n" }, StringSplitOptions.None);

                foreach (string State in States)

                {

                    if (!string.IsNullOrEmpty(State.Trim()))

                    {

                        StatesListBox.SelectedItems.Add(State);

                    }

                }

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        public void DisableControls()

        {

            try

            {

                WorkflowsComboBox.Enabled = false;

                StatesListBox.Enabled = false;

                DaysNumericUpDown.Enabled = false;

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

    }

}

See Also

Programming Tasks

Standard Task Add-in

TaskSample (VB.NET)

Back to top


SOLIDWORKS PDM Professional API Help

Writing 64-bit Add-ins

This topic shows how to create add-ins for the 64-bit version of SOLIDWORKS PDM Professional.

64-bit .NET Add-ins

You must use Microsoft Visual Studio 2005, or later, to create managed (.NET) DLL add-ins. The build target must be set to Any CPU for the DLL to load in both 32-bit and 64-bit hosts. Managed DLL add-ins are added to the vault using the Administration tool.

Native DLL Add-ins

A native 32-bit DLL cannot be loaded into a 64-bit EXE, and a 64-bit native DLL cannot be loaded into a 32-bit EXE. Because SOLIDWORKS PDM Professional gets loaded into both 32- and 64-bit processes, you must build two versions of your add-in, 32-bit and 64-bit.

Native DLL add-ins that are added to the vault on a 64-bit machine also work on a 32-bit machine:

  1. Right-click the Add-ins node in the Administration tool.
  2. Select New Add-in.
  3. Navigate to and open the 64-bit add-in DLL.
  4. In the Properties dialog, select Files in the left pane.
  5. Click Add Files.
  6. Navigate to and open the 32-bit add-in DLL.
  7. Click OK.

SOLIDWORKS PDM Professional creates a single add-in package that contains both 32-bit and 64-bit versions of the add-in. The 32-bit version is loaded in 32-bit processes, and the 64-bit version is loaded in 64-bit processes.


EPDM.Interop.epdm Namespace

SOLIDWORKS PDM Professional API Help Send Feedback
EPDM.Interop.epdm Namespace
See Also Inheritance Hierarchy
SOLIDWORKS PDM Professional API

Interfaces

Interface | Description
IEdmAddCustomRefs | Allows you to create or manage user-defined file references.
IEdmAddCustomRefs2 | Allows you to create or manage user-defined file references.
IEdmAddIn5 | Allows you to create a SOLIDWORKS PDM Professional add-in.
IEdmAddInDrawButton5 | Allows you to dynamically draw an add-in toolbar button.
IEdmAddInMgr5 | Allows you to administer add-ins.
IEdmAddInMgr6 | Allows you to administer add-ins.
IEdmAddInMgr7 | Allows you to administer add-ins.
IEdmAddInMgr8 | Allows you to administer add-ins.
IEdmAddInMgr9 | Allows you to administer add-ins.
IEdmAttribute5 | Allows access to a file attribute that is used when data is transferred between a file data card and a file.
IEdmBatchAdd | Allows you to add several files and folders to the vault at once.
IEdmBatchAdd2 | Allows you to display a dialog box with information about several files and folders being added to the vault all at once.
IEdmBatchAddFolders | Allows you to add several folders to the vault all at once.
IEdmBatchChangeState | Allows you to change states or revoke transitions of several files at once.
IEdmBatchChangeState2 | Allows you to change states or revoke transitions of several files at once.
IEdmBatchChangeState3 | Allows you to change states or revoke transitions of several files all at once.
IEdmBatchChangeState4 | Allows you to change states or revoke transitions of several files all at once.
IEdmBatchChangeState5 | Allows you to change states or revoke transitions of several files all at once.
IEdmBatchChangeState6 | Allows you to change states or revoke transitions of several files all at once.
IEdmBatchDelete | Allows you to delete several files and folders from the vault at once.
IEdmBatchDelete2 | Allows you to delete several files and folders from the vault at once.
IEdmBatchDelete3 | Allows you to delete several files and folders from the vault all at once.
IEdmBatchGet | Allows you to get several files from the vault all at once.
IEdmBatchItemGeneration | Allows you to generate items from a file structure.
IEdmBatchItemGeneration2 | Allows you to generate several items from file structures all at once.
IEdmBatchItemReferenceUpdate | Allows you to add or remove several item references all at once.
IEdmBatchListing | Allows you to create a listing of various file or folder properties.
IEdmBatchListing2 | Allows you to create a listing of various file or folder properties and specify from which configuration file the variables should be read.
IEdmBatchListing3 | Allows you to create a listing of several file, folder, or internal component properties all at once.
IEdmBatchListing4 | Allows you to create a listing of several file, folder, or internal component properties all at once.
IEdmBatchRefVars | Allows you to access several file reference variables all at once.
IEdmBatchUnlock | Allows you to unlock, check in, or undo check-outs of multiple files all at once.
IEdmBatchUnlock2 | Allows you to unlock, check in, or undo check-outs of multiple files all at once.
IEdmBatchUpdate | Allows you to set the values of several file and folder card variables all at once.
IEdmBatchUpdate2 | Allows you to set the values of several file and folder card variables all at once.
IEdmBitmap5 | Allows you to access a bitmap image.
IEdmBom | Allows you to access a Bill of Materials (BOM).
IEdmBomCell | Allows you to access a single row in a Bill of Materials (BOM).
IEdmBomCell2 | Allows you to access a single row in a Bill of Materials (BOM).
IEdmBomMgr | Allows you to access the Bill of Materials (BOM) layouts installed in a vault.
IEdmBomMgr2 | Allows you to access the Bill of Materials (BOM) layouts installed in a vault.
IEdmBomMgr3 | Allows you to add a SOLIDWORKS Bill of Materials (BOM) to a non-SOLIDWORKS document.
IEdmBomMgr4 | Allows you to access the Bill of Materials (BOM) layouts installed in a vault.
IEdmBomView | Allows you to access a Bill of Materials (BOM) view.
IEdmBomView2 | Allows you to access a Bill of Materials (BOM) view.
IEdmBomView3 | Allows you to access a Bill of Materials (BOM) view.
IEdmBomView4 | Allows you to access a Bill of Materials (BOM) view.
IEdmCallback | Monitors the progress of a supported API operation.
IEdmCallback6 | Monitors the progress of a supported API operation.
IEdmCallback8 | Monitors the progress of a supported API operation.
IEdmCard5 | Allows you to access the file or folder data card that is created with the SOLIDWORKS PDM Professional's Card Editor.
IEdmCard6 | Allows you to access the file or folder data card that is created with the SOLIDWORKS PDM Professional's Card Editor.
IEdmCard7 | Allows you to access the file or folder data card that is created with the SOLIDWORKS PDM Professional's Card Editor.
IEdmCardControl5 | Allows you to access a control in a file or folder data card.
IEdmCardControl6 | Allows you to access a control in a file or folder data card.
IEdmCardControl7 | Allows you to access a control in a file or folder data card.
IEdmCardView5 | Allows you to create a window containing a file or folder data card that you can edit.
IEdmCardView6 | Allows you to create a window containing a file or folder data card that you can edit.
IEdmCardView61 | Allows you to create a window containing a file or folder data card that you can edit.
IEdmCardView63 | Allows you to create a window containing a file or folder data card that you can edit.
IEdmCardView64 | Allows you to create a window containing a file or folder data card that you can edit.
IEdmCardViewCallback6 | Handles customized loading and saving of data in a card view.
IEdmCategory6 | Allows you to access a category.
IEdmCategoryMgr6 | Allows you to access all of the categories that have been set up in a vault.
IEdmClearLocalCache | Removes specified checked-in files and folders from the local file vault view cache. Only files that are not referenced by checked-out files are cleared.
IEdmClearLocalCache2 | Removes specified checked-in files and folders from the local file vault view cache. Only files that are not referenced by checked-out files are cleared.
IEdmClearLocalCache3 | Removes specified checked-in files and folders from the local file vault view cache. Only files that are not referenced by checked-out files are cleared.
IEdmCmdMgr5 | Allows you to add menu commands, toolbar buttons, and command hooks to SOLIDWORKS PDM Professional.
IEdmCmdMgr6 | Allows you to add menu commands, toolbar buttons, and command hooks to SOLIDWORKS PDM Professional.
IEdmCmdNode | Allows you to access a file changing state.
IEdmData | Allows you to access the properties of an object created by a template.
IEdmDictionary5 | Allows you to access key-value pairs of data in the SOLIDWORKS PDM Professional database.
IEdmEnum | Allows you to access and enumerate a list of elements.
IEdmEnumeratorCustomReference5 | Allows you to access custom file references.
IEdmEnumeratorCustomReference6 | Allows you to access user-defined file references.
IEdmEnumeratorCustomReference7 | Allows you to access user-defined file references.
IEdmEnumeratorVariable10 | Allows you to access the contents of a file data card.
IEdmEnumeratorVariable5 | Allows you to access the contents of a file or folder data card.
IEdmEnumeratorVariable6 | Allows you to access the contents of a file or folder data card.
IEdmEnumeratorVariable7 | Allows you to access the contents of a file data card.
IEdmEnumeratorVariable8 | Allows you to access the contents of a file data card.
IEdmEnumeratorVariable9 | Allows you to access the contents of a file data card.
IEdmEnumeratorVersion5 | Allows you to access the versions and revisions of a file.
IEdmEnumeratorVersion6 | Allows you to access the versions and revisions of a file.
IEdmEnumeratorVersion7 | Allows you to access the versions and revisions of a file.
IEdmFile10 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile11 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile12 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile13 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile14 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile15 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile16 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile17 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile18 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile5 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile6 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile7 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile8 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFile9 | Allows you to access a file in SOLIDWORKS PDM Professional.
IEdmFindUser | Allows you to search for users in the vault.
IEdmFolder10 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder11 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder12 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder13 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder5 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder6 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder7 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder8 | Allows you to access the contents of a file system folder in the vault.
IEdmFolder9 | Allows you to access the contents of a file system folder in the vault.
IEdmFolderData5 | Allows you to specify user and group permissions and file data cards when creating a folder with IEdmFolder5::AddFolder.
IEdmGetCSVersionDialog | Allows you to restore files in cold storage.
IEdmGetOpCallback | Controls and monitors IEdmBatchGet operations.
IEdmGetOpCallback2 | Controls and monitors IEdmBatchGet operations.
IEdmGetOpCallback3 | Controls and monitors IEdmBatchGet operations.
IEdmHistory | Allows you to access the history listing of files or folders.
IEdmHistory2 | Allows you to access the history listing of files or folders.
IEdmHistory3 | Allows you to access the sorted history listing of files or folders.
IEdmHistory4 | Allows you to access the sorted history of files or folders.
IEdmHistoryUpdate | Allows you to access the version and revision comments of files.
IEdmImage | Allows you to paint an image on a window.
IEdmInbox5 | Allows you to access the messages sent to a user.
IEdmItem | Allows you to access an item.
IEdmLabel5 | Allows you to access a file or folder label.
IEdmLabel6 | Allows you to access a file or folder label.
IEdmMenu5 | Allows you to add add-ins registered in SOLIDWORKS PDM Professional to your own menus and toolbars.
IEdmMenu6 | Allows you to add add-ins registered in SOLIDWORKS PDM Professional to your own menus and toolbars.
IEdmMenu7 | Allows you to add add-ins registered in SOLIDWORKS PDM Professional to your own menus and toolbars.
IEdmMessage5 | Allows you to encapsulate a single message in the inbox.
IEdmObject5 | Contains several properties and methods that are common to all derived interfaces.
IEdmPos5 | Allows you to identify the position of an element in a list of elements.
IEdmRawReferenceMgr | Allows you to update file reference paths directly in the checked-out files.
IEdmReference10 | Allows you to enumerate referenced and referencing files and set up user-defined references.
IEdmReference5 | Allows you to enumerate referenced and referencing files and set up user-defined references.
IEdmReference6 | Allows you to enumerate referenced and referencing files and set up user-defined references.
IEdmReference7 | Allows you to enumerate referenced and referencing files and set up user-defined references.
IEdmReference8 | Allows you to enumerate referenced and referencing files and set up user-defined references.
IEdmReference9 | Allows you to enumerate referenced and referencing files and set up user-defined references.
IEdmRefItem | Allows you to access an item in an IEdmRefItemContainer.
IEdmRefItem2 | Allows you to access an item in an IEdmRefItemContainer.
IEdmRefItemContainer | Allows you to access items in file reference dialogs.
IEdmRevision5 | Allows you to access a single revision of a file.
IEdmRevision6 | Allows you to access a single revision of a file.
IEdmRevision7 | Allows you to access a single revision of a file.
IEdmRevisionMgr | Allows you to update revision numbers on many files all at once.
IEdmRevisionMgr2 | Allows you to update revision numbers on many files all at once.
IEdmRevisionMgr3 | Allows you to update revision numbers on many files all at once.
IEdmSearch10 | Allows you to quickly find files or folders.
IEdmSearch5 | Allows you to quickly find files or folders.
IEdmSearch6 | Allows you to quickly find files or folders.
IEdmSearch7 | Allows you to quickly find files or folders.
IEdmSearch8 | Allows you to quickly find files or folders.
IEdmSearch9 | Allows you to quickly find files or folders.
IEdmSearchResult5 | Allows you to access a search result.
IEdmSearchResult6 | Allows you to access a search result.
IEdmSelectionList5 | Allows you to access a list of files or folders.
IEdmSelectionList6 | Allows you to access a list of objects of any EdmObjectType.
IEdmSerNoGen6 | Obsolete. Superseded by IEdmSerNoGen7 .
IEdmSerNoGen7 | Allows you to manage serial numbers.
IEdmSerNoGen8 | Allows you to manage serial numbers.
IEdmSerNoValue | Allows you to access the serial number generated by IEdmSerNoGen7::AllocSerNoValue.
IEdmState5 | Allows you to access a workflow state.
IEdmState6 | Allows you to access a workflow state.
IEdmState7 | Allows you to access a workflow state.
IEdmStrLst5 | Allows you to access a list of arbitrary strings.
IEdmSWBom | Allows you to access a SOLIDWORKS BOM.
IEdmSWBomCell | Allows you to access a cell in a custom SOLIDWORKS BOM table.
IEdmSWBomColumn | Allows you to access a column in a custom SOLIDWORKS BOM table.
IEdmSWBomRow | Allows you to access a row in a custom SOLIDWORKS BOM table.
IEdmTaskInstance | Allows you to access the task instance of an add-in.
IEdmTaskMgr | Allows you to manage task add-ins.
IEdmTaskProperties | Allows you to access the task definition of an add-in.
IEdmTemplate5 | Allows you to access a single template.
IEdmTemplate53 | Allows you to access a single template.
IEdmTemplate6 | Allows you to access a single template.
IEdmTemplateMgr5 | Allows you to access the templates installed in the file vault.
IEdmTransition10 | Allows you to access a workflow transition.
IEdmTransition5 | Allows you to access a workflow transition.
IEdmTransition6 | Allows you to access a workflow transition.
IEdmTransition7 | Allows you to access a workflow transition.
IEdmTransition8 | Allows you to access a workflow transition.
IEdmTransition9 | Allows you to access a workflow transition.
IEdmUnlockOpCallback | Allows you to access information and gain control of IEdmBatchUnlock operations.
IEdmUpdateReferences | Allows you to mend broken file references.
IEdmUser10 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUser11 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUser5 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUser6 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUser7 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUser8 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUser9 | Allows you to access a user in SOLIDWORKS PDM Professional.
IEdmUserGroup5 | Allows you to access a user group in SOLIDWORKS PDM Professional.
IEdmUserGroup6 | Allows you to access a user group in SOLIDWORKS PDM Professional.
IEdmUserGroup7 | Allows you to access a user group in SOLIDWORKS PDM Professional.
IEdmUserGroup8 | Allows you to access a user group in SOLIDWORKS PDM Professional.
IEdmUserGroup9 | Allows you to access a user group in SOLIDWORKS PDM Professional.
IEdmUserMgr10 | Allows you to access the users and user groups in the vault.
IEdmUserMgr5 | Allows you to access the users and user groups in the vault.
IEdmUserMgr6 | Obsolete. Superseded by IEdmUserMgr7 .
IEdmUserMgr7 | Allows you to access the users and user groups in the vault.
IEdmUserMgr8 | Allows you to access the users and user groups in the vault.
IEdmUserMgr9 | Allows you to access the users and user groups in the vault.
IEdmVariable5 | Allows you to access a variable on a file or folder data card.
IEdmVariableMgr5 | Allows you to manage the file and folder data card variables set up in the Card Editor.
IEdmVariableMgr6 | Allows you to manage the file and folder data card variables set up in the Card Editor.
IEdmVariableMgr7 | Allows you to manage the file and folder data card variables set up in the Card Editor.
IEdmVariableValue5 | Allows you to access the values of file and folder data card variables.
IEdmVariableValue6 | Allows you to access the values of file and folder data card variables.
IEdmVault10 | Allows you to access a file vault.
IEdmVault11 | Allows you to access a file vault.
IEdmVault12 | Allows you to access a file vault.
IEdmVault13 | Allows you to access a file vault.
IEdmVault14 | Allows you to access a file vault.
IEdmVault15 | Allows you to access a file vault.
IEdmVault16 | Allows you to access a file vault.
IEdmVault17 | Allows you to access a file vault.
IEdmVault18 | Allows you to access a file vault.
IEdmVault19 | Allows you to access a file vault.
IEdmVault20 | Allows you to access a file vault.
IEdmVault21 | Allows you to access a file vault.
IEdmVault22 | Allows you to access a file vault.
IEdmVault5 | Allows you to access a file vault.
IEdmVault6 | Allows you to access a file vault.
IEdmVault7 | Allows you to access a file vault.
IEdmVault8 | Allows you to access a file vault.
IEdmVault9 | Allows you to access a file vault.
IEdmVersion5 | Allows you to access the version of a file.
IEdmVersion6 | Allows you to access the version of a file.
IEdmVersion7 | Allows you to access the version of a file.
IEdmVersion8 | Allows you to access the version of a file.
IEdmWorkflow5 | Obsolete. Superseded by IEdmWorkflow6 .
IEdmWorkflow6 | Allows you to access a workflow set up using SOLIDWORKS PDM Professional's Workflow Editor.
IEdmWorkflowMgr6 | Allows you to access the workflows installed in a file vault.

Structures

Structure | Description
EdmAddFileInfo | Contains information about a file.
EdmAddInFileInfo | Contains information about a single file in an add-in package.
EdmAddInInfo | Provides SOLIDWORKS PDM Professional with information about your add-in.
EdmAddInInfo2 | Provides SOLIDWORKS PDM Professional with information about your add-in.
EdmAddInMenuInfo | Contains information about a menu command implemented by an add-in.
EdmAttributeData | Contains information about an attribute mapping in a variable (EdmVariableData).
EdmBatchDelErrInfo | Contains information about an error that occurred during execution of IEdmBatchDelete::CommitDelete.
EdmBatchError | Contains error information.
EdmBatchError2 | Contains error information.
EdmBomColumn | Contains information about a single column in a Bill of Materials.
EdmBomDefaultSetting | Contains the default view settings of a computed BOM.
EdmBomInfo | Contains information about a Bill of Materials.
EdmBomLayout | Contains information about a Bill of Materials layout.
EdmBomLayout2 | Contains information about a Bill of Materials layout.
EdmBomVersion | Contains information about a Bill of Materials version, revision, or label.
EdmBrokenParentInfo | Contains broken parent information.
EdmCardViewParams | Contains card view parameters.
EdmChangeStateTransitionInfo | Workflow state transition information.
EdmCheckRef | Contains information about a file reference.
EdmCmd | Contains the kind of command issued and information common to all files and folders affected by the command.
EdmCmdData | Contains command data.
EdmCmdInfo | Contains information about menu command items.
EdmColumnSet | Contains information about a column set's name and ID.
EdmCopyTreeOptions | Contains options for copying an assembly tree of files to a destination folder.
EdmDeletedItems | Contains information about deleted items.
EdmDocIDs | Contains information about one document in the vault; used in IEdmVault20::GetFiles.
EdmFileInfo | Information about a file or folder that is added to or removed from the vault.
EdmFolderInfo | Information about a folder that is added to the vault.
EdmFolderPermission | Contains permission settings.
EdmGenItemInfo | Contains information about generated items.
EdmGetVarData | Contains extra file information.
EdmGroupData | Contains information about a user group.
EdmGroupData2 | Contains information about a user group.
EdmHistoryItem | Contains a history item.
EdmItemRef | Contains information about an item reference.
EdmLicense | Contains information about a license type and is returned by IEdmVault11::GetLicense.
EdmListCol | Contains information about a column in a file listing.
EdmListFile | Holds information about a file returned by the IEdmBatchListing::GetFiles method.
EdmListFile2 | Holds information about a file returned by the IEdmBatchListing4::GetFiles2 method.
EdmListFolder | Contains information about a folder returned from IEdmBatchListing::GetFolders.
EdmListRef | Contains information about file references.
EdmMemberFolder | Adds a user as a member of a group to a specific folder.
EdmObjectInfo | Use in calls to IEdmVault9::GetObjects.
EdmPoint | Holds a point.
EdmRawReference | Contains information about a file reference.
EdmRect | Encapsulates a rectangle and is identical to the Win32 RECT struct.
EdmRefVar | Holds information about a single file reference variable; i.e., a variable stored on the reference relationship between an assembly file and one of its part files.
EdmRevComponent | Obsolete. Superseded by EdmRevComponent2.
EdmRevComponent2 | Holds information about a single revision number component.
EdmRevCounter | Used in calls to IEdmRevisionMgr::SetRevisionCounters, this structure holds information about a single counter.
EdmRevError | Returned from IEdmRevisionMgr::Commit if something goes wrong when incrementing the revision number on a file.
EdmRevNo | Holds information about a revision number and is returned from IEdmRevisionMgr2::GetRevisionNumbers..
EdmSelectionObject | Contains data returned from IEdmSelectionList6::GetNext2.
EdmSelItem | Contains information about one selected file; e.g., used with IEdmBatchUnlock::AddSelection.
EdmSelItem2 | Contains information about a selected item.
EdmSimpleXRefInfo | Contains cross-reference information.
EdmStatePermission | Contains state permission information.
EdmTaskInfo | Used by IEdmTaskMgr::RunTask.
EdmTaskMenuCmd | Used by IEdmTaskProperties::SetMenuCmds when an add-in adds menu commands to launch a task.
EdmTaskSel | Passed as argument to IEdmTaskProperties::SetSel.
EdmTaskSetupPage | Used by the method IEdmTaskProperties::SetSetupPages.
EdmTransitionPermission | Contains transition permission information.
EdmUnlockErrInfo | Contains extended information about an error message.
EdmUpdatedRefPath | Contains old and new path information for references that are moved or renamed by another client.
EdmUserData | Obsolete. Superseded by EdmUserData2 in SOLIDWORKS PDM Professional 2010 and later.
EdmUserData2 | Contains information about a user to be created.
EdmUserDataEx | Contains information about a user.
EdmVariableData | Contains information about a variable created with IEdmVariableMgr6::AddVariables.
EdmVarVal | Passed to IEdmBatchItemGeneration2::AddSelection2 to update a variable value.
EdmViewInfo | Contains information about a file vault view.
EdmWorkflowInfo | Holds information about a file's workflow state.

Enumerations

Enumeration | Description
CreateMenuFlags | Types of menu used in calls to IEdmVault5::CreatePluginMenu. Bitmask.
EdmAddAddInFlags | Options for adding add-ins. Used by IEdmAddInMgr5::AddAddIns.
EdmAddCallbackMsgID | Message IDs used in the message box during an add operation.
EdmAddFileDlgFlag | Flags used in IEdmBatchAdd2::ShowDlg to control the appearance of the dialog box.
EdmAddFlag | Options for adding a file to a folder to the vault, copying a file or folder within the vault, or copying/moving a tree of files and folders. Bitmask.
EdmAddInFileInfoFlags | Types of file in the add-in package used in EdmAddInFileInfo. Bitmask.
EdmBatchAddFlag | Flags used by IEdmBatchAdd::CommitAdd.
EdmBatchAddFolderFlag | Flags used by IEdmBatchAddFolders::AddFolder to specify the behavior of the added folder.
EdmBatchCreateFolderFlag | Flags used by IEdmBatchAddFolders::Create.
EdmBatchFlags | Flags used in IEdmBatchUpdate::SetVar and IEdmBatchUpdate2::SetFolderVar to control the behavior of IEdmBatchUpdate and IEdmBatchUpdate2. Bitmask.
EdmBomColumnType | Types of Bill of Material (BOM) column content; specified in EdmBomColumn and in calls to IEdmBomCell:GetVar, and IEdmBomCell::SetVar.
EdmBomFlag | Bill of Materials options used in calls to IEdmFile7::GetComputedBOM. Bitmask.
EdmBomInsertRowOption | Bill of Materials row insertion options for IEdmBomView2::InsertRow.
EdmBomSetVarOption | Types of value passed in IEdmBomCell::SetVar.
EdmBomType | Types of BOM passed in EdmBomInfo and EdmBomLayout2 structures.
EdmBomVersionType | Types of content specified in EdmBomVersion.meType.
EdmBrowseFlag | Browse options used in calls to IEdmVault5::BrowseForFile. Bitmask.
EdmBrowseForFolderFlag | Browse options used in calls to IEdmVault11::BrowseForFolder2.
EdmButtonState | States of a toolbar button; used in calls to IEdmAddInDrawButton5:DrawToolbarButton, IEdmCmdMgr5::AddToolbarImage, and IEdmMenu5::GetButtonImages.
EdmCardControlType | File or folder data card control types; used in calls to IEdmCardControl5::ControlType.
EdmCardFlag | Options for file data card behavior used in EdmCmdData; use these flags to tell SOLIDWORKS PDM Professional what to do when IEdmAddIn5::OnCmd returns.
EdmCardType | Types of data card used in calls to IEdmVault6::GetCardID.
EdmCardViewFlag | Options for appearance and functionality of card views created with IEdmVault10::CreateCardViewEx2 and IEdmFolder10::CreateCardView2. Bitmask.
EdmCardViewUpdateType | Card control update types; used in calls to IEdmCardView63::Update.
EdmChangeStateFileListFlag | Options for returning files when making calls to IEdmBatchChangeState::GetFileList. Bitmask.
EdmClientType | Types of SOLIDWORKS PDM Professional client; used in calls to IEdmVault8::ClientType.
EdmCmdNodeProp | Types of command node property; used in calls to IEdmCmdNode::GetProperty.
EdmCmdType | Reasons for SOLIDWORKS PDM Professional to call IEdmAddIn5::OnCmd.
EdmColType | Types of file listing column content; specified in the EdmListCol structure.
EdmCopyFlag | Options for copying files when making calls to IEdmFolder5::CopyFile. Bitmask.
EdmCopyType | Types of file copy operations.
EdmCreateListExFlags | Options for creating lists used in calls to IEdmBatchListing2::CreateListEx. Bitmask.
EdmCreateReferenceFlags | Options for creating custom references used in calls to IEdmAddCustomRefs::CreateTree.
EdmCreateVaultFlag | Options for creating new vaults used in calls to IEdmVault11::CreateNewVault.
EdmCreateVaultViewFlag | Options for creating vault views used in calls to IEdmVault11::CreateNewVaultView.
EdmDataPropertyType | Property types; used in calls to IEdmData::Get and IEdmData::Set.
EdmDataType | Data types; used in calls to IEdmData::Type.
EdmDefaultValueType | Default value types in SOLIDWORKS PDM Professional; used in calls to IEdmCardViewCallback6::GetCtrlData.
EdmDefValComp | Return options when calling IEdmCardViewCallback6::GetDefaultValueComponent.
EdmFileType | Types of SOLIDWORKS PDM Professional file; used in calls to IEdmFile8::FileType.
EdmFindUserProp | Properties to get or set when calling IEdmFindUser::GetPropt and IEdmFindUser::SetPropt.
EdmFolderHistoryFlag | Options for adding folders when calling IEdmHistory::AddFolder. Bitmask.
EdmFolderInfoFlag | Return codes in EdmFolderInfo which is returned from IEdmBatchAddFolders::Create.
EdmGetCmdFlags | Options for retrieving files from the vault used in calls to IEdmBatchGet::CreateTree. Bitmask.
EdmGetConfirmReason | Types of confirmation to specify when calling IEdmGetOpCallback::ConfirmReplace.
EdmGetFileListFlag | Files to return by IEdmBatchGet::GetFileList. Bitmask.
EdmGetFlag | Options for retrieving files used in calls to IEdmFile5::GetFileCopy, IEdmEnumeratorVersion5::GetFileCopy, IEdmVersion5::GetFileCopy, and IEdmRevision5::GetFileCopy. Bitmask.
EdmGetMenuInfoFlags | Flags returned from IEdmSearch7::GetMenuInfo.
EdmGetMsgFlag | Types of message returned used in calls to IEdmInbox5::GetFirstMessagePosition.
EdmGetOpError | Cold storage file retrieval error codes; used in calls to IEdmGetOpCallback2::ReportFailureEx.
EdmGetOpMsg | Log error messages; used in calls to IEdmGetOpCallback::LogMessage.
EdmGetOpReply | Options for continuing with a command; returned from IEdmGetOpCallback2::ReportFailureEx.
EdmGetPermFlag | Options for returning folder permissions used in calls to IEdmUserMgr7::GetFolderPermissions.
EdmGetVarDataFlag | Options specified in EdmGetVarData to describe a file. Bitmask.
EdmGroupDataFlags | Options specified in EdmGroupData used by IEdmUserMgr6::AddGroups to create new groups.
EdmGroupSetting | User group settings used by IEdmUserGroup9::SetSettingsVar.
EdmHistoryType | Types of history record; used by the IEdmHistory interface. Bitmask.
EdmIncRevFlags | Increment revisions used in IEdmFile5::IncrementRevision. Bitmask.
EdmInstallFileFlags | Operations used in calls to IEdmVault12::InstallFile to control the installation of data.
EdmItemGenerationFlags | Flags that control the behavior of IEdmBatchItemGeneration::CreateTree.
EdmItemLinkType | Types of linked files to items.
EdmLangCode | Localization language used in IEdmHistory3::GetEventDescription.
EdmLanguage | Types of languages; used by IEdmVault5::Language.
EdmLaunchSearchFlags | Flags which control the behavior of IEdmSearch7::LaunchApp.
EdmLibVer | Type library and SOLIDWORKS PDM version numbers.
EdmLicenseType | Types of license types, which are used in struct EdmLicense.
EdmListFileFlags | Flags passed to IEdmBatchListing::AddFile. Bitmask.
EdmListFolderFlags | Flags used in calls to IEdmBatchListing::AddFolder to tell how to add the folder to the list.
EdmListRetFileFlag | Flags returned in an IEdmBatchListing column if you specify column type EdmCol_EdmListRetFileFlag.
EdmLockFlag | Flags used in IEdmFile5::LockFile. Bitmask.
EdmMBoxResult | Types of clicked button returned by IEdmVault5::MsgBox.
EdmMBoxType | Types of widget to insert or display in IEdmVault5::MsgBox. Bitmask.
EdmMenuFlags | Flags used by IEdmCmdMgr5::AddCmd when writing an add-in that supports menu commands. Bitmask.
EdmMenuStrType | Types of arguments sent to IEdmMenu5::GetString to specify which string to return.
EdmMsgType | Types of messages sent to a user.
EdmObjectType | Types of objects returned by IEdmObject5::ObjectType, IEdmFile5::ObjectType, and IEdmFolder5::ObjectType.
EdmProgressType | Types of progress bars that are affected by certain operations.
EdmRawRefFlags | Flags used in EdmRawReference. Bitmask.
EdmRefFlags | Types of item reference. Bitmask.
EdmRefItemProperty | Types of property that can be accessed in IEdmRefItem objects via IEdmRefItem::GetProperty and IEdmRefItem::SetProperty.
EdmRefItemType | Items to return from IEdmRefItemContainer::GetItems.
EdmRefreshFlag | Flags that cause SOLIDWORKS PDM Professional to refresh elements of the user interface. Bitmask.
EdmRefType | Types of references to return from IEdmRefItem::GetRefs.
EdmRepaintType | Types of flags passed into IEdmImage::Reposition to control how to handle repainting of the background window.
EdmResolveAction | Types of flags that you return to SOLIDWORKS PDM Professional from IEdmCallback6::Resolve. Bitmask.
EdmResolveReason | Types of flags, which contain the reason for the function call, to pass to your implementation of IEdmCallback6::Resolve. Bitmask.
EdmRevComponentFlags | Flags used to control the members of the struct EdmRevComponent2. Bitmask.
EdmRightFlags | Flags used in calls to IEdmFolder5::HasRights and IEdmFolder5::HasRightsEx to check user rights. Bitmask.
EdmSearchToken | Values that determine which search criteria to set.
EdmStateFlags | Flags used in calls to IEdmFile5::ChangeState to set options for the operation. Bitmask.
EdmSysPerm | Types of system permissions for a user or group.
EdmSysRightFlags | Obsolete. Superseded by EdmSysPerm .
EdmTaskFlag | Task add-in flags used in IEdmTaskProperties::TaskFlags and EdmTaskInfo. Bitmask.
EdmTaskStatus | Task add-in statuses.
EdmTransitionRightFlags | Transition permission flags.
EdmTransitionType | Types of transitions.
EdmUnlockBuildTreeFlags | Flags used to control the creation of the check-in file tree created by the IEdmBatchUnlock interface. Bitmask.
EdmUnlockEvent | Types of check-in command passed to the IEdmUnlockOpCallback interface to notify the caller about what is happening while checking in files with the IEdmBatchUnlock interface.
EdmUnlockEventMsg | Type of check-in commands passed to IEdmUnlockOpCallback while checking in files with the IEdmBatchUnlock interface in order to notify the caller about the progress of the operation.
EdmUnlockFileListFlag | Flags telling IEdmBatchUnlock::GetFileList what kind of files to get. Bitmask.
EdmUnlockFlag | Flags used in IEdmFile5::UnlockFile to control the behavior of the check-in operation. Bitmask.
EdmUnlockOpMsg | Types of constant passed to IEdmUnlockOpCallback::MsgBox when the caller should either display a message to the user or process the message in some other way.
EdmUnlockOpReply | Types of operations returned from your IEdmUnlockOpCallback::MsgBox method if you implement an IEdmUnlockOpCallback interface to use with the IEdmBatchUnlock interface.
EdmUnlockStatusFlag | Statuses returned by IEdmBatchUnlock2::GetStatus.
EdmUserDataExFlag | Flags that tell which members of EdmUserDataEx are valid. Bitmask.
EdmUserDataFlags | Flags used in EdmUserData's mlFlags field when adding users with IEdmUserMgr6::AddUsers.
EdmUserPictureFlag | Flags that are passed in the lEdmUserPictureFlags argument of IEdmUserMgr8::CreateUserPicture.
EdmUserSetting | User settings used by IEdmUser11::SetSettingsVar.
EdmUserType | Type of user passed in UserType of IEdmUserMgr10::AddUsers3.
EdmUtility | Constants that are passed to the IEdmVault7::CreateUtility to create utility interfaces of various kinds.
EdmVariableFlags | Flags that set the style of variables used in file and folder data cards. Bitmask.
EdmVariableType | Constants that identify the data type of a variable.
EdmVarOp | Operators for variable searches.
EdmVaultType | Vault types.

See Also

EPDM.Interop.epdm Assembly


EPDM.Interop.epdm Namespace Inheritance Hierarchy

EPDM.Interop.epdm Namespace Inheritance Hierarchy
See Also

Inheritance Hierarchy

System.Object
System.ValueType
EPDM.Interop.epdm.EdmAddFileInfo
EPDM.Interop.epdm.EdmAddInFileInfo
EPDM.Interop.epdm.EdmAddInInfo
EPDM.Interop.epdm.EdmAddInInfo2
EPDM.Interop.epdm.EdmAddInMenuInfo
EPDM.Interop.epdm.EdmAttributeData
EPDM.Interop.epdm.EdmBatchDelErrInfo
EPDM.Interop.epdm.EdmBatchError
EPDM.Interop.epdm.EdmBatchError2
EPDM.Interop.epdm.EdmBomColumn
EPDM.Interop.epdm.EdmBomDefaultSetting
EPDM.Interop.epdm.EdmBomInfo
EPDM.Interop.epdm.EdmBomLayout
EPDM.Interop.epdm.EdmBomLayout2
EPDM.Interop.epdm.EdmBomVersion
EPDM.Interop.epdm.EdmBrokenParentInfo
EPDM.Interop.epdm.EdmCardViewParams
EPDM.Interop.epdm.EdmChangeStateTransitionInfo
EPDM.Interop.epdm.EdmCheckRef
EPDM.Interop.epdm.EdmCmd
EPDM.Interop.epdm.EdmCmdData
EPDM.Interop.epdm.EdmCmdInfo
EPDM.Interop.epdm.EdmColumnSet
EPDM.Interop.epdm.EdmCopyTreeOptions
EPDM.Interop.epdm.EdmDeletedItems
EPDM.Interop.epdm.EdmDocIDs
EPDM.Interop.epdm.EdmFileInfo
EPDM.Interop.epdm.EdmFolderInfo
EPDM.Interop.epdm.EdmFolderPermission
EPDM.Interop.epdm.EdmGenItemInfo
EPDM.Interop.epdm.EdmGetVarData
EPDM.Interop.epdm.EdmGroupData
EPDM.Interop.epdm.EdmGroupData2
EPDM.Interop.epdm.EdmHistoryItem
EPDM.Interop.epdm.EdmItemRef
EPDM.Interop.epdm.EdmLicense
EPDM.Interop.epdm.EdmListCol
EPDM.Interop.epdm.EdmListFile
EPDM.Interop.epdm.EdmListFile2
EPDM.Interop.epdm.EdmListFolder
EPDM.Interop.epdm.EdmListRef
EPDM.Interop.epdm.EdmMemberFolder
EPDM.Interop.epdm.EdmObjectInfo
EPDM.Interop.epdm.EdmPoint
EPDM.Interop.epdm.EdmRawReference
EPDM.Interop.epdm.EdmRect
EPDM.Interop.epdm.EdmRefVar
EPDM.Interop.epdm.EdmRevComponent
EPDM.Interop.epdm.EdmRevComponent2
EPDM.Interop.epdm.EdmRevCounter
EPDM.Interop.epdm.EdmRevError
EPDM.Interop.epdm.EdmRevNo
EPDM.Interop.epdm.EdmSelectionObject
EPDM.Interop.epdm.EdmSelItem
EPDM.Interop.epdm.EdmSelItem2
EPDM.Interop.epdm.EdmSimpleXRefInfo
EPDM.Interop.epdm.EdmStatePermission
EPDM.Interop.epdm.EdmTaskInfo
EPDM.Interop.epdm.EdmTaskMenuCmd
EPDM.Interop.epdm.EdmTaskSel
EPDM.Interop.epdm.EdmTaskSetupPage
EPDM.Interop.epdm.EdmTransitionPermission
EPDM.Interop.epdm.EdmUnlockErrInfo
EPDM.Interop.epdm.EdmUpdatedRefPath
EPDM.Interop.epdm.EdmUserData
EPDM.Interop.epdm.EdmUserData2
EPDM.Interop.epdm.EdmUserDataEx
EPDM.Interop.epdm.EdmVariableData
EPDM.Interop.epdm.EdmVarVal
EPDM.Interop.epdm.EdmViewInfo
EPDM.Interop.epdm.EdmWorkflowInfo

See Also

EPDM.Interop.epdm Assembly


IEdmAddCustomRefs Interface

IEdmAddCustomRefs Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmAddCustomRefs Interface

Allows you to create or manage user-defined file references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddCustomRefs
C#
public interface IEdmAddCustomRefs
C++/CLI
public interface class IEdmAddCustomRefs

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmAddCustomRefs2.

To manage existing references:

  1. Create IEdmAddCustomRefs using IEdmVault7::CreateUtility.
  2. Call IEdmAddCustomRefs::ShowEditReferencesDlg to display the existing file references.

To create new references:

  1. Create IEdmAddCustomRefs using IEdmVault7::CreateUtility.
  2. Call IEdmAddCustomRefs::AddReferencesClipboard, IEdmAddCustomRefs::AddReferencesID, or IEdmAddCustomRefs::AddReferencesPath to add file references.
  3. (Optional) Call IEdmAddCustomRefs::CreateTree and IEdmAddCustomRefs::ShowDlg to display the file references.
  4. Call IEdmAddCustomRefs::CreateReferences to create the new references.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmAddCustomRefs Members
EPDM.Interop.epdm Namespace


IEdmAddCustomRefs Interface Members

IEdmAddCustomRefs Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddCustomRefs Interface

The following tables list the members exposed by IEdmAddCustomRefs.

Public Methods

 | Name | Description
Method | AddReferencesClipboard | Adds a file reference that has been copied to the Windows clipboard to another checked-out file.
Method | AddReferencesID | Obsolete. Superseded by IEdmAddCustomRefs2::AddReferencesID2 .
Method | AddReferencesPath | Obsolete. Superseded by IEdmAddCustomRefs2::AddReferencesPath2 .
Method | CreateReferences | Creates the custom file references in the file vault.
Method | CreateTree | Computes the file reference tree.
Method | ShowDlg | Displays the Create File References dialog box that allows the user to edit the new file references.
Method | ShowEditReferencesDlg | Displays the Edit User-Defined File References dialog box that allows the user to edit the existing file references.
Top

See Also

IEdmAddCustomRefs Interface
EPDM.Interop.epdm Namespace


IEdmAddCustomRefs Interface Methods

IEdmAddCustomRefs Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddCustomRefs Interface

For a list of all members of this type, see IEdmAddCustomRefs members.

Public Methods

 | Name | Description
Method | AddReferencesClipboard | Adds a file reference that has been copied to the Windows clipboard to another checked-out file.
Method | AddReferencesID | Obsolete. Superseded by IEdmAddCustomRefs2::AddReferencesID2 .
Method | AddReferencesPath | Obsolete. Superseded by IEdmAddCustomRefs2::AddReferencesPath2 .
Method | CreateReferences | Creates the custom file references in the file vault.
Method | CreateTree | Computes the file reference tree.
Method | ShowDlg | Displays the Create File References dialog box that allows the user to edit the new file references.
Method | ShowEditReferencesDlg | Displays the Edit User-Defined File References dialog box that allows the user to edit the existing file references.
Top

See Also

IEdmAddCustomRefs Interface
EPDM.Interop.epdm Namespace


AddReferencesClipboard Method (IEdmAddCustomRefs)

AddReferencesClipboard Method (IEdmAddCustomRefs)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : AddReferencesClipboard Method (IEdmAddCustomRefs)

lRootFile
ID of file to which to add the file reference that is on the Windows clipboard
Adds a file reference that has been copied to the Windows clipboard to another checked-out file.

Syntax

Visual Basic
Sub AddReferencesClipboard( _
   ByVal lRootFile As System.Integer _
)
C#
void AddReferencesClipboard(
   System.int lRootFile
)
C++/CLI
void AddReferencesClipboard(
&   System.int lRootFile
)

Parameters

lRootFile
ID of file to which to add the file reference that is on the Windows clipboard

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

This method is valid only after the user has copied a file to the Windows clipboard. A file reference on the clipboard is in CF_HDROP format.

After calling this method, you must call IEdmAddCustomRefs::CreateReferences to create the custom file reference in the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


CreateReferences Method (IEdmAddCustomRefs)

CreateReferences Method (IEdmAddCustomRefs)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : CreateReferences Method (IEdmAddCustomRefs)

Creates the custom file references in the file vault.

Syntax

Visual Basic
Function CreateReferences() As System.Boolean
C#
System.bool CreateReferences()
C++/CLI
System.bool CreateReferences();

Return Value

True if any file was created, false if no files were created

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

Before calling this method, you must call one of the following methods to add a file reference to another file:

  • IEdmAddCustomRefs::AddReferencesClipboard
  • IEdmAddCustomRefs2::AddReferencesID2
  • IEdmAddCustomRefs2::AddReferencesPath2

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


CreateTree Method (IEdmAddCustomRefs)

CreateTree Method (IEdmAddCustomRefs)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : CreateTree Method (IEdmAddCustomRefs)

lEdmCreateReferenceFlags
Combination of EdmCreateReferenceFlags bits
Computes the file reference tree.

Syntax

Visual Basic
Function CreateTree( _
   ByVal lEdmCreateReferenceFlags As System.Integer _
) As System.Boolean
C#
System.bool CreateTree(
   System.int lEdmCreateReferenceFlags
)
C++/CLI
System.bool CreateTree(
&   System.int lEdmCreateReferenceFlags
)

Parameters

lEdmCreateReferenceFlags
Combination of EdmCreateReferenceFlags bits

Return Value

True if there are file references, false if not

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

If this method returns true, call IEdmAddCustomRefs::ShowDlg to display and edit the file references.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


ShowDlg Method (IEdmAddCustomRefs)

ShowDlg Method (IEdmAddCustomRefs)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : ShowDlg Method (IEdmAddCustomRefs)

hParentWnd
Parent window handle
Displays the Create File References dialog box that allows the user to edit the new file references.

Syntax

Visual Basic
Function ShowDlg( _
   ByVal hParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowDlg(
   System.int hParentWnd
)
C++/CLI
System.bool ShowDlg(
&   System.int hParentWnd
)

Parameters

hParentWnd
Parent window handle

Return Value

True if the user clicked OK, false if the user clicked Cancel

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

Before calling this method, call IEdmAddCustomRefs::CreateTree to compute the file reference tree.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


ShowEditReferencesDlg Method (IEdmAddCustomRefs)

ShowEditReferencesDlg Method (IEdmAddCustomRefs)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : ShowEditReferencesDlg Method (IEdmAddCustomRefs)

ppoFileIdArray
Array of IDs of the files to edit
lParentWnd
Parent window handle
Displays the Edit User-Defined File References dialog box that allows the user to edit the existing file references.

Syntax

Visual Basic
Function ShowEditReferencesDlg( _
   ByRef ppoFileIdArray() As System.Integer, _
   ByVal lParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowEditReferencesDlg(
   ref System.int[] ppoFileIdArray,
   System.int lParentWnd
)
C++/CLI
System.bool ShowEditReferencesDlg(
&   System.array<int>^% ppoFileIdArray,
&   System.int lParentWnd
)

Parameters

ppoFileIdArray
Array of IDs of the files to edit
lParentWnd
Parent window handle

Return Value

True if the user modified the file references, false if no changes were made

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


IEdmAddCustomRefs2 Interface

IEdmAddCustomRefs2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmAddCustomRefs2 Interface

Allows you to create or manage user-defined file references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddCustomRefs2
   Inherits IEdmAddCustomRefs
C#
public interface IEdmAddCustomRefs2 : IEdmAddCustomRefs
C++/CLI
public interface class IEdmAddCustomRefs2 : public IEdmAddCustomRefs

Remarks

This interface inherits from IEdmAddCustomRefs.

See Also

IEdmAddCustomRefs2 Members
EPDM.Interop.epdm Namespace


IEdmAddCustomRefs2 Interface Members

IEdmAddCustomRefs2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddCustomRefs2 Interface

The following tables list the members exposed by IEdmAddCustomRefs2.

Public Methods

 | Name | Description
Method | AddReferencesID2 | Adds file references by ID and quantity.
Method | AddReferencesPath2 | Adds file references by file system path and quantity.
Top

See Also

IEdmAddCustomRefs2 Interface
EPDM.Interop.epdm Namespace


IEdmAddCustomRefs2 Interface Methods

IEdmAddCustomRefs2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddCustomRefs2 Interface

For a list of all members of this type, see IEdmAddCustomRefs2 members.

Public Methods

 | Name | Description
Method | AddReferencesID2 | Adds file references by ID and quantity.
Method | AddReferencesPath2 | Adds file references by file system path and quantity.
Top

See Also

IEdmAddCustomRefs2 Interface
EPDM.Interop.epdm Namespace


AddReferencesID2 Method (IEdmAddCustomRefs2)

AddReferencesID2 Method (IEdmAddCustomRefs2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs2 Interface : AddReferencesID2 Method (IEdmAddCustomRefs2)

lRootFile
ID of file to which to add file references
ppoReferences
Array of EdmSelItems containing file references to add to lRootFile
plQuantity
Array of times that the files in ppoReferences are referenced in lRootFile
Adds file references by ID and quantity.

Syntax

Visual Basic
Sub AddReferencesID2( _
   ByVal lRootFile As System.Integer, _
   ByRef ppoReferences() As EdmSelItem, _
   ByRef plQuantity() As System.Integer _
)
C#
void AddReferencesID2(
   System.int lRootFile,
   ref EdmSelItem[] ppoReferences,
   ref System.int[] plQuantity
)
C++/CLI
void AddReferencesID2(
&   System.int lRootFile,
&   array<EdmSelItem>^% ppoReferences,
&   System.array<int>^% plQuantity
)

Parameters

lRootFile
ID of file to which to add file references
ppoReferences
Array of EdmSelItems containing file references to add to lRootFile
plQuantity
Array of times that the files in ppoReferences are referenced in lRootFile

Remarks

This method supersedes IEdmAddCustomRefs::AddReferencesID, which adds reference files only by ID.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs2 Interface
IEdmAddCustomRefs2 Members

Availability

Version 2013 of SOLIDWORKS PDM Professional


AddReferencesPath2 Method (IEdmAddCustomRefs2)

AddReferencesPath2 Method (IEdmAddCustomRefs2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs2 Interface : AddReferencesPath2 Method (IEdmAddCustomRefs2)

lRootFile
ID of file to which to add file references
ppoReferences
Array of paths to reference files
plQuantity
Array of times that the files in ppoReferences are referenced in lRootFile
Adds file references by file system path and quantity.

Syntax

Visual Basic
Sub AddReferencesPath2( _
   ByVal lRootFile As System.Integer, _
   ByRef ppoReferences() As System.String, _
   ByRef plQuantity() As System.Integer _
)
C#
void AddReferencesPath2(
   System.int lRootFile,
   ref System.string[] ppoReferences,
   ref System.int[] plQuantity
)
C++/CLI
void AddReferencesPath2(
&   System.int lRootFile,
&   System.array<String^>^% ppoReferences,
&   System.array<int>^% plQuantity
)

Parameters

lRootFile
ID of file to which to add file references
ppoReferences
Array of paths to reference files
plQuantity
Array of times that the files in ppoReferences are referenced in lRootFile

Remarks

This method supersedes IEdmAddCustomRefs::AddReferencesPath, which adds reference files only by file system path.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs2 Interface
IEdmAddCustomRefs2 Members

Availability

Version 2013 of SOLIDWORKS PDM Professional


IEdmAddIn5 Interface

IEdmAddIn5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmAddIn5 Interface

Allows you to create a SOLIDWORKS PDM Professional add-in.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddIn5
C#
public interface IEdmAddIn5
C++/CLI
public interface class IEdmAddIn5

Example

See Add-in Applications.

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)
Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface inherits from IUnknown. See Using and Implementing IUnknown (COM).

To create a SOLIDWORKS PDM Professional add-in:

  1. Create a class that implements this interface and its methods.
  2. Add menu commands, toolbar buttons, and hooks in your implementation of IEdmAddIn5::GetAddInInfo.
  3. Add callbacks for the hooks, menu commands, and toolbar buttons in your implementation of IEdmAddIn5::OnCmd.
  4. Register the add-in via the Administration Add-ins dialog. During registration, SOLIDWORKS PDM Professional calls your IEdmAddIn5::GetAddInInfo method to obtain information about the add-in.

After the add-in is created and registered, SOLIDWORKS PDM Professional calls your IEdmAddIn5::OnCmd method whenever the user executes a menu command or hook from your add-in.

See Also

IEdmAddIn5 Members
EPDM.Interop.epdm Namespace
IEdmAddInDrawButton5 Interface


IEdmAddIn5 Interface Members

IEdmAddIn5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddIn5 Interface

The following tables list the members exposed by IEdmAddIn5.

Public Methods

 | Name | Description
Method | GetAddInInfo | Called by SOLIDWORKS PDM Professional to obtain information about this add-in and the commands it supports.
Method | OnCmd | Called by SOLIDWORKS PDM Professional whenever one of the menu commands or hooks registered in IEdmAddIn5::GetAddInInfo is executed.
Top

See Also

IEdmAddIn5 Interface
EPDM.Interop.epdm Namespace
IEdmAddInDrawButton5 Interface


IEdmAddIn5 Interface Methods

IEdmAddIn5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddIn5 Interface

For a list of all members of this type, see IEdmAddIn5 members.

Public Methods

 | Name | Description
Method | GetAddInInfo | Called by SOLIDWORKS PDM Professional to obtain information about this add-in and the commands it supports.
Method | OnCmd | Called by SOLIDWORKS PDM Professional whenever one of the menu commands or hooks registered in IEdmAddIn5::GetAddInInfo is executed.
Top

See Also

IEdmAddIn5 Interface
EPDM.Interop.epdm Namespace
IEdmAddInDrawButton5 Interface


GetAddInInfo Method (IEdmAddIn5)

GetAddInInfo Method (IEdmAddIn5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddIn5 Interface : GetAddInInfo Method (IEdmAddIn5)

poInfo
EdmAddInInfo structure; before returning this structure, populate it with information about your add-in; used by the Administration Add-ins dialog during add-in registration
poVault
IEdmVault5; pointer to the active vault
poCmdMgr
IEdmCmdMgr5; pointer to the command manager that you use to add hooks, menu commands, and toolbar buttons
Called by SOLIDWORKS PDM Professional to obtain information about this add-in and the commands it supports.

Syntax

Visual Basic
Sub GetAddInInfo( _
   ByRef poInfo As EdmAddInInfo, _
   ByVal poVault As IEdmVault5, _
   ByVal poCmdMgr As IEdmCmdMgr5 _
)
C#
void GetAddInInfo(
   out EdmAddInInfo poInfo,
   IEdmVault5 poVault,
   IEdmCmdMgr5 poCmdMgr
)
C++/CLI
void GetAddInInfo(
&   [Out] EdmAddInInfo poInfo,
&   IEdmVault5^ poVault,
&   IEdmCmdMgr5^ poCmdMgr
)

Parameters

poInfo
EdmAddInInfo structure; before returning this structure, populate it with information about your add-in; used by the Administration Add-ins dialog during add-in registration
poVault
IEdmVault5; pointer to the active vault
poCmdMgr
IEdmCmdMgr5; pointer to the command manager that you use to add hooks, menu commands, and toolbar buttons

Example

See the IEdmAddin5 examples.

Remarks

See IEdmAddIn5 for more information.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddIn5 Interface
IEdmAddIn5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


OnCmd Method (IEdmAddIn5)

OnCmd Method (IEdmAddIn5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddIn5 Interface : OnCmd Method (IEdmAddIn5)

poCmd
EdmCmd structure; command information common to all affected files and folders
ppoData
Array of EdmCmdData structures, one for each affected file or folder
Called by SOLIDWORKS PDM Professional whenever one of the menu commands or hooks registered in IEdmAddIn5::GetAddInInfo is executed.

Syntax

Visual Basic
Sub OnCmd( _
   ByRef poCmd As EdmCmd, _
   ByRef ppoData() As EdmCmdData _
)
C#
void OnCmd(
   out EdmCmd poCmd,
   out EdmCmdData[] ppoData
)
C++/CLI
void OnCmd(
&   [Out] EdmCmd poCmd,
&   [Out] array<EdmCmdData>^ ppoData
)

Parameters

poCmd
EdmCmd structure; command information common to all affected files and folders
ppoData
Array of EdmCmdData structures, one for each affected file or folder

Example

See the IEdmAddin5 examples.

Remarks

See the IEdmAddIn5 topic for more information.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddIn5 Interface
IEdmAddIn5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmAddInDrawButton5 Interface

IEdmAddInDrawButton5 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmAddInDrawButton5 Interface

Allows you to dynamically draw an add-in toolbar button.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddInDrawButton5
C#
public interface IEdmAddInDrawButton5
C++/CLI
public interface class IEdmAddInDrawButton5

Remarks

This interface inherits from IUnknown. See Using and Implementing IUnknown (COM).

To dynamically draw a toolbar button:

  1. Create a class that implements both IEdmAddIn5 and IEdmAddInDrawButton5.
  2. Implement IEdmAddIn5::GetAddInInfo, calling IEdmCmdMgr5::AddCmd with lEdmMenuFlags setting the EdmMenuFlags.EdmMenu_OwnerDrawToolbarButton flag.
  3. Implement IEdmAddInDrawButton5::DrawToolbarButton to draw a toolbar button when called by SOLIDWORKS PDM Professional.

To draw a fixed toolbar button:

  1. Call IEdmCmdMgr5::AddToolbarImage.
  2. Call IEdmCmdMgr5::AddCmd, passing in the toolbar button image ID used in IEdmCmdMgr5::AddToolbarImage.

See Also

IEdmAddInDrawButton5 Members
EPDM.Interop.epdm Namespace


IEdmAddInDrawButton5 Interface Members

IEdmAddInDrawButton5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddInDrawButton5 Interface

The following tables list the members exposed by IEdmAddInDrawButton5.

Public Methods

 | Name | Description
Method | DrawToolbarButton | Dynamically draws an add-in toolbar button. NOTE: This method does not work in Windows Vista and later Windows operating systems.
Top

See Also

IEdmAddInDrawButton5 Interface
EPDM.Interop.epdm Namespace


IEdmAddInDrawButton5 Interface Methods

IEdmAddInDrawButton5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddInDrawButton5 Interface

For a list of all members of this type, see IEdmAddInDrawButton5 members.

Public Methods

 | Name | Description
Method | DrawToolbarButton | Dynamically draws an add-in toolbar button. NOTE: This method does not work in Windows Vista and later Windows operating systems.
Top

See Also

IEdmAddInDrawButton5 Interface
EPDM.Interop.epdm Namespace


DrawToolbarButton Method (IEdmAddInDrawButton5)

DrawToolbarButton Method (IEdmAddInDrawButton5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInDrawButton5 Interface : DrawToolbarButton Method (IEdmAddInDrawButton5)

lCmdID
Command ID passed to IEdmCmdMgr5::AddCmd during add-in registration
hDC
Handle of the device context to draw on
poDestRect
EdmRect structure; rectangle within which to draw
eState
State of the button image to draw as defined in EdmButtonState
plRetBackgroundColor
RGB value of a transparent color

Dynamically draws an add-in toolbar button.

NOTE: This method does not work in Windows Vista and later Windows operating systems.

Syntax

Visual Basic
Sub DrawToolbarButton( _
   ByVal lCmdID As System.Integer, _
   ByVal hDC As System.Integer, _
   ByRef poDestRect As EdmRect, _
   ByVal eState As EdmButtonState, _
   ByRef plRetBackgroundColor As System.Integer _
)
C#
void DrawToolbarButton(
   System.int lCmdID,
   System.int hDC,
   ref EdmRect poDestRect,
   EdmButtonState eState,
   out System.int plRetBackgroundColor
)
C++/CLI
void DrawToolbarButton(
&   System.int lCmdID,
&   System.int hDC,
&   EdmRect% poDestRect,
&   EdmButtonState eState,
&   [Out] System.int plRetBackgroundColor
)

Parameters

lCmdID
Command ID passed to IEdmCmdMgr5::AddCmd during add-in registration
hDC
Handle of the device context to draw on
poDestRect
EdmRect structure; rectangle within which to draw
eState
State of the button image to draw as defined in EdmButtonState
plRetBackgroundColor
RGB value of a transparent color

Example

Visual Basic sample code showing how to dynamically draw a toolbar button

  1. Add the toolbar button command in the IEdmAddIn5::GetAddInInfo implementation:

poCmdMgr.AddCmd 1000, "First command", EdmMenu_HasToolbarButton Or EdmMenu_OwnerDrawToolbarButton, "This is the first command", "First command", -1, -1

  2. At the top of your class implementation, add declarations of the Win32 GDI functions that you want to use (read more about this in the Visual Basic online help):

Private Declare Sub LineTo Lib "Gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long)

Private Declare Sub MoveToEx Lib "Gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal OldPnt As Long)

Private Declare Sub Arc Lib "Gdi32" (ByVal hDC As Long, _
                                     ByVal x1 As Long, ByVal y1 As Long, _
                                     ByVal x2 As Long, ByVal y2 As Long, _
                                     ByVal xstart As Long, ByVal ystart As Long, _
                                     ByVal xend As Long, ByVal yend As Long)

  3. Implement IEdmAddInDrawButton5::DrawToolbarButton (called by SOLIDWORKS PDM Professional):

Private Sub IEdmAddInDrawButton5_DrawToolbarButton(ByVal lCmdID As Long, ByVal hDC As Long, poDestRect As EdmRect, ByVal eState As EdmButtonState, plRetBackgroundColor As Long)
On Error GoTo ErrHand

If eState = BState_Cold Then
  'Draw a cross using the default pen
  MoveToEx hDC, poDestRect.mlLeft, poDestRect.mlTop, 0
  LineTo hDC, poDestRect.mlRight, poDestRect.mlBottom
  MoveToEx hDC, poDestRect.mlLeft, poDestRect.mlBottom, 0
  LineTo hDC, poDestRect.mlRight, poDestRect.mlTop
Else
  'Draw a circle using the default pen
  Arc hDC, poDestRect.mlLeft, poDestRect.mlTop, poDestRect.mlRight, poDestRect.mlBottom, _
  poDestRect.mlLeft + (poDestRect.mlRight - poDestRect.mlLeft) / 2, poDestRect.mlTop, _
  poDestRect.mlLeft + (poDestRect.mlRight - poDestRect.mlLeft) / 2, poDestRect.mlTop
End If

Exit Sub
ErrHand:
Dim errnum As String
errnum = Err.Number
MsgBox "Error drawing toolbar button!" + vbLf + Err.Description + vbLf + errnum
End Sub

Remarks

See the IEdmAddInDrawButton5 topic for more information.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInDrawButton5 Interface
IEdmAddInDrawButton5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmAddInMgr5 Interface

IEdmAddInMgr5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmAddInMgr5 Interface

Allows you to administer add-ins.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddInMgr5
C#
public interface IEdmAddInMgr5
C++/CLI
public interface class IEdmAddInMgr5

Example

Install Add-in (VB.NET)
Install Add-in (C#)

Remarks

This interface:

  • inherits from IUnknown. See Using and Implementing IUnknown (COM).
  • is extended by IEdmAddInMgr6.

See Also

IEdmAddInMgr5 Members
EPDM.Interop.epdm Namespace


IEdmAddInMgr5 Interface Members

IEdmAddInMgr5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr5 Interface

The following tables list the members exposed by IEdmAddInMgr5.

Public Methods

 | Name | Description
Method | AddAddIns | Installs add-ins in SOLIDWORKS PDM Professional.
Method | GetAddInInfo | Obsolete. Superseded by IEdmAddInMgr6::GetAddInInfo2 .
Top

See Also

IEdmAddInMgr5 Interface
EPDM.Interop.epdm Namespace


IEdmAddInMgr5 Interface Methods

IEdmAddInMgr5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr5 Interface

For a list of all members of this type, see IEdmAddInMgr5 members.

Public Methods

 | Name | Description
Method | AddAddIns | Installs add-ins in SOLIDWORKS PDM Professional.
Method | GetAddInInfo | Obsolete. Superseded by IEdmAddInMgr6::GetAddInInfo2 .
Top

See Also

IEdmAddInMgr5 Interface
EPDM.Interop.epdm Namespace


AddAddIns Method (IEdmAddInMgr5)

AddAddIns Method (IEdmAddInMgr5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr5 Interface : AddAddIns Method (IEdmAddInMgr5)

bsPathList
Linefeed-separated list of path and file names of add-in files
lEdmAddAddInFlags
Add-in option as defined in EdmAddAddInFlags
poReserved
Nothing or null
Installs add-ins in SOLIDWORKS PDM Professional.

Syntax

Visual Basic
Sub AddAddIns( _
   ByVal bsPathList As System.String, _
   ByVal lEdmAddAddInFlags As System.Integer, _
   ByRef poReserved As System.Object _
)
C#
void AddAddIns(
   System.string bsPathList,
   System.int lEdmAddAddInFlags,
   ref System.object poReserved
)
C++/CLI
void AddAddIns(
&   System.String^ bsPathList,
&   System.int lEdmAddAddInFlags,
&   System.Object^% poReserved
)

Parameters

bsPathList
Linefeed-separated list of path and file names of add-in files
lEdmAddAddInFlags
Add-in option as defined in EdmAddAddInFlags
poReserved
Nothing or null

Example

See the IEdmAddInMgr5 examples.

See Also

IEdmAddInMgr5 Interface
IEdmAddInMgr5 Members
IEdmAddInMgr9::RemoveAddIn Method ()

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmAddInMgr6 Interface

IEdmAddInMgr6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmAddInMgr6 Interface

Allows you to administer add-ins.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddInMgr6
   Inherits IEdmAddInMgr5
C#
public interface IEdmAddInMgr6 : IEdmAddInMgr5
C++/CLI
public interface class IEdmAddInMgr6 : public IEdmAddInMgr5

Example

See the IEdmAddInMgr5 examples.

Remarks

This interface:

  • extends IEdmAddInMgr5 by providing administration of debug add-ins.
  • is extended by IEdmAddInMgr7.

See Also

IEdmAddInMgr6 Members
EPDM.Interop.epdm Namespace


IEdmAddInMgr6 Interface Members

IEdmAddInMgr6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr6 Interface

The following tables list the members exposed by IEdmAddInMgr6.

Public Methods

 | Name | Description
Method | GetAddInInfo2 | Gets information about an add-in.
Method | GetDebugAddIns | Gets information about all of the add-ins that have been installed for debugging on this machine.
Method | InstallDebugAddIn | Installs an add-in for debugging on this machine.
Method | RemoveDebugAddIn | Removes an add-in that has been installed for debugging.
Top

See Also

IEdmAddInMgr6 Interface
EPDM.Interop.epdm Namespace


IEdmAddInMgr6 Interface Methods

IEdmAddInMgr6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr6 Interface

For a list of all members of this type, see IEdmAddInMgr6 members.

Public Methods

 | Name | Description
Method | GetAddInInfo2 | Gets information about an add-in.
Method | GetDebugAddIns | Gets information about all of the add-ins that have been installed for debugging on this machine.
Method | InstallDebugAddIn | Installs an add-in for debugging on this machine.
Method | RemoveDebugAddIn | Removes an add-in that has been installed for debugging.
Top

See Also

IEdmAddInMgr6 Interface
EPDM.Interop.epdm Namespace


GetAddInInfo2 Method (IEdmAddInMgr6)

GetAddInInfo2 Method (IEdmAddInMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr6 Interface : GetAddInInfo2 Method (IEdmAddInMgr6)

bsPath
Path to the DLL about which to get information
oReserved
Must be empty
poInfo
EdmAddInInfo2 structure; returned add-in information
Gets information about an add-in.

Syntax

Visual Basic
Sub GetAddInInfo2( _
   ByVal bsPath As System.String, _
   ByVal oReserved As System.Object, _
   ByRef poInfo As EdmAddInInfo2 _
)
C#
void GetAddInInfo2(
   System.string bsPath,
   System.object oReserved,
   out EdmAddInInfo2 poInfo
)
C++/CLI
void GetAddInInfo2(
&   System.String^ bsPath,
&   System.Object^ oReserved,
&   [Out] EdmAddInInfo2 poInfo
)

Parameters

bsPath
Path to the DLL about which to get information
oReserved
Must be empty
poInfo
EdmAddInInfo2 structure; returned add-in information

Example

See the IEdmAddInMgr5 examples.

Remarks

This method supersedes IEdmAddInMgr5::GetAddInInfo which returned less information about the add-in.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr6 Interface
IEdmAddInMgr6 Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


GetDebugAddIns Method (IEdmAddInMgr6)

GetDebugAddIns Method (IEdmAddInMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr6 Interface : GetDebugAddIns Method (IEdmAddInMgr6)

ppoAddIns
Array of EdmAddInInfo2 structures; one structure for each debug add-in
Gets information about all of the add-ins that have been installed for debugging on this machine.

Syntax

Visual Basic
Sub GetDebugAddIns( _
   ByRef ppoAddIns() As EdmAddInInfo2 _
)
C#
void GetDebugAddIns(
   out EdmAddInInfo2[] ppoAddIns
)
C++/CLI
void GetDebugAddIns(
&   [Out] array<EdmAddInInfo2>^ ppoAddIns
)

Parameters

ppoAddIns
Array of EdmAddInInfo2 structures; one structure for each debug add-in

Example

See the IEdmAddInMgr5 examples.

Remarks

You can install add-ins for debugging either of two ways:

  • Right-clicking the Add-ins node in the SOLIDWORKS PDM Professional Administration Tool and clicking Debug Add-ins.
  • Calling IEdmAddInMgr6::InstallDebugAddIn.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr6 Interface
IEdmAddInMgr6 Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


InstallDebugAddIn Method (IEdmAddInMgr6)

InstallDebugAddIn Method (IEdmAddInMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr6 Interface : InstallDebugAddIn Method (IEdmAddInMgr6)

oAddIn
Contains either the path to the DLL of the add-in to add or the ID of the class that implements IEdmAddIn5
Installs an add-in for debugging on this machine.

Syntax

Visual Basic
Sub InstallDebugAddIn( _
   ByVal oAddIn As System.Object _
)
C#
void InstallDebugAddIn(
   System.object oAddIn
)
C++/CLI
void InstallDebugAddIn(
&   System.Object^ oAddIn
)

Parameters

oAddIn
Contains either the path to the DLL of the add-in to add or the ID of the class that implements IEdmAddIn5

Remarks

You can install add-ins for debugging either of two ways:

  • Right-clicking the Add-ins node in the SOLIDWORKS PDM Professional Administration Tool and clicking Debug Add-ins.
  • Calling this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr6 Interface
IEdmAddInMgr6 Members
IEdmAddInMgr6::RemoveDebugAddIn Method ()

Availability

Version 6.4 of SOLIDWORKS PDM Professional


RemoveDebugAddIn Method (IEdmAddInMgr6)

RemoveDebugAddIn Method (IEdmAddInMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr6 Interface : RemoveDebugAddIn Method (IEdmAddInMgr6)

oAddIn
Contains either the path to the DLL of the add-in to remove or the ID of the class that implements IEdmAddIn5
Removes an add-in that has been installed for debugging.

Syntax

Visual Basic
Sub RemoveDebugAddIn( _
   ByVal oAddIn As System.Object _
)
C#
void RemoveDebugAddIn(
   System.object oAddIn
)
C++/CLI
void RemoveDebugAddIn(
&   System.Object^ oAddIn
)

Parameters

oAddIn
Contains either the path to the DLL of the add-in to remove or the ID of the class that implements IEdmAddIn5

Remarks

You can install add-ins for debugging either of two ways:

  • Right-clicking the Add-ins node in the SOLIDWORKS PDM Professional Administration Tool and clicking Debug Add-ins.
  • Calling IEdmAddInMgr6::InstallDebugAddIn.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr6 Interface
IEdmAddInMgr6 Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional or later


IEdmAddInMgr7 Interface

IEdmAddInMgr7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmAddInMgr7 Interface

Allows you to administer add-ins.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddInMgr7
   Inherits IEdmAddInMgr5, IEdmAddInMgr6
C#
public interface IEdmAddInMgr7 : IEdmAddInMgr5, IEdmAddInMgr6
C++/CLI
public interface class IEdmAddInMgr7 : public IEdmAddInMgr5, IEdmAddInMgr6

Example

See the IEdmAddInMgr5 examples.

Remarks

This interface:

  • extends IEdmAddInMgr6 by providing the ability to get information about all of the add-ins in a vault.
  • is extended by IEdmAddInMgr8.

See Also

IEdmAddInMgr7 Members
EPDM.Interop.epdm Namespace


IEdmAddInMgr7 Interface Members

IEdmAddInMgr7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr7 Interface

The following tables list the members exposed by IEdmAddInMgr7.

Public Methods

 | Name | Description
Method | GetInstalledAddIns | Gets information about all of the add-ins that have been installed in the vault.
Top

See Also

IEdmAddInMgr7 Interface
EPDM.Interop.epdm Namespace


IEdmAddInMgr7 Interface Methods

IEdmAddInMgr7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr7 Interface

For a list of all members of this type, see IEdmAddInMgr7 members.

Public Methods

 | Name | Description
Method | GetInstalledAddIns | Gets information about all of the add-ins that have been installed in the vault.
Top

See Also

IEdmAddInMgr7 Interface
EPDM.Interop.epdm Namespace


GetInstalledAddIns Method (IEdmAddInMgr7)

GetInstalledAddIns Method (IEdmAddInMgr7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr7 Interface : GetInstalledAddIns Method (IEdmAddInMgr7)

ppoAddIns
Array of EdmAddInInfo2 structures, one structure for each add-in
Gets information about all of the add-ins that have been installed in the vault.

Syntax

Visual Basic
Sub GetInstalledAddIns( _
   ByRef ppoAddIns() As EdmAddInInfo2 _
)
C#
void GetInstalledAddIns(
   out EdmAddInInfo2[] ppoAddIns
)
C++/CLI
void GetInstalledAddIns(
&   [Out] array<EdmAddInInfo2>^ ppoAddIns
)

Parameters

ppoAddIns
Array of EdmAddInInfo2 structures, one structure for each add-in

Example

See the IEdmAddInMgr5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr7 Interface
IEdmAddInMgr7 Members
IEdmAddInMgr8::GetInstalledAddIn Method ()

Availability

SOLIDWORKS PDM Professional 2008


IEdmAddInMgr8 Interface

IEdmAddInMgr8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmAddInMgr8 Interface

Allows you to administer add-ins.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddInMgr8
   Inherits IEdmAddInMgr5, IEdmAddInMgr6, IEdmAddInMgr7
C#
public interface IEdmAddInMgr8 : IEdmAddInMgr5, IEdmAddInMgr6, IEdmAddInMgr7
C++/CLI
public interface class IEdmAddInMgr8 : public IEdmAddInMgr5, IEdmAddInMgr6, IEdmAddInMgr7

Example

See the IEdmAddInMgr5 examples.

Remarks

This interface:

  • extends IEdmAddInMgr7 by providing the ability to extract files from add-ins.
  • is extended by IEdmAddInMgr9.

See Also

IEdmAddInMgr8 Members
EPDM.Interop.epdm Namespace


IEdmAddInMgr8 Interface Members

IEdmAddInMgr8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr8 Interface

The following tables list the members exposed by IEdmAddInMgr8.

Public Methods

 | Name | Description
Method | ExtractInstalledAddIn | Extracts files from the specified add-in and places them in the specified folder.
Method | GetCAFInfo | Extracts files and information from an add-in that is stored in a *.CAF that pre-dates SOLIDWORKS PDM Professional 2010.
Method | GetInstalledAddIn | Extracts files and information from the specified add-in.
Top

See Also

IEdmAddInMgr8 Interface
EPDM.Interop.epdm Namespace


IEdmAddInMgr8 Interface Methods

IEdmAddInMgr8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr8 Interface

For a list of all members of this type, see IEdmAddInMgr8 members.

Public Methods

 | Name | Description
Method | ExtractInstalledAddIn | Extracts files from the specified add-in and places them in the specified folder.
Method | GetCAFInfo | Extracts files and information from an add-in that is stored in a *.CAF that pre-dates SOLIDWORKS PDM Professional 2010.
Method | GetInstalledAddIn | Extracts files and information from the specified add-in.
Top

See Also

IEdmAddInMgr8 Interface
EPDM.Interop.epdm Namespace


ExtractInstalledAddIn Method (IEdmAddInMgr8)

ExtractInstalledAddIn Method (IEdmAddInMgr8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr8 Interface : ExtractInstalledAddIn Method (IEdmAddInMgr8)

oNameOrID
ID or name of the add-in from which to extract files
bsExtractPath
Path to the folder to which to extract files; ignored if empty
ppoFiles
Array of EdmAddInFileInfo structures, one structure for each extracted file
Extracts files from the specified add-in and places them in the specified folder.

Syntax

Visual Basic
Sub ExtractInstalledAddIn( _
   ByVal oNameOrID As System.Object, _
   ByVal bsExtractPath As System.String, _
   ByRef ppoFiles() As EdmAddInFileInfo _
)
C#
void ExtractInstalledAddIn(
   System.object oNameOrID,
   System.string bsExtractPath,
   out EdmAddInFileInfo[] ppoFiles
)
C++/CLI
void ExtractInstalledAddIn(
&   System.Object^ oNameOrID,
&   System.String^ bsExtractPath,
&   [Out] array<EdmAddInFileInfo>^ ppoFiles
)

Parameters

oNameOrID
ID or name of the add-in from which to extract files
bsExtractPath
Path to the folder to which to extract files; ignored if empty
ppoFiles
Array of EdmAddInFileInfo structures, one structure for each extracted file

Remarks

This method performs a subset of the functionality of IEdmAddInMgr8::GetInstalledAddIn.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: oNameOrID specified an ID that was not found.
  • E_EDM_INVALID_NAME: oNameOrID specified a name that was not found.
  • E_EDM_FOLDER_NOT_FOUND: bsExtractPath contained a path to a missing folder.

See Also

IEdmAddInMgr8 Interface
IEdmAddInMgr8 Members

Availability

SOLIDWORKS PDM Professional 2010


GetCAFInfo Method (IEdmAddInMgr8)

GetCAFInfo Method (IEdmAddInMgr8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr8 Interface : GetCAFInfo Method (IEdmAddInMgr8)

bsCAFPath
Path to the *.CAF from which to get information
bsExtractPath
Path to the folder to which to extract files; ignored if empty
poAddIn
EdmAddInInfo2 structure; information about the add-in
ppoFiles
Array of EdmAddInFileInfo structures, one for each file extracted from the add-in
ppoCmds
Array of EdmAddInMenuInfo structures, one for each menu command implemented by the add-in
Extracts files and information from an add-in that is stored in a *.CAF that pre-dates SOLIDWORKS PDM Professional 2010.

Syntax

Visual Basic
Sub GetCAFInfo( _
   ByVal bsCAFPath As System.String, _
   ByVal bsExtractPath As System.String, _
   ByRef poAddIn As EdmAddInInfo2, _
   ByRef ppoFiles() As EdmAddInFileInfo, _
   ByRef ppoCmds() As EdmAddInMenuInfo _
)
C#
void GetCAFInfo(
   System.string bsCAFPath,
   System.string bsExtractPath,
   out EdmAddInInfo2 poAddIn,
   out EdmAddInFileInfo[] ppoFiles,
   out EdmAddInMenuInfo[] ppoCmds
)
C++/CLI
void GetCAFInfo(
&   System.String^ bsCAFPath,
&   System.String^ bsExtractPath,
&   [Out] EdmAddInInfo2 poAddIn,
&   [Out] array<EdmAddInFileInfo>^ ppoFiles,
&   [Out] array<EdmAddInMenuInfo>^ ppoCmds
)

Parameters

bsCAFPath
Path to the *.CAF from which to get information
bsExtractPath
Path to the folder to which to extract files; ignored if empty
poAddIn
EdmAddInInfo2 structure; information about the add-in
ppoFiles
Array of EdmAddInFileInfo structures, one for each file extracted from the add-in
ppoCmds
Array of EdmAddInMenuInfo structures, one for each menu command implemented by the add-in

Example

See the IEdmAddInMgr5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_FOUND: The specified *.CAF file was not found.

See Also

IEdmAddInMgr8 Interface
IEdmAddInMgr8 Members

Availability

SOLIDWORKS PDM Professional 2010


GetInstalledAddIn Method (IEdmAddInMgr8)

GetInstalledAddIn Method (IEdmAddInMgr8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr8 Interface : GetInstalledAddIn Method (IEdmAddInMgr8)

oNameOrID
ID or name of the add-in
bsExtractPath
Path to the folder to which to extract files; ignored if empty
poAddIn
EdmAddInInfo2 structure; information about the add-in
ppoFiles
Array of EdmAddInFileInfo structures, one for each file extracted from the add-in
ppoCmds
Array of EdmAddInMenuInfo structures, one for each menu command implemented by the add-in
Extracts files and information from the specified add-in.

Syntax

Visual Basic
Sub GetInstalledAddIn( _
   ByVal oNameOrID As System.Object, _
   ByVal bsExtractPath As System.String, _
   ByRef poAddIn As EdmAddInInfo2, _
   ByRef ppoFiles() As EdmAddInFileInfo, _
   ByRef ppoCmds() As EdmAddInMenuInfo _
)
C#
void GetInstalledAddIn(
   System.object oNameOrID,
   System.string bsExtractPath,
   out EdmAddInInfo2 poAddIn,
   out EdmAddInFileInfo[] ppoFiles,
   out EdmAddInMenuInfo[] ppoCmds
)
C++/CLI
void GetInstalledAddIn(
&   System.Object^ oNameOrID,
&   System.String^ bsExtractPath,
&   [Out] EdmAddInInfo2 poAddIn,
&   [Out] array<EdmAddInFileInfo>^ ppoFiles,
&   [Out] array<EdmAddInMenuInfo>^ ppoCmds
)

Parameters

oNameOrID
ID or name of the add-in
bsExtractPath
Path to the folder to which to extract files; ignored if empty
poAddIn
EdmAddInInfo2 structure; information about the add-in
ppoFiles
Array of EdmAddInFileInfo structures, one for each file extracted from the add-in
ppoCmds
Array of EdmAddInMenuInfo structures, one for each menu command implemented by the add-in

Example

See the IEdmAddInMgr5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: oNameOrID specified an ID that was not found.
  • E_EDM_INVALID_NAME: oNameOrID specified a name that was not found.
  • E_EDM_FOLDER_NOT_FOUND: bsExtractPath contained a path to a missing folder.

See Also

IEdmAddInMgr8 Interface
IEdmAddInMgr8 Members
IEdmAddInMgr8::ExtractInstalledAddIn Method ()
IEdmAddInMgr7::GetInstalledAddIns Method ()

Availability

SOLIDWORKS PDM Professional 2010


IEdmAddInMgr9 Interface

IEdmAddInMgr9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmAddInMgr9 Interface

Allows you to administer add-ins.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAddInMgr9
   Inherits IEdmAddInMgr5, IEdmAddInMgr6, IEdmAddInMgr7, IEdmAddInMgr8
C#
public interface IEdmAddInMgr9 : IEdmAddInMgr5, IEdmAddInMgr6, IEdmAddInMgr7, IEdmAddInMgr8
C++/CLI
public interface class IEdmAddInMgr9 : public IEdmAddInMgr5, IEdmAddInMgr6, IEdmAddInMgr7, IEdmAddInMgr8

Example

Install Add-in (VB.NET)
Install Add-in (C#)

Remarks

This interface extends IEdmAddInMgr8 by providing the ability to uninstall an add-in.

See Also

IEdmAddInMgr9 Members
EPDM.Interop.epdm Namespace


IEdmAddInMgr9 Interface Members

IEdmAddInMgr9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr9 Interface

The following tables list the members exposed by IEdmAddInMgr9.

Public Methods

 | Name | Description
Method | RemoveAddIn | Removes the specified add-in.
Top

See Also

IEdmAddInMgr9 Interface
EPDM.Interop.epdm Namespace


IEdmAddInMgr9 Interface Methods

IEdmAddInMgr9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmAddInMgr9 Interface

For a list of all members of this type, see IEdmAddInMgr9 members.

Public Methods

 | Name | Description
Method | RemoveAddIn | Removes the specified add-in.
Top

See Also

IEdmAddInMgr9 Interface
EPDM.Interop.epdm Namespace


RemoveAddIn Method (IEdmAddInMgr9)

RemoveAddIn Method (IEdmAddInMgr9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr9 Interface : RemoveAddIn Method (IEdmAddInMgr9)

oNameOrID
ID or name of the add-in to remove
Removes the specified add-in.

Syntax

Visual Basic
Sub RemoveAddIn( _
   ByVal oNameOrID As System.Object _
)
C#
void RemoveAddIn(
   System.object oNameOrID
)
C++/CLI
void RemoveAddIn(
&   System.Object^ oNameOrID
)

Parameters

oNameOrID
ID or name of the add-in to remove

Example

See the IEdmAddInMgr9 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr9 Interface
IEdmAddInMgr9 Members
IEdmAddInMgr5::AddAddIns Method ()

Availability

SOLIDWORKS PDM Professional 2018


IEdmAttribute5 Interface

IEdmAttribute5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmAttribute5 Interface

Allows access to a file attribute that is used when data is transferred between a file data card and a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmAttribute5
   Inherits IEdmObject5
C#
public interface IEdmAttribute5 : IEdmObject5
C++/CLI
public interface class IEdmAttribute5 : public IEdmObject5

Example

Find Data Cards with Description Variable (VB.NET)
Find Data Cards with Description Variable (C#)

Remarks

This interface inherits from IEdmObject5. Call IEdmObject5::Name to get the name of this attribute.

A variable, EdmVariable5, can be mapped to zero or more attributes (IEdmAttribute5).

Accessors

IEdmVariable5::GetNextAttribute

IEdmVariableValue5::GetNextAttribute

IEdmVault5::GetObject

See Also

IEdmAttribute5 Members
EPDM.Interop.epdm Namespace


IEdmAttribute5 Interface Members

IEdmAttribute5 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmAttribute5 Interface

The following tables list the members exposed by IEdmAttribute5.

Public Properties

 | Name | Description
Property | BlockName | Gets the name of the block in which to search for this attribute.
Property | Extensions | Gets a list of file extensions for which this attribute is valid.
Top

See Also

IEdmAttribute5 Interface
EPDM.Interop.epdm Namespace


IEdmAttribute5 Interface Properties

IEdmAttribute5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmAttribute5 Interface

For a list of all members of this type, see IEdmAttribute5 members.

Public Properties

 | Name | Description
Property | BlockName | Gets the name of the block in which to search for this attribute.
Property | Extensions | Gets a list of file extensions for which this attribute is valid.
Top

See Also

IEdmAttribute5 Interface
EPDM.Interop.epdm Namespace


BlockName Property (IEdmAttribute5)

BlockName Property (IEdmAttribute5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAttribute5 Interface : BlockName Property (IEdmAttribute5)

Gets the name of the block in which to search for this attribute.

Syntax

Visual Basic
ReadOnly Property BlockName As System.String
C#
System.string BlockName {get;}
C++/CLI
property System.String^ BlockName {
   System.String^ get();
}

Property Value

Name of the block in which to search for this attribute

See Also

IEdmAttribute5 Interface
IEdmAttribute5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


Extensions Property (IEdmAttribute5)

Extensions Property (IEdmAttribute5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAttribute5 Interface : Extensions Property (IEdmAttribute5)

Gets a list of file extensions for which this attribute is valid.

Syntax

Visual Basic
ReadOnly Property Extensions As System.String
C#
System.string Extensions {get;}
C++/CLI
property System.String^ Extensions {
   System.String^ get();
}

Property Value

Comma-separated list of file extensions ("doc,ppt,xls")

Example

See IEdmAttribute5 examples.

See Also

IEdmAttribute5 Interface
IEdmAttribute5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmBatchAdd Interface

IEdmBatchAdd Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchAdd Interface

Allows you to add several files and folders to the vault at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchAdd
C#
public interface IEdmBatchAdd
C++/CLI
public interface class IEdmBatchAdd

Example

Batch Add Files and Folders to Vault (VB.NET)
Batch Add Files and Folders to Vault (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBatchAdd2.

Using IEdmBatchAdd is more efficient than calling IEdmFolder5::AddFile or IEdmFolder5::AddFolder multiple times.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchAdd Members
EPDM.Interop.epdm Namespace
IEdmBatchAddFolders Interface


IEdmBatchAdd Interface Members

IEdmBatchAdd Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchAdd Interface

The following tables list the members exposed by IEdmBatchAdd.

Public Methods

 | Name | Description
Method | AddFileFromPath | Adds a file to the batch of files to be added to the vault; the file will be copied to a destination folder with the specified ID.
Method | AddFileFromPathToPath | Adds a file to the batch of files to be added to the vault; the file will be copied to the specified destination folder path.
Method | AddFileFromVault | Adds a file with the specified ID and folder ID to the batch of files to be added to the vault; the file will be copied to a new vault folder with the specified ID.
Method | AddFileFromVaultToPath | Adds a file with the specified ID and folder ID to the batch of files to be added to the vault; the file will be copied to a new vault folder with the specified path.
Method | AddFolder | Adds the specified folder or folder path to the batch of folders to be added to the vault.
Method | AddFolderPath | Adds the specified folder path to the batch of folders to be added to the vault.
Method | CommitAdd | Adds all files and folders in the batch to the vault.
Method | SetFileNameSerNo | For internal use only; do not use.
Top

See Also

IEdmBatchAdd Interface
EPDM.Interop.epdm Namespace
IEdmBatchAddFolders Interface


IEdmBatchAdd Interface Methods

IEdmBatchAdd Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchAdd Interface

For a list of all members of this type, see IEdmBatchAdd members.

Public Methods

 | Name | Description
Method | AddFileFromPath | Adds a file to the batch of files to be added to the vault; the file will be copied to a destination folder with the specified ID.
Method | AddFileFromPathToPath | Adds a file to the batch of files to be added to the vault; the file will be copied to the specified destination folder path.
Method | AddFileFromVault | Adds a file with the specified ID and folder ID to the batch of files to be added to the vault; the file will be copied to a new vault folder with the specified ID.
Method | AddFileFromVaultToPath | Adds a file with the specified ID and folder ID to the batch of files to be added to the vault; the file will be copied to a new vault folder with the specified path.
Method | AddFolder | Adds the specified folder or folder path to the batch of folders to be added to the vault.
Method | AddFolderPath | Adds the specified folder path to the batch of folders to be added to the vault.
Method | CommitAdd | Adds all files and folders in the batch to the vault.
Method | SetFileNameSerNo | For internal use only; do not use.
Top

See Also

IEdmBatchAdd Interface
EPDM.Interop.epdm Namespace
IEdmBatchAddFolders Interface


AddFileFromPath Method (IEdmBatchAdd)

AddFileFromPath Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : AddFileFromPath Method (IEdmBatchAdd)

bsSourcePath
Path of file to add
lDestinationFolderID
ID of folder to which to add the file
lArg
Caller-defined argument
bsNewName
Optional new name of the added file
lEdmAddFlags
Combination of EdmAddFlag bits
Adds a file to the batch of files to be added to the vault; the file will be copied to a destination folder with the specified ID.

Syntax

Visual Basic
Sub AddFileFromPath( _
   ByVal bsSourcePath As System.String, _
   ByVal lDestinationFolderID As System.Integer, _
   Optional ByVal lArg As System.Integer, _
   Optional ByVal bsNewName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
)
C#
void AddFileFromPath(
   System.string bsSourcePath,
   System.int lDestinationFolderID,
   System.int lArg,
   System.string bsNewName,
   System.int lEdmAddFlags
)
C++/CLI
void AddFileFromPath(
&   System.String^ bsSourcePath,
&   System.int lDestinationFolderID,
&   System.int lArg,
&   System.String^ bsNewName,
&   System.int lEdmAddFlags
)

Parameters

bsSourcePath
Path of file to add
lDestinationFolderID
ID of folder to which to add the file
lArg
Caller-defined argument
bsNewName
Optional new name of the added file
lEdmAddFlags
Combination of EdmAddFlag bits

Remarks

Before calling this method, use IEdmBatchAdd::SetFileNameSerNo to specify how to create the name for the new file's data card.

After calling this method, you must call IEdmBatchAdd::CommitAdd to actually add the file to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


AddFileFromPathToPath Method (IEdmBatchAdd)

AddFileFromPathToPath Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : AddFileFromPathToPath Method (IEdmBatchAdd)

bsSourcePath
Path of file to add
bsDestinationFolderPath
Path of folder to which to add the file
lArg
Caller-defined argument
bsNewName
Optional new name of the added file
lEdmAddFlags
Combination of EdmAddFlag bits
Adds a file to the batch of files to be added to the vault; the file will be copied to the specified destination folder path.

Syntax

Visual Basic
Sub AddFileFromPathToPath( _
   ByVal bsSourcePath As System.String, _
   ByVal bsDestinationFolderPath As System.String, _
   Optional ByVal lArg As System.Integer, _
   Optional ByVal bsNewName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
)
C#
void AddFileFromPathToPath(
   System.string bsSourcePath,
   System.string bsDestinationFolderPath,
   System.int lArg,
   System.string bsNewName,
   System.int lEdmAddFlags
)
C++/CLI
void AddFileFromPathToPath(
&   System.String^ bsSourcePath,
&   System.String^ bsDestinationFolderPath,
&   System.int lArg,
&   System.String^ bsNewName,
&   System.int lEdmAddFlags
)

Parameters

bsSourcePath
Path of file to add
bsDestinationFolderPath
Path of folder to which to add the file
lArg
Caller-defined argument
bsNewName
Optional new name of the added file
lEdmAddFlags
Combination of EdmAddFlag bits

Example

See the IEdmBatchAdd examples.

Remarks

Before calling this method, use IEdmBatchAdd::SetFileNameSerNo to specify how to create the name for the new file's data card.

If the specified bsDestinationFolderPath does not exist in the vault, it will be created when the file is added.

After calling this method, you must call IEdmBatchAdd::CommitAdd to actually add the file to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


AddFileFromVault Method (IEdmBatchAdd)

AddFileFromVault Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : AddFileFromVault Method (IEdmBatchAdd)

lSourceFileID
ID of file to copy
lSourceFolderID
ID of folder of file to copy
lDestinationFolderID
ID of folder to which to copy the file
lArg
Caller-defined argument.
bsNewName
Optional new name of file.
lEdmAddFlags
Combination of EdmAddFlag bits
Adds a file with the specified ID and folder ID to the batch of files to be added to the vault; the file will be copied to a new vault folder with the specified ID.

Syntax

Visual Basic
Sub AddFileFromVault( _
   ByVal lSourceFileID As System.Integer, _
   ByVal lSourceFolderID As System.Integer, _
   ByVal lDestinationFolderID As System.Integer, _
   Optional ByVal lArg As System.Integer, _
   Optional ByVal bsNewName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
)
C#
void AddFileFromVault(
   System.int lSourceFileID,
   System.int lSourceFolderID,
   System.int lDestinationFolderID,
   System.int lArg,
   System.string bsNewName,
   System.int lEdmAddFlags
)
C++/CLI
void AddFileFromVault(
&   System.int lSourceFileID,
&   System.int lSourceFolderID,
&   System.int lDestinationFolderID,
&   System.int lArg,
&   System.String^ bsNewName,
&   System.int lEdmAddFlags
)

Parameters

lSourceFileID
ID of file to copy
lSourceFolderID
ID of folder of file to copy
lDestinationFolderID
ID of folder to which to copy the file
lArg
Caller-defined argument.
bsNewName
Optional new name of file.
lEdmAddFlags
Combination of EdmAddFlag bits

Remarks

Before calling this method, use IEdmBatchAdd::SetFileNameSerNo to specify how to create the name for the new file's data card.

After calling this method, you must call IEdmBatchAdd::CommitAdd to actually add the file to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


AddFileFromVaultToPath Method (IEdmBatchAdd)

AddFileFromVaultToPath Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : AddFileFromVaultToPath Method (IEdmBatchAdd)

lSourceFileID
ID of file to copy
lSourceFolderID
ID of folder of file to copy
bsDestinationFolderPath
Path of folder to which to copy the file
lArg
Caller-defined argument
bsNewName
Optional new name of file
lEdmAddFlags
Combination of EdmAddFlag bits
Adds a file with the specified ID and folder ID to the batch of files to be added to the vault; the file will be copied to a new vault folder with the specified path.

Syntax

Visual Basic
Sub AddFileFromVaultToPath( _
   ByVal lSourceFileID As System.Integer, _
   ByVal lSourceFolderID As System.Integer, _
   ByVal bsDestinationFolderPath As System.String, _
   Optional ByVal lArg As System.Integer, _
   Optional ByVal bsNewName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
)
C#
void AddFileFromVaultToPath(
   System.int lSourceFileID,
   System.int lSourceFolderID,
   System.string bsDestinationFolderPath,
   System.int lArg,
   System.string bsNewName,
   System.int lEdmAddFlags
)
C++/CLI
void AddFileFromVaultToPath(
&   System.int lSourceFileID,
&   System.int lSourceFolderID,
&   System.String^ bsDestinationFolderPath,
&   System.int lArg,
&   System.String^ bsNewName,
&   System.int lEdmAddFlags
)

Parameters

lSourceFileID
ID of file to copy
lSourceFolderID
ID of folder of file to copy
bsDestinationFolderPath
Path of folder to which to copy the file
lArg
Caller-defined argument
bsNewName
Optional new name of file
lEdmAddFlags
Combination of EdmAddFlag bits

Example

See the IEdmBatchAdd examples.

Remarks

Before calling this method, use IEdmBatchAdd::SetFileNameSerNo to specify how to create the name for the new file's data card.

If the specified bsDestinationFolderPath does not exist in the vault, it will be created when the file is added.

After calling this method, you must call IEdmBatchAdd::CommitAdd to actually add the file to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


AddFolder Method (IEdmBatchAdd)

AddFolder Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : AddFolder Method (IEdmBatchAdd)

lParentFolderID
ID of parent folder to which to add the folders
bsRelativePath
Name of folder or relative path of new folder
lArg
Caller-defined argument
lEdmBatchAddFolderFlags
Combination of EdmBatchAddFolderFlag bits
poData
Optional IEdmFolderData5; extra information about the folder to create
lSourceFolderID
Optional ID of source folder from which to copy properties from
Adds the specified folder or folder path to the batch of folders to be added to the vault.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal lParentFolderID As System.Integer, _
   ByVal bsRelativePath As System.String, _
   ByVal lArg As System.Integer, _
   Optional ByVal lEdmBatchAddFolderFlags As System.Integer, _
   Optional ByVal poData As EdmFolderData, _
   Optional ByVal lSourceFolderID As System.Integer _
)
C#
void AddFolder(
   System.int lParentFolderID,
   System.string bsRelativePath,
   System.int lArg,
   System.int lEdmBatchAddFolderFlags,
   EdmFolderData poData,
   System.int lSourceFolderID
)
C++/CLI
void AddFolder(
&   System.int lParentFolderID,
&   System.String^ bsRelativePath,
&   System.int lArg,
&   System.int lEdmBatchAddFolderFlags,
&   EdmFolderData^ poData,
&   System.int lSourceFolderID
)

Parameters

lParentFolderID
ID of parent folder to which to add the folders
bsRelativePath
Name of folder or relative path of new folder
lArg
Caller-defined argument
lEdmBatchAddFolderFlags
Combination of EdmBatchAddFolderFlag bits
poData
Optional IEdmFolderData5; extra information about the folder to create
lSourceFolderID
Optional ID of source folder from which to copy properties from

Example

See the IEdmBatchAdd examples.

Remarks

Before calling this method, use IEdmBatchAdd::SetFileNameSerNo to specify how to create the name for the new file's data card.

After calling this method, you must call IEdmBatchAdd::CommitAdd to actually add the file to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


AddFolderPath Method (IEdmBatchAdd)

AddFolderPath Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : AddFolderPath Method (IEdmBatchAdd)

bsLocalPath
File system path to folder to create; path leads in to the file vault; all folders missing in the path are created
lArg
Caller-defined argument
lEdmBatchAddFolderFlags
Combination of EdmBatchAddFolderFlag bits
poData
Optional IEdmFolderData5; extra information about the folder to create
lSourceFolderID
Optional ID of source folder from which to copy properties
Adds the specified folder path to the batch of folders to be added to the vault.

Syntax

Visual Basic
Sub AddFolderPath( _
   ByVal bsLocalPath As System.String, _
   ByVal lArg As System.Integer, _
   Optional ByVal lEdmBatchAddFolderFlags As System.Integer, _
   Optional ByVal poData As EdmFolderData, _
   Optional ByVal lSourceFolderID As System.Integer _
)
C#
void AddFolderPath(
   System.string bsLocalPath,
   System.int lArg,
   System.int lEdmBatchAddFolderFlags,
   EdmFolderData poData,
   System.int lSourceFolderID
)
C++/CLI
void AddFolderPath(
&   System.String^ bsLocalPath,
&   System.int lArg,
&   System.int lEdmBatchAddFolderFlags,
&   EdmFolderData^ poData,
&   System.int lSourceFolderID
)

Parameters

bsLocalPath
File system path to folder to create; path leads in to the file vault; all folders missing in the path are created
lArg
Caller-defined argument
lEdmBatchAddFolderFlags
Combination of EdmBatchAddFolderFlag bits
poData
Optional IEdmFolderData5; extra information about the folder to create
lSourceFolderID
Optional ID of source folder from which to copy properties

Example

See the IEdmBatchAdd examples.

Remarks

Before calling this method, use IEdmBatchAdd::SetFileNameSerNo to specify how to create the name for the new file's data card.

After calling this method, you must call IEdmBatchAdd::CommitAdd to actually add the file to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


CommitAdd Method (IEdmBatchAdd)

CommitAdd Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : CommitAdd Method (IEdmBatchAdd)

lHwnd
Parent window handle that is passed to add-ins that are notified about files and folders added to the vault
ppoRetFiles
Array of EdmFileInfo structures, one structure for each file and folder
lEdmBatchAddFlags
Combination of EdmBatchAddFlag bits
poCallback
Optional pointer to a class that implements IEdmCallback or IEdmCallback6 to provide the caller with more information
Adds all files and folders in the batch to the vault.

Syntax

Visual Basic
Function CommitAdd( _
   ByVal lHwnd As System.Integer, _
   ByRef ppoRetFiles() As EdmFileInfo, _
   Optional ByVal lEdmBatchAddFlags As System.Integer, _
   Optional ByVal poCallback As System.Object _
) As System.Integer
C#
System.int CommitAdd(
   System.int lHwnd,
   out EdmFileInfo[] ppoRetFiles,
   System.int lEdmBatchAddFlags,
   System.object poCallback
)
C++/CLI
System.int CommitAdd(
&   System.int lHwnd,
&   [Out] array<EdmFileInfo>^ ppoRetFiles,
&   System.int lEdmBatchAddFlags,
&   System.Object^ poCallback
)

Parameters

lHwnd
Parent window handle that is passed to add-ins that are notified about files and folders added to the vault
ppoRetFiles
Array of EdmFileInfo structures, one structure for each file and folder
lEdmBatchAddFlags
Combination of EdmBatchAddFlag bits
poCallback
Optional pointer to a class that implements IEdmCallback or IEdmCallback6 to provide the caller with more information

Return Value

0 for success; See ppoRetFiles' EdmFileInfo.mhResult for each file added to the vault to get individual result codes

Example

See the IEdmBatchAdd examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


IEdmBatchAdd2 Interface

IEdmBatchAdd2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchAdd2 Interface

Allows you to display a dialog box with information about several files and folders being added to the vault all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchAdd2
   Inherits IEdmBatchAdd
C#
public interface IEdmBatchAdd2 : IEdmBatchAdd
C++/CLI
public interface class IEdmBatchAdd2 : public IEdmBatchAdd

Example

See the IEdmBatchAdd examples.

Remarks

This interface extends IEdmBatchAdd.

See Also

IEdmBatchAdd2 Members
EPDM.Interop.epdm Namespace


IEdmBatchAdd2 Interface Members

IEdmBatchAdd2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchAdd2 Interface

The following tables list the members exposed by IEdmBatchAdd2.

Public Methods

 | Name | Description
Method | ShowDlg | Shows a dialog box containing information about the file and folders that are about to be added to the vault by IEdmBatchAdd::CommitAdd.
Top

See Also

IEdmBatchAdd2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchAdd2 Interface Methods

IEdmBatchAdd2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchAdd2 Interface

For a list of all members of this type, see IEdmBatchAdd2 members.

Public Methods

 | Name | Description
Method | ShowDlg | Shows a dialog box containing information about the file and folders that are about to be added to the vault by IEdmBatchAdd::CommitAdd.
Top

See Also

IEdmBatchAdd2 Interface
EPDM.Interop.epdm Namespace


ShowDlg Method (IEdmBatchAdd2)

ShowDlg Method (IEdmBatchAdd2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd2 Interface : ShowDlg Method (IEdmBatchAdd2)

hParentWnd
Parent window handle for the dialog box
lEdmAddFileDlgFlags
Combination of EdmAddFileDlgFlag bits
bsMessage
Message to display in the dialog box
bsCaption
Dialog box caption
Shows a dialog box containing information about the file and folders that are about to be added to the vault by IEdmBatchAdd::CommitAdd.

Syntax

Visual Basic
Function ShowDlg( _
   ByVal hParentWnd As System.Integer, _
   ByVal lEdmAddFileDlgFlags As System.Integer, _
   Optional ByVal bsMessage As System.String, _
   Optional ByVal bsCaption As System.String _
) As System.Boolean
C#
System.bool ShowDlg(
   System.int hParentWnd,
   System.int lEdmAddFileDlgFlags,
   System.string bsMessage,
   System.string bsCaption
)
C++/CLI
System.bool ShowDlg(
&   System.int hParentWnd,
&   System.int lEdmAddFileDlgFlags,
&   System.String^ bsMessage,
&   System.String^ bsCaption
)

Parameters

hParentWnd
Parent window handle for the dialog box
lEdmAddFileDlgFlags
Combination of EdmAddFileDlgFlag bits
bsMessage
Message to display in the dialog box
bsCaption
Dialog box caption

Return Value

True if the user clicked OK, false if the user clicked Cancel

Example

See the IEdmBatchAdd examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd2 Interface
IEdmBatchAdd2 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBatchAddFolders Interface

IEdmBatchAddFolders Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchAddFolders Interface

Allows you to add several folders to the vault all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchAddFolders
C#
public interface IEdmBatchAddFolders
C++/CLI
public interface class IEdmBatchAddFolders

Example

Batch Add Folders (VB.NET)
Batch Add Folders (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To add several folders to the vault in one batch:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing EdmUtility.EdmUtil_BatchAddFolders as a parameter.
  2. Call IEdmBatchAddFolders::AddFolder once for each folder to add to the batch.
  3. Call IEdmBatchAddFolders::Create to commit the folders in the batch to the vault.

Using IEdmBatchAddFolders is more efficient than calling IEdmFolder5::AddFolder or IEdmFolder5::CreateFolderPath multiple times.

Use IEdmBatchAdd if you need to add several files and folders to the vault.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchAddFolders Members
EPDM.Interop.epdm Namespace


IEdmBatchAddFolders Interface Members

IEdmBatchAddFolders Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchAddFolders Interface

The following tables list the members exposed by IEdmBatchAddFolders.

Public Methods

 | Name | Description
Method | AddFolder | Adds a folder or a complete folder path to the batch of folders to add to the vault.
Method | Create | Creates all the folders that were added to the batch using IEdmBatchAddFolders::AddFolder.
Top

See Also

IEdmBatchAddFolders Interface
EPDM.Interop.epdm Namespace


IEdmBatchAddFolders Interface Methods

IEdmBatchAddFolders Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchAddFolders Interface

For a list of all members of this type, see IEdmBatchAddFolders members.

Public Methods

 | Name | Description
Method | AddFolder | Adds a folder or a complete folder path to the batch of folders to add to the vault.
Method | Create | Creates all the folders that were added to the batch using IEdmBatchAddFolders::AddFolder.
Top

See Also

IEdmBatchAddFolders Interface
EPDM.Interop.epdm Namespace


AddFolder Method (IEdmBatchAddFolders)

AddFolder Method (IEdmBatchAddFolders)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAddFolders Interface : AddFolder Method (IEdmBatchAddFolders)

lParentFolderID
ID of parent folder to which to add the folders
bsRelativePath
Name of folder or relative path of new folder
lParam
Caller-defined value
lEdmBatchAddFolderFlags
Combination of EdmBatchAddFolderFlag bits
poData
Optional IEdmFolderData5 permission settings and card layouts are copied to the added folders
lSourceFolderID
Optional ID of folder to copy; if not 0, permission settings and card layouts from the source folder with this lSourceFolderID are copied to the added folders
Adds a folder or a complete folder path to the batch of folders to add to the vault.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal lParentFolderID As System.Integer, _
   ByVal bsRelativePath As System.String, _
   ByVal lParam As System.Integer, _
   Optional ByVal lEdmBatchAddFolderFlags As System.Integer, _
   Optional ByVal poData As EdmFolderData, _
   Optional ByVal lSourceFolderID As System.Integer _
)
C#
void AddFolder(
   System.int lParentFolderID,
   System.string bsRelativePath,
   System.int lParam,
   System.int lEdmBatchAddFolderFlags,
   EdmFolderData poData,
   System.int lSourceFolderID
)
C++/CLI
void AddFolder(
&   System.int lParentFolderID,
&   System.String^ bsRelativePath,
&   System.int lParam,
&   System.int lEdmBatchAddFolderFlags,
&   EdmFolderData^ poData,
&   System.int lSourceFolderID
)

Parameters

lParentFolderID
ID of parent folder to which to add the folders
bsRelativePath
Name of folder or relative path of new folder
lParam
Caller-defined value
lEdmBatchAddFolderFlags
Combination of EdmBatchAddFolderFlag bits
poData
Optional IEdmFolderData5 permission settings and card layouts are copied to the added folders
lSourceFolderID
Optional ID of folder to copy; if not 0, permission settings and card layouts from the source folder with this lSourceFolderID are copied to the added folders

Example

See the IEdmBatchAddFolders examples.

Remarks

After calling this method, you must call IEdmBatchAddFolders::Create to actually add the folder to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_NAME: The folder name contained invalid characters.

See Also

IEdmBatchAddFolders Interface
IEdmBatchAddFolders Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


Create Method (IEdmBatchAddFolders)

Create Method (IEdmBatchAddFolders)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAddFolders Interface : Create Method (IEdmBatchAddFolders)

lHwnd
Parent window handle that is passed to add-ins that are notified about folders added to the vault
ppoRetFolders
Array of EdmFolderInfo structures; one structure for each folder added
lEdmBatchCreateFolderFlags
Combination of EdmBatchCreateFolderFlag bits
Creates all the folders that were added to the batch using IEdmBatchAddFolders::AddFolder.

Syntax

Visual Basic
Sub Create( _
   ByVal lHwnd As System.Integer, _
   ByRef ppoRetFolders() As EdmFolderInfo, _
   Optional ByVal lEdmBatchCreateFolderFlags As System.Integer _
)
C#
void Create(
   System.int lHwnd,
   out EdmFolderInfo[] ppoRetFolders,
   System.int lEdmBatchCreateFolderFlags
)
C++/CLI
void Create(
&   System.int lHwnd,
&   [Out] array<EdmFolderInfo>^ ppoRetFolders,
&   System.int lEdmBatchCreateFolderFlags
)

Parameters

lHwnd
Parent window handle that is passed to add-ins that are notified about folders added to the vault
ppoRetFolders
Array of EdmFolderInfo structures; one structure for each folder added
lEdmBatchCreateFolderFlags
Combination of EdmBatchCreateFolderFlag bits

Example

See the IEdmBatchAddFolders examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_COULD_NOT_CREATE_LOCAL_FOLDER: The folders were created in the vault but could not be created in the local cache.

See Also

IEdmBatchAddFolders Interface
IEdmBatchAddFolders Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


IEdmBatchChangeState Interface

IEdmBatchChangeState Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchChangeState Interface

Allows you to change states or revoke transitions of several files at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchChangeState
C#
public interface IEdmBatchChangeState
C++/CLI
public interface class IEdmBatchChangeState

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBatchChangeState2.

To change the states of files:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing EdmUtility.EdmUtil_BatchChangeState as a parameter.
  2. Call IEdmBatchChangeState::AddFile to add a file to the batch of files whose states you want to change.
  3. Call IEdmBatchChangeState::CreateTree to build the initial file reference tree.
  4. Optionally call IEdmBatchChangeState::ShowDlg to show a dialog with the affected files.
  5. Call IEdmBatchChangeState::ChangeState to change the states of the files added to the batch.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchChangeState Members
EPDM.Interop.epdm Namespace


IEdmBatchChangeState Interface Members

IEdmBatchChangeState Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState Interface

The following tables list the members exposed by IEdmBatchChangeState.

Public Properties

 | Name | Description
Property | Comment | Comment about this state change or transition revocation to add to the history listing.
Top

Public Methods

 | Name | Description
Method | AddFile | Adds a file to this batch of files whose states you want to change or whose transitions you want to revoke.
Method | ChangeState | Obsolete. Superseded by IEdmBatchChangeState4::ChangeState2.
Method | CreateTree | Computes the file reference tree and checks that the specified state transition can be performed for the files added to this batch using IEdmBatchChangeState::AddFile.
Method | GetFileList | Gets the list of files affected by the state change or transition revocation.
Method | SetAux | Reserved for future use.
Method | ShowDlg | Shows the change state or revoke transition dialog box.
Top

See Also

IEdmBatchChangeState Interface
EPDM.Interop.epdm Namespace


IEdmBatchChangeState Interface Methods

IEdmBatchChangeState Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState Interface

For a list of all members of this type, see IEdmBatchChangeState members.

Public Methods

 | Name | Description
Method | AddFile | Adds a file to this batch of files whose states you want to change or whose transitions you want to revoke.
Method | ChangeState | Obsolete. Superseded by IEdmBatchChangeState4::ChangeState2.
Method | CreateTree | Computes the file reference tree and checks that the specified state transition can be performed for the files added to this batch using IEdmBatchChangeState::AddFile.
Method | GetFileList | Gets the list of files affected by the state change or transition revocation.
Method | SetAux | Reserved for future use.
Method | ShowDlg | Shows the change state or revoke transition dialog box.
Top

See Also

IEdmBatchChangeState Interface
EPDM.Interop.epdm Namespace


AddFile Method (IEdmBatchChangeState)

AddFile Method (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : AddFile Method (IEdmBatchChangeState)

lFileID
ID of file whose state you want to change or whose transition you want to revoke
lFolderID
ID of file's folder
Adds a file to this batch of files whose states you want to change or whose transitions you want to revoke.

Syntax

Visual Basic
Sub AddFile( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer _
)
C#
void AddFile(
   System.int lFileID,
   System.int lFolderID
)
C++/CLI
void AddFile(
&   System.int lFileID,
&   System.int lFolderID
)

Parameters

lFileID
ID of file whose state you want to change or whose transition you want to revoke
lFolderID
ID of file's folder

Example

See the IEdmBatchChangeState4 examples.

Remarks

After calling this method, call IEdmBatchChangeState::ChangeState to actually change the state of the file or revoke its transition.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009


CreateTree Method (IEdmBatchChangeState)

CreateTree Method (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : CreateTree Method (IEdmBatchChangeState)

bsTransition
Name of the workflow state transition to perform
Computes the file reference tree and checks that the specified state transition can be performed for the files added to this batch using IEdmBatchChangeState::AddFile.

Syntax

Visual Basic
Function CreateTree( _
   ByVal bsTransition As System.String _
) As System.Boolean
C#
System.bool CreateTree(
   System.string bsTransition
)
C++/CLI
System.bool CreateTree(
&   System.String^ bsTransition
)

Parameters

bsTransition
Name of the workflow state transition to perform

Return Value

True if there are any valid state changes, false if not

Example

See the IEdmBatchChangeState4 examples.

Remarks

If you are revoking transitions, instead of calling this method, call IEdmBatchChangeState2::CreateTreeForRevoke.

After calling this method, call IEdmBatchChangeState::ShowDlg and/or IEdmBatchChangeState::ChangeState.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009


GetFileList Method (IEdmBatchChangeState)

GetFileList Method (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : GetFileList Method (IEdmBatchChangeState)

lEdmChangeStateFileListFlags
Combination of EdmChangeStateFileListFlag bits
Gets the list of files affected by the state change or transition revocation.

Syntax

Visual Basic
Function GetFileList( _
   ByVal lEdmChangeStateFileListFlags As System.Integer _
) As EdmSelectionList5
C#
EdmSelectionList5 GetFileList(
   System.int lEdmChangeStateFileListFlags
)
C++/CLI
EdmSelectionList5^ GetFileList(
&   System.int lEdmChangeStateFileListFlags
)

Parameters

lEdmChangeStateFileListFlags
Combination of EdmChangeStateFileListFlag bits

Return Value

IEdmSelectionList5; list of affected objects

Example

See the IEdmBatchChangeState4 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009


SetAux Method (IEdmBatchChangeState)

SetAux Method (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : SetAux Method (IEdmBatchChangeState)

poAux
lFlags
Reserved for future use.

Syntax

Visual Basic
Sub SetAux( _
   ByVal poAux As System.Object, _
   Optional ByVal lFlags As System.Integer _
)
C#
void SetAux(
   System.object poAux,
   System.int lFlags
)
C++/CLI
void SetAux(
&   System.Object^ poAux,
&   System.int lFlags
)

Parameters

poAux
lFlags

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009


ShowDlg Method (IEdmBatchChangeState)

ShowDlg Method (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : ShowDlg Method (IEdmBatchChangeState)

lParentWnd
Parent window handle for the dialog box
Shows the change state or revoke transition dialog box.

Syntax

Visual Basic
Function ShowDlg( _
   ByVal lParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowDlg(
   System.int lParentWnd
)
C++/CLI
System.bool ShowDlg(
&   System.int lParentWnd
)

Parameters

lParentWnd
Parent window handle for the dialog box

Return Value

True if the user clicked OK, false if the user clicked Cancel

Example

See the IEdmBatchChangeState4 examples.

Remarks

Before calling this method, you must call IEdmBatchChangeState::CreateTree if changing states or IEdmBatchChangeState2::CreateTreeForRevoke if revoking transitions.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009; for the revoke transition dialog, SOLIDWORKS PDM Professional 2013


IEdmBatchChangeState Interface Properties

IEdmBatchChangeState Interface Properties
EPDM.Interop.epdm Namespace : IEdmBatchChangeState Interface

For a list of all members of this type, see IEdmBatchChangeState members.

Public Properties

 | Name | Description
Property | Comment | Comment about this state change or transition revocation to add to the history listing.
Top

See Also

IEdmBatchChangeState Interface
EPDM.Interop.epdm Namespace


Comment Property (IEdmBatchChangeState)

Comment Property (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : Comment Property (IEdmBatchChangeState)

Comment about this state change or transition revocation to add to the history listing.

Syntax

Visual Basic
Property Comment As System.String
C#
System.string Comment {get; set;}
C++/CLI
property System.String^ Comment {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Comment

Example

See the IEdmBatchChangeState4 examples.

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBatchChangeState2 Interface

IEdmBatchChangeState2 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchChangeState2 Interface

Allows you to change states or revoke transitions of several files at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchChangeState2
   Inherits IEdmBatchChangeState
C#
public interface IEdmBatchChangeState2 : IEdmBatchChangeState
C++/CLI
public interface class IEdmBatchChangeState2 : public IEdmBatchChangeState

Example

Batch Revoke State Transitions of Files (VB.NET)
Batch Revoke State Transitions of Files (C#)

Remarks

This interface:

  • extends IEdmBatchChangeState.
  • is extended by IEdmBatchChangeState3.

See Also

IEdmBatchChangeState2 Members
EPDM.Interop.epdm Namespace


IEdmBatchChangeState2 Interface Members

IEdmBatchChangeState2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState2 Interface

The following tables list the members exposed by IEdmBatchChangeState2.

Public Methods

 | Name | Description
Method | CreateTreeForRevoke | Computes the file reference tree and checks that the specified transition revocation can be performed for the files added to this batch using IEdmBatchChangeState::AddFile.
Method | GetAvailableTransitionList | Gets the state transitions available for the files in this batch.
Top

See Also

IEdmBatchChangeState2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchChangeState2 Interface Methods

IEdmBatchChangeState2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState2 Interface

For a list of all members of this type, see IEdmBatchChangeState2 members.

Public Methods

 | Name | Description
Method | CreateTreeForRevoke | Computes the file reference tree and checks that the specified transition revocation can be performed for the files added to this batch using IEdmBatchChangeState::AddFile.
Method | GetAvailableTransitionList | Gets the state transitions available for the files in this batch.
Top

See Also

IEdmBatchChangeState2 Interface
EPDM.Interop.epdm Namespace


CreateTreeForRevoke Method (IEdmBatchChangeState2)

CreateTreeForRevoke Method (IEdmBatchChangeState2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState2 Interface : CreateTreeForRevoke Method (IEdmBatchChangeState2)

bsTransition
Name of the workflow state transition to revoke
Computes the file reference tree and checks that the specified transition revocation can be performed for the files added to this batch using IEdmBatchChangeState::AddFile.

Syntax

Visual Basic
Function CreateTreeForRevoke( _
   ByVal bsTransition As System.String _
) As System.Boolean
C#
System.bool CreateTreeForRevoke(
   System.string bsTransition
)
C++/CLI
System.bool CreateTreeForRevoke(
&   System.String^ bsTransition
)

Parameters

bsTransition
Name of the workflow state transition to revoke

Return Value

True if there are any valid files on which to revoke transitions, false if there are no valid files

Example

See the IEdmBatchChangeState2 examples.

Remarks

To include parent files in the file reference tree, call IEdmBatchChangeState5::IncludeParentsForRevokeTree.

After calling this method, call IEdmBatchChangeState::ShowDlg and/or IEdmBatchChangeState::ChangeState.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState2 Interface
IEdmBatchChangeState2 Members

Availability

SOLIDWORKS PDM Professional 2013


GetAvailableTransitionList Method (IEdmBatchChangeState2)

GetAvailableTransitionList Method (IEdmBatchChangeState2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState2 Interface : GetAvailableTransitionList Method (IEdmBatchChangeState2)

ppoTransitions
Array of EdmChangeStateTransitionInfo structures; one structure for each state transition
Gets the state transitions available for the files in this batch.

Syntax

Visual Basic
Sub GetAvailableTransitionList( _
   ByRef ppoTransitions() As EdmChangeStateTransitionInfo _
)
C#
void GetAvailableTransitionList(
   out EdmChangeStateTransitionInfo[] ppoTransitions
)
C++/CLI
void GetAvailableTransitionList(
&   [Out] array<EdmChangeStateTransitionInfo>^ ppoTransitions
)

Parameters

ppoTransitions
Array of EdmChangeStateTransitionInfo structures; one structure for each state transition

Example

See the IEdmBatchChangeState2 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState2 Interface
IEdmBatchChangeState2 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmBatchChangeState3 Interface

IEdmBatchChangeState3 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchChangeState3 Interface

Allows you to change states or revoke transitions of several files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchChangeState3
   Inherits IEdmBatchChangeState, IEdmBatchChangeState2
C#
public interface IEdmBatchChangeState3 : IEdmBatchChangeState, IEdmBatchChangeState2
C++/CLI
public interface class IEdmBatchChangeState3 : public IEdmBatchChangeState, IEdmBatchChangeState2

Example

Batch Revoke State Transitions of Files (VB.NET)
Batch Revoke State Transitions of Files (C#)

Remarks

This interface:

  • extends IEdmBatchChangeState2.
  • is extended by IEdmBatchChangeState4.

See Also

IEdmBatchChangeState3 Members
EPDM.Interop.epdm Namespace


IEdmBatchChangeState3 Interface Members

IEdmBatchChangeState3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState3 Interface

The following tables list the members exposed by IEdmBatchChangeState3.

Public Methods

 | Name | Description
Method | AllowAdminToRevoke | Sets whether an administrator is allowed to revoke state transitions of files in this batch.
Method | SetRevokeUserID | Sets the ID of the user allowed to revoke state transitions of files in this batch.
Top

See Also

IEdmBatchChangeState3 Interface
EPDM.Interop.epdm Namespace


IEdmBatchChangeState3 Interface Methods

IEdmBatchChangeState3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState3 Interface

For a list of all members of this type, see IEdmBatchChangeState3 members.

Public Methods

 | Name | Description
Method | AllowAdminToRevoke | Sets whether an administrator is allowed to revoke state transitions of files in this batch.
Method | SetRevokeUserID | Sets the ID of the user allowed to revoke state transitions of files in this batch.
Top

See Also

IEdmBatchChangeState3 Interface
EPDM.Interop.epdm Namespace


AllowAdminToRevoke Method (IEdmBatchChangeState3)

AllowAdminToRevoke Method (IEdmBatchChangeState3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState3 Interface : AllowAdminToRevoke Method (IEdmBatchChangeState3)

bAllowAdminToRevoke
True to allow an administrator to revoke state transitions of files, false to not
Sets whether an administrator is allowed to revoke state transitions of files in this batch.

Syntax

Visual Basic
Sub AllowAdminToRevoke( _
   ByVal bAllowAdminToRevoke As System.Boolean _
)
C#
void AllowAdminToRevoke(
   System.bool bAllowAdminToRevoke
)
C++/CLI
void AllowAdminToRevoke(
&   System.bool bAllowAdminToRevoke
)

Parameters

bAllowAdminToRevoke
True to allow an administrator to revoke state transitions of files, false to not

Example

See the IEdmBatchChangeState3 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState3 Interface
IEdmBatchChangeState3 Members

Availability

SOLIDWORKS PDM Professional 2013


SetRevokeUserID Method (IEdmBatchChangeState3)

SetRevokeUserID Method (IEdmBatchChangeState3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState3 Interface : SetRevokeUserID Method (IEdmBatchChangeState3)

lUserID
ID of user allowed to revoke state transitions of files
Sets the ID of the user allowed to revoke state transitions of files in this batch.

Syntax

Visual Basic
Sub SetRevokeUserID( _
   ByVal lUserID As System.Integer _
)
C#
void SetRevokeUserID(
   System.int lUserID
)
C++/CLI
void SetRevokeUserID(
&   System.int lUserID
)

Parameters

lUserID
ID of user allowed to revoke state transitions of files

Example

See the IEdmBatchChangeState3 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState3 Interface
IEdmBatchChangeState3 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmBatchChangeState4 Interface

IEdmBatchChangeState4 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchChangeState4 Interface

Allows you to change states or revoke transitions of several files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchChangeState4
   Inherits IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3
C#
public interface IEdmBatchChangeState4 : IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3
C++/CLI
public interface class IEdmBatchChangeState4 : public IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3

Example

Batch Change States of Files (VB.NET)
Batch Change States of Files (C#)

Remarks

This interface:

  • extends IEdmBatchChangeState3 by supporting password-protected workflow transitions.
  • is extended by IEdmBatchChangeState5.

See Also

IEdmBatchChangeState4 Members
EPDM.Interop.epdm Namespace


IEdmBatchChangeState4 Interface Members

IEdmBatchChangeState4 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState4 Interface

The following tables list the members exposed by IEdmBatchChangeState4.

Public Methods

 | Name | Description
Method | ChangeState2 | Changes states or revokes transitions of all the files added to this batch using IEdmBatchChangeState::AddFile.
Top

See Also

IEdmBatchChangeState4 Interface
EPDM.Interop.epdm Namespace


IEdmBatchChangeState4 Interface Methods

IEdmBatchChangeState4 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState4 Interface

For a list of all members of this type, see IEdmBatchChangeState4 members.

Public Methods

 | Name | Description
Method | ChangeState2 | Changes states or revokes transitions of all the files added to this batch using IEdmBatchChangeState::AddFile.
Top

See Also

IEdmBatchChangeState4 Interface
EPDM.Interop.epdm Namespace


ChangeState2 Method (IEdmBatchChangeState4)

ChangeState2 Method (IEdmBatchChangeState4)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState4 Interface : ChangeState2 Method (IEdmBatchChangeState4)

lParentWnd

Parent window handle that is passed to add-ins that are notified about file state changes in the vault

bsPasswd
Password of user executing the transition
poCallback

Optional pointer to a class that implements IEdmCallback to receive progress information about the operation

Changes states or revokes transitions of all the files added to this batch using IEdmBatchChangeState::AddFile.

Syntax

Visual Basic
Sub ChangeState2( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsPasswd As System.String, _
   Optional ByVal poCallback As EdmCallback _
)
C#
void ChangeState2(
   System.int lParentWnd,
   System.string bsPasswd,
   EdmCallback poCallback
)
C++/CLI
void ChangeState2(
&   System.int lParentWnd,
&   System.String^ bsPasswd,
&   EdmCallback^ poCallback
)

Parameters

lParentWnd

Parent window handle that is passed to add-ins that are notified about file state changes in the vault

bsPasswd
Password of user executing the transition
poCallback

Optional pointer to a class that implements IEdmCallback to receive progress information about the operation

Example

See the IEdmBatchChangeState4 examples.

Remarks

The difference between this method and the now obsolete IEdmBatchChangeState::ChangeState is that this method specifies a user password that allows the file to change state if the transition requires authentication (IEdmTransition10::Authentication).

Before calling this method, you must call IEdmBatchChangeState::CreateTree if changing states or IEdmBatchChangeState2::CreateTreeForRevoke if revoking transitions.

Return codes:

  • E_EDM_STATECHANGE_FAILED: The password is invalid.
  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState4 Interface
IEdmBatchChangeState4 Members

Availability

SOLIDWORKS PDM Professional 2015 SP02


IEdmBatchChangeState5 Interface

IEdmBatchChangeState5 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchChangeState5 Interface

Allows you to change states or revoke transitions of several files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchChangeState5
   Inherits IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3, IEdmBatchChangeState4
C#
public interface IEdmBatchChangeState5 : IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3, IEdmBatchChangeState4
C++/CLI
public interface class IEdmBatchChangeState5 : public IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3, IEdmBatchChangeState4

Remarks

This interface:

  • extends IEdmBatchChangeState4 by allowing users to include parent files in the file reference tree to revoke transactions.
  • is extended by IEdmBatchChangeState6.

See Also

IEdmBatchChangeState5 Members
EPDM.Interop.epdm Namespace


IEdmBatchChangeState5 Interface Members

IEdmBatchChangeState5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState5 Interface

The following tables list the members exposed by IEdmBatchChangeState5.

Public Methods

 | Name | Description
Method | IncludeParentsForRevokeTree | Gets or sets whether to include parent files in the file reference tree to revoke transactions.
Top

See Also

IEdmBatchChangeState5 Interface
EPDM.Interop.epdm Namespace


IEdmBatchChangeState5 Interface Methods

IEdmBatchChangeState5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState5 Interface

For a list of all members of this type, see IEdmBatchChangeState5 members.

Public Methods

 | Name | Description
Method | IncludeParentsForRevokeTree | Gets or sets whether to include parent files in the file reference tree to revoke transactions.
Top

See Also

IEdmBatchChangeState5 Interface
EPDM.Interop.epdm Namespace


IncludeParentsForRevokeTree Method (IEdmBatchChangeState5)

IncludeParentsForRevokeTree Method (IEdmBatchChangeState5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState5 Interface : IncludeParentsForRevokeTree Method (IEdmBatchChangeState5)

bInclude
True to include parent files in the file reference tree to revoke transactions, false to not
Gets or sets whether to include parent files in the file reference tree to revoke transactions.

Syntax

Visual Basic
Sub IncludeParentsForRevokeTree( _
   ByVal bInclude As System.Boolean _
)
C#
void IncludeParentsForRevokeTree(
   System.bool bInclude
)
C++/CLI
void IncludeParentsForRevokeTree(
&   System.bool bInclude
)

Parameters

bInclude
True to include parent files in the file reference tree to revoke transactions, false to not

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The argument is invalid.

See Also

IEdmBatchChangeState5 Interface
IEdmBatchChangeState5 Members

Availability

SOLIDWORKS PDM Professional 2015 SP04


IEdmBatchChangeState6 Interface

IEdmBatchChangeState6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchChangeState6 Interface

Allows you to change states or revoke transitions of several files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchChangeState6
   Inherits IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3, IEdmBatchChangeState4, IEdmBatchChangeState5
C#
public interface IEdmBatchChangeState6 : IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3, IEdmBatchChangeState4, IEdmBatchChangeState5
C++/CLI
public interface class IEdmBatchChangeState6 : public IEdmBatchChangeState, IEdmBatchChangeState2, IEdmBatchChangeState3, IEdmBatchChangeState4, IEdmBatchChangeState5

Example

Batch Change States of Files As User (VB.NET)
Batch Change States of Files As User (C#)

Remarks

This interface extends IEdmBatchChangeState5 by allowing another user to transition files.

See Also

IEdmBatchChangeState6 Members
EPDM.Interop.epdm Namespace


IEdmBatchChangeState6 Interface Members

IEdmBatchChangeState6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState6 Interface

The following tables list the members exposed by IEdmBatchChangeState6.

Public Methods

 | Name | Description
Method | RunAsUser | Transitions files with another user's credentials.
Top

See Also

IEdmBatchChangeState6 Interface
EPDM.Interop.epdm Namespace


IEdmBatchChangeState6 Interface Methods

IEdmBatchChangeState6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchChangeState6 Interface

For a list of all members of this type, see IEdmBatchChangeState6 members.

Public Methods

 | Name | Description
Method | RunAsUser | Transitions files with another user's credentials.
Top

See Also

IEdmBatchChangeState6 Interface
EPDM.Interop.epdm Namespace


RunAsUser Method (IEdmBatchChangeState6)

RunAsUser Method (IEdmBatchChangeState6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState6 Interface : RunAsUser Method (IEdmBatchChangeState6)

lParentWnd
Parent window handle that is passed to add-ins that are notified about file state changes in the vault
bsRunASUserName
User name to use to transition the files
bsRunAsPassword
Password for bsRunASUserName
Transitions files with another user's credentials.

Syntax

Visual Basic
Sub RunAsUser( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsRunASUserName As System.String, _
   ByVal bsRunAsPassword As System.String _
)
C#
void RunAsUser(
   System.int lParentWnd,
   System.string bsRunASUserName,
   System.string bsRunAsPassword
)
C++/CLI
void RunAsUser(
&   System.int lParentWnd,
&   System.String^ bsRunASUserName,
&   System.String^ bsRunAsPassword
)

Parameters

lParentWnd
Parent window handle that is passed to add-ins that are notified about file state changes in the vault
bsRunASUserName
User name to use to transition the files
bsRunAsPassword
Password for bsRunASUserName

Example

See the IEdmBatchChangeState6 examples.

See Also

IEdmBatchChangeState6 Interface
IEdmBatchChangeState6 Members

Availability

SOLIDWORKS PDM Professional 2024


IEdmBatchDelete Interface

IEdmBatchDelete Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchDelete Interface

Allows you to delete several files and folders from the vault at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchDelete
C#
public interface IEdmBatchDelete
C++/CLI
public interface class IEdmBatchDelete

Example

Batch Delete Files and Folders from Vault (VB.NET)
Batch Delete Files and Folders from Vault (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBatchDelete2.

To delete several files and folders from the vault at once:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing EdmUtility.EdmUtil_BatchDelete as a parameter.
  2. Call IEdmBatchDelete::AddFileByID, IEdmBatchDelete::AddFileByPath, or IEdmBatchDelete::AddFolder one or more times to add files and folders to the batch for deletion.
  3. Call IEdmBatchDelete::ComputePermissions to prepare the delete operation.
  4. Optionally call IEdmBatchDelete2::ShowWarningDlg2 to display a message about any errors found in step 3.
  5. Call IEdmBatchDelete::CommitDelete to delete the files and folders added to the batch.
  6. Optionally call IEdmBatchDelete::ShowCommitErrorsDlg or IEdmBatchDelete3::GetCommitErrors to get any errors that might have occurred in step 5.

Using IEdmBatchDelete is more efficient than calling IEdmFolder5::DeleteFile or IEdmFolder5::DeleteFolder multiple times.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchDelete Members
EPDM.Interop.epdm Namespace


IEdmBatchDelete Interface Members

IEdmBatchDelete Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchDelete Interface

The following tables list the members exposed by IEdmBatchDelete.

Public Methods

 | Name | Description
Method | AddFileByID | Adds a file with the specified file and folder IDs to the batch of files to be deleted.
Method | AddFileByPath | Adds a file with the specified path to the batch of files to be deleted.
Method | AddFolder | Adds a folder with the specified ID or path to the batch of folders to delete.
Method | CommitDelete | Deletes the files and folders added to the batch by IEdmBatchDelete::AddFileByID, IEdmBatchDelete::AddFileByPath, and/or IEdmBatchDelete::AddFolder.
Method | ComputePermissions | Specifies whether files or folders should be permanently deleted or moved to the recycle bin.
Method | ShowCommitErrorsDlg | Shows a dialog box containing the errors that occurred during IEdmBatchDelete::CommitDelete.
Method | ShowWarningDlg | Obsolete. Superseded by IEdmBatchDelete2::ShowWarningDlg2 .
Top

See Also

IEdmBatchDelete Interface
EPDM.Interop.epdm Namespace


IEdmBatchDelete Interface Methods

IEdmBatchDelete Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchDelete Interface

For a list of all members of this type, see IEdmBatchDelete members.

Public Methods

 | Name | Description
Method | AddFileByID | Adds a file with the specified file and folder IDs to the batch of files to be deleted.
Method | AddFileByPath | Adds a file with the specified path to the batch of files to be deleted.
Method | AddFolder | Adds a folder with the specified ID or path to the batch of folders to delete.
Method | CommitDelete | Deletes the files and folders added to the batch by IEdmBatchDelete::AddFileByID, IEdmBatchDelete::AddFileByPath, and/or IEdmBatchDelete::AddFolder.
Method | ComputePermissions | Specifies whether files or folders should be permanently deleted or moved to the recycle bin.
Method | ShowCommitErrorsDlg | Shows a dialog box containing the errors that occurred during IEdmBatchDelete::CommitDelete.
Method | ShowWarningDlg | Obsolete. Superseded by IEdmBatchDelete2::ShowWarningDlg2 .
Top

See Also

IEdmBatchDelete Interface
EPDM.Interop.epdm Namespace


AddFileByID Method (IEdmBatchDelete)

AddFileByID Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : AddFileByID Method (IEdmBatchDelete)

lFileID
ID of file to delete
lFolderID
ID of file's parent folder
Adds a file with the specified file and folder IDs to the batch of files to be deleted.

Syntax

Visual Basic
Sub AddFileByID( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer _
)
C#
void AddFileByID(
   System.int lFileID,
   System.int lFolderID
)
C++/CLI
void AddFileByID(
&   System.int lFileID,
&   System.int lFolderID
)

Parameters

lFileID
ID of file to delete
lFolderID
ID of file's parent folder

Remarks

After calling this method, call IEdmBatchDelete::CommitDelete to delete the file from the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


AddFileByPath Method (IEdmBatchDelete)

AddFileByPath Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : AddFileByPath Method (IEdmBatchDelete)

bsPath
Path of file to delete
Adds a file with the specified path to the batch of files to be deleted.

Syntax

Visual Basic
Sub AddFileByPath( _
   ByVal bsPath As System.String _
)
C#
void AddFileByPath(
   System.string bsPath
)
C++/CLI
void AddFileByPath(
&   System.String^ bsPath
)

Parameters

bsPath
Path of file to delete

Example

See the IEdmBatchDelete examples.

Remarks

After calling this method, call IEdmBatchDelete::CommitDelete to delete the file from the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


AddFolder Method (IEdmBatchDelete)

AddFolder Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : AddFolder Method (IEdmBatchDelete)

oFolderIDorPath
ID of or path to folder to delete
Adds a folder with the specified ID or path to the batch of folders to delete.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal oFolderIDorPath As System.Object _
)
C#
void AddFolder(
   System.object oFolderIDorPath
)
C++/CLI
void AddFolder(
&   System.Object^ oFolderIDorPath
)

Parameters

oFolderIDorPath
ID of or path to folder to delete

Example

See the IEdmBatchDelete examples.

Remarks

After calling this method, call IEdmBatchDelete::CommitDelete to delete the file from the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


CommitDelete Method (IEdmBatchDelete)

CommitDelete Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : CommitDelete Method (IEdmBatchDelete)

hParentWnd
Parent window handle that is passed to add-ins that are notified about file or folder deletions from the vault
poCallback
Optional pointer to a class that implements IEdmCallback to provide delete progress feedback to the user
Deletes the files and folders added to the batch by IEdmBatchDelete::AddFileByID, IEdmBatchDelete::AddFileByPath, and/or IEdmBatchDelete::AddFolder.

Syntax

Visual Basic
Function CommitDelete( _
   ByVal hParentWnd As System.Integer, _
   Optional ByVal poCallback As EdmCallback _
) As System.Boolean
C#
System.bool CommitDelete(
   System.int hParentWnd,
   EdmCallback poCallback
)
C++/CLI
System.bool CommitDelete(
&   System.int hParentWnd,
&   EdmCallback^ poCallback
)

Parameters

hParentWnd
Parent window handle that is passed to add-ins that are notified about file or folder deletions from the vault
poCallback
Optional pointer to a class that implements IEdmCallback to provide delete progress feedback to the user

Return Value

True if no errors occurred, false if errors occurred

Example

See the IEdmBatchDelete examples.

Remarks

Before calling this method, you must call IEdmBatchDelete::ComputePermissions.

If errors occurred during IEdmBatchDelete::CommitDelete, call IEdmBatchDelete::ShowCommitErrorsDlg or IEdmBatchDelete3::GetCommitErrors.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NOT_INITIALIZED: IEdmBatchDelete::ComputePermissions has not been called.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


ComputePermissions Method (IEdmBatchDelete)

ComputePermissions Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : ComputePermissions Method (IEdmBatchDelete)

bDestroy
True to permanently delete files and folders, false to move files and folders to the recycle bin
poCallback
Optional pointer to a class that implements IEdmCallback to provide delete progress feedback to the user
Specifies whether files or folders should be permanently deleted or moved to the recycle bin.

Syntax

Visual Basic
Function ComputePermissions( _
   ByVal bDestroy As System.Boolean, _
   Optional ByVal poCallback As EdmCallback _
) As System.Boolean
C#
System.bool ComputePermissions(
   System.bool bDestroy,
   EdmCallback poCallback
)
C++/CLI
System.bool ComputePermissions(
&   System.bool bDestroy,
&   EdmCallback^ poCallback
)

Parameters

bDestroy
True to permanently delete files and folders, false to move files and folders to the recycle bin
poCallback
Optional pointer to a class that implements IEdmCallback to provide delete progress feedback to the user

Return Value

True if no errors occurred, false otherwise

Example

See the IEdmBatchDelete examples.

Remarks

Before calling this method, you must add files and folders to the batch using IEdmBatchDelete::AddFileByID, IEdmBatchDelete::AddFileByPath, and IEdmBatchDelete::AddFolder.

If errors occurred during IEdmBatchDelete::ComputePermissions, call IEdmBatchDelete::ShowWarningDlg.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


ShowCommitErrorsDlg Method (IEdmBatchDelete)

ShowCommitErrorsDlg Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : ShowCommitErrorsDlg Method (IEdmBatchDelete)

hParentWnd
Parent window handle for the dialog box
Shows a dialog box containing the errors that occurred during IEdmBatchDelete::CommitDelete.

Syntax

Visual Basic
Sub ShowCommitErrorsDlg( _
   ByVal hParentWnd As System.Integer _
)
C#
void ShowCommitErrorsDlg(
   System.int hParentWnd
)
C++/CLI
void ShowCommitErrorsDlg(
&   System.int hParentWnd
)

Parameters

hParentWnd
Parent window handle for the dialog box

Example

See the IEdmBatchDelete examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NOT_INITIALIZED: IEdmBatchDelete::CommitDelete has not been called.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


IEdmBatchDelete2 Interface

IEdmBatchDelete2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchDelete2 Interface

Allows you to delete several files and folders from the vault at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchDelete2
   Inherits IEdmBatchDelete
C#
public interface IEdmBatchDelete2 : IEdmBatchDelete
C++/CLI
public interface class IEdmBatchDelete2 : public IEdmBatchDelete

Remarks

This interface:

  • extends IEdmBatchDelete by providing the option to show deleted objects in the trash can in IEdmBatchDelete2::ShowWarningDlg2.
  • is extended by IEdmBatchDelete3.

See Also

IEdmBatchDelete2 Members
EPDM.Interop.epdm Namespace


IEdmBatchDelete2 Interface Members

IEdmBatchDelete2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchDelete2 Interface

The following tables list the members exposed by IEdmBatchDelete2.

Public Methods

 | Name | Description
Method | ShowWarningDlg2 | Shows a dialog box with the warnings and errors that occurred during IEdmBatchDelete::ComputePermissions.
Top

See Also

IEdmBatchDelete2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchDelete2 Interface Methods

IEdmBatchDelete2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchDelete2 Interface

For a list of all members of this type, see IEdmBatchDelete2 members.

Public Methods

 | Name | Description
Method | ShowWarningDlg2 | Shows a dialog box with the warnings and errors that occurred during IEdmBatchDelete::ComputePermissions.
Top

See Also

IEdmBatchDelete2 Interface
EPDM.Interop.epdm Namespace


ShowWarningDlg2 Method (IEdmBatchDelete2)

ShowWarningDlg2 Method (IEdmBatchDelete2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete2 Interface : ShowWarningDlg2 Method (IEdmBatchDelete2)

hParentWnd
Parent window handle for the dialog box
bIncludeDeleted
True to show the contents of the trash can, false to not
Shows a dialog box with the warnings and errors that occurred during IEdmBatchDelete::ComputePermissions.

Syntax

Visual Basic
Function ShowWarningDlg2( _
   ByVal hParentWnd As System.Integer, _
   ByVal bIncludeDeleted As System.Boolean _
) As System.Boolean
C#
System.bool ShowWarningDlg2(
   System.int hParentWnd,
   System.bool bIncludeDeleted
)
C++/CLI
System.bool ShowWarningDlg2(
&   System.int hParentWnd,
&   System.bool bIncludeDeleted
)

Parameters

hParentWnd
Parent window handle for the dialog box
bIncludeDeleted
True to show the contents of the trash can, false to not

Return Value

True if the user chooses to continue the operation in spite of the warnings, false if the user cancels the operation

Example

See the IEdmBatchDelete examples.

Remarks

This method supersedes IEdmBatchDelete.ShowWarningDlg by adding the option to show the deleted objects in the trash can.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NOT_INITIALIZED: IEdmBatchDelete::ComputePermissions has not been called.

See Also

IEdmBatchDelete2 Interface
IEdmBatchDelete2 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBatchDelete3 Interface

IEdmBatchDelete3 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchDelete3 Interface

Allows you to delete several files and folders from the vault all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchDelete3
   Inherits IEdmBatchDelete, IEdmBatchDelete2
C#
public interface IEdmBatchDelete3 : IEdmBatchDelete, IEdmBatchDelete2
C++/CLI
public interface class IEdmBatchDelete3 : public IEdmBatchDelete, IEdmBatchDelete2

Remarks

This interface extends IEdmBatchDelete2 by adding IEdmBatchDelete3::GetCommitErrors which shows the errors that occurred during IEdmBatchDelete::CommitDelete.

See Also

IEdmBatchDelete3 Members
EPDM.Interop.epdm Namespace


IEdmBatchDelete3 Interface Members

IEdmBatchDelete3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchDelete3 Interface

The following tables list the members exposed by IEdmBatchDelete3.

Public Methods

 | Name | Description
Method | GetCommitErrors | Shows the errors that occurred during IEdmBatchDelete::CommitDelete.
Top

See Also

IEdmBatchDelete3 Interface
EPDM.Interop.epdm Namespace


IEdmBatchDelete3 Interface Methods

IEdmBatchDelete3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchDelete3 Interface

For a list of all members of this type, see IEdmBatchDelete3 members.

Public Methods

 | Name | Description
Method | GetCommitErrors | Shows the errors that occurred during IEdmBatchDelete::CommitDelete.
Top

See Also

IEdmBatchDelete3 Interface
EPDM.Interop.epdm Namespace


GetCommitErrors Method (IEdmBatchDelete3)

GetCommitErrors Method (IEdmBatchDelete3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete3 Interface : GetCommitErrors Method (IEdmBatchDelete3)

ppoDelErrors
Array of EdmBatchDelErrInfo structures; one for each error that occurred during IEdmBatchDelete::CommitDelete
Shows the errors that occurred during IEdmBatchDelete::CommitDelete.

Syntax

Visual Basic
Sub GetCommitErrors( _
   ByRef ppoDelErrors() As EdmBatchDelErrInfo _
)
C#
void GetCommitErrors(
   out EdmBatchDelErrInfo[] ppoDelErrors
)
C++/CLI
void GetCommitErrors(
&   [Out] array<EdmBatchDelErrInfo>^ ppoDelErrors
)

Parameters

ppoDelErrors
Array of EdmBatchDelErrInfo structures; one for each error that occurred during IEdmBatchDelete::CommitDelete

Example

See the IEdmBatchDelete examples.

Remarks

Call this method after calling IEdmBatchDelete::CommitDelete.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NOT_INITIALIZED: IEdmBatchDelete::CommitDelete has not been called.

See Also

IEdmBatchDelete3 Interface
IEdmBatchDelete3 Members

Availability

SOLIDWORKS PDM Professional 2012


IEdmBatchGet Interface

IEdmBatchGet Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchGet Interface

Allows you to get several files from the vault all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchGet
C#
public interface IEdmBatchGet
C++/CLI
public interface class IEdmBatchGet

Example

Batch Check Out Files (VB.NET)
Batch Check Out Files (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To get several files at once:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing EdmUtility.EdmUtil_BatchGet as a parameter.
  2. Call IEdmBatchGet::AddSelection or IEdmBatchGet::AddSelectionEx at least once.
  3. Call IEdmBatchGet::CreateTree to compute the file reference tree and specify get and check-out options.
  4. Optionally call IEdmBatchGet::ShowDlg to display the Get or Check Out dialog box.
  5. Call IEdmBatchGet::GetFiles to get the files.

Using this interface is more efficient than calling IEdmFile5::GetFileCopy and IEdmFile5::LockFile for each file that you want to check out.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchGet Members
EPDM.Interop.epdm Namespace


IEdmBatchGet Interface Members

IEdmBatchGet Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmBatchGet Interface

The following tables list the members exposed by IEdmBatchGet.

Public Properties

 | Name | Description
Property | FileCount | Gets the number of files in this batch.
Top

Public Methods

 | Name | Description
Method | AddSelection | Adds one or more files or folders to the batch of files or folders to get.
Method | AddSelectionEx | Adds a file with the specified ID and version to the batch of files to get.
Method | CreateTree | Computes the file reference tree with the files added to the batch using IEdmBatchGet::AddSelection or IEdmBatchGet::AddSelectionEx.
Method | GetFileList | Gets a list of the files in this batch.
Method | GetFiles | Gets the files in the batch.
Method | ShowDlg | Displays a dialog in which are listed the files to get or check out.
Top

See Also

IEdmBatchGet Interface
EPDM.Interop.epdm Namespace


IEdmBatchGet Interface Methods

IEdmBatchGet Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchGet Interface

For a list of all members of this type, see IEdmBatchGet members.

Public Methods

 | Name | Description
Method | AddSelection | Adds one or more files or folders to the batch of files or folders to get.
Method | AddSelectionEx | Adds a file with the specified ID and version to the batch of files to get.
Method | CreateTree | Computes the file reference tree with the files added to the batch using IEdmBatchGet::AddSelection or IEdmBatchGet::AddSelectionEx.
Method | GetFileList | Gets a list of the files in this batch.
Method | GetFiles | Gets the files in the batch.
Method | ShowDlg | Displays a dialog in which are listed the files to get or check out.
Top

See Also

IEdmBatchGet Interface
EPDM.Interop.epdm Namespace


AddSelection Method (IEdmBatchGet)

AddSelection Method (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : AddSelection Method (IEdmBatchGet)

poVault
IEdmVault5; vault from which to get the files or folders
ppoSelection
Array of EdmSelItem structures; one structure for each file or folder
Adds one or more files or folders to the batch of files or folders to get.

Syntax

Visual Basic
Sub AddSelection( _
   ByVal poVault As EdmVault5, _
   ByRef ppoSelection() As EdmSelItem _
)
C#
void AddSelection(
   EdmVault5 poVault,
   ref EdmSelItem[] ppoSelection
)
C++/CLI
void AddSelection(
&   EdmVault5^ poVault,
&   array<EdmSelItem>^% ppoSelection
)

Parameters

poVault
IEdmVault5; vault from which to get the files or folders
ppoSelection
Array of EdmSelItem structures; one structure for each file or folder

Example

See the IEdmBatchGet examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


AddSelectionEx Method (IEdmBatchGet)

AddSelectionEx Method (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : AddSelectionEx Method (IEdmBatchGet)

poVault
IEdmVault5; vault from which to get the file
lFileID
ID of file to get
lParentFolderID
ID of the file's parent folder
oVersionOrFileDate
Number or modified date of the version of the file to get
Adds a file with the specified ID and version to the batch of files to get.

Syntax

Visual Basic
Sub AddSelectionEx( _
   ByVal poVault As EdmVault5, _
   ByVal lFileID As System.Integer, _
   ByVal lParentFolderID As System.Integer, _
   ByVal oVersionOrFileDate As System.Object _
)
C#
void AddSelectionEx(
   EdmVault5 poVault,
   System.int lFileID,
   System.int lParentFolderID,
   System.object oVersionOrFileDate
)
C++/CLI
void AddSelectionEx(
&   EdmVault5^ poVault,
&   System.int lFileID,
&   System.int lParentFolderID,
&   System.Object^ oVersionOrFileDate
)

Parameters

poVault
IEdmVault5; vault from which to get the file
lFileID
ID of file to get
lParentFolderID
ID of the file's parent folder
oVersionOrFileDate
Number or modified date of the version of the file to get

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


CreateTree Method (IEdmBatchGet)

CreateTree Method (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : CreateTree Method (IEdmBatchGet)

lParentWnd
Parent window handle
lEdmGetCmdFlags
Combination of EdmGetCmdFlags bits; specifies options for retrieving files from the vault
Computes the file reference tree with the files added to the batch using IEdmBatchGet::AddSelection or IEdmBatchGet::AddSelectionEx.

Syntax

Visual Basic
Sub CreateTree( _
   ByVal lParentWnd As System.Integer, _
   ByVal lEdmGetCmdFlags As System.Integer _
)
C#
void CreateTree(
   System.int lParentWnd,
   System.int lEdmGetCmdFlags
)
C++/CLI
void CreateTree(
&   System.int lParentWnd,
&   System.int lEdmGetCmdFlags
)

Parameters

lParentWnd
Parent window handle
lEdmGetCmdFlags
Combination of EdmGetCmdFlags bits; specifies options for retrieving files from the vault

Example

See the IEdmBatchGet examples.

Remarks

After calling this method, call IEdmBatchGet::ShowDlg and IEdmBatchGet::GetFiles.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


GetFileList Method (IEdmBatchGet)

GetFileList Method (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : GetFileList Method (IEdmBatchGet)

lEdmGetFileListFlags
Combination of EdmGetFileListFlag bits
Gets a list of the files in this batch.

Syntax

Visual Basic
Function GetFileList( _
   ByVal lEdmGetFileListFlags As System.Integer _
) As EdmSelectionList5
C#
EdmSelectionList5 GetFileList(
   System.int lEdmGetFileListFlags
)
C++/CLI
EdmSelectionList5^ GetFileList(
&   System.int lEdmGetFileListFlags
)

Parameters

lEdmGetFileListFlags
Combination of EdmGetFileListFlag bits

Return Value

IEdmSelectionList5; list of files in this batch

Example

See the IEdmBatchGet examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


GetFiles Method (IEdmBatchGet)

GetFiles Method (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : GetFiles Method (IEdmBatchGet)

lParentWnd
Parent window handle
poCallback
Optional pointer to a class that implements IEdmGetOpCallback, IEdmGetOpCallback2, or IEdmGetOpCallback3 to control and monitor the operation
Gets the files in the batch.

Syntax

Visual Basic
Sub GetFiles( _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal poCallback As IEdmGetOpCallback _
)
C#
void GetFiles(
   System.int lParentWnd,
   IEdmGetOpCallback poCallback
)
C++/CLI
void GetFiles(
&   System.int lParentWnd,
&   IEdmGetOpCallback^ poCallback
)

Parameters

lParentWnd
Parent window handle
poCallback
Optional pointer to a class that implements IEdmGetOpCallback, IEdmGetOpCallback2, or IEdmGetOpCallback3 to control and monitor the operation

Example

See the IEdmBatchGet examples.

Remarks

Call this method after calling IEdmBatchGet::CreateTree and, optionally, IEdmBatchGet::ShowDlg.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


ShowDlg Method (IEdmBatchGet)

ShowDlg Method (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : ShowDlg Method (IEdmBatchGet)

lParentWnd
Parent window handle
Displays a dialog in which are listed the files to get or check out.

Syntax

Visual Basic
Function ShowDlg( _
   ByVal lParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowDlg(
   System.int lParentWnd
)
C++/CLI
System.bool ShowDlg(
&   System.int lParentWnd
)

Parameters

lParentWnd
Parent window handle

Return Value

True if the user clicked Get or Check Out, false if the user clicked Cancel

Example

See the IEdmBatchGet examples.

Remarks

Call this method after calling IEdmBatchGet::CreateTree and before calling IEdmBatchGet::GetFiles.

Return code:

  • S_OK: The method successfully executed.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


IEdmBatchGet Interface Properties

IEdmBatchGet Interface Properties
EPDM.Interop.epdm Namespace : IEdmBatchGet Interface

For a list of all members of this type, see IEdmBatchGet members.

Public Properties

 | Name | Description
Property | FileCount | Gets the number of files in this batch.
Top

See Also

IEdmBatchGet Interface
EPDM.Interop.epdm Namespace


FileCount Property (IEdmBatchGet)

FileCount Property (IEdmBatchGet)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchGet Interface : FileCount Property (IEdmBatchGet)

Gets the number of files in this batch.

Syntax

Visual Basic
ReadOnly Property FileCount As System.Integer
C#
System.int FileCount {get;}
C++/CLI
property System.int FileCount {
   System.int get();
}

Property Value

Number of files in this batch

Example

See the IEdmBatchGet examples.

Remarks

This property is valid only after IEdmBatchGet::CreateTree is called.

See Also

IEdmBatchGet Interface
IEdmBatchGet Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


IEdmBatchItemGeneration Interface

IEdmBatchItemGeneration Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration Interface

Allows you to generate items from a file structure.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchItemGeneration
C#
public interface IEdmBatchItemGeneration
C++/CLI
public interface class IEdmBatchItemGeneration

Example

See the IEdmBatchItemGeneration2 examples.

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBatchItemGeneration2 which allows you to generate stand-alone items without a file structure.

To create several items from files at once:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing EdmUtility.EdmUtil_BatchItemGeneration as a parameter.
  2. Call IEdmBatchItemGeneration::AddSelection one or more times.
  3. Call IEdmBatchItemGeneration::CreateTree to compute the file reference tree.
  4. Optionally call IEdmBatchItemGeneration::ShowDlg to show an item dialog.
  5. Call IEdmBatchItemGeneration::GenerateItems to create the items.

See the Programming Items topic for more information.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchItemGeneration Members
EPDM.Interop.epdm Namespace


IEdmBatchItemGeneration Interface Members

IEdmBatchItemGeneration Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration Interface

The following tables list the members exposed by IEdmBatchItemGeneration.

Public Properties

 | Name | Description
Property | DestFolderID | Gets or sets the ID of the item folder where new items are placed.
Top

Public Methods

 | Name | Description
Method | AddSelection | Obsolete. Superseded by IEdmBatchItemGeneration2::AddSelection2 .
Method | CreateTree | Computes the file reference tree for the items added to the batch using IEdmBatchItemGeneration::AddSelection.
Method | GenerateItems | Creates the items added to the batch by IEdmBatchItemGeneration::AddSelection.
Method | ShowDlg | Shows the item creation dialog box.
Top

See Also

IEdmBatchItemGeneration Interface
EPDM.Interop.epdm Namespace


IEdmBatchItemGeneration Interface Methods

IEdmBatchItemGeneration Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration Interface

For a list of all members of this type, see IEdmBatchItemGeneration members.

Public Methods

 | Name | Description
Method | AddSelection | Obsolete. Superseded by IEdmBatchItemGeneration2::AddSelection2 .
Method | CreateTree | Computes the file reference tree for the items added to the batch using IEdmBatchItemGeneration::AddSelection.
Method | GenerateItems | Creates the items added to the batch by IEdmBatchItemGeneration::AddSelection.
Method | ShowDlg | Shows the item creation dialog box.
Top

See Also

IEdmBatchItemGeneration Interface
EPDM.Interop.epdm Namespace


CreateTree Method (IEdmBatchItemGeneration)

CreateTree Method (IEdmBatchItemGeneration)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemGeneration Interface : CreateTree Method (IEdmBatchItemGeneration)

lParentWnd
Parent window handle
lEdmItemGenerationCmdFlags
Combination of EdmItemGenerationFlags bits
Computes the file reference tree for the items added to the batch using IEdmBatchItemGeneration::AddSelection.

Syntax

Visual Basic
Function CreateTree( _
   ByVal lParentWnd As System.Integer, _
   ByVal lEdmItemGenerationCmdFlags As System.Integer _
) As System.Boolean
C#
System.bool CreateTree(
   System.int lParentWnd,
   System.int lEdmItemGenerationCmdFlags
)
C++/CLI
System.bool CreateTree(
&   System.int lParentWnd,
&   System.int lEdmItemGenerationCmdFlags
)

Parameters

lParentWnd
Parent window handle
lEdmItemGenerationCmdFlags
Combination of EdmItemGenerationFlags bits

Return Value

True if there is at least one item to create; false if there are none

Example

Add Items (C#)
Add Items (VB.NET)

Remarks

After calling this method, call IEdmBatchItemGeneration::GenerateItems and, optionally, IEdmBatchItemGeneration::ShowDlg.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchItemGeneration Interface
IEdmBatchItemGeneration Members

Availability

SOLIDWORKS PDM Professional 2010


GenerateItems Method (IEdmBatchItemGeneration)

GenerateItems Method (IEdmBatchItemGeneration)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemGeneration Interface : GenerateItems Method (IEdmBatchItemGeneration)

lParentWnd
Parent window handle
ppoRetItems
Array of EdmGenItemInfo structures, one structure for each new item
pbOpen

True, if the following occurred:

  • EdmItemGenerationFlags.Eigcf_OpenItemsCheckbox was set in IEdmBatchItemGeneration::CreateTree.
  • The user selected the checkbox to open items after creation in the dialog box displayed by IEdmBatchItemGeneration::ShowDlg.

False, if not

poCallback
Null; reserved for future use
Creates the items added to the batch by IEdmBatchItemGeneration::AddSelection.

Syntax

Visual Basic
Sub GenerateItems( _
   ByVal lParentWnd As System.Integer, _
   ByRef ppoRetItems() As EdmGenItemInfo, _
   ByRef pbOpen As System.Boolean, _
   Optional ByVal poCallback As System.Object _
)
C#
void GenerateItems(
   System.int lParentWnd,
   out EdmGenItemInfo[] ppoRetItems,
   out System.bool pbOpen,
   System.object poCallback
)
C++/CLI
void GenerateItems(
&   System.int lParentWnd,
&   [Out] array<EdmGenItemInfo>^ ppoRetItems,
&   [Out] System.bool pbOpen,
&   System.Object^ poCallback
)

Parameters

lParentWnd
Parent window handle
ppoRetItems
Array of EdmGenItemInfo structures, one structure for each new item
pbOpen

True, if the following occurred:

  • EdmItemGenerationFlags.Eigcf_OpenItemsCheckbox was set in IEdmBatchItemGeneration::CreateTree.
  • The user selected the checkbox to open items after creation in the dialog box displayed by IEdmBatchItemGeneration::ShowDlg.

False, if not

poCallback
Null; reserved for future use

Example

Add Items (C#)
Add Items (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchItemGeneration Interface
IEdmBatchItemGeneration Members

Availability

SOLIDWORKS PDM Professional 2010


ShowDlg Method (IEdmBatchItemGeneration)

ShowDlg Method (IEdmBatchItemGeneration)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemGeneration Interface : ShowDlg Method (IEdmBatchItemGeneration)

lParentWnd
Parent window handle
Shows the item creation dialog box.

Syntax

Visual Basic
Function ShowDlg( _
   ByVal lParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowDlg(
   System.int lParentWnd
)
C++/CLI
System.bool ShowDlg(
&   System.int lParentWnd
)

Parameters

lParentWnd
Parent window handle

Return Value

True if the user clicked OK, false if the user clicked Cancel

Example

See the example in the IEdmBatchItemGeneration topic.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchItemGeneration Interface
IEdmBatchItemGeneration Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmBatchItemGeneration Interface Properties

IEdmBatchItemGeneration Interface Properties
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration Interface

For a list of all members of this type, see IEdmBatchItemGeneration members.

Public Properties

 | Name | Description
Property | DestFolderID | Gets or sets the ID of the item folder where new items are placed.
Top

See Also

IEdmBatchItemGeneration Interface
EPDM.Interop.epdm Namespace


DestFolderID Property (IEdmBatchItemGeneration)

DestFolderID Property (IEdmBatchItemGeneration)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemGeneration Interface : DestFolderID Property (IEdmBatchItemGeneration)

Gets or sets the ID of the item folder where new items are placed.

Syntax

Visual Basic
Property DestFolderID As System.Integer
C#
System.int DestFolderID {get; set;}
C++/CLI
property System.int DestFolderID {
   System.int get();
   void set ( &   System.int value);
}

Property Value

ID of the item folder; by default, the item root folder

See Also

IEdmBatchItemGeneration Interface
IEdmBatchItemGeneration Members

Availability

SOLIDWORKS PDM Professional 2009 Service Pack 2


IEdmBatchItemGeneration2 Interface

IEdmBatchItemGeneration2 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration2 Interface

Allows you to generate several items from file structures all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchItemGeneration2
   Inherits IEdmBatchItemGeneration
C#
public interface IEdmBatchItemGeneration2 : IEdmBatchItemGeneration
C++/CLI
public interface class IEdmBatchItemGeneration2 : public IEdmBatchItemGeneration

Example

Add Items (C#)
Add Items (VB.NET)

Remarks

This interface extends IEdmBatchItemGeneration.

See the Programming Items topic for more information.

See Also

IEdmBatchItemGeneration2 Members
EPDM.Interop.epdm Namespace


IEdmBatchItemGeneration2 Interface Members

IEdmBatchItemGeneration2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration2 Interface

The following tables list the members exposed by IEdmBatchItemGeneration2.

Public Methods

 | Name | Description
Method | AddSelection2 | Adds information to the batch to generate a new item either from a file or stand-alone without a source file.
Top

See Also

IEdmBatchItemGeneration2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchItemGeneration2 Interface Methods

IEdmBatchItemGeneration2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchItemGeneration2 Interface

For a list of all members of this type, see IEdmBatchItemGeneration2 members.

Public Methods

 | Name | Description
Method | AddSelection2 | Adds information to the batch to generate a new item either from a file or stand-alone without a source file.
Top

See Also

IEdmBatchItemGeneration2 Interface
EPDM.Interop.epdm Namespace


AddSelection2 Method (IEdmBatchItemGeneration2)

AddSelection2 Method (IEdmBatchItemGeneration2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemGeneration2 Interface : AddSelection2 Method (IEdmBatchItemGeneration2)

poVault
IEdmVault5; vault in which to create the new item
poVariables
Optional array of EdmVarVal structures; variables to write to the item
bsItemName
Name of new item; if left blank, the serial number generator assigns the name
lDestFolderID
ID of the folder in which to place the new item; if left blank, the new item is placed in the item root folder
lSrcFileID
ID of the file from which to create the item; if 0 or blank, no link is created
lSrcFileProjID
ID of the parent folder of lSrcFileID; only valid if lSrcFileID is not 0 or blank
bsSrcFileConfig
Name of the configuration in the source file to which to link the new item
lEdmRefFlags
Combination of EdmRefFlags bits
Adds information to the batch to generate a new item either from a file or stand-alone without a source file.

Syntax

Visual Basic
Sub AddSelection2( _
   ByVal poVault As EdmVault5, _
   ByVal poVariables() As EdmVarVal, _
   Optional ByVal bsItemName As System.String, _
   Optional ByVal lDestFolderID As System.Integer, _
   Optional ByVal lSrcFileID As System.Integer, _
   Optional ByVal lSrcFileProjID As System.Integer, _
   Optional ByVal bsSrcFileConfig As System.String, _
   Optional ByVal lEdmRefFlags As System.Integer _
)
C#
void AddSelection2(
   EdmVault5 poVault,
   EdmVarVal[] poVariables,
   System.string bsItemName,
   System.int lDestFolderID,
   System.int lSrcFileID,
   System.int lSrcFileProjID,
   System.string bsSrcFileConfig,
   System.int lEdmRefFlags
)
C++/CLI
void AddSelection2(
&   EdmVault5^ poVault,
&   array<EdmVarVal>^ poVariables,
&   System.String^ bsItemName,
&   System.int lDestFolderID,
&   System.int lSrcFileID,
&   System.int lSrcFileProjID,
&   System.String^ bsSrcFileConfig,
&   System.int lEdmRefFlags
)

Parameters

poVault
IEdmVault5; vault in which to create the new item
poVariables
Optional array of EdmVarVal structures; variables to write to the item
bsItemName
Name of new item; if left blank, the serial number generator assigns the name
lDestFolderID
ID of the folder in which to place the new item; if left blank, the new item is placed in the item root folder
lSrcFileID
ID of the file from which to create the item; if 0 or blank, no link is created
lSrcFileProjID
ID of the parent folder of lSrcFileID; only valid if lSrcFileID is not 0 or blank
bsSrcFileConfig
Name of the configuration in the source file to which to link the new item
lEdmRefFlags
Combination of EdmRefFlags bits

Example

Add Items (C#)
Add Items (VB.NET)

Remarks

This method supersedes IEdmBatchItemGeneration::AddSelection by adding the ability to create stand-alone items without a source file.

To create a stand-alone item, you must call this method specifying poVault at a minimum. You can optionally specify poVariables and bsItemName to create a stand-alone item. The other parameters are only used to create new items from files.

After calling this method, call IEdmBatchItemGeneration::CreateTree.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchItemGeneration2 Interface
IEdmBatchItemGeneration2 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmBatchItemReferenceUpdate Interface

IEdmBatchItemReferenceUpdate Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchItemReferenceUpdate Interface

Allows you to add or remove several item references all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchItemReferenceUpdate
C#
public interface IEdmBatchItemReferenceUpdate
C++/CLI
public interface class IEdmBatchItemReferenceUpdate

Example

Batch Add Item References (VB.NET)
Batch Add Item References (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

See the Programming Items topic for more information.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchItemReferenceUpdate Members
EPDM.Interop.epdm Namespace


IEdmBatchItemReferenceUpdate Interface Members

IEdmBatchItemReferenceUpdate Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchItemReferenceUpdate Interface

The following tables list the members exposed by IEdmBatchItemReferenceUpdate.

Public Methods

 | Name | Description
Method | UpdateReferences | Adds or removes item references.
Top

See Also

IEdmBatchItemReferenceUpdate Interface
EPDM.Interop.epdm Namespace


IEdmBatchItemReferenceUpdate Interface Methods

IEdmBatchItemReferenceUpdate Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchItemReferenceUpdate Interface

For a list of all members of this type, see IEdmBatchItemReferenceUpdate members.

Public Methods

 | Name | Description
Method | UpdateReferences | Adds or removes item references.
Top

See Also

IEdmBatchItemReferenceUpdate Interface
EPDM.Interop.epdm Namespace


UpdateReferences Method (IEdmBatchItemReferenceUpdate)

UpdateReferences Method (IEdmBatchItemReferenceUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemReferenceUpdate Interface : UpdateReferences Method (IEdmBatchItemReferenceUpdate)

ppoAddReferences
Array of EdmItemRef structures; item references to add
ppoRemoveReferences
Array of EdmItemRef structures; item references to remove
Adds or removes item references.

Syntax

Visual Basic
Sub UpdateReferences( _
   ByRef ppoAddReferences() As EdmItemRef, _
   ByRef ppoRemoveReferences() As EdmItemRef _
)
C#
void UpdateReferences(
   out EdmItemRef[] ppoAddReferences,
   out EdmItemRef[] ppoRemoveReferences
)
C++/CLI
void UpdateReferences(
&   [Out] array<EdmItemRef>^ ppoAddReferences,
&   [Out] array<EdmItemRef>^ ppoRemoveReferences
)

Parameters

ppoAddReferences
Array of EdmItemRef structures; item references to add
ppoRemoveReferences
Array of EdmItemRef structures; item references to remove

Example

See the IEdmBatchItemReferenceUpdate examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchItemReferenceUpdate Interface
IEdmBatchItemReferenceUpdate Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmBatchListing Interface

IEdmBatchListing Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchListing Interface

Allows you to create a listing of various file or folder properties.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchListing
C#
public interface IEdmBatchListing
C++/CLI
public interface class IEdmBatchListing

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBatchListing2.

To create a listing of the properties of a batched set of files or folders:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing in EdmUtility.EdmUtil_BatchList as a parameter.
  2. Call IEdmBatchListing::AddFile once for each file whose properties you want to list.
  3. Call IEdmBatchListing::AddFolder once for each folder whose properties you want to list.
  4. Optionally call IEdmBatchListing::GetColumnSetNames to get the column sets that can be used to create listings with this interface.
  5. Call IEdmBatchListing::CreateList to create the listing.
  6. Call IEdmBatchListing::GetFiles to get the files in the listing or IEdmBatchListing::GetFolders to get the folders in the listing.

Using this interface to create a listing of file or folder properties is more efficient than retrieving the interfaces and properties of the files and folders individually.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchListing Members
EPDM.Interop.epdm Namespace


IEdmBatchListing Interface Members

IEdmBatchListing Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing Interface

The following tables list the members exposed by IEdmBatchListing.

Public Methods

 | Name | Description
Method | AddFile | Adds a file to the batch of files for which to create a listing.
Method | AddFolder | Adds a folder to the batch of folders for which to create a listing.
Method | CreateList | Obsolete. Superseded by IEdmBatchListing2::CreateListEx .
Method | GetColumnSetNames | Gets the names of the column sets that can be used to create listings with this interface.
Method | GetFiles | Obsolete. Superseded by IEdmBatchListing4::GetFiles2.
Method | GetFolders | Gets all the folders in this listing.
Top

See Also

IEdmBatchListing Interface
EPDM.Interop.epdm Namespace


IEdmBatchListing Interface Methods

IEdmBatchListing Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing Interface

For a list of all members of this type, see IEdmBatchListing members.

Public Methods

 | Name | Description
Method | AddFile | Adds a file to the batch of files for which to create a listing.
Method | AddFolder | Adds a folder to the batch of folders for which to create a listing.
Method | CreateList | Obsolete. Superseded by IEdmBatchListing2::CreateListEx .
Method | GetColumnSetNames | Gets the names of the column sets that can be used to create listings with this interface.
Method | GetFiles | Obsolete. Superseded by IEdmBatchListing4::GetFiles2.
Method | GetFolders | Gets all the folders in this listing.
Top

See Also

IEdmBatchListing Interface
EPDM.Interop.epdm Namespace


AddFile Method (IEdmBatchListing)

AddFile Method (IEdmBatchListing)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing Interface : AddFile Method (IEdmBatchListing)

oIdOrPath
ID or path of the file to add
oFileDate
Local file date
lParam
Caller-defined argument
lEdmListFileFlags
Reserved; must be 0
Adds a file to the batch of files for which to create a listing.

Syntax

Visual Basic
Sub AddFile( _
   ByVal oIdOrPath As System.Object, _
   ByVal oFileDate As System.Date, _
   ByVal lParam As System.Integer, _
   Optional ByVal lEdmListFileFlags As System.Integer _
)
C#
void AddFile(
   System.object oIdOrPath,
   System.DateTime oFileDate,
   System.int lParam,
   System.int lEdmListFileFlags
)
C++/CLI
void AddFile(
&   System.Object^ oIdOrPath,
&   System.DateTime oFileDate,
&   System.int lParam,
&   System.int lEdmListFileFlags
)

Parameters

oIdOrPath
ID or path of the file to add
oFileDate
Local file date
lParam
Caller-defined argument
lEdmListFileFlags
Reserved; must be 0

Remarks

After calling this method for each file whose properties you want to list, call IEdmBatchListing::CreateList to create a listing for all the files.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing Interface
IEdmBatchListing Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


AddFolder Method (IEdmBatchListing)

AddFolder Method (IEdmBatchListing)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing Interface : AddFolder Method (IEdmBatchListing)

oIdOrPath
ID of folder to add; path is not supported in SOLIDWORKS PDM 2010
lParam
Caller-defined argument
lEdmListFolderFlags
Only EdmListFiolderFlags.EdmListFolder_Recursive is supported
Adds a folder to the batch of folders for which to create a listing.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal oIdOrPath As System.Object, _
   ByVal lParam As System.Integer, _
   Optional ByVal lEdmListFolderFlags As System.Integer _
)
C#
void AddFolder(
   System.object oIdOrPath,
   System.int lParam,
   System.int lEdmListFolderFlags
)
C++/CLI
void AddFolder(
&   System.Object^ oIdOrPath,
&   System.int lParam,
&   System.int lEdmListFolderFlags
)

Parameters

oIdOrPath
ID of folder to add; path is not supported in SOLIDWORKS PDM 2010
lParam
Caller-defined argument
lEdmListFolderFlags
Only EdmListFiolderFlags.EdmListFolder_Recursive is supported

Remarks

After calling this method for each folder whose properties you want to list, call IEdmBatchListing::CreateList to create a listing of all the folders' properties.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing Interface
IEdmBatchListing Members

Availability

SOLIDWORKS PDM 2010


CreateList Method (IEdmBatchListing)

CreateList Method (IEdmBatchListing)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing Interface : CreateList Method (IEdmBatchListing)

bsColumnSetName
Empty string, column set name returned by IEdmBatchListing::GetColumnSetNames, or a list of variable names separated by a newline character and starting with a newline character (e.g., "\nAuthor\nProject\nDate")
ppoColumns
Array of EdmListCol structures; one structure for each column in the column set; empty array if bsColumnSetName is an empty string
Obsolete. Superseded by IEdmBatchListing2::CreateListEx .

Syntax

Visual Basic
Sub CreateList( _
   ByVal bsColumnSetName As System.String, _
   ByRef ppoColumns() As EdmListCol _
)
C#
void CreateList(
   System.string bsColumnSetName,
   out EdmListCol[] ppoColumns
)
C++/CLI
void CreateList(
&   System.String^ bsColumnSetName,
&   [Out] array<EdmListCol>^ ppoColumns
)

Parameters

bsColumnSetName
Empty string, column set name returned by IEdmBatchListing::GetColumnSetNames, or a list of variable names separated by a newline character and starting with a newline character (e.g., "\nAuthor\nProject\nDate")
ppoColumns
Array of EdmListCol structures; one structure for each column in the column set; empty array if bsColumnSetName is an empty string

Remarks

After calling this method, call IEdmBatchListing::GetFiles and IEdmBatchListing::GetFolders.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing Interface
IEdmBatchListing Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


GetColumnSetNames Method (IEdmBatchListing)

GetColumnSetNames Method (IEdmBatchListing)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing Interface : GetColumnSetNames Method (IEdmBatchListing)

Gets the names of the column sets that can be used to create listings with this interface.

Syntax

Visual Basic
Function GetColumnSetNames() As EdmStrLst5
C#
EdmStrLst5 GetColumnSetNames()
C++/CLI
EdmStrLst5^ GetColumnSetNames();

Return Value

IEdmStrLst5; list of column set names that can be used as a parameter in IEdmBatchListing::CreateList

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing Interface
IEdmBatchListing Members

Availability

SOLIDWORKS PDM Professional 2007


GetFiles Method (IEdmBatchListing)

GetFiles Method (IEdmBatchListing)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing Interface : GetFiles Method (IEdmBatchListing)

ppoFiles
Array of EdmListFile structures; one structure for each file in the listing
Obsolete. Superseded by IEdmBatchListing4::GetFiles2.

Syntax

Visual Basic
Sub GetFiles( _
   ByRef ppoFiles() As EdmListFile _
)
C#
void GetFiles(
   out EdmListFile[] ppoFiles
)
C++/CLI
void GetFiles(
&   [Out] array<EdmListFile>^ ppoFiles
)

Parameters

ppoFiles
Array of EdmListFile structures; one structure for each file in the listing

Remarks

Before calling this method, call IEdmBatchListing::CreateList.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing Interface
IEdmBatchListing Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


GetFolders Method (IEdmBatchListing)

GetFolders Method (IEdmBatchListing)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing Interface : GetFolders Method (IEdmBatchListing)

ppoFolders
Array of EdmListFolder structures; one structure for each folder in the listing
Gets all the folders in this listing.

Syntax

Visual Basic
Sub GetFolders( _
   ByRef ppoFolders() As EdmListFolder _
)
C#
void GetFolders(
   out EdmListFolder[] ppoFolders
)
C++/CLI
void GetFolders(
&   [Out] array<EdmListFolder>^ ppoFolders
)

Parameters

ppoFolders
Array of EdmListFolder structures; one structure for each folder in the listing

Remarks

Before calling this method, call IEdmBatchListing::CreateList.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing Interface
IEdmBatchListing Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmBatchListing2 Interface

IEdmBatchListing2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchListing2 Interface

Allows you to create a listing of various file or folder properties and specify from which configuration file the variables should be read.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchListing2
   Inherits IEdmBatchListing
C#
public interface IEdmBatchListing2 : IEdmBatchListing
C++/CLI
public interface class IEdmBatchListing2 : public IEdmBatchListing

Remarks

This interface:

  • extends IEdmBatchListing.
  • is extended by IEdmBatchListing3.

See Also

IEdmBatchListing2 Members
EPDM.Interop.epdm Namespace


IEdmBatchListing2 Interface Members

IEdmBatchListing2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing2 Interface

The following tables list the members exposed by IEdmBatchListing2.

Public Methods

 | Name | Description
Method | AddFileCfg | Adds a file to the batch of files for which to create a listing using variables from the specified configuration.
Method | CreateListEx | Creates a listing of the properties of the files and folders that were added to the batch using IEdmBatchListing::AddFile, IEdmBatchListing::AddFolder, and IEdmBatchListing2::AddFileCfg.
Top

See Also

IEdmBatchListing2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchListing2 Interface Methods

IEdmBatchListing2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing2 Interface

For a list of all members of this type, see IEdmBatchListing2 members.

Public Methods

 | Name | Description
Method | AddFileCfg | Adds a file to the batch of files for which to create a listing using variables from the specified configuration.
Method | CreateListEx | Creates a listing of the properties of the files and folders that were added to the batch using IEdmBatchListing::AddFile, IEdmBatchListing::AddFolder, and IEdmBatchListing2::AddFileCfg.
Top

See Also

IEdmBatchListing2 Interface
EPDM.Interop.epdm Namespace


AddFileCfg Method (IEdmBatchListing2)

AddFileCfg Method (IEdmBatchListing2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing2 Interface : AddFileCfg Method (IEdmBatchListing2)

oIdOrPath
Path of file to add
oFileDate
Local file date
lParam
Caller-defined argument
bsConfigName
Name of the configuration from which to read the file variables; default is an empty string
lEdmListFileFlags
Combination of EdmListFileFlags bits; default is 0
Adds a file to the batch of files for which to create a listing using variables from the specified configuration.

Syntax

Visual Basic
Sub AddFileCfg( _
   ByVal oIdOrPath As System.Object, _
   ByVal oFileDate As System.Date, _
   ByVal lParam As System.Integer, _
   Optional ByVal bsConfigName As System.String, _
   Optional ByVal lEdmListFileFlags As System.Integer _
)
C#
void AddFileCfg(
   System.object oIdOrPath,
   System.DateTime oFileDate,
   System.int lParam,
   System.string bsConfigName,
   System.int lEdmListFileFlags
)
C++/CLI
void AddFileCfg(
&   System.Object^ oIdOrPath,
&   System.DateTime oFileDate,
&   System.int lParam,
&   System.String^ bsConfigName,
&   System.int lEdmListFileFlags
)

Parameters

oIdOrPath
Path of file to add
oFileDate
Local file date
lParam
Caller-defined argument
bsConfigName
Name of the configuration from which to read the file variables; default is an empty string
lEdmListFileFlags
Combination of EdmListFileFlags bits; default is 0

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This method extends IEdmBatchListing::AddFile and IEdmBAtchListing::AddFolder by adding the ability to specify the configuration from which to read the file variables.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing2 Interface
IEdmBatchListing2 Members

Availability

SOLIDWORKS PDM Professional 2009


CreateListEx Method (IEdmBatchListing2)

CreateListEx Method (IEdmBatchListing2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing2 Interface : CreateListEx Method (IEdmBatchListing2)

bsColumnSetName
Empty string, one of the set names returned by IEdmBatchListing::GetColumnSetNames, or a list of variable names separated by newline characters and starting with a newline character (e.g., "\nAuthor\nProject\nDate")
lEdmCreateListExFlags
Combination of EdmCreateListExFlags bits
ppoColumns
Array of EdmListCol structures; one structure for each column in the column set
poAux
Reserved for future use
Creates a listing of the properties of the files and folders that were added to the batch using IEdmBatchListing::AddFile, IEdmBatchListing::AddFolder, and IEdmBatchListing2::AddFileCfg.

Syntax

Visual Basic
Sub CreateListEx( _
   ByVal bsColumnSetName As System.String, _
   ByVal lEdmCreateListExFlags As System.Integer, _
   ByRef ppoColumns() As EdmListCol, _
   Optional ByVal poAux As System.Object _
)
C#
void CreateListEx(
   System.string bsColumnSetName,
   System.int lEdmCreateListExFlags,
   out EdmListCol[] ppoColumns,
   System.object poAux
)
C++/CLI
void CreateListEx(
&   System.String^ bsColumnSetName,
&   System.int lEdmCreateListExFlags,
&   [Out] array<EdmListCol>^ ppoColumns,
&   System.Object^ poAux
)

Parameters

bsColumnSetName
Empty string, one of the set names returned by IEdmBatchListing::GetColumnSetNames, or a list of variable names separated by newline characters and starting with a newline character (e.g., "\nAuthor\nProject\nDate")
lEdmCreateListExFlags
Combination of EdmCreateListExFlags bits
ppoColumns
Array of EdmListCol structures; one structure for each column in the column set
poAux
Reserved for future use

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This method extends IEdmBatchListing::CreateList by adding the ability to configure from where the file variables are read.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing2 Interface
IEdmBatchListing2 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBatchListing3 Interface

IEdmBatchListing3 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchListing3 Interface

Allows you to create a listing of several file, folder, or internal component properties all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchListing3
   Inherits IEdmBatchListing, IEdmBatchListing2
C#
public interface IEdmBatchListing3 : IEdmBatchListing, IEdmBatchListing2
C++/CLI
public interface class IEdmBatchListing3 : public IEdmBatchListing, IEdmBatchListing2

Remarks

This interface:

  • extends IEdmBatchListing2 by adding the ability to add an internal component to the listing and get references.
  • is extended by IEdmBatchListing4, which allows users to find out if files in their local cache are valid or obsolete.

See Also

IEdmBatchListing3 Members
EPDM.Interop.epdm Namespace


IEdmBatchListing3 Interface Members

IEdmBatchListing3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing3 Interface

The following tables list the members exposed by IEdmBatchListing3.

Public Methods

 | Name | Description
Method | AddInternalComponent | Adds the specified internal component to the batch for listing.
Method | GetReferences | Gets a list of referenced files.
Top

See Also

IEdmBatchListing3 Interface
EPDM.Interop.epdm Namespace


IEdmBatchListing3 Interface Methods

IEdmBatchListing3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing3 Interface

For a list of all members of this type, see IEdmBatchListing3 members.

Public Methods

 | Name | Description
Method | AddInternalComponent | Adds the specified internal component to the batch for listing.
Method | GetReferences | Gets a list of referenced files.
Top

See Also

IEdmBatchListing3 Interface
EPDM.Interop.epdm Namespace


AddInternalComponent Method (IEdmBatchListing3)

AddInternalComponent Method (IEdmBatchListing3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing3 Interface : AddInternalComponent Method (IEdmBatchListing3)

oPath
Path of internal component
oID
ID of internal component
oVirtualFileParentPath
Path of parent folder
oFileDate
Date of file
lParam
User-defined argument
bsConfigName
Name of the configuration file from which to read variables
lEdmListFileFlags
Combination of EdmListFileFlags bits
Adds the specified internal component to the batch for listing.

Syntax

Visual Basic
Sub AddInternalComponent( _
   ByVal oPath As System.Object, _
   ByVal oID As System.Object, _
   ByVal oVirtualFileParentPath As System.Object, _
   ByVal oFileDate As System.Date, _
   ByVal lParam As System.Integer, _
   Optional ByVal bsConfigName As System.String, _
   Optional ByVal lEdmListFileFlags As System.Integer _
)
C#
void AddInternalComponent(
   System.object oPath,
   System.object oID,
   System.object oVirtualFileParentPath,
   System.DateTime oFileDate,
   System.int lParam,
   System.string bsConfigName,
   System.int lEdmListFileFlags
)
C++/CLI
void AddInternalComponent(
&   System.Object^ oPath,
&   System.Object^ oID,
&   System.Object^ oVirtualFileParentPath,
&   System.DateTime oFileDate,
&   System.int lParam,
&   System.String^ bsConfigName,
&   System.int lEdmListFileFlags
)

Parameters

oPath
Path of internal component
oID
ID of internal component
oVirtualFileParentPath
Path of parent folder
oFileDate
Date of file
lParam
User-defined argument
bsConfigName
Name of the configuration file from which to read variables
lEdmListFileFlags
Combination of EdmListFileFlags bits

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing3 Interface
IEdmBatchListing3 Members

Availability

SOLIDWORKS PDM Professional 2010


GetReferences Method (IEdmBatchListing3)

GetReferences Method (IEdmBatchListing3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing3 Interface : GetReferences Method (IEdmBatchListing3)

ppoReferences
Array of EdmListRef structures
Gets a list of referenced files.

Syntax

Visual Basic
Sub GetReferences( _
   ByRef ppoReferences() As EdmListRef _
)
C#
void GetReferences(
   out EdmListRef[] ppoReferences
)
C++/CLI
void GetReferences(
&   [Out] array<EdmListRef>^ ppoReferences
)

Parameters

ppoReferences
Array of EdmListRef structures

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing3 Interface
IEdmBatchListing3 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmBatchListing4 Interface

IEdmBatchListing4 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchListing4 Interface

Allows you to create a listing of several file, folder, or internal component properties all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchListing4
   Inherits IEdmBatchListing, IEdmBatchListing2, IEdmBatchListing3
C#
public interface IEdmBatchListing4 : IEdmBatchListing, IEdmBatchListing2, IEdmBatchListing3
C++/CLI
public interface class IEdmBatchListing4 : public IEdmBatchListing, IEdmBatchListing2, IEdmBatchListing3

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This interface extends IEdmBatchListing3 by allowing users to find out if files in their local cache are valid or obsolete.

See Also

IEdmBatchListing4 Members
EPDM.Interop.epdm Namespace


IEdmBatchListing4 Interface Members

IEdmBatchListing4 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing4 Interface

The following tables list the members exposed by IEdmBatchListing4.

Public Methods

 | Name | Description
Method | GetFiles2 | Gets all the files in this listing.
Top

See Also

IEdmBatchListing4 Interface
EPDM.Interop.epdm Namespace


IEdmBatchListing4 Interface Methods

IEdmBatchListing4 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchListing4 Interface

For a list of all members of this type, see IEdmBatchListing4 members.

Public Methods

 | Name | Description
Method | GetFiles2 | Gets all the files in this listing.
Top

See Also

IEdmBatchListing4 Interface
EPDM.Interop.epdm Namespace


GetFiles2 Method (IEdmBatchListing4)

GetFiles2 Method (IEdmBatchListing4)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBatchListing4 Interface : GetFiles2 Method (IEdmBatchListing4)

ppoFiles
Array of EdmListFile2 structures; one structure for each file in the listing
Gets all the files in this listing.

Syntax

Visual Basic
Sub GetFiles2( _
   ByRef ppoFiles() As EdmListFile2 _
)
C#
void GetFiles2(
   out EdmListFile2[] ppoFiles
)
C++/CLI
void GetFiles2(
&   [Out] array<EdmListFile2>^ ppoFiles
)

Parameters

ppoFiles
Array of EdmListFile2 structures; one structure for each file in the listing

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This method does not work with assemblies that contain weldment components or cutlist items.

Before calling this method, call IEdmBatchListing2::CreateListEx.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchListing4 Interface
IEdmBatchListing4 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmBatchRefVars Interface

IEdmBatchRefVars Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchRefVars Interface

Allows you to access several file reference variables all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchRefVars
C#
public interface IEdmBatchRefVars
C++/CLI
public interface class IEdmBatchRefVars

Example

Batch Get and Set Reference Variables (VB.NET)
Batch Get and Set Reference Variables (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Reference variables are used in Bill of Materials columns that are configured to look for reference-specific values. To create a reference variable:

  1. Open the SOLIDWORKS PDM Professional Administration tool.
  2. Log into a vault.
  3. Double-click Bill of Materials > BOM.
  4. Click a column in the Columns list.
  5. Select Look for variable in reference specific values.
  6. Click OK.
  7. In a vault view, check out an assembly.
  8. Click the Bill of Materials tab.
  9. In the column configured to use reference-specific values, type text.
  10. Click Save in the Bill of Materials toolbar.

Each component of the assembly is in a separate reference relationship with the assembly. The BOM column configured to Look for variable in reference specific values contains reference variable values. Use this interface to get and set these reference variable values.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchRefVars Members
EPDM.Interop.epdm Namespace


IEdmBatchRefVars Interface Members

IEdmBatchRefVars Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchRefVars Interface

The following tables list the members exposed by IEdmBatchRefVars.

Public Methods

 | Name | Description
Method | GetAllRefVars | Gets all of the values for the specified reference variables.
Method | GetRefVars | Gets the values of the specified reference variables.
Method | SetRefVars | Sets the values of the specified reference variables.
Top

See Also

IEdmBatchRefVars Interface
EPDM.Interop.epdm Namespace


IEdmBatchRefVars Interface Methods

IEdmBatchRefVars Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchRefVars Interface

For a list of all members of this type, see IEdmBatchRefVars members.

Public Methods

 | Name | Description
Method | GetAllRefVars | Gets all of the values for the specified reference variables.
Method | GetRefVars | Gets the values of the specified reference variables.
Method | SetRefVars | Sets the values of the specified reference variables.
Top

See Also

IEdmBatchRefVars Interface
EPDM.Interop.epdm Namespace


GetAllRefVars Method (IEdmBatchRefVars)

GetAllRefVars Method (IEdmBatchRefVars)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchRefVars Interface : GetAllRefVars Method (IEdmBatchRefVars)

ppoVars
Array of EdmRefVar structures; one structure for each reference variable
lParentFileID
ID of parent file for which to get reference variables
lParentFileVersion
Version number of parent file for which to get reference variables; 0 gets the latest version if the parent file is checked in and the checked-out version if it is checked out
lChildFileID
ID of the referenced child file; 0 gets variables for all child references
bsParentConfig
Configuration of parent file for which to get reference variables; "" gets all configurations
bsChildConfig
Configuration of parent file for which to get reference variables; "" is ignored
Gets all of the values for the specified reference variables.

Syntax

Visual Basic
Sub GetAllRefVars( _
   ByRef ppoVars() As EdmRefVar, _
   ByVal lParentFileID As System.Integer, _
   Optional ByVal lParentFileVersion As System.Integer, _
   Optional ByVal lChildFileID As System.Integer, _
   Optional ByVal bsParentConfig As System.String, _
   Optional ByVal bsChildConfig As System.String _
)
C#
void GetAllRefVars(
   out EdmRefVar[] ppoVars,
   System.int lParentFileID,
   System.int lParentFileVersion,
   System.int lChildFileID,
   System.string bsParentConfig,
   System.string bsChildConfig
)
C++/CLI
void GetAllRefVars(
&   [Out] array<EdmRefVar>^ ppoVars,
&   System.int lParentFileID,
&   System.int lParentFileVersion,
&   System.int lChildFileID,
&   System.String^ bsParentConfig,
&   System.String^ bsChildConfig
)

Parameters

ppoVars
Array of EdmRefVar structures; one structure for each reference variable
lParentFileID
ID of parent file for which to get reference variables
lParentFileVersion
Version number of parent file for which to get reference variables; 0 gets the latest version if the parent file is checked in and the checked-out version if it is checked out
lChildFileID
ID of the referenced child file; 0 gets variables for all child references
bsParentConfig
Configuration of parent file for which to get reference variables; "" gets all configurations
bsChildConfig
Configuration of parent file for which to get reference variables; "" is ignored

Example

See the IEdmBatchRefVars examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchRefVars Interface
IEdmBatchRefVars Members

Availability

SOLIDWORKS PDM Professional 2010


GetRefVars Method (IEdmBatchRefVars)

GetRefVars Method (IEdmBatchRefVars)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchRefVars Interface : GetRefVars Method (IEdmBatchRefVars)

ppoVars
Array of EdmRefVar structures; one structure for each reference variable whose value you want to retrieve
Gets the values of the specified reference variables.

Syntax

Visual Basic
Sub GetRefVars( _
   ByRef ppoVars() As EdmRefVar _
)
C#
void GetRefVars(
   out EdmRefVar[] ppoVars
)
C++/CLI
void GetRefVars(
&   [Out] array<EdmRefVar>^ ppoVars
)

Parameters

ppoVars
Array of EdmRefVar structures; one structure for each reference variable whose value you want to retrieve

Example

See the IEdmBatchRefVars examples.

Remarks

This method updates the moValue and mhResult members of the EdmRefVar structures. mlParentVersion = 0 gets the values from the latest version you have permission to read.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchRefVars Interface
IEdmBatchRefVars Members
IEdmBatchRefVars::SetRefVars Method ()

Availability

SOLIDWORKS PDM Professional 2010


SetRefVars Method (IEdmBatchRefVars)

SetRefVars Method (IEdmBatchRefVars)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchRefVars Interface : SetRefVars Method (IEdmBatchRefVars)

ppoVars
Array of EdmRefVar structures; one structure for each reference variable whose value you want to update
Sets the values of the specified reference variables.

Syntax

Visual Basic
Sub SetRefVars( _
   ByRef ppoVars() As EdmRefVar _
)
C#
void SetRefVars(
   out EdmRefVar[] ppoVars
)
C++/CLI
void SetRefVars(
&   [Out] array<EdmRefVar>^ ppoVars
)

Parameters

ppoVars
Array of EdmRefVar structures; one structure for each reference variable whose value you want to update

Example

See the IEdmBatchRefVars examples.

Remarks

Call IEdmBatchRefVars::GetRefVars and IEdmBatchRefVars::GetAllRefVars to get the variable values.

The parent file must be checked out in order to update reference variables.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchRefVars Interface
IEdmBatchRefVars Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmBatchUnlock Interface

IEdmBatchUnlock Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchUnlock Interface

Allows you to unlock, check in, or undo check-outs of multiple files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchUnlock
C#
public interface IEdmBatchUnlock
C++/CLI
public interface class IEdmBatchUnlock

Example

Batch Check In Files (C#)
Batch Check In Files (VB.NET)
Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBatchUnlock2.

To unlock, check in, or undo the check-outs of multiple files in one batch:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing in EdmUtility.EdmUtil_BatchUnlock.
  2. Call IEdmBatchUnlock::AddSelection to specify the files to unlock.
  3. Call IEdmBatchUnlock::CreateTree to create the file reference tree.
  4. Optionally call IEdmBatchUnlock::ShowDlg to display the SOLIDWORKS PDM Professional Check In or Undo Check Out dialog box.
  5. Call IEdmBatchUnlock::GetFileList to get the files affected by the unlock operation.
  6. Call IEdmBatchUnlock::UnlockFiles to perform the batch unlock operation.

Using this interface to unlock, check in, or undo check-outs is more efficient than calling IEdmFile5::UnlockFile or IEdmFile5::UndoLockFile for each file.

You can obtain an IEdmRefItemContainer interface from IEdmBatchUnlock by assignment (QueryInterface in C++).

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchUnlock Members
EPDM.Interop.epdm Namespace


IEdmBatchUnlock Interface Members

IEdmBatchUnlock Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmBatchUnlock Interface

The following tables list the members exposed by IEdmBatchUnlock.

Public Properties

 | Name | Description
Property | Comment | Gets or sets the comment for unlocking, checking in, or undoing check-outs of the files in this batch.
Top

Public Methods

 | Name | Description
Method | AddSelection | Specifies the batch of files to be unlocked.
Method | CreateTree | Creates the file reference tree.
Method | GetFileList | Gets the list of files to be unlocked.
Method | ShowDlg | Displays the SOLIDWORKS PDM Professional Check In or Undo Check Out dialog box.
Method | UnlockFiles | Unlocks, checks in, or undoes the check-outs of the files in this batch.
Top

See Also

IEdmBatchUnlock Interface
EPDM.Interop.epdm Namespace


IEdmBatchUnlock Interface Methods

IEdmBatchUnlock Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchUnlock Interface

For a list of all members of this type, see IEdmBatchUnlock members.

Public Methods

 | Name | Description
Method | AddSelection | Specifies the batch of files to be unlocked.
Method | CreateTree | Creates the file reference tree.
Method | GetFileList | Gets the list of files to be unlocked.
Method | ShowDlg | Displays the SOLIDWORKS PDM Professional Check In or Undo Check Out dialog box.
Method | UnlockFiles | Unlocks, checks in, or undoes the check-outs of the files in this batch.
Top

See Also

IEdmBatchUnlock Interface
EPDM.Interop.epdm Namespace


AddSelection Method (IEdmBatchUnlock)

AddSelection Method (IEdmBatchUnlock)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock Interface : AddSelection Method (IEdmBatchUnlock)

poVault
IEdmVault5; vault to which the files belong
ppoSelection
Array of IEdmSelItem structures; one structure for each file to unlock
Specifies the batch of files to be unlocked.

Syntax

Visual Basic
Sub AddSelection( _
   ByVal poVault As EdmVault5, _
   ByRef ppoSelection() As EdmSelItem _
)
C#
void AddSelection(
   EdmVault5 poVault,
   ref EdmSelItem[] ppoSelection
)
C++/CLI
void AddSelection(
&   EdmVault5^ poVault,
&   array<EdmSelItem>^% ppoSelection
)

Parameters

poVault
IEdmVault5; vault to which the files belong
ppoSelection
Array of IEdmSelItem structures; one structure for each file to unlock

Example

See the IEdmBatchUnlock examples.

Remarks

See the IEdmBatchUnlock remarks for information about using this method.

When you call this method, SOLIDWORKS PDM Professional automatically adds the file's references to the unlock file set.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUnlock Interface
IEdmBatchUnlock Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


CreateTree Method (IEdmBatchUnlock)

CreateTree Method (IEdmBatchUnlock)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock Interface : CreateTree Method (IEdmBatchUnlock)

lParentWnd
Parent window handle
lEdmUnlockBuildTreeFlags
Combination of EdmUnlockBuildTreeFlags bits
poCallback
IEdmUnlockOpCallback; optional callback that you can implement to receive more information about the unlock operation
Creates the file reference tree.

Syntax

Visual Basic
Function CreateTree( _
   ByVal lParentWnd As System.Integer, _
   ByVal lEdmUnlockBuildTreeFlags As System.Integer, _
   Optional ByVal poCallback As IEdmUnlockOpCallback _
) As System.Boolean
C#
System.bool CreateTree(
   System.int lParentWnd,
   System.int lEdmUnlockBuildTreeFlags,
   IEdmUnlockOpCallback poCallback
)
C++/CLI
System.bool CreateTree(
&   System.int lParentWnd,
&   System.int lEdmUnlockBuildTreeFlags,
&   IEdmUnlockOpCallback^ poCallback
)

Parameters

lParentWnd
Parent window handle
lEdmUnlockBuildTreeFlags
Combination of EdmUnlockBuildTreeFlags bits
poCallback
IEdmUnlockOpCallback; optional callback that you can implement to receive more information about the unlock operation

Return Value

True if at least one file is valid for the operation, false if no files are valid for the operation

Example

See the IEdmBatchUnlock examples.

Remarks

See the IEdmBatchUnlock remarks for information about using this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUnlock Interface
IEdmBatchUnlock Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


GetFileList Method (IEdmBatchUnlock)

GetFileList Method (IEdmBatchUnlock)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock Interface : GetFileList Method (IEdmBatchUnlock)

lEdmUnlockFileListFlags
Combination of EdmUnlockFileListFlag bits
Gets the list of files to be unlocked.

Syntax

Visual Basic
Function GetFileList( _
   ByVal lEdmUnlockFileListFlags As System.Integer _
) As EdmSelectionList5
C#
EdmSelectionList5 GetFileList(
   System.int lEdmUnlockFileListFlags
)
C++/CLI
EdmSelectionList5^ GetFileList(
&   System.int lEdmUnlockFileListFlags
)

Parameters

lEdmUnlockFileListFlags
Combination of EdmUnlockFileListFlag bits

Return Value

IEdmSelectionList5

Example

See the IEdmBatchUnlock examples.

Remarks

See the IEdmBatchUnlock remarks for information about using this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUnlock Interface
IEdmBatchUnlock Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


ShowDlg Method (IEdmBatchUnlock)

ShowDlg Method (IEdmBatchUnlock)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock Interface : ShowDlg Method (IEdmBatchUnlock)

lParentWnd
Parent window handle
Displays the SOLIDWORKS PDM Professional Check In or Undo Check Out dialog box.

Syntax

Visual Basic
Function ShowDlg( _
   ByVal lParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowDlg(
   System.int lParentWnd
)
C++/CLI
System.bool ShowDlg(
&   System.int lParentWnd
)

Parameters

lParentWnd
Parent window handle

Return Value

True if successful, false if not

Example

See the IEdmBatchUnlock examples.

Remarks

See the IEdmBatchUnlock remarks for information about using this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUnlock Interface
IEdmBatchUnlock Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


UnlockFiles Method (IEdmBatchUnlock)

UnlockFiles Method (IEdmBatchUnlock)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock Interface : UnlockFiles Method (IEdmBatchUnlock)

lParentWnd
Parent window handle
poCallback
IEdmUnlockOpCallback; optional callback that you can implement to receive more information about the unlock operation
Unlocks, checks in, or undoes the check-outs of the files in this batch.

Syntax

Visual Basic
Sub UnlockFiles( _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal poCallback As IEdmUnlockOpCallback _
)
C#
void UnlockFiles(
   System.int lParentWnd,
   IEdmUnlockOpCallback poCallback
)
C++/CLI
void UnlockFiles(
&   System.int lParentWnd,
&   IEdmUnlockOpCallback^ poCallback
)

Parameters

lParentWnd
Parent window handle
poCallback
IEdmUnlockOpCallback; optional callback that you can implement to receive more information about the unlock operation

Example

See the IEdmBatchUnlock examples.

Remarks

See the IEdmBatchUnlock remarks for information about using this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUnlock Interface
IEdmBatchUnlock Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


IEdmBatchUnlock Interface Properties

IEdmBatchUnlock Interface Properties
EPDM.Interop.epdm Namespace : IEdmBatchUnlock Interface

For a list of all members of this type, see IEdmBatchUnlock members.

Public Properties

 | Name | Description
Property | Comment | Gets or sets the comment for unlocking, checking in, or undoing check-outs of the files in this batch.
Top

See Also

IEdmBatchUnlock Interface
EPDM.Interop.epdm Namespace


Comment Property (IEdmBatchUnlock)

Comment Property (IEdmBatchUnlock)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock Interface : Comment Property (IEdmBatchUnlock)

Gets or sets the comment for unlocking, checking in, or undoing check-outs of the files in this batch.

Syntax

Visual Basic
Property Comment As System.String
C#
System.string Comment {get; set;}
C++/CLI
property System.String^ Comment {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Unlock comment

Example

See the IEdmBatchUnlock examples.

See Also

IEdmBatchUnlock Interface
IEdmBatchUnlock Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


IEdmBatchUnlock2 Interface

IEdmBatchUnlock2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchUnlock2 Interface

Allows you to unlock, check in, or undo check-outs of multiple files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchUnlock2
   Inherits IEdmBatchUnlock
C#
public interface IEdmBatchUnlock2 : IEdmBatchUnlock
C++/CLI
public interface class IEdmBatchUnlock2 : public IEdmBatchUnlock

Example

See the IEdmBatchUnlock examples.

Remarks

This interface extends IEdmBatchUnlock by adding the ability to get the status of the unlock operation.

See Also

IEdmBatchUnlock2 Members
EPDM.Interop.epdm Namespace


IEdmBatchUnlock2 Interface Members

IEdmBatchUnlock2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchUnlock2 Interface

The following tables list the members exposed by IEdmBatchUnlock2.

Public Methods

 | Name | Description
Method | GetStatus | Gets the specified statuses for this unlock operation.
Top

See Also

IEdmBatchUnlock2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchUnlock2 Interface Methods

IEdmBatchUnlock2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchUnlock2 Interface

For a list of all members of this type, see IEdmBatchUnlock2 members.

Public Methods

 | Name | Description
Method | GetStatus | Gets the specified statuses for this unlock operation.
Top

See Also

IEdmBatchUnlock2 Interface
EPDM.Interop.epdm Namespace


GetStatus Method (IEdmBatchUnlock2)

GetStatus Method (IEdmBatchUnlock2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUnlock2 Interface : GetStatus Method (IEdmBatchUnlock2)

lEdmUnlockStatusFlag
Combination of EdmUnlockStatusFlag bits
Gets the specified statuses for this unlock operation.

Syntax

Visual Basic
Function GetStatus( _
   ByVal lEdmUnlockStatusFlag As System.Integer _
) As System.Object
C#
System.object GetStatus(
   System.int lEdmUnlockStatusFlag
)
C++/CLI
System.Object^ GetStatus(
&   System.int lEdmUnlockStatusFlag
)

Parameters

lEdmUnlockStatusFlag
Combination of EdmUnlockStatusFlag bits

Return Value

Array of statuses

Example

See the IEdmBatchUnlock examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUnlock2 Interface
IEdmBatchUnlock2 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmBatchUpdate Interface

IEdmBatchUpdate Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBatchUpdate Interface

Allows you to set the values of several file and folder card variables all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchUpdate
C#
public interface IEdmBatchUpdate
C++/CLI
public interface class IEdmBatchUpdate

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is superseded by IEdmBatchUpdate2, which can also update folder variables.

To set the values of file card variables:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing in EdmUtility.EdmUtil_BatchUpdate.
  2. Call IEdmBatchUpdate::SetVar once for each variable you want to update.
  3. Call IEdmBatchUpdate::Commit to commit all variable changes.

Before SOLIDWORKS PDM Professional 6.2, the only way to set the values of variables used in file data cards was to use the IEdmEnumeratorVariable interface which processed the variables one file and one variable at a time. This still works, but when setting the values of many variables, it is more efficient to use the IEdmBatchUpdate interface which accumulates all variables to set and then commits them all in a single operation.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchUpdate Members
EPDM.Interop.epdm Namespace


IEdmBatchUpdate Interface Members

IEdmBatchUpdate Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchUpdate Interface

The following tables list the members exposed by IEdmBatchUpdate.

Public Methods

 | Name | Description
Method | Commit | Obsolete. Superseded by IEdmBatchUpdate2::CommitUpdate .
Method | SetAux | For internal use only.
Method | SetVar | Obsolete. Superseded by IEdmBatchUpdate2::SetVar .
Top

See Also

IEdmBatchUpdate Interface
EPDM.Interop.epdm Namespace


IEdmBatchUpdate Interface Methods

IEdmBatchUpdate Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchUpdate Interface

For a list of all members of this type, see IEdmBatchUpdate members.

Public Methods

 | Name | Description
Method | Commit | Obsolete. Superseded by IEdmBatchUpdate2::CommitUpdate .
Method | SetAux | For internal use only.
Method | SetVar | Obsolete. Superseded by IEdmBatchUpdate2::SetVar .
Top

See Also

IEdmBatchUpdate Interface
EPDM.Interop.epdm Namespace


SetAux Method (IEdmBatchUpdate)

SetAux Method (IEdmBatchUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUpdate Interface : SetAux Method (IEdmBatchUpdate)

poAux
lFlags
For internal use only.

Syntax

Visual Basic
Sub SetAux( _
   ByVal poAux As System.Object, _
   Optional ByVal lFlags As System.Integer _
)
C#
void SetAux(
   System.object poAux,
   System.int lFlags
)
C++/CLI
void SetAux(
&   System.Object^ poAux,
&   System.int lFlags
)

Parameters

poAux
lFlags

See Also

IEdmBatchUpdate Interface
IEdmBatchUpdate Members


IEdmBatchUpdate2 Interface

IEdmBatchUpdate2 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBatchUpdate2 Interface

Allows you to set the values of several file and folder card variables all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBatchUpdate2
C#
public interface IEdmBatchUpdate2
C++/CLI
public interface class IEdmBatchUpdate2

Example

Batch Update Card Variables (VB.NET)
Batch Update Card Variables (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • supersedes IEdmBatchUpdate, which can only update file variables.

To set the values of file and folder card variables:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing in EdmUtility.EdmUtil_BatchUpdate.
  2. Call IEdmBatchUpdate2::SetVar once for each file card variable you want to update. You must first check out the files whose card variables you want to update.
  3. Call IEdmBatchUpdate2::SetFolderVar once for each folder card variable you want to update.
  4. Call IEdmBatchUpdate2::CommitUpdate to commit all of the file and folder card variable changes.

Prior to SOLIDWORKS PDM Professional 6.2, the only way to set file card variables was to use IEdmEnumeratorVariable, which can handle only one file or folder card variable at a time. As of SOLIDWORKS PDM Professional 6.2, you should use IEdmBatchUpdate2, which can handle several file and folder card variables at a time.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBatchUpdate2 Members
EPDM.Interop.epdm Namespace


IEdmBatchUpdate2 Interface Members

IEdmBatchUpdate2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBatchUpdate2 Interface

The following tables list the members exposed by IEdmBatchUpdate2.

Public Methods

 | Name | Description
Method | CommitUpdate | Commits all of the file and folder card variable updates in this batch.
Method | SetFolderVar | Adds a folder card variable to the batch of variables to update.
Method | SetVar | Adds a file card variable to the batch of variables to update.
Top

See Also

IEdmBatchUpdate2 Interface
EPDM.Interop.epdm Namespace


IEdmBatchUpdate2 Interface Methods

IEdmBatchUpdate2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBatchUpdate2 Interface

For a list of all members of this type, see IEdmBatchUpdate2 members.

Public Methods

 | Name | Description
Method | CommitUpdate | Commits all of the file and folder card variable updates in this batch.
Method | SetFolderVar | Adds a folder card variable to the batch of variables to update.
Method | SetVar | Adds a file card variable to the batch of variables to update.
Top

See Also

IEdmBatchUpdate2 Interface
EPDM.Interop.epdm Namespace


CommitUpdate Method (IEdmBatchUpdate2)

CommitUpdate Method (IEdmBatchUpdate2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUpdate2 Interface : CommitUpdate Method (IEdmBatchUpdate2)

ppoRetErrors
Array of EdmBatchError2 structures; one structure for each non-critical error that occurred during the update
poCallback
Optional pointer to a class that implements IEdmCallback to get more information during the operation
Commits all of the file and folder card variable updates in this batch.

Syntax

Visual Basic
Function CommitUpdate( _
   ByRef ppoRetErrors() As EdmBatchError2, _
   Optional ByVal poCallback As EdmCallback _
) As System.Integer
C#
System.int CommitUpdate(
   out EdmBatchError2[] ppoRetErrors,
   EdmCallback poCallback
)
C++/CLI
System.int CommitUpdate(
&   [Out] array<EdmBatchError2>^ ppoRetErrors,
&   EdmCallback^ poCallback
)

Parameters

ppoRetErrors
Array of EdmBatchError2 structures; one structure for each non-critical error that occurred during the update
poCallback
Optional pointer to a class that implements IEdmCallback to get more information during the operation

Return Value

Size of ppoRetErrors array; 0 if no errors

Example

See the IEdmBatchUpdate2 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUpdate2 Interface
IEdmBatchUpdate2 Members

Availability

SOLIDWORKS PDM Professional Version 6.3


SetFolderVar Method (IEdmBatchUpdate2)

SetFolderVar Method (IEdmBatchUpdate2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUpdate2 Interface : SetFolderVar Method (IEdmBatchUpdate2)

lFolderID
ID of folder to which to write the card variable
lVariableID
ID of folder card variable to update
poValue
New value of the folder card variable
lEdmBatchFlags
Combination of EdmBatchFlags bits
Adds a folder card variable to the batch of variables to update.

Syntax

Visual Basic
Sub SetFolderVar( _
   ByVal lFolderID As System.Integer, _
   ByVal lVariableID As System.Integer, _
   ByRef poValue As System.Object, _
   Optional ByVal lEdmBatchFlags As System.Integer _
)
C#
void SetFolderVar(
   System.int lFolderID,
   System.int lVariableID,
   ref System.object poValue,
   System.int lEdmBatchFlags
)
C++/CLI
void SetFolderVar(
&   System.int lFolderID,
&   System.int lVariableID,
&   System.Object^% poValue,
&   System.int lEdmBatchFlags
)

Parameters

lFolderID
ID of folder to which to write the card variable
lVariableID
ID of folder card variable to update
poValue
New value of the folder card variable
lEdmBatchFlags
Combination of EdmBatchFlags bits

Example

See the IEdmBatchUpdate2 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUpdate2 Interface
IEdmBatchUpdate2 Members

Availability

SOLIDWORKS PDM Professional Version 6.3


SetVar Method (IEdmBatchUpdate2)

SetVar Method (IEdmBatchUpdate2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUpdate2 Interface : SetVar Method (IEdmBatchUpdate2)

lFileID
ID of file to which to write the file card variable
lVariableID
ID of file card variable to update
poValue
New value of the file card variable
bsConfiguration
Name of configuration to which to write the file card variable; ignored if lEdmBatchFlags contains EdmBatchFlags.EdmBatch_AllConfigs
lEdmBatchFlags
Combination of EdmBatchFlags bits
Adds a file card variable to the batch of variables to update.

Syntax

Visual Basic
Sub SetVar( _
   ByVal lFileID As System.Integer, _
   ByVal lVariableID As System.Integer, _
   ByRef poValue As System.Object, _
   ByVal bsConfiguration As System.String, _
   Optional ByVal lEdmBatchFlags As System.Integer _
)
C#
void SetVar(
   System.int lFileID,
   System.int lVariableID,
   ref System.object poValue,
   System.string bsConfiguration,
   System.int lEdmBatchFlags
)
C++/CLI
void SetVar(
&   System.int lFileID,
&   System.int lVariableID,
&   System.Object^% poValue,
&   System.String^ bsConfiguration,
&   System.int lEdmBatchFlags
)

Parameters

lFileID
ID of file to which to write the file card variable
lVariableID
ID of file card variable to update
poValue
New value of the file card variable
bsConfiguration
Name of configuration to which to write the file card variable; ignored if lEdmBatchFlags contains EdmBatchFlags.EdmBatch_AllConfigs
lEdmBatchFlags
Combination of EdmBatchFlags bits

Example

See the IEdmBatchUpdate2 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUpdate2 Interface
IEdmBatchUpdate2 Members

Availability

SOLIDWORKS PDM Professional Version 6.3


IEdmBitmap5 Interface

IEdmBitmap5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBitmap5 Interface

Allows you to access a bitmap image.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBitmap5
C#
public interface IEdmBitmap5
C++/CLI
public interface class IEdmBitmap5

Example

Get Preview Bitmap of File (VB.NET)
Get Preview Bitmap of File (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmEnumeratorVariable5::GetThumbnail

See Also

IEdmBitmap5 Members
EPDM.Interop.epdm Namespace


IEdmBitmap5 Interface Members

IEdmBitmap5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmBitmap5 Interface

The following tables list the members exposed by IEdmBitmap5.

Public Properties

 | Name | Description
Property | Height | Gets the height of the image.
Property | Width | Gets the width of the image.
Top

Public Methods

 | Name | Description
Method | Draw | Draws this bitmap image in a window.
Method | GetBitmapInfo | Gets bitmap information.
Method | GetBitmapInfoSize | Gets the size of the bitmap information returned by IEdmBitmap5::GetBitmapInfo.
Method | SaveBmp | Saves this bitmap image as a BMP file.
Top

See Also

IEdmBitmap5 Interface
EPDM.Interop.epdm Namespace


IEdmBitmap5 Interface Methods

IEdmBitmap5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBitmap5 Interface

For a list of all members of this type, see IEdmBitmap5 members.

Public Methods

 | Name | Description
Method | Draw | Draws this bitmap image in a window.
Method | GetBitmapInfo | Gets bitmap information.
Method | GetBitmapInfoSize | Gets the size of the bitmap information returned by IEdmBitmap5::GetBitmapInfo.
Method | SaveBmp | Saves this bitmap image as a BMP file.
Top

See Also

IEdmBitmap5 Interface
EPDM.Interop.epdm Namespace


Draw Method (IEdmBitmap5)

Draw Method (IEdmBitmap5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBitmap5 Interface : Draw Method (IEdmBitmap5)

lWnd
Handle of window in which to draw the bitmap image
lX
X-coordinate in pixels where to position upper-left corner of image ; default is 0
lY
Y-coordinate in pixels where to position upper-left corner of image; default is 0
lWidth
Width in pixels of the drawn image; 0 for source image width
lHeight
Height in pixels of the drawn image; 0 for source image height
Draws this bitmap image in a window.

Syntax

Visual Basic
Sub Draw( _
   ByVal lWnd As System.Integer, _
   Optional ByVal lX As System.Integer, _
   Optional ByVal lY As System.Integer, _
   Optional ByVal lWidth As System.Integer, _
   Optional ByVal lHeight As System.Integer _
)
C#
void Draw(
   System.int lWnd,
   System.int lX,
   System.int lY,
   System.int lWidth,
   System.int lHeight
)
C++/CLI
void Draw(
&   System.int lWnd,
&   System.int lX,
&   System.int lY,
&   System.int lWidth,
&   System.int lHeight
)

Parameters

lWnd
Handle of window in which to draw the bitmap image
lX
X-coordinate in pixels where to position upper-left corner of image ; default is 0
lY
Y-coordinate in pixels where to position upper-left corner of image; default is 0
lWidth
Width in pixels of the drawn image; 0 for source image width
lHeight
Height in pixels of the drawn image; 0 for source image height

Example

See the IEdmBitmap5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBitmap5 Interface
IEdmBitmap5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetBitmapInfo Method (IEdmBitmap5)

GetBitmapInfo Method (IEdmBitmap5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBitmap5 Interface : GetBitmapInfo Method (IEdmBitmap5)

lDataSize
Size of pbData (see Remarks)
pbData
Buffer in which to return the bitmap information
Gets bitmap information.

Syntax

Visual Basic
Sub GetBitmapInfo( _
   ByVal lDataSize As System.Integer, _
   ByRef pbData As System.Byte _
)
C#
void GetBitmapInfo(
   System.int lDataSize,
   out System.byte pbData
)
C++/CLI
void GetBitmapInfo(
&   System.int lDataSize,
&   [Out] System.byte pbData
)

Parameters

lDataSize
Size of pbData (see Remarks)
pbData
Buffer in which to return the bitmap information

Remarks

Before calling this method, you must properly allocate the size of the pbData buffer. Call IEdmBitmap5::GetBitmapInfoSize to determine the size of buffer to allocate and to specify lDataSize.

Return codes:

  • S_OK: The method successfully executed.
  • E_INVALIDARG: lDataSize does not match the size of the returned structure.

See Also

IEdmBitmap5 Interface
IEdmBitmap5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetBitmapInfoSize Method (IEdmBitmap5)

GetBitmapInfoSize Method (IEdmBitmap5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBitmap5 Interface : GetBitmapInfoSize Method (IEdmBitmap5)

Gets the size of the bitmap information returned by IEdmBitmap5::GetBitmapInfo.

Syntax

Visual Basic
Function GetBitmapInfoSize() As System.Integer
C#
System.int GetBitmapInfoSize()
C++/CLI
System.int GetBitmapInfoSize();

Return Value

Size in bytes of the bitmap information

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBitmap5 Interface
IEdmBitmap5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SaveBmp Method (IEdmBitmap5)

SaveBmp Method (IEdmBitmap5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBitmap5 Interface : SaveBmp Method (IEdmBitmap5)

bsBmpPath
Path and name of the BMP file; if the file already exists, it is overwritten
Saves this bitmap image as a BMP file.

Syntax

Visual Basic
Sub SaveBmp( _
   ByVal bsBmpPath As System.String _
)
C#
void SaveBmp(
   System.string bsBmpPath
)
C++/CLI
void SaveBmp(
&   System.String^ bsBmpPath
)

Parameters

bsBmpPath
Path and name of the BMP file; if the file already exists, it is overwritten

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_SHARE_ERROR: Error opening the file.
  • E_EDM_IO_ERROR: Error writing the file.

See Also

IEdmBitmap5 Interface
IEdmBitmap5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmBitmap5 Interface Properties

IEdmBitmap5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmBitmap5 Interface

For a list of all members of this type, see IEdmBitmap5 members.

Public Properties

 | Name | Description
Property | Height | Gets the height of the image.
Property | Width | Gets the width of the image.
Top

See Also

IEdmBitmap5 Interface
EPDM.Interop.epdm Namespace


Height Property (IEdmBitmap5)

Height Property (IEdmBitmap5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBitmap5 Interface : Height Property (IEdmBitmap5)

Gets the height of the image.

Syntax

Visual Basic
ReadOnly Property Height As System.Integer
C#
System.int Height {get;}
C++/CLI
property System.int Height {
   System.int get();
}

Property Value

Height in pixels of the image

See Also

IEdmBitmap5 Interface
IEdmBitmap5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Width Property (IEdmBitmap5)

Width Property (IEdmBitmap5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBitmap5 Interface : Width Property (IEdmBitmap5)

Gets the width of the image.

Syntax

Visual Basic
ReadOnly Property Width As System.Integer
C#
System.int Width {get;}
C++/CLI
property System.int Width {
   System.int get();
}

Property Value

Width in pixels of the image

See Also

IEdmBitmap5 Interface
IEdmBitmap5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmBom Interface

IEdmBom Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBom Interface

Allows you to access a Bill of Materials (BOM).

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBom
   Inherits IEdmObject5
C#
public interface IEdmBom : IEdmObject5
C++/CLI
public interface class IEdmBom : public IEdmObject5

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

This interface inherits from IEdmObject5.

To access this interface:

  1. Call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_BOM.

- or -

  1. Create an EdmObjectInfo structure with meType = EdmObjectType.EdmObject_BOM.
  2. Call IEdmVault9::GetObjects with ppoObjects set to the EdmObjectInfo structure created in step 1.

Accessors

IEdmVault5::GetObject

IEdmVault9::GetObjects

See Also

IEdmBom Members
EPDM.Interop.epdm Namespace
IEdmFile7::GetDerivedBOMs Method ()


IEdmBom Interface Members

IEdmBom Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmBom Interface

The following tables list the members exposed by IEdmBom.

Public Properties

 | Name | Description
Property | CheckOutUserID | Gets the ID of the user who has this BOM checked out.
Property | CurrentState | Gets the current workflow state of this BOM.
Property | CurrentVersion | Gets the current version number of this BOM.
Property | FileID | Gets the unique ID of the file used to generate this BOM.
Property | IsCheckedOut | Gets whether this BOM is checked out.
Top

Public Methods

 | Name | Description
Method | ChangeState | Changes the workflow state of this BOM.
Method | CheckIn | Checks in this BOM.
Method | CheckOut | Checks out this BOM.
Method | Delete | Deletes this BOM.
Method | GetVersions | Gets the versions of this BOM.
Method | GetView | Gets the BOM view for the specified BOM version. The BOM view allows you to read and manipulate the contents of the BOM.
Top

See Also

IEdmBom Interface
EPDM.Interop.epdm Namespace
IEdmFile7::GetDerivedBOMs Method ()


IEdmBom Interface Methods

IEdmBom Interface Methods
EPDM.Interop.epdm Namespace : IEdmBom Interface

For a list of all members of this type, see IEdmBom members.

Public Methods

 | Name | Description
Method | ChangeState | Changes the workflow state of this BOM.
Method | CheckIn | Checks in this BOM.
Method | CheckOut | Checks out this BOM.
Method | Delete | Deletes this BOM.
Method | GetVersions | Gets the versions of this BOM.
Method | GetView | Gets the BOM view for the specified BOM version. The BOM view allows you to read and manipulate the contents of the BOM.
Top

See Also

IEdmBom Interface
EPDM.Interop.epdm Namespace
IEdmFile7::GetDerivedBOMs Method ()


ChangeState Method (IEdmBom)

ChangeState Method (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : ChangeState Method (IEdmBom)

poStateIdOrName
Name or ID of new workflow state
bsComment
Comment to append to the history of this BOM
lParentWnd
Parent window handle; passed to registered add-ins
lEdmStateFlags
Combination of EdmStateFlags bits
Changes the workflow state of this BOM.

Syntax

Visual Basic
Sub ChangeState( _
   ByVal poStateIdOrName As System.Object, _
   ByVal bsComment As System.String, _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal lEdmStateFlags As System.Integer _
)
C#
void ChangeState(
   System.object poStateIdOrName,
   System.string bsComment,
   System.int lParentWnd,
   System.int lEdmStateFlags
)
C++/CLI
void ChangeState(
&   System.Object^ poStateIdOrName,
&   System.String^ bsComment,
&   System.int lParentWnd,
&   System.int lEdmStateFlags
)

Parameters

poStateIdOrName
Name or ID of new workflow state
bsComment
Comment to append to the history of this BOM
lParentWnd
Parent window handle; passed to registered add-ins
lEdmStateFlags
Combination of EdmStateFlags bits

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


CheckIn Method (IEdmBom)

CheckIn Method (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : CheckIn Method (IEdmBom)

bsComment
Comment to add to the history of this BOM
Checks in this BOM.

Syntax

Visual Basic
Sub CheckIn( _
   ByVal bsComment As System.String _
)
C#
void CheckIn(
   System.string bsComment
)
C++/CLI
void CheckIn(
&   System.String^ bsComment
)

Parameters

bsComment
Comment to add to the history of this BOM

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


CheckOut Method (IEdmBom)

CheckOut Method (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : CheckOut Method (IEdmBom)

Checks out this BOM.

Syntax

Visual Basic
Sub CheckOut()
C#
void CheckOut()
C++/CLI
void CheckOut();

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


Delete Method (IEdmBom)

Delete Method (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : Delete Method (IEdmBom)

Deletes this BOM.

Syntax

Visual Basic
Sub Delete()
C#
void Delete()
C++/CLI
void Delete();

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


GetVersions Method (IEdmBom)

GetVersions Method (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : GetVersions Method (IEdmBom)

ppoVersions
Array of EdmBomVersion structures; one structure for each BOM version; the structure of the oldest version is at the beginning of the array
Gets the versions of this BOM.

Syntax

Visual Basic
Sub GetVersions( _
   ByRef ppoVersions() As EdmBomVersion _
)
C#
void GetVersions(
   out EdmBomVersion[] ppoVersions
)
C++/CLI
void GetVersions(
&   [Out] array<EdmBomVersion>^ ppoVersions
)

Parameters

ppoVersions
Array of EdmBomVersion structures; one structure for each BOM version; the structure of the oldest version is at the beginning of the array

Example

See the IEdmBom examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


GetView Method (IEdmBom)

GetView Method (IEdmBom)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : GetView Method (IEdmBom)

lVersionNo
Version of the BOM whose view you want
Gets the BOM view for the specified BOM version. The BOM view allows you to read and manipulate the contents of the BOM.

Syntax

Visual Basic
Function GetView( _
   Optional ByVal lVersionNo As System.Integer _
) As EdmBomView
C#
EdmBomView GetView(
   System.int lVersionNo
)
C++/CLI
EdmBomView^ GetView(
&   System.int lVersionNo
)

Parameters

lVersionNo
Version of the BOM whose view you want

Return Value

IEdmBomView

Example

Add Row to Bill of Materials (VB.NET)
Add Row to Bill of Materials (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBom Interface Properties

IEdmBom Interface Properties
EPDM.Interop.epdm Namespace : IEdmBom Interface

For a list of all members of this type, see IEdmBom members.

Public Properties

 | Name | Description
Property | CheckOutUserID | Gets the ID of the user who has this BOM checked out.
Property | CurrentState | Gets the current workflow state of this BOM.
Property | CurrentVersion | Gets the current version number of this BOM.
Property | FileID | Gets the unique ID of the file used to generate this BOM.
Property | IsCheckedOut | Gets whether this BOM is checked out.
Top

See Also

IEdmBom Interface
EPDM.Interop.epdm Namespace
IEdmFile7::GetDerivedBOMs Method ()


CheckOutUserID Property (IEdmBom)

CheckOutUserID Property (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : CheckOutUserID Property (IEdmBom)

Gets the ID of the user who has this BOM checked out.

Syntax

Visual Basic
ReadOnly Property CheckOutUserID As System.Integer
C#
System.int CheckOutUserID {get;}
C++/CLI
property System.int CheckOutUserID {
   System.int get();
}

Property Value

ID of the user who has this BOM checked out; 0 if not checked out

Example

See the IEdmBom examples.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


CurrentState Property (IEdmBom)

CurrentState Property (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : CurrentState Property (IEdmBom)

Gets the current workflow state of this BOM.

Syntax

Visual Basic
ReadOnly Property CurrentState As IEdmState6
C#
IEdmState6 CurrentState {get;}
C++/CLI
property IEdmState6^ CurrentState {
   IEdmState6^ get();
}

Property Value

IEdmState6

Example

See the IEdmBom examples.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


CurrentVersion Property (IEdmBom)

CurrentVersion Property (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : CurrentVersion Property (IEdmBom)

Gets the current version number of this BOM.

Syntax

Visual Basic
ReadOnly Property CurrentVersion As System.Integer
C#
System.int CurrentVersion {get;}
C++/CLI
property System.int CurrentVersion {
   System.int get();
}

Property Value

Current version number of this BOM

Example

See the IEdmBom examples.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


FileID Property (IEdmBom)

FileID Property (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : FileID Property (IEdmBom)

Gets the unique ID of the file used to generate this BOM.

Syntax

Visual Basic
ReadOnly Property FileID As System.Integer
C#
System.int FileID {get;}
C++/CLI
property System.int FileID {
   System.int get();
}

Property Value

File ID

Example

See the IEdmBom examples.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


IsCheckedOut Property (IEdmBom)

IsCheckedOut Property (IEdmBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBom Interface : IsCheckedOut Property (IEdmBom)

Gets whether this BOM is checked out.

Syntax

Visual Basic
ReadOnly Property IsCheckedOut As System.Boolean
C#
System.bool IsCheckedOut {get;}
C++/CLI
property System.bool IsCheckedOut {
   System.bool get();
}

Property Value

True if this BOM is checked out, false if not

Example

See the IEdmBom examples.

See Also

IEdmBom Interface
IEdmBom Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBomCell Interface

IEdmBomCell Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBomCell Interface

Allows you to access a single row in a Bill of Materials (BOM).

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomCell
C#
public interface IEdmBomCell
C++/CLI
public interface class IEdmBomCell

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmBomCell2.

Accessors

IEdmBomView::GetRows

See Also

IEdmBomCell Members
EPDM.Interop.epdm Namespace
IEdmBomView::SetRows Method ()


IEdmBomCell Interface Members

IEdmBomCell Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomCell Interface

The following tables list the members exposed by IEdmBomCell.

Public Methods

 | Name | Description
Method | GetItemID | Gets the row index of this BOM row.
Method | GetPathName | Gets the file system path to the file in this BOM row.
Method | GetTreeLevel | Gets the position of this BOM row in the computed BOM.
Method | GetVar | Gets the value of the specified cell in this BOM row.
Method | IsLocked | Gets whether the file associated with this BOM cell is checked out and can be edited.
Method | SetVar | Sets the value of the specified cell in this BOM row.
Top

See Also

IEdmBomCell Interface
EPDM.Interop.epdm Namespace
IEdmBomView::SetRows Method ()


IEdmBomCell Interface Methods

IEdmBomCell Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomCell Interface

For a list of all members of this type, see IEdmBomCell members.

Public Methods

 | Name | Description
Method | GetItemID | Gets the row index of this BOM row.
Method | GetPathName | Gets the file system path to the file in this BOM row.
Method | GetTreeLevel | Gets the position of this BOM row in the computed BOM.
Method | GetVar | Gets the value of the specified cell in this BOM row.
Method | IsLocked | Gets whether the file associated with this BOM cell is checked out and can be edited.
Method | SetVar | Sets the value of the specified cell in this BOM row.
Top

See Also

IEdmBomCell Interface
EPDM.Interop.epdm Namespace
IEdmBomView::SetRows Method ()


GetItemID Method (IEdmBomCell)

GetItemID Method (IEdmBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell Interface : GetItemID Method (IEdmBomCell)

Gets the row index of this BOM row.

Syntax

Visual Basic
Function GetItemID() As System.Integer
C#
System.int GetItemID()
C++/CLI
System.int GetItemID();

Return Value

Row index

Example

See the IEdmBomCell examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomCell Interface
IEdmBomCell Members

Availability

SOLIDWORKS PDM Professional 2009


GetPathName Method (IEdmBomCell)

GetPathName Method (IEdmBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell Interface : GetPathName Method (IEdmBomCell)

Gets the file system path to the file in this BOM row.

Syntax

Visual Basic
Function GetPathName() As System.String
C#
System.string GetPathName()
C++/CLI
System.String^ GetPathName();

Return Value

File system path to the file in this row

Example

See the IEdmBomCell examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomCell Interface
IEdmBomCell Members

Availability

SOLIDWORKS PDM Professional 2009


GetTreeLevel Method (IEdmBomCell)

GetTreeLevel Method (IEdmBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell Interface : GetTreeLevel Method (IEdmBomCell)

Gets the position of this BOM row in the computed BOM.

Syntax

Visual Basic
Function GetTreeLevel() As System.Integer
C#
System.int GetTreeLevel()
C++/CLI
System.int GetTreeLevel();

Return Value

Position of this BOM row in the computed BOM

Example

See the IEdmBomCell examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomCell Interface
IEdmBomCell Members

Availability

SOLIDWORKS PDM Professional 2009


GetVar Method (IEdmBomCell)

GetVar Method (IEdmBomCell)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell Interface : GetVar Method (IEdmBomCell)

lVariableID
ID of the variable to get (see Remarks)
eColumn
Type of column as defined in EdmBomColumnType (see Remarks)
poValue
Value in this BOM cell
poComputedValue
Computed value in this BOM cell
pbsConfiguration
Name of the configuration from which to get this BOM cell's value
pbReadOnly
True if this BOM cell cannot be updated, false if it can be updated by IEdmBomCell::SetVar
Gets the value of the specified cell in this BOM row.

Syntax

Visual Basic
Sub GetVar( _
   ByVal lVariableID As System.Integer, _
   ByVal eColumn As EdmBomColumnType, _
   ByRef poValue As System.Object, _
   ByRef poComputedValue As System.Object, _
   ByRef pbsConfiguration As System.String, _
   ByRef pbReadOnly As System.Boolean _
)
C#
void GetVar(
   System.int lVariableID,
   EdmBomColumnType eColumn,
   out System.object poValue,
   out System.object poComputedValue,
   out System.string pbsConfiguration,
   out System.bool pbReadOnly
)
C++/CLI
void GetVar(
&   System.int lVariableID,
&   EdmBomColumnType eColumn,
&   [Out] System.Object^ poValue,
&   [Out] System.Object^ poComputedValue,
&   [Out] System.String^ pbsConfiguration,
&   [Out] System.bool pbReadOnly
)

Parameters

lVariableID
ID of the variable to get (see Remarks)
eColumn
Type of column as defined in EdmBomColumnType (see Remarks)
poValue
Value in this BOM cell
poComputedValue
Computed value in this BOM cell
pbsConfiguration
Name of the configuration from which to get this BOM cell's value
pbReadOnly
True if this BOM cell cannot be updated, false if it can be updated by IEdmBomCell::SetVar

Example

Add Row to Bill of Materials (VB.NET)
Add Row to Bill of Materials (C#)

Remarks

  1. Call IEdmBomView::GetColumns to get EdmBomColumn for this BOM cell.
  2. Set IVariableID with EdmBomColumn.mlVariableID.
  3. Set eColumn with EdmBomColumn.meType.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomCell Interface
IEdmBomCell Members

Availability

SOLIDWORKS PDM Professional 2009


IsLocked Method (IEdmBomCell)

IsLocked Method (IEdmBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell Interface : IsLocked Method (IEdmBomCell)

Gets whether the file associated with this BOM cell is checked out and can be edited.

Syntax

Visual Basic
Function IsLocked() As System.Boolean
C#
System.bool IsLocked()
C++/CLI
System.bool IsLocked();

Return Value

True if the file associated with this BOM cell is available for editing, false if not

Example

See the IEdmBomCell examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomCell Interface
IEdmBomCell Members

Availability

SOLIDWORKS PDM Professional 2009


SetVar Method (IEdmBomCell)

SetVar Method (IEdmBomCell)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell Interface : SetVar Method (IEdmBomCell)

lVariableID
ID of the variable to set (see Remarks)
eColumn
Type of column as defined in EdmBomColumnType (see Remarks)
oNewValue
New value
bsConfiguration
Name of the configuration in which to set the value of this BOM cell
eOption
Type of value to set as defined in EdmBomSetVarOption
pbsErrorMessage
Error message
Sets the value of the specified cell in this BOM row.

Syntax

Visual Basic
Function SetVar( _
   ByVal lVariableID As System.Integer, _
   ByVal eColumn As EdmBomColumnType, _
   ByVal oNewValue As System.Object, _
   ByVal bsConfiguration As System.String, _
   ByVal eOption As EdmBomSetVarOption, _
   ByRef pbsErrorMessage As System.String _
) As System.Boolean
C#
System.bool SetVar(
   System.int lVariableID,
   EdmBomColumnType eColumn,
   System.object oNewValue,
   System.string bsConfiguration,
   EdmBomSetVarOption eOption,
   out System.string pbsErrorMessage
)
C++/CLI
System.bool SetVar(
&   System.int lVariableID,
&   EdmBomColumnType eColumn,
&   System.Object^ oNewValue,
&   System.String^ bsConfiguration,
&   EdmBomSetVarOption eOption,
&   [Out] System.String^ pbsErrorMessage
)

Parameters

lVariableID
ID of the variable to set (see Remarks)
eColumn
Type of column as defined in EdmBomColumnType (see Remarks)
oNewValue
New value
bsConfiguration
Name of the configuration in which to set the value of this BOM cell
eOption
Type of value to set as defined in EdmBomSetVarOption
pbsErrorMessage
Error message

Return Value

True if the value is successfully set, false if not

Example

Add Row to Bill of Materials (VB.NET)
Add Row to Bill of Materials (C#)

Remarks

  1. Call IEdmBomView::GetColumns to get EdmBomColumn for this BOM cell.
  2. Set IVariableID with EdmBomColumn.mlVariableID.
  3. Set eColumn with EdmBomColumn.meType.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomCell Interface
IEdmBomCell Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBomCell2 Interface

IEdmBomCell2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBomCell2 Interface

Allows you to access a single row in a Bill of Materials (BOM).

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomCell2
   Inherits IEdmBomCell
C#
public interface IEdmBomCell2 : IEdmBomCell
C++/CLI
public interface class IEdmBomCell2 : public IEdmBomCell

Remarks

This interface extends IEdmBomCell by providing the ability to determine whether the BOM cell is virtual.

Accessors

IEdmBomView::GetRows

See Also

IEdmBomCell2 Members
EPDM.Interop.epdm Namespace


IEdmBomCell2 Interface Members

IEdmBomCell2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomCell2 Interface

The following tables list the members exposed by IEdmBomCell2.

Public Methods

 | Name | Description
Method | IsVirtual | Gets whether this BOM row is a virtual component.
Top

See Also

IEdmBomCell2 Interface
EPDM.Interop.epdm Namespace


IEdmBomCell2 Interface Methods

IEdmBomCell2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomCell2 Interface

For a list of all members of this type, see IEdmBomCell2 members.

Public Methods

 | Name | Description
Method | IsVirtual | Gets whether this BOM row is a virtual component.
Top

See Also

IEdmBomCell2 Interface
EPDM.Interop.epdm Namespace


IsVirtual Method (IEdmBomCell2)

IsVirtual Method (IEdmBomCell2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomCell2 Interface : IsVirtual Method (IEdmBomCell2)

Gets whether this BOM row is a virtual component.

Syntax

Visual Basic
Function IsVirtual() As System.Boolean
C#
System.bool IsVirtual()
C++/CLI
System.bool IsVirtual();

Return Value

True if this is a virtual component, false if not

See Also

IEdmBomCell2 Interface
IEdmBomCell2 Members

Availability

SOLIDWORKS PDM Professional 2020


IEdmBomMgr Interface

IEdmBomMgr Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBomMgr Interface

Allows you to access the Bill of Materials (BOM) layouts installed in a vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomMgr
C#
public interface IEdmBomMgr
C++/CLI
public interface class IEdmBomMgr

Remarks

This interface:

  • Inherits from IDispatch. See IDispatch Interface (Automation).
  • Is extended by IEdmBomMgr2.

To view a vault's BOM layouts in the SOLIDWORKS PDM Professional Administration tool, log in to a vault and expand Bills of Materials.

To access this interface, call IEdmVault7::CreateUtility with eType = EdmUtility.EdmUtil_BomMgr.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBomMgr Members
EPDM.Interop.epdm Namespace


IEdmBomMgr Interface Members

IEdmBomMgr Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr Interface

The following tables list the members exposed by IEdmBomMgr.

Public Methods

 | Name | Description
Method | GetBomLayouts | Obsolete. Superseded by IEdmBomMgr2::GetBomLayouts2 .
Top

See Also

IEdmBomMgr Interface
EPDM.Interop.epdm Namespace


IEdmBomMgr Interface Methods

IEdmBomMgr Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr Interface

For a list of all members of this type, see IEdmBomMgr members.

Public Methods

 | Name | Description
Method | GetBomLayouts | Obsolete. Superseded by IEdmBomMgr2::GetBomLayouts2 .
Top

See Also

IEdmBomMgr Interface
EPDM.Interop.epdm Namespace


IEdmBomMgr2 Interface

IEdmBomMgr2 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBomMgr2 Interface

Allows you to access the Bill of Materials (BOM) layouts installed in a vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomMgr2
   Inherits IEdmBomMgr
C#
public interface IEdmBomMgr2 : IEdmBomMgr
C++/CLI
public interface class IEdmBomMgr2 : public IEdmBomMgr

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

This interface:

- Extends IEdmBomMgr by providing:

    • support for Web 2 applications,
    • the ability to determine whether a specified user can see a specified BOM layout, and
    • a new layout structure, EdmBomLayout2, that includes BOM type information.

- Is extended by IEdmBomMgr3.

To view a vault's BOM layouts in the SOLIDWORKS PDM Professional Administration tool, log in to a vault and expand Bills of Materials.

To access this interface, call IEdmVault7::CreateUtility with eType = EdmUtility.EdmUtil_BomMgr.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBomMgr2 Members
EPDM.Interop.epdm Namespace


IEdmBomMgr2 Interface Members

IEdmBomMgr2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr2 Interface

The following tables list the members exposed by IEdmBomMgr2.

Public Methods

 | Name | Description
Method | CanSeeBomLayout | Gets whether the specified BOM layout is visible to the specified user.
Method | GetBomLayouts2 | Gets all of the BOM layouts installed in a vault.
Top

See Also

IEdmBomMgr2 Interface
EPDM.Interop.epdm Namespace


IEdmBomMgr2 Interface Methods

IEdmBomMgr2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr2 Interface

For a list of all members of this type, see IEdmBomMgr2 members.

Public Methods

 | Name | Description
Method | CanSeeBomLayout | Gets whether the specified BOM layout is visible to the specified user.
Method | GetBomLayouts2 | Gets all of the BOM layouts installed in a vault.
Top

See Also

IEdmBomMgr2 Interface
EPDM.Interop.epdm Namespace


CanSeeBomLayout Method (IEdmBomMgr2)

CanSeeBomLayout Method (IEdmBomMgr2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomMgr2 Interface : CanSeeBomLayout Method (IEdmBomMgr2)

lLayoutId
BOM layout ID
lUserID
User ID
Gets whether the specified BOM layout is visible to the specified user.

Syntax

Visual Basic
Function CanSeeBomLayout( _
   ByVal lLayoutId As System.Integer, _
   ByVal lUserID As System.Integer _
) As System.Boolean
C#
System.bool CanSeeBomLayout(
   System.int lLayoutId,
   System.int lUserID
)
C++/CLI
System.bool CanSeeBomLayout(
&   System.int lLayoutId,
&   System.int lUserID
)

Parameters

lLayoutId
BOM layout ID
lUserID
User ID

Return Value

True if visible, false if not

Example

See the IEdmBomMgr2 examples.

See Also

IEdmBomMgr2 Interface
IEdmBomMgr2 Members

Availability

SOLIDWORKS PDM Professional 2020


GetBomLayouts2 Method (IEdmBomMgr2)

GetBomLayouts2 Method (IEdmBomMgr2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomMgr2 Interface : GetBomLayouts2 Method (IEdmBomMgr2)

ppoRetLayouts
Array of EdmBomLayout2 structures; one structure for each BOM layout
Gets all of the BOM layouts installed in a vault.

Syntax

Visual Basic
Sub GetBomLayouts2( _
   ByRef ppoRetLayouts() As EdmBomLayout2 _
)
C#
void GetBomLayouts2(
   out EdmBomLayout2[] ppoRetLayouts
)
C++/CLI
void GetBomLayouts2(
&   [Out] array<EdmBomLayout2>^ ppoRetLayouts
)

Parameters

ppoRetLayouts
Array of EdmBomLayout2 structures; one structure for each BOM layout

Example

See the IEdmBomMgr2 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomMgr2 Interface
IEdmBomMgr2 Members

Availability

SOLIDWORKS PDM Professional 2020


IEdmBomMgr3 Interface

IEdmBomMgr3 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBomMgr3 Interface

Allows you to add a SOLIDWORKS Bill of Materials (BOM) to a non-SOLIDWORKS document.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomMgr3
   Inherits IEdmBomMgr, IEdmBomMgr2
C#
public interface IEdmBomMgr3 : IEdmBomMgr, IEdmBomMgr2
C++/CLI
public interface class IEdmBomMgr3 : public IEdmBomMgr, IEdmBomMgr2

Example

//C# console application:

// Preconditions:

// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Console > Console App.
// 3. Type AddBomCSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Add dependencies and safely pass arrays of structures.
// 9. Replace the code in Program.cs with the code below.
//10. Change the namespace to match your setup.
//11. Change the userName, vaultName, swBom.RefDocID, swBom.RefCfgs, swBom.SheetName,
//    AddSWBom method parameters, and swRow property assignmentsin the code
//    to match your vault and the document to which you want to add this BOM.
//12. Click Debug > Start Debugging or press F5.

// Postconditions: Press a key when prompted in the console.

//---------------------------------------------------------------------------

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using EPDM.Interop.epdm;

using EPDM.Interop.EPDMResultCode;

using System.Windows.Forms;

namespace SPR_1207428

{

  class Program

  {

    const int LVCFMT_CENTER = 2;

    const int LVCFMT_RIGHT = 1;

    static string userName = "Admin";

    static string vaultName = "2022_A1_B291";

    static void Main(string[] args)

    {

      StringBuilder sb = new StringBuilder();

      try

      {

        sb.AppendFormat("UserName: {0}", userName).AppendLine();

        sb.AppendFormat("VaultName: {0}", vaultName).AppendLine();

        IEdmVault11 vault = (IEdmVault11)(new EdmVault5());

        if (!vault.IsLoggedIn)

          vault.Login(userName, "", vaultName);

        IEdmBomMgr3 bomMgr = (IEdmBomMgr3)vault.CreateUtility(EdmUtility.EdmUtil_BomMgr);

        IEdmSWBom swBom = bomMgr.CreateEmptySWBom();

        swBom.Name = "Custom SWBom 7";

        swBom.TableType = 0;

        swBom.StartNumber = 1;

        swBom.IncrementNumber = 1;

        swBom.RefCfgs = "Default";

        swBom.RefDocID = 1553;

        swBom.SheetName = "Sheet1";

        IEdmSWBomColumn swColTmp;

        swColTmp = swBom.InsertColumn(0, "PART NUMBER");

        swColTmp.Flags = LVCFMT_CENTER;

        swColTmp.Width = 120;

        swColTmp.Type = 8;

        swColTmp = swBom.InsertColumn(1, "DESCRIPTION");

        swColTmp.Flags = LVCFMT_CENTER;

        swColTmp.Width = 231;

        swColTmp.CustomPropName = "Description";

        swColTmp = swBom.InsertColumn(2, "WEIGHT");

        swColTmp.Flags = LVCFMT_CENTER;

        swColTmp.Width = 71;

        swColTmp.CustomPropName = "Weight";

        swColTmp = swBom.InsertColumn(3, "VENDOR");

        swColTmp.Flags = LVCFMT_CENTER;

        swColTmp.Width = 132;

        swColTmp.CustomPropName = "Vendor";

        swColTmp = swBom.InsertColumn(4, "QTY.");

        swColTmp.Flags = LVCFMT_RIGHT;

        swColTmp.Width = 71;

        swColTmp.Type = 6;

        swColTmp = swBom.InsertColumn(0, "ITEM NO."); // insert at first position; reorders previous indexing

        swColTmp.Flags = LVCFMT_CENTER;

        swColTmp.Width = 71;

        swColTmp.Type = 7;

        IEdmSWBomRow swRow = swBom.InsertRow(0);

        swRow.DocID = 1556;

        swRow.Configuration = "Default";

        swRow.Version = 1;

        swRow.ProjectID = 7;

        //swRow.ComponentRep = "SW-100200-2<Default>@Bill of Materials1/SW-100217-1<Default>@SW-100200/SW-201831-1<Default>@SW-100217";

        swBom.GetCell(0, 0).Text = "1";  //Item number

        swBom.GetCell(0, 1).Text = "SW-201831";  //Part number

        swBom.GetCell(0, 2).Text = "BASE"; //Description

        swBom.GetCell(0, 3).Text = "3696.33"; //Weight

        swBom.GetCell(0, 5).Text = "1"; //Quantity

        //Add the new SOLIDWORKS BOM to document with ID=1553 and Version=9

        bomMgr.AddSWBom(1553, 7, 9, (EdmSWBom)swBom);

        sb.AppendFormat("{0} sucessfully added.", swBom.Name).AppendLine();

      }

      catch (System.Runtime.InteropServices.COMException ex)

      {

        var errorType = typeof(EdmResultErrorCodes_e);

        if (Enum.IsDefined(errorType, ex.ErrorCode))

          sb.AppendFormat("Edm error occurred: {0}", Enum.GetName(errorType, ex.ErrorCode)).AppendLine();

        else

          sb.AppendLine("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);

      }

      catch (Exception ex)

      {

        sb.AppendFormat("Error occurred: {0}", ex.Message).AppendLine();

      }

      Console.WriteLine(sb.ToString());

      Console.WriteLine("Please press any key to exit");

      Console.ReadKey();

    }

  }

}

Remarks

This interface:

  • extends IEdmBomMgr2 by providing the ability to:
    • create a SOLIDWORKS BOM with rows and columns not tied to a fixed layout.
    • add a SOLIDWORKS BOM to a non-SOLIDWORKS document in the vault.
  • is extended by IEdmBomMgr4.

To access this interface, call IEdmVault7::CreateUtility with eType = EdmUtility.EdmUtil_BomMgr and then cast the returned object to IEdmBomMgr3.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBomMgr3 Members
EPDM.Interop.epdm Namespace


IEdmBomMgr3 Interface Members

IEdmBomMgr3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr3 Interface

The following tables list the members exposed by IEdmBomMgr3.

Public Methods

 | Name | Description
Method | AddSWBom | Adds the specified SOLIDWORKS BOM to the specified document.
Method | CreateEmptySWBom | Creates an empty SOLIDWORKS BOM.
Top

See Also

IEdmBomMgr3 Interface
EPDM.Interop.epdm Namespace


IEdmBomMgr3 Interface Methods

IEdmBomMgr3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr3 Interface

For a list of all members of this type, see IEdmBomMgr3 members.

Public Methods

 | Name | Description
Method | AddSWBom | Adds the specified SOLIDWORKS BOM to the specified document.
Method | CreateEmptySWBom | Creates an empty SOLIDWORKS BOM.
Top

See Also

IEdmBomMgr3 Interface
EPDM.Interop.epdm Namespace


AddSWBom Method (IEdmBomMgr3)

AddSWBom Method (IEdmBomMgr3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomMgr3 Interface : AddSWBom Method (IEdmBomMgr3)

lDocumentID
ID of document
lProjectID
ID of project where document resides
lDocRevNr
Version number of document
poSWBom
IEdmSWBom
Adds the specified SOLIDWORKS BOM to the specified document.

Syntax

Visual Basic
Sub AddSWBom( _
   ByVal lDocumentID As System.Integer, _
   ByVal lProjectID As System.Integer, _
   ByVal lDocRevNr As System.Integer, _
   ByVal poSWBom As EdmSWBom _
)
C#
void AddSWBom(
   System.int lDocumentID,
   System.int lProjectID,
   System.int lDocRevNr,
   EdmSWBom poSWBom
)
C++/CLI
void AddSWBom(
&   System.int lDocumentID,
&   System.int lProjectID,
&   System.int lDocRevNr,
&   EdmSWBom^ poSWBom
)

Parameters

lDocumentID
ID of document
lProjectID
ID of project where document resides
lDocRevNr
Version number of document
poSWBom
IEdmSWBom

Example

See the IEdmBomMgr3 examples.

See Also

IEdmBomMgr3 Interface
IEdmBomMgr3 Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


CreateEmptySWBom Method (IEdmBomMgr3)

CreateEmptySWBom Method (IEdmBomMgr3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomMgr3 Interface : CreateEmptySWBom Method (IEdmBomMgr3)

Creates an empty SOLIDWORKS BOM.

Syntax

Visual Basic
Function CreateEmptySWBom() As EdmSWBom
C#
EdmSWBom CreateEmptySWBom()
C++/CLI
EdmSWBom^ CreateEmptySWBom();

Return Value

IEdmSWBom

Example

See the IEdmBomMgr3 examples.

Remarks

After calling this method, call IEdmBomMgr3::AddSWBom to add a new SOLIDWORKS BOM to an existing document.

See Also

IEdmBomMgr3 Interface
IEdmBomMgr3 Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


IEdmBomMgr4 Interface

IEdmBomMgr4 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBomMgr4 Interface

Allows you to access the Bill of Materials (BOM) layouts installed in a vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomMgr4
   Inherits IEdmBomMgr, IEdmBomMgr2, IEdmBomMgr3
C#
public interface IEdmBomMgr4 : IEdmBomMgr, IEdmBomMgr2, IEdmBomMgr3
C++/CLI
public interface class IEdmBomMgr4 : public IEdmBomMgr, IEdmBomMgr2, IEdmBomMgr3

Example

Tailor the IEdmBomMgr2 C# example to use this interface by replacing its GetBOM_Click function with:

public void GetBOM_Click(System.Object sender, System.EventArgs e)

        {

            try

            {

                IEdmVault11 vault2 = null;

                if (vault1 == null)

                {

                    vault1 = new EdmVault5();

                }

                vault2 = (IEdmVault11)vault1;

                if (!vault1.IsLoggedIn)

                {

                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                }

                if (aFile != null)

                {

                    // Get named BOMs and their versions for the selected file

                    EdmBomInfo[] derivedBOMs = null;

                    aFile.GetDerivedBOMs(out derivedBOMs);

                    int arrSize = 0;

                    EdmBomVersion[] ppoVersions = null;

                    int i = 0;

                    int j = 0;

                    int id = 0;

                    string str = "";

                    string verstr = "";

                    int verArrSize = 0;

                    arrSize = derivedBOMs.Length;

                    int userID = 0;

                    bool canSeeLayout = false;

                    userID = vault2.GetLoggedInWindowsUserID(vault2.Name);

                    while (i < arrSize)

                    {

                        id = derivedBOMs[i].mlBomID;

                        bom = (IEdmBom)vault2.GetObject(EdmObjectType.EdmObject_BOM, id);

                        str = "Named BOM: " + derivedBOMs[i].mbsBomName + "\r\n" + "Type of BOM as defined in EdmBomType: " + derivedBOMs[i].meType + "\\n" + "Check-out user: " + bom.CheckOutUserID + "\r\n" + "Current state: " + bom.CurrentState.Name + "\r\n" + "Current version: " + bom.CurrentVersion + "\r\n" + "ID: " + bom.FileID + "\r\n" + "Is checked out: " + bom.IsCheckedOut;

                        MessageBox.Show(str);

                        bom.GetVersions(out ppoVersions);

                        verArrSize = ppoVersions.Length;

                        while (j < verArrSize)

                        {

                            verstr = "BOM version: " + "\r\n" + "Type as defined in EdmBomVersionType: " + ppoVersions[j].meType + "\r\n" + "Version number: " + ppoVersions[j].mlVersion + "\r\n" + "Date: " + ppoVersions[j].moDate + "\r\n" + "Label: " + ppoVersions[j].mbsTag + "\r\n" + "Comment: " + ppoVersions[j].mbsComment;

                            MessageBox.Show(verstr);

                            j = j + 1;

                        }

                        i = i + 1;

                    }

                    // Get a BOM view with the specified layout

                    bomMgr = (IEdmBomMgr2)vault2.CreateUtility(EdmUtility.EdmUtil_BomMgr);

                    EdmBomLayout2[] ppoRetLayouts = null;

                    EdmBomLayout2 ppoRetLayout = default(EdmBomLayout2);

                    bomMgr.GetBomLayouts2(out ppoRetLayouts);

                    i = 0;

                    arrSize = ppoRetLayouts.Length;

                    str = "";

                    while (i < arrSize)

                    {

                        ppoRetLayout = ppoRetLayouts[i];

                        canSeeLayout = bomMgr.CanSeeBomLayout(userID, ppoRetLayout.mlLayoutID);

                        bomMgr4 = (IEdmBomMgr4)bomMgr;

                        EdmBomDefaultSetting _bomDefSetting;

                        _bomDefSetting = bomMgr4.GetBomDefaultSetting(ppoRetLayout.mlLayoutID);

                           str = "";

                        switch (_bomDefSetting.mlBomDisplayType)

                        {

                            case 1: str = "BOM display type is indented";break;

                            case 2: str = "BOM display Type is parts only"; break;

                            case 3: str = "BOM display type is top level only"; break;

                            case 4: str = "BOM display type is Flattened"; break;

                        }

                        MessageBox.Show(str);

                        str = "BOM Layout " + i + ": " + ppoRetLayout.mbsLayoutName + "\r\n" + "ID: " + ppoRetLayout.mlLayoutID;

                        str = str + "  Logged-in user can see this layout? " + canSeeLayout;

                        if (ppoRetLayout.mbsLayoutName == "BOM")

                        {

                            bomView = (IEdmBomView3)aFile.GetComputedBOM(ppoRetLayout.mbsLayoutName, 0, "@", (int)EdmBomFlag.EdmBf_AsBuilt + (int)EdmBomFlag.EdmBf_ShowSelected);

                        }

                        MessageBox.Show(str);

                        i = i + 1;

                    }

                    // Display BOM view row and column information

                    object[] ppoRows = null;

                    IEdmBomCell ppoRow = default(IEdmBomCell);

                    bomView.GetRows(out ppoRows);

                    i = 0;

                    arrSize = ppoRows.Length;

                    str = "";

                    while (i < arrSize)

                    {

                        ppoRow = (IEdmBomCell)ppoRows[i];

                        str = "BOM Row " + i + ": " + "\r\n" + "Item ID: " + ppoRow.GetItemID() + "\r\n" + "Path name: " + ppoRow.GetPathName() + "\r\n" + "Tree level: " + ppoRow.GetTreeLevel() + "\r\n" + " Is locked? " + ppoRow.IsLocked();

                        MessageBox.Show(str);

                        i = i + 1;

                    }

                    EdmBomColumn[] ppoColumns = null;

                    bomView.GetColumns(out ppoColumns);

                    i = 0;

                    arrSize = ppoColumns.Length;

                    str = "";

                    while (i < arrSize)

                    {

                        str = "BOM Column " + i + ": " + "\r\n" + "Header: " + ppoColumns[i].mbsCaption + "\r\n" + "Column type as defined in EdmBomColumnType: " + ppoColumns[i].meType + "\r\n" + "ID: " + ppoColumns[i].mlColumnID + "\r\n" + "Flags: " + ppoColumns[i].mlFlags + "\r\n" + "Variable ID: " + ppoColumns[i].mlVariableID + "\r\n" + "Variable type as defined in EdmVariableType: " + ppoColumns[i].mlVariableType + "\r\n" + "Column width: " + ppoColumns[i].mlWidth;

                        MessageBox.Show(str);

                        i = i + 1;

                    }

                    SaveBOM.Enabled = true;

                }

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

Remarks

This interface:

  • extends IEdmBomMgr3 by providing the ability to get a computed BOM's default view settings as specified in the Conisio Admin tool.

To access this interface, call IEdmVault7::CreateUtility with eType = EdmUtility.EdmUtil_BomMgr and then cast the returned object to IEdmBomMgr4.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmBomMgr4 Members
EPDM.Interop.epdm Namespace


IEdmBomMgr4 Interface Members

IEdmBomMgr4 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr4 Interface

The following tables list the members exposed by IEdmBomMgr4.

Public Methods

 | Name | Description
Method | GetBomDefaultSetting | Gets the specified computed BOM's default view settings as specified in the Conisio Admin tool.
Top

See Also

IEdmBomMgr4 Interface
EPDM.Interop.epdm Namespace


IEdmBomMgr4 Interface Methods

IEdmBomMgr4 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomMgr4 Interface

For a list of all members of this type, see IEdmBomMgr4 members.

Public Methods

 | Name | Description
Method | GetBomDefaultSetting | Gets the specified computed BOM's default view settings as specified in the Conisio Admin tool.
Top

See Also

IEdmBomMgr4 Interface
EPDM.Interop.epdm Namespace


GetBomDefaultSetting Method (IEdmBomMgr4)

GetBomDefaultSetting Method (IEdmBomMgr4)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomMgr4 Interface : GetBomDefaultSetting Method (IEdmBomMgr4)

lLayoutId
BOM layout ID
Gets the specified computed BOM's default view settings as specified in the Conisio Admin tool.

Syntax

Visual Basic
Function GetBomDefaultSetting( _
   ByVal lLayoutId As System.Integer _
) As EdmBomDefaultSetting
C#
EdmBomDefaultSetting GetBomDefaultSetting(
   System.int lLayoutId
)
C++/CLI
EdmBomDefaultSetting GetBomDefaultSetting(
&   System.int lLayoutId
)

Parameters

lLayoutId
BOM layout ID

Return Value

EdmBomDefaultSetting

Example

See the IEdmBomMgr4 example.

Remarks

To specify lLayoutId, use IEdmBomMgr2::GetBomLayouts2 to find the layout ID of the BOM whose default settings you want to see.

See Also

IEdmBomMgr4 Interface
IEdmBomMgr4 Members

Availability

SOLIDWORKS PDM Professional 2025


IEdmBomView Interface

IEdmBomView Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBomView Interface

Allows you to access a Bill of Materials (BOM) view.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomView
C#
public interface IEdmBomView
C++/CLI
public interface class IEdmBomView

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmBomView2.

Accessors

IEdmBom::GetView

IEdmFile7::GetComputedBOM

See Also

IEdmBomView Members
EPDM.Interop.epdm Namespace


IEdmBomView Interface Members

IEdmBomView Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomView Interface

The following tables list the members exposed by IEdmBomView.

Public Methods

 | Name | Description
Method | Commit | Saves the BOM content.
Method | GetColumns | Gets the column definitions for this BOM.
Method | GetRows | Gets the row definitions for this BOM.
Method | SetRows | Adds new rows or reorders existing rows in this BOM.
Top

See Also

IEdmBomView Interface
EPDM.Interop.epdm Namespace


IEdmBomView Interface Methods

IEdmBomView Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomView Interface

For a list of all members of this type, see IEdmBomView members.

Public Methods

 | Name | Description
Method | Commit | Saves the BOM content.
Method | GetColumns | Gets the column definitions for this BOM.
Method | GetRows | Gets the row definitions for this BOM.
Method | SetRows | Adds new rows or reorders existing rows in this BOM.
Top

See Also

IEdmBomView Interface
EPDM.Interop.epdm Namespace


Commit Method (IEdmBomView)

Commit Method (IEdmBomView)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBomView Interface : Commit Method (IEdmBomView)

bsSaveAsBomName
Name of new BOM in which to save the BOM content; empty string to save changes to an existing BOM
pbsErrorMessage
Error message
plFocusNodeID
ID of node to which to set focus
Saves the BOM content.

Syntax

Visual Basic
Function Commit( _
   ByVal bsSaveAsBomName As System.String, _
   ByRef pbsErrorMessage As System.String, _
   ByRef plFocusNodeID As System.Integer _
) As System.Integer
C#
System.int Commit(
   System.string bsSaveAsBomName,
   out System.string pbsErrorMessage,
   out System.int plFocusNodeID
)
C++/CLI
System.int Commit(
&   System.String^ bsSaveAsBomName,
&   [Out] System.String^ pbsErrorMessage,
&   [Out] System.int plFocusNodeID
)

Parameters

bsSaveAsBomName
Name of new BOM in which to save the BOM content; empty string to save changes to an existing BOM
pbsErrorMessage
Error message
plFocusNodeID
ID of node to which to set focus

Return Value

Return codes

Example

Add Row to Bill of Materials (VB.NET)
Add Row to Bill of Materials (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomView Interface
IEdmBomView Members

Availability

SOLIDWORKS PDM Professional 2009


GetColumns Method (IEdmBomView)

GetColumns Method (IEdmBomView)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomView Interface : GetColumns Method (IEdmBomView)

ppoColumns
Array of EdmBomColumn structures; one structure for each BOM column
Gets the column definitions for this BOM.

Syntax

Visual Basic
Sub GetColumns( _
   ByRef ppoColumns() As EdmBomColumn _
)
C#
void GetColumns(
   out EdmBomColumn[] ppoColumns
)
C++/CLI
void GetColumns(
&   [Out] array<EdmBomColumn>^ ppoColumns
)

Parameters

ppoColumns
Array of EdmBomColumn structures; one structure for each BOM column

Example

See the IEdmBomView examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomView Interface
IEdmBomView Members

Availability

SOLIDWORKS PDM Professional 2009


GetRows Method (IEdmBomView)

GetRows Method (IEdmBomView)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomView Interface : GetRows Method (IEdmBomView)

ppoRows
Array of IEdmBomCells; one interface for each BOM row
Gets the row definitions for this BOM.

Syntax

Visual Basic
Sub GetRows( _
   ByRef ppoRows() As System.Object _
)
C#
void GetRows(
   out System.object[] ppoRows
)
C++/CLI
void GetRows(
&   [Out] System.array<Object^>^ ppoRows
)

Parameters

ppoRows
Array of IEdmBomCells; one interface for each BOM row

Example

See the IEdmBomView examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomView Interface
IEdmBomView Members

Availability

SOLIDWORKS PDM Professional 2009


SetRows Method (IEdmBomView)

SetRows Method (IEdmBomView)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomView Interface : SetRows Method (IEdmBomView)

poRows
Array of ordered IEdmBomCell interfaces; one interface for each BOM row
Adds new rows or reorders existing rows in this BOM.

Syntax

Visual Basic
Sub SetRows( _
   ByVal poRows() As System.Object _
)
C#
void SetRows(
   System.object[] poRows
)
C++/CLI
void SetRows(
&   System.array<Object^>^ poRows
)

Parameters

poRows
Array of ordered IEdmBomCell interfaces; one interface for each BOM row

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomView Interface
IEdmBomView Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmBomView2 Interface

IEdmBomView2 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBomView2 Interface

Allows you to access a Bill of Materials (BOM) view.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomView2
   Inherits IEdmBomView
C#
public interface IEdmBomView2 : IEdmBomView
C++/CLI
public interface class IEdmBomView2 : public IEdmBomView

Example

Add Row to Bill of Materials (VB.NET)
Add Row to Bill of Materials (C#)

Remarks

This interface:

  • extends IEdmBomView by adding the ability to insert a row in a named bill of materials.
  • is extended by IEdmBomView3.

See Also

IEdmBomView2 Members
EPDM.Interop.epdm Namespace


IEdmBomView2 Interface Members

IEdmBomView2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomView2 Interface

The following tables list the members exposed by IEdmBomView2.

Public Methods

 | Name | Description
Method | InsertRow | Inserts a row into this named BOM.
Top

See Also

IEdmBomView2 Interface
EPDM.Interop.epdm Namespace


IEdmBomView2 Interface Methods

IEdmBomView2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomView2 Interface

For a list of all members of this type, see IEdmBomView2 members.

Public Methods

 | Name | Description
Method | InsertRow | Inserts a row into this named BOM.
Top

See Also

IEdmBomView2 Interface
EPDM.Interop.epdm Namespace


InsertRow Method (IEdmBomView2)

InsertRow Method (IEdmBomView2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmBomView2 Interface : InsertRow Method (IEdmBomView2)

poRow
IEdmBomCell; existing row
eInsertOption
Where the new BOM row is inserted with respect to poRow as defined in EdmBomInsertRowOption
ppoNewRow
IEdmBomCell
Inserts a row into this named BOM.

Syntax

Visual Basic
Sub InsertRow( _
   ByVal poRow As EdmBomCell, _
   ByVal eInsertOption As EdmBomInsertRowOption, _
   ByRef ppoNewRow As EdmBomCell _
)
C#
void InsertRow(
   EdmBomCell poRow,
   EdmBomInsertRowOption eInsertOption,
   out EdmBomCell ppoNewRow
)
C++/CLI
void InsertRow(
&   EdmBomCell^ poRow,
&   EdmBomInsertRowOption eInsertOption,
&   [Out] EdmBomCell^ ppoNewRow
)

Parameters

poRow
IEdmBomCell; existing row
eInsertOption
Where the new BOM row is inserted with respect to poRow as defined in EdmBomInsertRowOption
ppoNewRow
IEdmBomCell

Example

Add Row to Bill of Materials (VB.NET)
Add Row to Bill of Materials (C#)

Remarks

This method is valid only for named BOMs.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomView2 Interface
IEdmBomView2 Members

Availability

SOLIDWORKS PDM Professional 2011 SP04


IEdmBomView3 Interface

IEdmBomView3 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmBomView3 Interface

Allows you to access a Bill of Materials (BOM) view.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomView3
   Inherits IEdmBomView, IEdmBomView2
C#
public interface IEdmBomView3 : IEdmBomView, IEdmBomView2
C++/CLI
public interface class IEdmBomView3 : public IEdmBomView, IEdmBomView2

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

This interface:

  • extends IEdmBomView2 by adding the ability to save the BOM to a comma separated values (CSV) file.
  • is extended by IEdmBomView4.

See Also

IEdmBomView3 Members
EPDM.Interop.epdm Namespace


IEdmBomView3 Interface Members

IEdmBomView3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomView3 Interface

The following tables list the members exposed by IEdmBomView3.

Public Methods

 | Name | Description
Method | SaveToCSV | Saves this BOM to a comma separated values (CSV) file.
Top

See Also

IEdmBomView3 Interface
EPDM.Interop.epdm Namespace


IEdmBomView3 Interface Methods

IEdmBomView3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomView3 Interface

For a list of all members of this type, see IEdmBomView3 members.

Public Methods

 | Name | Description
Method | SaveToCSV | Saves this BOM to a comma separated values (CSV) file.
Top

See Also

IEdmBomView3 Interface
EPDM.Interop.epdm Namespace


SaveToCSV Method (IEdmBomView3)

SaveToCSV Method (IEdmBomView3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomView3 Interface : SaveToCSV Method (IEdmBomView3)

bsFilePath
Path and file name (*.CSV) to which to save this BOM
bCreateLevelColumn
True to include a level column in the CSV file for an indented BOM, false to not
Saves this BOM to a comma separated values (CSV) file.

Syntax

Visual Basic
Sub SaveToCSV( _
   ByVal bsFilePath As System.String, _
   ByVal bCreateLevelColumn As System.Boolean _
)
C#
void SaveToCSV(
   System.string bsFilePath,
   System.bool bCreateLevelColumn
)
C++/CLI
void SaveToCSV(
&   System.String^ bsFilePath,
&   System.bool bCreateLevelColumn
)

Parameters

bsFilePath
Path and file name (*.CSV) to which to save this BOM
bCreateLevelColumn
True to include a level column in the CSV file for an indented BOM, false to not

Example

See the IEdmBomView3 examples.

See Also

IEdmBomView3 Interface
IEdmBomView3 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmBomView4 Interface

IEdmBomView4 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmBomView4 Interface

Allows you to access a Bill of Materials (BOM) view.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmBomView4
   Inherits IEdmBomView, IEdmBomView2, IEdmBomView3
C#
public interface IEdmBomView4 : IEdmBomView, IEdmBomView2, IEdmBomView3
C++/CLI
public interface class IEdmBomView4 : public IEdmBomView, IEdmBomView2, IEdmBomView3

Remarks

This interface extends IEdmBomView3 by adding the ability to rename a named BOM.

Accessors

IEdmBom::GetView

IEdmFile7::GetComputedBOM

See Also

IEdmBomView4 Members
EPDM.Interop.epdm Namespace


IEdmBomView4 Interface Members

IEdmBomView4 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmBomView4 Interface

The following tables list the members exposed by IEdmBomView4.

Public Methods

 | Name | Description
Method | Rename | Renames this named BOM.
Top

See Also

IEdmBomView4 Interface
EPDM.Interop.epdm Namespace


IEdmBomView4 Interface Methods

IEdmBomView4 Interface Methods
EPDM.Interop.epdm Namespace : IEdmBomView4 Interface

For a list of all members of this type, see IEdmBomView4 members.

Public Methods

 | Name | Description
Method | Rename | Renames this named BOM.
Top

See Also

IEdmBomView4 Interface
EPDM.Interop.epdm Namespace


Rename Method (IEdmBomView4)

Rename Method (IEdmBomView4)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomView4 Interface : Rename Method (IEdmBomView4)

bsFileName
New file name of named BOM
Renames this named BOM.

Syntax

Visual Basic
Sub Rename( _
   ByVal bsFileName As System.String _
)
C#
void Rename(
   System.string bsFileName
)
C++/CLI
void Rename(
&   System.String^ bsFileName
)

Parameters

bsFileName
New file name of named BOM

Example

// Preconditions:

// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Console > Console App.
// 3. Type RenameBomCSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Add dependencies and safely pass arrays of structures.
// 9. Copy the code below to Program.cs.
//10. Change the namespace to match your project name.
//11. Add an assembly with a named BOM to your vault.
//12. Ensure that parameters of Login, and GetFileFromPath match your vault.
//13. Modify the Rename method’s parameter to rename your assembly’s named BOM.

//

//Postconditions:

//1. Refresh your vault view.
//2. Select the assembly with the named BOM in the vault.
//3. Observe the renamed BOM in the BOM dropdown on the Bill of Materials tab.

//Program.cs:

using System;

using EPDM.Interop.epdm;
using EPDM.Interop.EPDMResultCode;

using System.Windows.Forms;

namespace RenameBomCSharp

{

    class Program

    {

        static IEdmVault5 vault1 = null;

        static IEdmFile7 aFile;

        static string userName = "Admin";

        static void Main(string[] args)

        {

            try

            {

                vault1 = new EdmVault5();

                if (!vault1.IsLoggedIn)

                    vault1.Login(userName, "password", "JEB12");

                IEdmVault7 vault7 = (IEdmVault7)vault1;

                IEdmFolder5 ppoRetParentFolder;

                aFile = (IEdmFile7)vault1.GetFileFromPath("C:\\Users\\J4M\\Desktop\\JEB12\\test3.sldasm", out ppoRetParentFolder);

                EdmBomInfo[] derivedBOMs = null;

                aFile.GetDerivedBOMs(out derivedBOMs);

                int bomId = derivedBOMs[0].mlBomID;

                IEdmBom bom = (IEdmBom)vault7.GetObject(EdmObjectType.EdmObject_BOM, bomId);

                EdmBomVersion[] ppoVersions = null;

                bom.GetVersions(out ppoVersions);

                IEdmBomView4 bomView = (IEdmBomView4)bom.GetView(ppoVersions[ppoVersions.Length - 1].mlVersion);

                bomView.Rename("test3_renamed.sldasm.1.BOM");

                Console.WriteLine("BOM successfully renamed");

                Console.WriteLine("Press any key to exit");

                Console.ReadKey();

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                var errorType = typeof(EdmResultErrorCodes_e);

                if (Enum.IsDefined(errorType, ex.ErrorCode))

                    MessageBox.Show(String.Format("Error occurred: {0}", Enum.GetName(errorType, ex.ErrorCode)));

                else

                    MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

    }

}

Remarks

Named BOMs are saved as:

file_name.sldext.version.BOM

Be sure to use the correct format when specifying bsFileName. For example, if you get assembly.sldasm, then to rename its BOM set bsFileName to:

assembly_renamed.sldasm.1.BOM

See Also

IEdmBomView4 Interface
IEdmBomView4 Members

Availability

SOLIDWORKS PDM Professional 2022


IEdmCallback Interface

IEdmCallback Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCallback Interface

Monitors the progress of a supported API operation.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCallback
C#
public interface IEdmCallback
C++/CLI
public interface class IEdmCallback

Example

Create Card View (VB.NET)
Create Card View (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

This callback interface works only with API methods that provide a poCallback argument. For example:

  • IEdmFolder5::CreateCardView
  • IEdmBatchAdd::CommitAdd
  • IEdmBatchChangeState::ChangeState
  • IEdmBatchDelete::CommitDelete
  • IEdmBatchUpdate2::CommitUpdate
  • IEdmClearLocalCache::CommitClear
  • IEdmUserMgr8::CreateUserPicture
  • IEdmVault10::CreateCardViewEx2
  • IEdmVault11::CreateNewVault

To use this interface:

  1. Create a new class.
  2. Implement all of the methods of IEdmCallback in the new class.
  3. Call one of the API methods whose progress you want to monitor, setting its poCallback argument to a pointer to the new class.

See Also

IEdmCallback Members
EPDM.Interop.epdm Namespace
IEdmFolder5::CreateCardView Method ()
IEdmEnumeratorVariable5::StoreValuesFromDatabase Method ()


IEdmCallback Interface Members

IEdmCallback Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCallback Interface

The following tables list the members exposed by IEdmCallback.

Public Methods

 | Name | Description
Method | SetModifiedFlag | Indicates that the contents of a document have changed.
Method | SetProgressPos | Sets the current position in the progress bar.
Method | SetProgressRange | Sets the minimum and maximum values in the progress bar.
Method | SetStatusMessage | Displays a message to the user.
Top

See Also

IEdmCallback Interface
EPDM.Interop.epdm Namespace
IEdmFolder5::CreateCardView Method ()
IEdmEnumeratorVariable5::StoreValuesFromDatabase Method ()


IEdmCallback Interface Methods

IEdmCallback Interface Methods
EPDM.Interop.epdm Namespace : IEdmCallback Interface

For a list of all members of this type, see IEdmCallback members.

Public Methods

 | Name | Description
Method | SetModifiedFlag | Indicates that the contents of a document have changed.
Method | SetProgressPos | Sets the current position in the progress bar.
Method | SetProgressRange | Sets the minimum and maximum values in the progress bar.
Method | SetStatusMessage | Displays a message to the user.
Top

See Also

IEdmCallback Interface
EPDM.Interop.epdm Namespace
IEdmFolder5::CreateCardView Method ()
IEdmEnumeratorVariable5::StoreValuesFromDatabase Method ()


SetModifiedFlag Method (IEdmCallback)

SetModifiedFlag Method (IEdmCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback Interface : SetModifiedFlag Method (IEdmCallback)

Indicates that the contents of a document have changed.

Syntax

Visual Basic
Sub SetModifiedFlag()
C#
void SetModifiedFlag()
C++/CLI
void SetModifiedFlag();

Example

See the IEdmCallback examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCallback Interface
IEdmCallback Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SetProgressPos Method (IEdmCallback)

SetProgressPos Method (IEdmCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback Interface : SetProgressPos Method (IEdmCallback)

lPos
Current position in the progress bar
Sets the current position in the progress bar.

Syntax

Visual Basic
Sub SetProgressPos( _
   ByVal lPos As System.Integer _
)
C#
void SetProgressPos(
   System.int lPos
)
C++/CLI
void SetProgressPos(
&   System.int lPos
)

Parameters

lPos
Current position in the progress bar

Example

See the IEdmCallback examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_CANCELLED_BY_USER: Cancel the operation.

See Also

IEdmCallback Interface
IEdmCallback Members
IEdmCallback::SetProgressRange Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


SetProgressRange Method (IEdmCallback)

SetProgressRange Method (IEdmCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback Interface : SetProgressRange Method (IEdmCallback)

lMin
Minimum value in the progress bar
lMax
Maximum value in the progress bar
Sets the minimum and maximum values in the progress bar.

Syntax

Visual Basic
Sub SetProgressRange( _
   ByVal lMin As System.Integer, _
   ByVal lMax As System.Integer _
)
C#
void SetProgressRange(
   System.int lMin,
   System.int lMax
)
C++/CLI
void SetProgressRange(
&   System.int lMin,
&   System.int lMax
)

Parameters

lMin
Minimum value in the progress bar
lMax
Maximum value in the progress bar

Example

See the IEdmCallback examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_CANCELLED_BY_USER: Cancel the operation.

See Also

IEdmCallback Interface
IEdmCallback Members
IEdmCallback::SetProgressPos Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


SetStatusMessage Method (IEdmCallback)

SetStatusMessage Method (IEdmCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback Interface : SetStatusMessage Method (IEdmCallback)

bsMessage
Message to display
Displays a message to the user.

Syntax

Visual Basic
Sub SetStatusMessage( _
   ByVal bsMessage As System.String _
)
C#
void SetStatusMessage(
   System.string bsMessage
)
C++/CLI
void SetStatusMessage(
&   System.String^ bsMessage
)

Parameters

bsMessage
Message to display

Example

See the IEdmCallback examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_CANCELLED_BY_USER: Cancel the operation.

See Also

IEdmCallback Interface
IEdmCallback Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmCallback6 Interface

IEdmCallback6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCallback6 Interface

Monitors the progress of a supported API operation.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCallback6
C#
public interface IEdmCallback6
C++/CLI
public interface class IEdmCallback6

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

This interface inherits from IUnknown. See Using and Implementing IUnknown (COM).

This callback interface works only with methods that provide a poCallback argument. For example:

  • IEdmFolder6::AddFiles
  • IEdmBatchAdd::CommitAdd

To use this interface:

  1. Create a new class.
  2. Implement all of the methods of IEdmCallback6 in the new class.
  3. Call one of the methods whose progress you want to monitor, setting its poCallback argument to a pointer to the new class.

See Also

IEdmCallback6 Members
EPDM.Interop.epdm Namespace


IEdmCallback6 Interface Members

IEdmCallback6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCallback6 Interface

The following tables list the members exposed by IEdmCallback6.

Public Methods

 | Name | Description
Method | MsgBox | Displays a message box.
Method | Resolve | Resolves multiple errors.
Method | SetProgress | Sets the current progress bar position.
Method | SetProgressRange | Sets the maximum value for a progress bar.
Method | SetStatusMessage | Displays a message to the user.
Top

See Also

IEdmCallback6 Interface
EPDM.Interop.epdm Namespace


IEdmCallback6 Interface Methods

IEdmCallback6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCallback6 Interface

For a list of all members of this type, see IEdmCallback6 members.

Public Methods

 | Name | Description
Method | MsgBox | Displays a message box.
Method | Resolve | Resolves multiple errors.
Method | SetProgress | Sets the current progress bar position.
Method | SetProgressRange | Sets the maximum value for a progress bar.
Method | SetStatusMessage | Displays a message to the user.
Top

See Also

IEdmCallback6 Interface
EPDM.Interop.epdm Namespace


MsgBox Method (IEdmCallback6)

MsgBox Method (IEdmCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback6 Interface : MsgBox Method (IEdmCallback6)

lParentWnd
Handle of the parent window
lMsgID
ID of the message to be shown (see Remarks)
bsMsg
Message to be displayed
eType
Message box type as defined in EdmMBoxType
Displays a message box.

Syntax

Visual Basic
Function MsgBox( _
   ByVal lParentWnd As System.Integer, _
   ByVal lMsgID As System.Integer, _
   ByVal bsMsg As System.String, _
   Optional ByVal eType As EdmMBoxType _
) As EdmMBoxResult
C#
EdmMBoxResult MsgBox(
   System.int lParentWnd,
   System.int lMsgID,
   System.string bsMsg,
   EdmMBoxType eType
)
C++/CLI
EdmMBoxResult MsgBox(
&   System.int lParentWnd,
&   System.int lMsgID,
&   System.String^ bsMsg,
&   EdmMBoxType eType
)

Parameters

lParentWnd
Handle of the parent window
lMsgID
ID of the message to be shown (see Remarks)
bsMsg
Message to be displayed
eType
Message box type as defined in EdmMBoxType

Return Value

Message box result as defined in EdmMBoxResult

Example

See the IEdmCallback6 examples.

Remarks

For callbacks during add operations, IMsgID is one of the values defined in EdmAddCallbackMsgID.

Return codes:

  • S_OK: The method successfully executed.
  • <any error code>: The calling method terminated.

See Also

IEdmCallback6 Interface
IEdmCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


Resolve Method (IEdmCallback6)

Resolve Method (IEdmCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback6 Interface : Resolve Method (IEdmCallback6)

lParentWnd
Handle of the parent window
ppoItems
Array of EdmCmdData structures; one structure for each item that needs to be resolved (see Remarks)
Resolves multiple errors.

Syntax

Visual Basic
Sub Resolve( _
   ByVal lParentWnd As System.Integer, _
   ByRef ppoItems() As EdmCmdData _
)
C#
void Resolve(
   System.int lParentWnd,
   out EdmCmdData[] ppoItems
)
C++/CLI
void Resolve(
&   System.int lParentWnd,
&   [Out] array<EdmCmdData>^ ppoItems
)

Parameters

lParentWnd
Handle of the parent window
ppoItems
Array of EdmCmdData structures; one structure for each item that needs to be resolved (see Remarks)

Example

See the IEdmCallback6 examples.

Remarks

SOLIDWORKS PDM Professional continues to call this method until all errors are resolved or until this method returns an error code. If you do not properly implement this method to return an error code, you may cause your program to hang.

Contents of each ppoItem EdmCmdData structure:

Member | Direction | Contents
mlObjectID1 | Input | ID of the source file that is being copied; 0 if the file is copied from outside the vault
mlObjectID2 | Input | ID of the source file's parent folder; 0 if the file is copied from outside the vault
mbsStrData1 | Input | Path to the source file
mbsStrData2 | Input | Path to the destination file
mlLongData1 | Input | Combination of EdmResolveReason bits telling why this method is called
mlLongData2 | Output | Combination of EdmResolveAction bits telling SOLIDWORKS PDM Professional how to proceed

The ppoItems array may contain items that do not need to be resolved. The mlLongData1 struct members for those items are zero.

See Also

IEdmCallback6 Interface
IEdmCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


SetProgress Method (IEdmCallback6)

SetProgress Method (IEdmCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback6 Interface : SetProgress Method (IEdmCallback6)

lBarIndex
0-based index of the progress bar
lPos
Current position
bsMsg
Message to be displayed
Sets the current progress bar position.

Syntax

Visual Basic
Function SetProgress( _
   ByVal lBarIndex As System.Integer, _
   ByVal lPos As System.Integer, _
   ByVal bsMsg As System.String _
) As System.Boolean
C#
System.bool SetProgress(
   System.int lBarIndex,
   System.int lPos,
   System.string bsMsg
)
C++/CLI
System.bool SetProgress(
&   System.int lBarIndex,
&   System.int lPos,
&   System.String^ bsMsg
)

Parameters

lBarIndex
0-based index of the progress bar
lPos
Current position
bsMsg
Message to be displayed

Return Value

True to continue, false to cancel

Example

See the IEdmCallback6 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • <any error code>: The calling method terminated.

See Also

IEdmCallback6 Interface
IEdmCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


SetProgressRange Method (IEdmCallback6)

SetProgressRange Method (IEdmCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback6 Interface : SetProgressRange Method (IEdmCallback6)

lBarIndex
0-based index of the progress bar
lMax
Maximum value for the progress bar; minimum value is always 0
Sets the maximum value for a progress bar.

Syntax

Visual Basic
Sub SetProgressRange( _
   ByVal lBarIndex As System.Integer, _
   ByVal lMax As System.Integer _
)
C#
void SetProgressRange(
   System.int lBarIndex,
   System.int lMax
)
C++/CLI
void SetProgressRange(
&   System.int lBarIndex,
&   System.int lMax
)

Parameters

lBarIndex
0-based index of the progress bar
lMax
Maximum value for the progress bar; minimum value is always 0

Example

See the IEdmCallback6 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • <any error code>: The calling method terminated.

See Also

IEdmCallback6 Interface
IEdmCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


SetStatusMessage Method (IEdmCallback6)

SetStatusMessage Method (IEdmCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback6 Interface : SetStatusMessage Method (IEdmCallback6)

lBarIndex
0-based index of the progress bar
bsMessage
Message to display
Displays a message to the user.

Syntax

Visual Basic
Sub SetStatusMessage( _
   ByVal lBarIndex As System.Integer, _
   ByVal bsMessage As System.String _
)
C#
void SetStatusMessage(
   System.int lBarIndex,
   System.string bsMessage
)
C++/CLI
void SetStatusMessage(
&   System.int lBarIndex,
&   System.String^ bsMessage
)

Parameters

lBarIndex
0-based index of the progress bar
bsMessage
Message to display

Example

See the IEdmCallback6 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • <any error code>: The calling method terminated.

See Also

IEdmCallback6 Interface
IEdmCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmCallback8 Interface

IEdmCallback8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmCallback8 Interface

Monitors the progress of a supported API operation.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCallback8
   Inherits IEdmCallback6
C#
public interface IEdmCallback8 : IEdmCallback6
C++/CLI
public interface class IEdmCallback8 : public IEdmCallback6

Remarks

This interface extends IEdmCallback6 by providing the ability to specify minor progress parameters.

See Also

IEdmCallback8 Members
EPDM.Interop.epdm Namespace


IEdmCallback8 Interface Members

IEdmCallback8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCallback8 Interface

The following tables list the members exposed by IEdmCallback8.

Public Methods

 | Name | Description
Method | ChangeMinorProgressVisibility | Change whether to display minor progress of this callback.
Method | SetMinorMax | Sets the maximum minor progress of this callback.
Method | SetMinorProgress | Sets the current minor progress bar position.
Top

See Also

IEdmCallback8 Interface
EPDM.Interop.epdm Namespace


IEdmCallback8 Interface Methods

IEdmCallback8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCallback8 Interface

For a list of all members of this type, see IEdmCallback8 members.

Public Methods

 | Name | Description
Method | ChangeMinorProgressVisibility | Change whether to display minor progress of this callback.
Method | SetMinorMax | Sets the maximum minor progress of this callback.
Method | SetMinorProgress | Sets the current minor progress bar position.
Top

See Also

IEdmCallback8 Interface
EPDM.Interop.epdm Namespace


ChangeMinorProgressVisibility Method (IEdmCallback8)

ChangeMinorProgressVisibility Method (IEdmCallback8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback8 Interface : ChangeMinorProgressVisibility Method (IEdmCallback8)

bShow
True to display minor progress, false to not
Change whether to display minor progress of this callback.

Syntax

Visual Basic
Sub ChangeMinorProgressVisibility( _
   ByVal bShow As System.Boolean _
)
C#
void ChangeMinorProgressVisibility(
   System.bool bShow
)
C++/CLI
void ChangeMinorProgressVisibility(
&   System.bool bShow
)

Parameters

bShow
True to display minor progress, false to not

See Also

IEdmCallback8 Interface
IEdmCallback8 Members

Availability

SOLIDWORKS PDM Professional 2021


SetMinorMax Method (IEdmCallback8)

SetMinorMax Method (IEdmCallback8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback8 Interface : SetMinorMax Method (IEdmCallback8)

dwMax
Maximum minor progress
Sets the maximum minor progress of this callback.

Syntax

Visual Basic
Sub SetMinorMax( _
   ByVal dwMax As System.UInteger _
)
C#
void SetMinorMax(
   System.uint dwMax
)
C++/CLI
void SetMinorMax(
&   System.uint dwMax
)

Parameters

dwMax
Maximum minor progress

See Also

IEdmCallback8 Interface
IEdmCallback8 Members

Availability

SOLIDWORKS PDM Professional 2021


SetMinorProgress Method (IEdmCallback8)

SetMinorProgress Method (IEdmCallback8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCallback8 Interface : SetMinorProgress Method (IEdmCallback8)

oMsg
Message to be displayed
dwProgress
Progress
Sets the current minor progress bar position.

Syntax

Visual Basic
Sub SetMinorProgress( _
   ByVal oMsg As System.String, _
   ByVal dwProgress As System.UInteger _
)
C#
void SetMinorProgress(
   System.string oMsg,
   System.uint dwProgress
)
C++/CLI
void SetMinorProgress(
&   System.String^ oMsg,
&   System.uint dwProgress
)

Parameters

oMsg
Message to be displayed
dwProgress
Progress

See Also

IEdmCallback8 Interface
IEdmCallback8 Members

Availability

SOLIDWORKS PDM Professional 2021


IEdmCard5 Interface

IEdmCard5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCard5 Interface

Allows you to access the file or folder data card that is created with the SOLIDWORKS PDM Professional's Card Editor.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCard5
   Inherits IEdmObject5
C#
public interface IEdmCard5 : IEdmObject5
C++/CLI
public interface class IEdmCard5 : public IEdmObject5

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)
Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmCard6.

To access this interface, call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_Card.

Accessors

IEdmFolder5::GetCard

IEdmVault5::GetObject

See Also

IEdmCard5 Members
EPDM.Interop.epdm Namespace


IEdmCard5 Interface Members

IEdmCard5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCard5 Interface

The following tables list the members exposed by IEdmCard5.

Public Methods

 | Name | Description
Method | GetControl | Gets a card control with the specified ID.
Method | GetControlID | Gets the ID of the control that is connected to the specified variable in this card.
Method | GetFirstControlPosition | Starts an enumeration of the controls in this data card.
Method | GetNextControl | Gets the next control in the enumeration.
Method | GetSize | Gets the size of this data card.
Top

See Also

IEdmCard5 Interface
EPDM.Interop.epdm Namespace


IEdmCard5 Interface Methods

IEdmCard5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCard5 Interface

For a list of all members of this type, see IEdmCard5 members.

Public Methods

 | Name | Description
Method | GetControl | Gets a card control with the specified ID.
Method | GetControlID | Gets the ID of the control that is connected to the specified variable in this card.
Method | GetFirstControlPosition | Starts an enumeration of the controls in this data card.
Method | GetNextControl | Gets the next control in the enumeration.
Method | GetSize | Gets the size of this data card.
Top

See Also

IEdmCard5 Interface
EPDM.Interop.epdm Namespace


GetControl Method (IEdmCard5)

GetControl Method (IEdmCard5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCard5 Interface : GetControl Method (IEdmCard5)

lControlID
ID of card control to get
Gets a card control with the specified ID.

Syntax

Visual Basic
Function GetControl( _
   ByVal lControlID As System.Integer _
) As IEdmCardControl5
C#
IEdmCardControl5 GetControl(
   System.int lControlID
)
C++/CLI
IEdmCardControl5^ GetControl(
&   System.int lControlID
)

Parameters

lControlID
ID of card control to get

Return Value

IEdmCardControl5

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: The supplied control is invalid.
  • E_EDM_DATABASE_ACCESS: The supplied control ID is invalid.

See Also

IEdmCard5 Interface
IEdmCard5 Members
IEdmCard5::GetControlID Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetControlID Method (IEdmCard5)

GetControlID Method (IEdmCard5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCard5 Interface : GetControlID Method (IEdmCard5)

poVariableNameOrID
ID or name of the variable for which to get the control ID
Gets the ID of the control that is connected to the specified variable in this card.

Syntax

Visual Basic
Function GetControlID( _
   ByRef poVariableNameOrID As System.Object _
) As System.Integer
C#
System.int GetControlID(
   ref System.object poVariableNameOrID
)
C++/CLI
System.int GetControlID(
&   System.Object^% poVariableNameOrID
)

Parameters

poVariableNameOrID
ID or name of the variable for which to get the control ID

Return Value

Control ID; 0 if the variable isn't used by any control in this card

Remarks

If more than one control is connected to the same variable, there is no way of knowing for which control this method returns an ID.

The returned ID can be passed to IEdmCard5::GetControl or IEdmVault5::GetObject in order to obtain IEdmCardControl5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable was not found.

See Also

IEdmCard5 Interface
IEdmCard5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstControlPosition Method (IEdmCard5)

GetFirstControlPosition Method (IEdmCard5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmCard5 Interface : GetFirstControlPosition Method (IEdmCard5)

Starts an enumeration of the controls in this data card.

Syntax

Visual Basic
Function GetFirstControlPosition() As IEdmPos5
C#
IEdmPos5 GetFirstControlPosition()
C++/CLI
IEdmPos5^ GetFirstControlPosition();

Return Value

IEdmPos5; position of the first control in the list

Example

Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

After calling this method, pass the returned position of the first control to IEdmCard5::GetNextControl to get the first control in the list. Call IEdmCard5::GetNextControl repeatedly to get the rest of the controls in the list.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCard5 Interface
IEdmCard5 Members
IEdmCard5::GetNextControl Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextControl Method (IEdmCard5)

GetNextControl Method (IEdmCard5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmCard5 Interface : GetNextControl Method (IEdmCard5)

poPos
IEdmPos5; position of the next control in the list
Gets the next control in the enumeration.

Syntax

Visual Basic
Function GetNextControl( _
   ByVal poPos As IEdmPos5 _
) As IEdmCardControl5
C#
IEdmCardControl5 GetNextControl(
   IEdmPos5 poPos
)
C++/CLI
IEdmCardControl5^ GetNextControl(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next control in the list

Return Value

IEdmCardControl5

Example

Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first control, IEdmPos5. Call IEdmCard5::GetFirstControlPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the controls.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: There are no more controls to get; IEdmPos5::IsNull is true.

See Also

IEdmCard5 Interface
IEdmCard5 Members
IEdmCard5::GetFirstControlPosition Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetSize Method (IEdmCard5)

GetSize Method (IEdmCard5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmCard5 Interface : GetSize Method (IEdmCard5)

plWidth
Width in pixels of this data card
plHeight
Height in pixels of this data card
Gets the size of this data card.

Syntax

Visual Basic
Sub GetSize( _
   ByRef plWidth As System.Integer, _
   ByRef plHeight As System.Integer _
)
C#
void GetSize(
   out System.int plWidth,
   out System.int plHeight
)
C++/CLI
void GetSize(
&   [Out] System.int plWidth,
&   [Out] System.int plHeight
)

Parameters

plWidth
Width in pixels of this data card
plHeight
Height in pixels of this data card

Example

Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCard5 Interface
IEdmCard5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmCard6 Interface

IEdmCard6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCard6 Interface

Allows you to access the file or folder data card that is created with the SOLIDWORKS PDM Professional's Card Editor.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCard6
   Inherits IEdmCard5, IEdmObject5
C#
public interface IEdmCard6 : IEdmCard5, IEdmObject5
C++/CLI
public interface class IEdmCard6 : public IEdmCard5, IEdmObject5

Example

Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

This interface extends IEdmCard5 by getting the card type.

To access this interface, call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_Card.

See Also

IEdmCard6 Members
EPDM.Interop.epdm Namespace


IEdmCard6 Interface Members

IEdmCard6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmCard6 Interface

The following tables list the members exposed by IEdmCard6.

Public Properties

 | Name | Description
Property | CardType | Gets the type of this data card.
Top

See Also

IEdmCard6 Interface
EPDM.Interop.epdm Namespace


IEdmCard6 Interface Properties

IEdmCard6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmCard6 Interface

For a list of all members of this type, see IEdmCard6 members.

Public Properties

 | Name | Description
Property | CardType | Gets the type of this data card.
Top

See Also

IEdmCard6 Interface
EPDM.Interop.epdm Namespace


CardType Property (IEdmCard6)

CardType Property (IEdmCard6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCard6 Interface : CardType Property (IEdmCard6)

Gets the type of this data card.

Syntax

Visual Basic
ReadOnly Property CardType As EdmCardType
C#
EdmCardType CardType {get;}
C++/CLI
property EdmCardType CardType {
   EdmCardType get();
}

Property Value

Type of data card as defined in EdmCardType

Example

See the IEdmCard6 examples.

See Also

IEdmCard6 Interface
IEdmCard6 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmCard7 Interface

IEdmCard7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmCard7 Interface

Allows you to access the file or folder data card that is created with the SOLIDWORKS PDM Professional's Card Editor.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCard7
   Inherits IEdmCard5, IEdmCard6, IEdmObject5
C#
public interface IEdmCard7 : IEdmCard5, IEdmCard6, IEdmObject5
C++/CLI
public interface class IEdmCard7 : public IEdmCard5, IEdmCard6, IEdmObject5

Example

// C# code snippet

// Taken from IEdmCard6 example and modified

IEdmVault5 vault1 = null;
IEdmFile5 aFile;
IEdmFolder5 aFolder;
IEdmCard7 aCard;
IEdmCardControl7 aControl;
int plWidth;
int plHeight;
int plX;
int plY;
int plParentCtrlID;
int plPageNo;
object poMin = null;
object poMax = null;
int varType;
int contType;
string fileExt;
int cardID;
string str;
...

public void GetCardControls_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}

vault2 = (IEdmVault9)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

if ((aFile != null))
{
// Get the selected file's data card
aCard = (IEdmCard7)aFolder.GetCard(fileExt);
cardID = aFolder.GetCardID(fileExt);

aCard.GetSize(out plWidth, out plHeight);
str = "File: " + aFile.Name + Constants.vbLf + "Card ID: " + cardID + ", EdmCardType: " + aCard.CardType + ", Width: " + plWidth + ", Height: " + plHeight;
MessageBox.Show(str);

// Get all controls in the data card
 object [] CardControlsArray = null;
aCard.GetAllControls(out CardControlsArray);

for(int i=0; i < CardControlsArray.size(); i++)
{

object aTmpControl = CardControlsArray[i];

aControl = (IEdmCardControl7) aTmpControl;

contType = (int)aControl.ControlType;

bool ret = false;
string[] variableItemsList = null;
if (((contType == 7) | (contType == 8) | (contType == 9) | (contType == 10)))
{
str = "List values associated with drop-down card control: " + aControl.VariableID.ToString();
ret = aControl.GetControlVariableList(aFile.ID, out variableItemsList);

foreach (string listValue in variableItemsList)
{
str = str + Constants.vbLf + listValue;
}
MessageBox.Show(str);
}

// Get the edit box controls on the card
if (contType == 4)
{
str = "";
aControl.GetParentInfo(out plParentCtrlID, out plPageNo);
aControl.GetPosition(out plX, out plY, out plWidth, out plHeight);
varType = (int)aControl.GetValidation(out poMin, out poMax);

str = "Card control: " + aControl.Name;
str = str + Constants.vbLf + "Variable ID: " + aControl.VariableID + Constants.vbLf + "EdmCardControlType: " + contType + Constants.vbLf + "Is multi-line? " + aControl.IsMultiLine + Constants.vbLf + "Is read-only? " + aControl.IsReadOnly + Constants.vbLf + "Show in preview? " + aControl.ShowInPreview;
str = str + Constants.vbLf + "Location on card: [" + plX + ", " + plY + "], Width: " + plWidth + ", Height: " + plHeight;
str = str + Constants.vbLf + "Parent control ID (0, if none): " + plParentCtrlID;
str = str + Constants.vbLf + "Tab index: " + plPageNo;
str = str + Constants.vbLf + "EdmVariableType: " + varType;

str = str + Constants.vbLf + "Updates all configurations? " + aControl.UpdatesAllConfigurations.ToString();

MessageBox.Show(str);
}
}
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

Remarks

This interface extends IEdmCard6 by providing the ability to get all controls in the file or folder data card.

Accessors

IEdmFolder5::GetCard

IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_Card

See Also

IEdmCard7 Members
EPDM.Interop.epdm Namespace


IEdmCard7 Interface Members

IEdmCard7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCard7 Interface

The following tables list the members exposed by IEdmCard7.

Public Methods

 | Name | Description
Method | GetAllControls | Gets all controls in this file or folder data card.
Top

See Also

IEdmCard7 Interface
EPDM.Interop.epdm Namespace


IEdmCard7 Interface Methods

IEdmCard7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCard7 Interface

For a list of all members of this type, see IEdmCard7 members.

Public Methods

 | Name | Description
Method | GetAllControls | Gets all controls in this file or folder data card.
Top

See Also

IEdmCard7 Interface
EPDM.Interop.epdm Namespace


GetAllControls Method (IEdmCard7)

GetAllControls Method (IEdmCard7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCard7 Interface : GetAllControls Method (IEdmCard7)

ppControlsList
Array of IEdmCardControl5
Gets all controls in this file or folder data card.

Syntax

Visual Basic
Sub GetAllControls( _
   ByRef ppControlsList() As System.Object _
)
C#
void GetAllControls(
   out System.object[] ppControlsList
)
C++/CLI
void GetAllControls(
&   [Out] System.array<Object^>^ ppControlsList
)

Parameters

ppControlsList
Array of IEdmCardControl5

Example

See the IEdmCard7 example.

See Also

IEdmCard7 Interface
IEdmCard7 Members

Availability

SOLIDWORKS PDM Professional 2019 SP03


IEdmCardControl5 Interface

IEdmCardControl5 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmCardControl5 Interface

Allows you to access a control in a file or folder data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardControl5
   Inherits IEdmObject5
C#
public interface IEdmCardControl5 : IEdmObject5
C++/CLI
public interface class IEdmCardControl5 : public IEdmObject5

Remarks

This interface:

  • inherits from IEdmObject5.
  • extends IEdmCardControl6.

To access this interface, call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_CardControl.

Accessors

IEdmCard5::GetControl

IEdmCard5::GetNextControl

IEdmVault5::GetObject

See Also

IEdmCardControl5 Members
EPDM.Interop.epdm Namespace


IEdmCardControl5 Interface Members

IEdmCardControl5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmCardControl5 Interface

The following tables list the members exposed by IEdmCardControl5.

Public Properties

 | Name | Description
Property | ControlType | Gets the type of this control.
Property | IsMultiLine | Gets whether this edit box is handles multiple lines.
Property | IsReadOnly | Gets whether this control is read-only.
Property | ShowInPreview | Gets whether the contents of this control display in the preview.
Property | VariableID | Gets the ID of the variable to which this control is connected.
Top

Public Methods

 | Name | Description
Method | GetButtonCommand | Gets the command string that is executed when a button is clicked in the Card Editor.
Method | GetParentInfo | Gets the parent control of this control.
Method | GetPosition | Gets the dimensions and position of this control.
Method | GetValidation | Gets the input validation criteria for this control.
Top

See Also

IEdmCardControl5 Interface
EPDM.Interop.epdm Namespace


IEdmCardControl5 Interface Methods

IEdmCardControl5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardControl5 Interface

For a list of all members of this type, see IEdmCardControl5 members.

Public Methods

 | Name | Description
Method | GetButtonCommand | Gets the command string that is executed when a button is clicked in the Card Editor.
Method | GetParentInfo | Gets the parent control of this control.
Method | GetPosition | Gets the dimensions and position of this control.
Method | GetValidation | Gets the input validation criteria for this control.
Top

See Also

IEdmCardControl5 Interface
EPDM.Interop.epdm Namespace


GetButtonCommand Method (IEdmCardControl5)

GetButtonCommand Method (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : GetButtonCommand Method (IEdmCardControl5)

lParentWnd
Parent window handle
Gets the command string that is executed when a button is clicked in the Card Editor.

Syntax

Visual Basic
Function GetButtonCommand( _
   ByVal lParentWnd As System.Integer _
) As System.String
C#
System.string GetButtonCommand(
   System.int lParentWnd
)
C++/CLI
System.String^ GetButtonCommand(
&   System.int lParentWnd
)

Parameters

lParentWnd
Parent window handle

Return Value

Command string

Remarks

If the button is linked to a program that is not found, this method launches a dialog box in which the user can browse to the missing EXE file. If the user clicks Cancel in the dialog box, HRESULT = E_EDM_CANCELLED_BY_USER is returned by this method.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: The supplied control is not a push-button. Call IEdmCardControl5::ControlType first to verify whether the control is a push-button.
  • E_EDM_CANCELLED_BY_USER: The user clicked Cancel in the dialog box.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetParentInfo Method (IEdmCardControl5)

GetParentInfo Method (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : GetParentInfo Method (IEdmCardControl5)

plParentCtrlID
ID of the parent control; 0 if there is no parent control
plPageNo
0-based index of the tab control on which this control is located
Gets the parent control of this control.

Syntax

Visual Basic
Sub GetParentInfo( _
   ByRef plParentCtrlID As System.Integer, _
   ByRef plPageNo As System.Integer _
)
C#
void GetParentInfo(
   out System.int plParentCtrlID,
   out System.int plPageNo
)
C++/CLI
void GetParentInfo(
&   [Out] System.int plParentCtrlID,
&   [Out] System.int plPageNo
)

Parameters

plParentCtrlID
ID of the parent control; 0 if there is no parent control
plPageNo
0-based index of the tab control on which this control is located

Example

See the IEdmCardControl6 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The control does not have a parent.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetPosition Method (IEdmCardControl5)

GetPosition Method (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : GetPosition Method (IEdmCardControl5)

plX
X-coordinate of the top-left corner of the control
plY
Y-coordinate of the top-left corner of the control
plWidth
Width of the control in pixels
plHeight
Height of the control in pixels
Gets the dimensions and position of this control.

Syntax

Visual Basic
Sub GetPosition( _
   ByRef plX As System.Integer, _
   ByRef plY As System.Integer, _
   ByRef plWidth As System.Integer, _
   ByRef plHeight As System.Integer _
)
C#
void GetPosition(
   out System.int plX,
   out System.int plY,
   out System.int plWidth,
   out System.int plHeight
)
C++/CLI
void GetPosition(
&   [Out] System.int plX,
&   [Out] System.int plY,
&   [Out] System.int plWidth,
&   [Out] System.int plHeight
)

Parameters

plX
X-coordinate of the top-left corner of the control
plY
Y-coordinate of the top-left corner of the control
plWidth
Width of the control in pixels
plHeight
Height of the control in pixels

Example

See the IEdmCardControl6 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetValidation Method (IEdmCardControl5)

GetValidation Method (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : GetValidation Method (IEdmCardControl5)

poMin
Minimum limit; minimum number of characters in a control of type, EdmVariableType.EdmVarType_Text
poMax
Maximum limit for this control's value; maximum number of characters in a control of type, EdmVariableType.EdmVarType_Text
Gets the input validation criteria for this control.

Syntax

Visual Basic
Function GetValidation( _
   ByRef poMin As System.Object, _
   ByRef poMax As System.Object _
) As EdmVariableType
C#
EdmVariableType GetValidation(
   out System.object poMin,
   out System.object poMax
)
C++/CLI
EdmVariableType GetValidation(
&   [Out] System.Object^ poMin,
&   [Out] System.Object^ poMax
)

Parameters

poMin
Minimum limit; minimum number of characters in a control of type, EdmVariableType.EdmVarType_Text
poMax
Maximum limit for this control's value; maximum number of characters in a control of type, EdmVariableType.EdmVarType_Text

Return Value

Data type to validate as defined in EdmVariableType

Example

See the IEdmCardControl6 examples.

Remarks

If a card control has input validation, the user is unable to click OK or Apply until all validation conditions are met.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmCardControl5 Interface Properties

IEdmCardControl5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmCardControl5 Interface

For a list of all members of this type, see IEdmCardControl5 members.

Public Properties

 | Name | Description
Property | ControlType | Gets the type of this control.
Property | IsMultiLine | Gets whether this edit box is handles multiple lines.
Property | IsReadOnly | Gets whether this control is read-only.
Property | ShowInPreview | Gets whether the contents of this control display in the preview.
Property | VariableID | Gets the ID of the variable to which this control is connected.
Top

See Also

IEdmCardControl5 Interface
EPDM.Interop.epdm Namespace


ControlType Property (IEdmCardControl5)

ControlType Property (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : ControlType Property (IEdmCardControl5)

Gets the type of this control.

Syntax

Visual Basic
ReadOnly Property ControlType As EdmCardControlType
C#
EdmCardControlType ControlType {get;}
C++/CLI
property EdmCardControlType ControlType {
   EdmCardControlType get();
}

Property Value

Type of control as defined in EdmCardControlType

Example

See the IEdmCardControl6 examples.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IsMultiLine Property (IEdmCardControl5)

IsMultiLine Property (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : IsMultiLine Property (IEdmCardControl5)

Gets whether this edit box is handles multiple lines.

Syntax

Visual Basic
ReadOnly Property IsMultiLine As System.Boolean
C#
System.bool IsMultiLine {get;}
C++/CLI
property System.bool IsMultiLine {
   System.bool get();
}

Property Value

True if this edit box handles multiple lines, false if not

Example

See the IEdmCardControl6 examples.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IsReadOnly Property (IEdmCardControl5)

IsReadOnly Property (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : IsReadOnly Property (IEdmCardControl5)

Gets whether this control is read-only.

Syntax

Visual Basic
ReadOnly Property IsReadOnly As System.Boolean
C#
System.bool IsReadOnly {get;}
C++/CLI
property System.bool IsReadOnly {
   System.bool get();
}

Property Value

True if this control is read-only, false if not

Example

See the IEdmCardControl6 examples.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


ShowInPreview Property (IEdmCardControl5)

ShowInPreview Property (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : ShowInPreview Property (IEdmCardControl5)

Gets whether the contents of this control display in the preview.

Syntax

Visual Basic
ReadOnly Property ShowInPreview As System.Boolean
C#
System.bool ShowInPreview {get;}
C++/CLI
property System.bool ShowInPreview {
   System.bool get();
}

Property Value

True to display the contents of this control in the preview

Example

See the IEdmCardControl6 examples.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


VariableID Property (IEdmCardControl5)

VariableID Property (IEdmCardControl5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl5 Interface : VariableID Property (IEdmCardControl5)

Gets the ID of the variable to which this control is connected.

Syntax

Visual Basic
ReadOnly Property VariableID As System.Integer
C#
System.int VariableID {get;}
C++/CLI
property System.int VariableID {
   System.int get();
}

Property Value

ID of the variable to which this control is connected; 0, if the control is not connected to a variable

Example

See the IEdmCardControl6 examples.

See Also

IEdmCardControl5 Interface
IEdmCardControl5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmCardControl6 Interface

IEdmCardControl6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardControl6 Interface

Allows you to access a control in a file or folder data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardControl6
   Inherits IEdmCardControl5, IEdmObject5
C#
public interface IEdmCardControl6 : IEdmCardControl5, IEdmObject5
C++/CLI
public interface class IEdmCardControl6 : public IEdmCardControl5, IEdmObject5

Example

Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

This interface:

  • extends IEdmCardControl5 by providing the option to update all configurations in edit box controls.
  • is extended by IEdmCardControl7.

To access this interface, call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_CardControl.

See Also

IEdmCardControl6 Members
EPDM.Interop.epdm Namespace


IEdmCardControl6 Interface Members

IEdmCardControl6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmCardControl6 Interface

The following tables list the members exposed by IEdmCardControl6.

Public Properties

 | Name | Description
Property | UpdatesAllConfigurations | Gets whether this edit box control updates all configuration tabs of the file data card.
Top

See Also

IEdmCardControl6 Interface
EPDM.Interop.epdm Namespace


IEdmCardControl6 Interface Properties

IEdmCardControl6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmCardControl6 Interface

For a list of all members of this type, see IEdmCardControl6 members.

Public Properties

 | Name | Description
Property | UpdatesAllConfigurations | Gets whether this edit box control updates all configuration tabs of the file data card.
Top

See Also

IEdmCardControl6 Interface
EPDM.Interop.epdm Namespace


UpdatesAllConfigurations Property (IEdmCardControl6)

UpdatesAllConfigurations Property (IEdmCardControl6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl6 Interface : UpdatesAllConfigurations Property (IEdmCardControl6)

Gets whether this edit box control updates all configuration tabs of the file data card.

Syntax

Visual Basic
ReadOnly Property UpdatesAllConfigurations As System.Boolean
C#
System.bool UpdatesAllConfigurations {get;}
C++/CLI
property System.bool UpdatesAllConfigurations {
   System.bool get();
}

Property Value

True to update all configuration tabs, false to not

Example

See the IEdmCardControl6 examples.

Remarks

This property:

  • corresponds to the Updates all configurations check box in the Edit-box properties panel of the Card Editor.
  • is valid only if IEdmCardControl5::ControlType is EdmCardControlType.EdmCtrl_Editbox.

See Also

IEdmCardControl6 Interface
IEdmCardControl6 Members

Availability

SOLIDWORKS PDM Professional 2015 SP02


IEdmCardControl7 Interface

IEdmCardControl7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardControl7 Interface

Allows you to access a control in a file or folder data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardControl7
   Inherits IEdmCardControl5, IEdmCardControl6, IEdmObject5
C#
public interface IEdmCardControl7 : IEdmCardControl5, IEdmCardControl6, IEdmObject5
C++/CLI
public interface class IEdmCardControl7 : public IEdmCardControl5, IEdmCardControl6, IEdmObject5

Example

Get Card Control Information (C#)
Get Card Control Information (VB.NET)

Remarks

This interface extends IEdmCardControl6 by providing the ability to get the list of items in a list control on the data card.

To access this interface, call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_CardControl.

See Also

IEdmCardControl7 Members
EPDM.Interop.epdm Namespace


IEdmCardControl7 Interface Members

IEdmCardControl7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardControl7 Interface

The following tables list the members exposed by IEdmCardControl7.

Public Methods

 | Name | Description
Method | GetControlVariableList | Gets the list values associated with this drop-down list card control.
Top

See Also

IEdmCardControl7 Interface
EPDM.Interop.epdm Namespace


IEdmCardControl7 Interface Methods

IEdmCardControl7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardControl7 Interface

For a list of all members of this type, see IEdmCardControl7 members.

Public Methods

 | Name | Description
Method | GetControlVariableList | Gets the list values associated with this drop-down list card control.
Top

See Also

IEdmCardControl7 Interface
EPDM.Interop.epdm Namespace


GetControlVariableList Method (IEdmCardControl7)

GetControlVariableList Method (IEdmCardControl7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardControl7 Interface : GetControlVariableList Method (IEdmCardControl7)

lDocumentID
ID of the file
ppVariableItemsList
Array of list values; empty if the card control is not associated with a list (see Remarks)
Gets the list values associated with this drop-down list card control.

Syntax

Visual Basic
Function GetControlVariableList( _
   ByVal lDocumentID As System.Integer, _
   ByRef ppVariableItemsList() As System.String _
) As System.Boolean
C#
System.bool GetControlVariableList(
   System.int lDocumentID,
   out System.string[] ppVariableItemsList
)
C++/CLI
System.bool GetControlVariableList(
&   System.int lDocumentID,
&   [Out] System.array<String^>^ ppVariableItemsList
)

Parameters

lDocumentID
ID of the file
ppVariableItemsList
Array of list values; empty if the card control is not associated with a list (see Remarks)

Return Value

True if retrieving the list is successful, false if not

Example

See the IEdmCardControl7 examples.

Remarks

This method is valid only if IEdmCardControl5::ControlType is set to EdmCardControlType:

  • EdmCtrl_ComboboxDropdown
  • EdmCtrl_ComboboxDroplist
  • EdmCtrl_ComboboxSimple
  • EdmCtrl_Listbox

This method supports the following items that appear in the Admin tool > Card Editor when you double-click on a droplist, dropdown, or listbox card control:

  • Free text
  • Controlled by variable
  • Special value > User list or Group list

This method does not support add-in lists.

See Also

IEdmCardControl7 Interface
IEdmCardControl7 Members

Availability

SOLIDWORKS PDM Professional 2018


IEdmCardView5 Interface

IEdmCardView5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardView5 Interface

Allows you to create a window containing a file or folder data card that you can edit.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardView5
C#
public interface IEdmCardView5
C++/CLI
public interface class IEdmCardView5

Example

Create Card View (VB.NET)
Create Card View (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmCardView6.

Accessors

IEdmFolder5::CreateCardView

See Also

IEdmCardView5 Members
EPDM.Interop.epdm Namespace


IEdmCardView5 Interface Members

IEdmCardView5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardView5 Interface

The following tables list the members exposed by IEdmCardView5.

Public Methods

 | Name | Description
Method | GetCardSize | Gets the size of the file or folder data card.
Method | GetCardWindow | Gets the handle of the window that contains the file or folder data card.
Method | SaveData | Saves the data entered by the user in this card view to the file and database.
Method | ShowWindow | Sets whether to show or hide the card view window.
Top

See Also

IEdmCardView5 Interface
EPDM.Interop.epdm Namespace


IEdmCardView5 Interface Methods

IEdmCardView5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardView5 Interface

For a list of all members of this type, see IEdmCardView5 members.

Public Methods

 | Name | Description
Method | GetCardSize | Gets the size of the file or folder data card.
Method | GetCardWindow | Gets the handle of the window that contains the file or folder data card.
Method | SaveData | Saves the data entered by the user in this card view to the file and database.
Method | ShowWindow | Sets whether to show or hide the card view window.
Top

See Also

IEdmCardView5 Interface
EPDM.Interop.epdm Namespace


GetCardSize Method (IEdmCardView5)

GetCardSize Method (IEdmCardView5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView5 Interface : GetCardSize Method (IEdmCardView5)

plWidth
Width of the card in pixels
plHeight
Height of the card in pixels
Gets the size of the file or folder data card.

Syntax

Visual Basic
Sub GetCardSize( _
   ByRef plWidth As System.Integer, _
   ByRef plHeight As System.Integer _
)
C#
void GetCardSize(
   out System.int plWidth,
   out System.int plHeight
)
C++/CLI
void GetCardSize(
&   [Out] System.int plWidth,
&   [Out] System.int plHeight
)

Parameters

plWidth
Width of the card in pixels
plHeight
Height of the card in pixels

Example

See the IEdmCardView5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardView5 Interface
IEdmCardView5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetCardWindow Method (IEdmCardView5)

GetCardWindow Method (IEdmCardView5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView5 Interface : GetCardWindow Method (IEdmCardView5)

Gets the handle of the window that contains the file or folder data card.

Syntax

Visual Basic
Function GetCardWindow() As System.Integer
C#
System.int GetCardWindow()
C++/CLI
System.int GetCardWindow();

Return Value

Window handle

Example

See the IEdmCardView5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardView5 Interface
IEdmCardView5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SaveData Method (IEdmCardView5)

SaveData Method (IEdmCardView5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView5 Interface : SaveData Method (IEdmCardView5)

Saves the data entered by the user in this card view to the file and database.

Syntax

Visual Basic
Sub SaveData()
C#
void SaveData()
C++/CLI
void SaveData();

Example

See the IEdmCardView5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_SHARE_ERROR: The file is already opened in another application.

See Also

IEdmCardView5 Interface
IEdmCardView5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


ShowWindow Method (IEdmCardView5)

ShowWindow Method (IEdmCardView5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView5 Interface : ShowWindow Method (IEdmCardView5)

bShow
True to show the card view window, false to not
Sets whether to show or hide the card view window.

Syntax

Visual Basic
Sub ShowWindow( _
   Optional ByVal bShow As System.Boolean _
)
C#
void ShowWindow(
   System.bool bShow
)
C++/CLI
void ShowWindow(
&   System.bool bShow
)

Parameters

bShow
True to show the card view window, false to not

Example

See the IEdmCardView5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardView5 Interface
IEdmCardView5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmCardView6 Interface

IEdmCardView6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardView6 Interface

Allows you to create a window containing a file or folder data card that you can edit.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardView6
   Inherits IEdmCardView5
C#
public interface IEdmCardView6 : IEdmCardView5
C++/CLI
public interface class IEdmCardView6 : public IEdmCardView5

Example

Create Card View (VB.NET)
Create Card View (C#)

Remarks

This interface:

  • extends IEdmCardView5 by adding the ability to perform an action when the card view is cancelled.
  • is extended by IEdmCardView61.

Accessors

IEdmVault6::CreateCardViewEx

See Also

IEdmCardView6 Members
EPDM.Interop.epdm Namespace


IEdmCardView6 Interface Members

IEdmCardView6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardView6 Interface

The following tables list the members exposed by IEdmCardView6.

Public Methods

 | Name | Description
Method | OnCancel | Rolls back all changes made in the card view after it is cancelled.
Top

See Also

IEdmCardView6 Interface
EPDM.Interop.epdm Namespace


IEdmCardView6 Interface Methods

IEdmCardView6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardView6 Interface

For a list of all members of this type, see IEdmCardView6 members.

Public Methods

 | Name | Description
Method | OnCancel | Rolls back all changes made in the card view after it is cancelled.
Top

See Also

IEdmCardView6 Interface
EPDM.Interop.epdm Namespace


OnCancel Method (IEdmCardView6)

OnCancel Method (IEdmCardView6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView6 Interface : OnCancel Method (IEdmCardView6)

Rolls back all changes made in the card view after it is cancelled.

Syntax

Visual Basic
Sub OnCancel()
C#
void OnCancel()
C++/CLI
void OnCancel();

Example

See the IEdmCardView6 examples.

Remarks

Call this method when the card view is cancelled. This method ensures that all serial numbers generated in the card (by right-clicking in edit boxes linked to serial numbers) are pushed back to the database so they can be reused. If you do not call this method, serial numbers are not restored to the database, and gaps in the serial number series occur.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardView6 Interface
IEdmCardView6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmCardView61 Interface

IEdmCardView61 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardView61 Interface

Allows you to create a window containing a file or folder data card that you can edit.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardView61
   Inherits IEdmCardView5, IEdmCardView6
C#
public interface IEdmCardView61 : IEdmCardView5, IEdmCardView6
C++/CLI
public interface class IEdmCardView61 : public IEdmCardView5, IEdmCardView6

Example

Create Card View (VB.NET)
Create Card View (C#)

Remarks

This interface:

  • extends IEdmCardView6 by adding the ability to set input focus to a certain control in the card view.
  • is extended by IEdmCardView63.

See Also

IEdmCardView61 Members
EPDM.Interop.epdm Namespace


IEdmCardView61 Interface Members

IEdmCardView61 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardView61 Interface

The following tables list the members exposed by IEdmCardView61.

Public Methods

 | Name | Description
Method | SetFocus | Sets input focus to a certain control in this card view.
Top

See Also

IEdmCardView61 Interface
EPDM.Interop.epdm Namespace


IEdmCardView61 Interface Methods

IEdmCardView61 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardView61 Interface

For a list of all members of this type, see IEdmCardView61 members.

Public Methods

 | Name | Description
Method | SetFocus | Sets input focus to a certain control in this card view.
Top

See Also

IEdmCardView61 Interface
EPDM.Interop.epdm Namespace


SetFocus Method (IEdmCardView61)

SetFocus Method (IEdmCardView61)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView61 Interface : SetFocus Method (IEdmCardView61)

poVariableNameOrID
Name or ID of the variable to which to set focus; 0 to set focus to the first control in the card
Sets input focus to a certain control in this card view.

Syntax

Visual Basic
Sub SetFocus( _
   Optional ByRef poVariableNameOrID As System.Object _
)
C#
void SetFocus(
   ref System.object poVariableNameOrID
)
C++/CLI
void SetFocus(
&   System.Object^% poVariableNameOrID
)

Parameters

poVariableNameOrID
Name or ID of the variable to which to set focus; 0 to set focus to the first control in the card

Example

See the IEdmCardView61 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardView61 Interface
IEdmCardView61 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmCardView63 Interface

IEdmCardView63 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardView63 Interface

Allows you to create a window containing a file or folder data card that you can edit.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardView63
   Inherits IEdmCardView5, IEdmCardView6, IEdmCardView61
C#
public interface IEdmCardView63 : IEdmCardView5, IEdmCardView6, IEdmCardView61
C++/CLI
public interface class IEdmCardView63 : public IEdmCardView5, IEdmCardView6, IEdmCardView61

Example

Create Card View (VB.NET)
Create Card View (C#)

Remarks

This interface:

  • Extends IEdmCardView61 by adding the ability to update the controls in a card view.
  • Is extended by IEdmCardView64.

See Also

IEdmCardView63 Members
EPDM.Interop.epdm Namespace


IEdmCardView63 Interface Members

IEdmCardView63 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardView63 Interface

The following tables list the members exposed by IEdmCardView63.

Public Methods

 | Name | Description
Method | Update | Updates controls in this card view.
Top

See Also

IEdmCardView63 Interface
EPDM.Interop.epdm Namespace


IEdmCardView63 Interface Methods

IEdmCardView63 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardView63 Interface

For a list of all members of this type, see IEdmCardView63 members.

Public Methods

 | Name | Description
Method | Update | Updates controls in this card view.
Top

See Also

IEdmCardView63 Interface
EPDM.Interop.epdm Namespace


Update Method (IEdmCardView63)

Update Method (IEdmCardView63)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView63 Interface : Update Method (IEdmCardView63)

eType
Type of update to perform as defined in EdmCardViewUpdateType
poArg
Reserved for future use
Updates controls in this card view.

Syntax

Visual Basic
Sub Update( _
   ByVal eType As EdmCardViewUpdateType, _
   Optional ByRef poArg As System.Object _
)
C#
void Update(
   EdmCardViewUpdateType eType,
   ref System.object poArg
)
C++/CLI
void Update(
&   EdmCardViewUpdateType eType,
&   System.Object^% poArg
)

Parameters

eType
Type of update to perform as defined in EdmCardViewUpdateType
poArg
Reserved for future use

Example

See the IEdmCardView63 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardView63 Interface
IEdmCardView63 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmCardView64 Interface

IEdmCardView64 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardView64 Interface

Allows you to create a window containing a file or folder data card that you can edit.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardView64
   Inherits IEdmCardView5, IEdmCardView6, IEdmCardView61, IEdmCardView63
C#
public interface IEdmCardView64 : IEdmCardView5, IEdmCardView6, IEdmCardView61, IEdmCardView63
C++/CLI
public interface class IEdmCardView64 : public IEdmCardView5, IEdmCardView6, IEdmCardView61, IEdmCardView63

Example

Create Card View (VB.NET)
Create Card View (C#)

Remarks

This interface extends IEdmCardView63 by providing methods to control the focus on this data card view.

See Also

IEdmCardView64 Members
EPDM.Interop.epdm Namespace


IEdmCardView64 Interface Members

IEdmCardView64 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardView64 Interface

The following tables list the members exposed by IEdmCardView64.

Public Methods

 | Name | Description
Method | IsFocusOnDataCard | Gets whether focus is on this data card view.
Method | SetFlagIsFocusOnDataCard | Sets whether focus is on this data card view.
Top

See Also

IEdmCardView64 Interface
EPDM.Interop.epdm Namespace


IEdmCardView64 Interface Methods

IEdmCardView64 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardView64 Interface

For a list of all members of this type, see IEdmCardView64 members.

Public Methods

 | Name | Description
Method | IsFocusOnDataCard | Gets whether focus is on this data card view.
Method | SetFlagIsFocusOnDataCard | Sets whether focus is on this data card view.
Top

See Also

IEdmCardView64 Interface
EPDM.Interop.epdm Namespace


IsFocusOnDataCard Method (IEdmCardView64)

IsFocusOnDataCard Method (IEdmCardView64)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView64 Interface : IsFocusOnDataCard Method (IEdmCardView64)

isFocCtrl
True to focus on this data card view, false to not
Gets whether focus is on this data card view.

Syntax

Visual Basic
Sub IsFocusOnDataCard( _
   ByRef isFocCtrl As System.Boolean _
)
C#
void IsFocusOnDataCard(
   out System.bool isFocCtrl
)
C++/CLI
void IsFocusOnDataCard(
&   [Out] System.bool isFocCtrl
)

Parameters

isFocCtrl
True to focus on this data card view, false to not

See Also

IEdmCardView64 Interface
IEdmCardView64 Members
IEdmCardView64::SetFlagIsFocusOnDataCard Method ()

Availability

SOLIDWORKS PDM Professional 2020


SetFlagIsFocusOnDataCard Method (IEdmCardView64)

SetFlagIsFocusOnDataCard Method (IEdmCardView64)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardView64 Interface : SetFlagIsFocusOnDataCard Method (IEdmCardView64)

flg
True to focus on this data card view, false to not
Sets whether focus is on this data card view.

Syntax

Visual Basic
Sub SetFlagIsFocusOnDataCard( _
   ByVal flg As System.Boolean _
)
C#
void SetFlagIsFocusOnDataCard(
   System.bool flg
)
C++/CLI
void SetFlagIsFocusOnDataCard(
&   System.bool flg
)

Parameters

flg
True to focus on this data card view, false to not

Example

See the IEdmCardView64 examples.

See Also

IEdmCardView64 Interface
IEdmCardView64 Members
IEdmCardView64::IsFocusOnDataCard Method ()

Availability

SOLIDWORKS PDM Professional 2020


IEdmCardViewCallback6 Interface

IEdmCardViewCallback6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCardViewCallback6 Interface

Handles customized loading and saving of data in a card view.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCardViewCallback6
C#
public interface IEdmCardViewCallback6
C++/CLI
public interface class IEdmCardViewCallback6

Example

Create Custom Card View (VB.NET)
Create Custom Card View (C#)

Remarks

This interface inherits from IUnknown. See Using and Implementing IUnknown (COM).

This callback interface allows you to customize how data is loaded and saved in a simple card view that is created using IEdmVault10::CreateCardViewEx2. To use this callback interface:

  1. Create a new class.
  2. Implement all of the methods of IEdmCardViewCallback6 in the new class.
  3. Call IEdmVault10::CreateCardViewEx2, setting poCallback to a pointer to the new class.

See Also

IEdmCardViewCallback6 Members
EPDM.Interop.epdm Namespace


IEdmCardViewCallback6 Interface Members

IEdmCardViewCallback6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCardViewCallback6 Interface

The following tables list the members exposed by IEdmCardViewCallback6.

Public Methods

 | Name | Description
Method | GetCtrlData | Gets the data to insert into a control when a card is opened.
Method | GetDefaultValueComponent | Called by the serial number generator to get the default value for the specified serial number component.
Method | OnAddInInput | Handles input from an add-in when an add-in button is clicked in the card view.
Method | SetCtrlData | Stores the control's variable data when a card is saved.
Method | SetModifiedFlag | Called when a card variable changes.
Top

See Also

IEdmCardViewCallback6 Interface
EPDM.Interop.epdm Namespace


IEdmCardViewCallback6 Interface Methods

IEdmCardViewCallback6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCardViewCallback6 Interface

For a list of all members of this type, see IEdmCardViewCallback6 members.

Public Methods

 | Name | Description
Method | GetCtrlData | Gets the data to insert into a control when a card is opened.
Method | GetDefaultValueComponent | Called by the serial number generator to get the default value for the specified serial number component.
Method | OnAddInInput | Handles input from an add-in when an add-in button is clicked in the card view.
Method | SetCtrlData | Stores the control's variable data when a card is saved.
Method | SetModifiedFlag | Called when a card variable changes.
Top

See Also

IEdmCardViewCallback6 Interface
EPDM.Interop.epdm Namespace


IEdmCategory6 Interface

IEdmCategory6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCategory6 Interface

Allows you to access a category.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCategory6
   Inherits IEdmObject5
C#
public interface IEdmCategory6 : IEdmObject5
C++/CLI
public interface class IEdmCategory6 : public IEdmObject5

Example

Get Categories (VB.NET)
Get Categories (C#)

Remarks

This interface inherits from IEdmObject5.

To access this interface, call IEdmVault5::GetObject with eType = EdmObjectType.EdmObject_Category.

Accessors

IEdmCategoryMgr6::GetNextCategory

IEdmFile6::Category

IEdmVault5::GetObject

See Also

IEdmCategory6 Members
EPDM.Interop.epdm Namespace


IEdmCategory6 Interface Members

IEdmCategory6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmCategory6 Interface

The following tables list the members exposed by IEdmCategory6.

Public Properties

 | Name | Description
Property | Description | Gets the description of the category.
Top

See Also

IEdmCategory6 Interface
EPDM.Interop.epdm Namespace


IEdmCategory6 Interface Properties

IEdmCategory6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmCategory6 Interface

For a list of all members of this type, see IEdmCategory6 members.

Public Properties

 | Name | Description
Property | Description | Gets the description of the category.
Top

See Also

IEdmCategory6 Interface
EPDM.Interop.epdm Namespace


Description Property (IEdmCategory6)

Description Property (IEdmCategory6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCategory6 Interface : Description Property (IEdmCategory6)

Gets the description of the category.

Syntax

Visual Basic
ReadOnly Property Description As System.String
C#
System.string Description {get;}
C++/CLI
property System.String^ Description {
   System.String^ get();
}

Property Value

Description of the category

Example

See the IEdmCategory6 examples.

See Also

IEdmCategory6 Interface
IEdmCategory6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmCategoryMgr6 Interface

IEdmCategoryMgr6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCategoryMgr6 Interface

Allows you to access all of the categories that have been set up in a vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCategoryMgr6
C#
public interface IEdmCategoryMgr6
C++/CLI
public interface class IEdmCategoryMgr6

Example

Get Categories (VB.NET)
Get Categories (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To access this interface, call IEdmVault7::CreateUtility with eType = EdmUtility.EdmUtil_CategoryMgr.

Files in SOLIDWORKS PDM Professional can be categorized according to certain criteria such as card properties, file extensions, etc. The categories are set up using SOLIDWORKS PDM Professional’s administration tool.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmCategoryMgr6 Members
EPDM.Interop.epdm Namespace
IEdmCategory6 Interface


IEdmCategoryMgr6 Interface Members

IEdmCategoryMgr6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCategoryMgr6 Interface

The following tables list the members exposed by IEdmCategoryMgr6.

Public Methods

 | Name | Description
Method | GetFirstCategoryPosition | Starts an enumeration of the categories in the vault.
Method | GetNextCategory | Gets the next category in the enumeration.
Top

See Also

IEdmCategoryMgr6 Interface
EPDM.Interop.epdm Namespace
IEdmCategory6 Interface


IEdmCategoryMgr6 Interface Methods

IEdmCategoryMgr6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCategoryMgr6 Interface

For a list of all members of this type, see IEdmCategoryMgr6 members.

Public Methods

 | Name | Description
Method | GetFirstCategoryPosition | Starts an enumeration of the categories in the vault.
Method | GetNextCategory | Gets the next category in the enumeration.
Top

See Also

IEdmCategoryMgr6 Interface
EPDM.Interop.epdm Namespace
IEdmCategory6 Interface


GetFirstCategoryPosition Method (IEdmCategoryMgr6)

GetFirstCategoryPosition Method (IEdmCategoryMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCategoryMgr6 Interface : GetFirstCategoryPosition Method (IEdmCategoryMgr6)

Starts an enumeration of the categories in the vault.

Syntax

Visual Basic
Function GetFirstCategoryPosition() As IEdmPos5
C#
IEdmPos5 GetFirstCategoryPosition()
C++/CLI
IEdmPos5^ GetFirstCategoryPosition();

Return Value

IEdmPos5; position of the first category in the list

Example

See the IEdmCategoryMgr6 examples.

Remarks

After calling this method, call IEdmCategoryMgr6::GetNextCategory.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCategoryMgr6 Interface
IEdmCategoryMgr6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetNextCategory Method (IEdmCategoryMgr6)

GetNextCategory Method (IEdmCategoryMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCategoryMgr6 Interface : GetNextCategory Method (IEdmCategoryMgr6)

poPos
IEdmPos5; position of the next category in the list
Gets the next category in the enumeration.

Syntax

Visual Basic
Function GetNextCategory( _
   ByVal poPos As IEdmPos5 _
) As IEdmCategory6
C#
IEdmCategory6 GetNextCategory(
   IEdmPos5 poPos
)
C++/CLI
IEdmCategory6^ GetNextCategory(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next category in the list

Return Value

IEdmCategory6

Example

See the IEdmCategoryMgr6 examples.

Remarks

To obtain the position of the first category in the list, call IEdmCategoryMgr6::GetFirstCategoryPosition.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the categories.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: No more categories can be accessed.

See Also

IEdmCategoryMgr6 Interface
IEdmCategoryMgr6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmClearLocalCache Interface

IEdmClearLocalCache Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmClearLocalCache Interface

Removes specified checked-in files and folders from the local file vault view cache. Only files that are not referenced by checked-out files are cleared.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmClearLocalCache
C#
public interface IEdmClearLocalCache
C++/CLI
public interface class IEdmClearLocalCache

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmClearLocalCache2 which provides the option to not remove cached Toolbox Library parts.

This interface provides the same functionality as the Clear Local Cache command that you can run from the context menu of a folder in File Explorer.

To clear the local cache:

  1. Access this interface by calling IEdmVault7::CreateUtility, passing EdmUtility.EdmUtil_ClearLocalCache as a parameter.
  2. Call IEdmClearLocalCache::AddFileByPath or IEdmClearLocalCache::AddFolder one or more times, specifying the files and folders that you want to clear.
  3. Call IEdmClearLocalCache::CommitClear to clear the local cache.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmClearLocalCache Members
EPDM.Interop.epdm Namespace


IEdmClearLocalCache Interface Members

IEdmClearLocalCache Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmClearLocalCache Interface

The following tables list the members exposed by IEdmClearLocalCache.

Public Methods

 | Name | Description
Method | AddFileByPath | Adds the specified file to the batch of files and folders to clear from the local cache.
Method | AddFolder | Adds the specified folder to the batch of files and folders to clear from the local cache.
Method | CommitClear | Clears the files and folders specified by IEdmClearLocalCache::AddFilebyPath and IEdmClearLocalCache::AddFolder from the local cache.
Top

See Also

IEdmClearLocalCache Interface
EPDM.Interop.epdm Namespace


IEdmClearLocalCache Interface Methods

IEdmClearLocalCache Interface Methods
EPDM.Interop.epdm Namespace : IEdmClearLocalCache Interface

For a list of all members of this type, see IEdmClearLocalCache members.

Public Methods

 | Name | Description
Method | AddFileByPath | Adds the specified file to the batch of files and folders to clear from the local cache.
Method | AddFolder | Adds the specified folder to the batch of files and folders to clear from the local cache.
Method | CommitClear | Clears the files and folders specified by IEdmClearLocalCache::AddFilebyPath and IEdmClearLocalCache::AddFolder from the local cache.
Top

See Also

IEdmClearLocalCache Interface
EPDM.Interop.epdm Namespace


AddFileByPath Method (IEdmClearLocalCache)

AddFileByPath Method (IEdmClearLocalCache)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmClearLocalCache Interface : AddFileByPath Method (IEdmClearLocalCache)

bsFilePath
Path and filename of the file to clear
Adds the specified file to the batch of files and folders to clear from the local cache.

Syntax

Visual Basic
Sub AddFileByPath( _
   ByVal bsFilePath As System.String _
)
C#
void AddFileByPath(
   System.string bsFilePath
)
C++/CLI
void AddFileByPath(
&   System.String^ bsFilePath
)

Parameters

bsFilePath
Path and filename of the file to clear

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

After calling this method, you must call IEdmClearLocalCache::CommitClear to actually clear the file from the cache.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmClearLocalCache Interface
IEdmClearLocalCache Members

Availability

SOLIDWORKS PDM Professional 2008


AddFolder Method (IEdmClearLocalCache)

AddFolder Method (IEdmClearLocalCache)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmClearLocalCache Interface : AddFolder Method (IEdmClearLocalCache)

oFolderIDorPath
ID or path of the folder to clear from the cache
bRecursive
True to clear subfolders, false to not
Adds the specified folder to the batch of files and folders to clear from the local cache.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal oFolderIDorPath As System.Object, _
   Optional ByVal bRecursive As System.Boolean _
)
C#
void AddFolder(
   System.object oFolderIDorPath,
   System.bool bRecursive
)
C++/CLI
void AddFolder(
&   System.Object^ oFolderIDorPath,
&   System.bool bRecursive
)

Parameters

oFolderIDorPath
ID or path of the folder to clear from the cache
bRecursive
True to clear subfolders, false to not

Remarks

After calling this method, you must call IEdmClearLocalCache::CommitClear to actually clear the folder from the cache.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmClearLocalCache Interface
IEdmClearLocalCache Members

Availability

SOLIDWORKS PDM Professional 2008


CommitClear Method (IEdmClearLocalCache)

CommitClear Method (IEdmClearLocalCache)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmClearLocalCache Interface : CommitClear Method (IEdmClearLocalCache)

poCallback
Optional pointer to a class that implements IEdmCallback to provide progress feedback to the user
Clears the files and folders specified by IEdmClearLocalCache::AddFilebyPath and IEdmClearLocalCache::AddFolder from the local cache.

Syntax

Visual Basic
Sub CommitClear( _
   Optional ByVal poCallback As EdmCallback _
)
C#
void CommitClear(
   EdmCallback poCallback
)
C++/CLI
void CommitClear(
&   EdmCallback^ poCallback
)

Parameters

poCallback
Optional pointer to a class that implements IEdmCallback to provide progress feedback to the user

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmClearLocalCache Interface
IEdmClearLocalCache Members

Availability

SOLIDWORKS PDM Professional 2008


IEdmClearLocalCache2 Interface

IEdmClearLocalCache2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmClearLocalCache2 Interface

Removes specified checked-in files and folders from the local file vault view cache. Only files that are not referenced by checked-out files are cleared.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmClearLocalCache2
   Inherits IEdmClearLocalCache
C#
public interface IEdmClearLocalCache2 : IEdmClearLocalCache
C++/CLI
public interface class IEdmClearLocalCache2 : public IEdmClearLocalCache

Example

See the IEdmClearLocalCache examples.

Remarks

This interface:

  • extends IEdmClearLocalCache by providing the ability to not remove Toolbox Library parts from the cache.
  • is extended by IEdmClearLocalCache3.

See Also

IEdmClearLocalCache2 Members
EPDM.Interop.epdm Namespace


IEdmClearLocalCache2 Interface Members

IEdmClearLocalCache2 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmClearLocalCache2 Interface

The following tables list the members exposed by IEdmClearLocalCache2.

Public Properties

 | Name | Description
Property | IgnoreToolboxFiles | Gets or sets whether to not remove Toolbox Library parts from the cache.
Top

See Also

IEdmClearLocalCache2 Interface
EPDM.Interop.epdm Namespace


IEdmClearLocalCache2 Interface Properties

IEdmClearLocalCache2 Interface Properties
EPDM.Interop.epdm Namespace : IEdmClearLocalCache2 Interface

For a list of all members of this type, see IEdmClearLocalCache2 members.

Public Properties

 | Name | Description
Property | IgnoreToolboxFiles | Gets or sets whether to not remove Toolbox Library parts from the cache.
Top

See Also

IEdmClearLocalCache2 Interface
EPDM.Interop.epdm Namespace


IgnoreToolboxFiles Property (IEdmClearLocalCache2)

IgnoreToolboxFiles Property (IEdmClearLocalCache2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmClearLocalCache2 Interface : IgnoreToolboxFiles Property (IEdmClearLocalCache2)

Gets or sets whether to not remove Toolbox Library parts from the cache.

Syntax

Visual Basic
Property IgnoreToolboxFiles As System.Boolean
C#
System.bool IgnoreToolboxFiles {get; set;}
C++/CLI
property System.bool IgnoreToolboxFiles {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to not remove Toolbox Library parts, false to remove them

Example

See the IEdmClearLocalCache examples.

See Also

IEdmClearLocalCache2 Interface
IEdmClearLocalCache2 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmClearLocalCache3 Interface

IEdmClearLocalCache3 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmClearLocalCache3 Interface

Removes specified checked-in files and folders from the local file vault view cache. Only files that are not referenced by checked-out files are cleared.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmClearLocalCache3
   Inherits IEdmClearLocalCache, IEdmClearLocalCache2
C#
public interface IEdmClearLocalCache3 : IEdmClearLocalCache, IEdmClearLocalCache2
C++/CLI
public interface class IEdmClearLocalCache3 : public IEdmClearLocalCache, IEdmClearLocalCache2

Example

See the IEdmClearLocalCache examples.

Remarks

This interface extends IEdmClearLocalCache2.

See Also

IEdmClearLocalCache3 Members
EPDM.Interop.epdm Namespace


IEdmClearLocalCache3 Interface Members

IEdmClearLocalCache3 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmClearLocalCache3 Interface

The following tables list the members exposed by IEdmClearLocalCache3.

Public Properties

 | Name | Description
Property | UseAutoClearCacheOption | Gets or sets whether to use the Clear Cache setting for the logged-in user.
Top

See Also

IEdmClearLocalCache3 Interface
EPDM.Interop.epdm Namespace


IEdmClearLocalCache3 Interface Properties

IEdmClearLocalCache3 Interface Properties
EPDM.Interop.epdm Namespace : IEdmClearLocalCache3 Interface

For a list of all members of this type, see IEdmClearLocalCache3 members.

Public Properties

 | Name | Description
Property | UseAutoClearCacheOption | Gets or sets whether to use the Clear Cache setting for the logged-in user.
Top

See Also

IEdmClearLocalCache3 Interface
EPDM.Interop.epdm Namespace


UseAutoClearCacheOption Property (IEdmClearLocalCache3)

UseAutoClearCacheOption Property (IEdmClearLocalCache3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmClearLocalCache3 Interface : UseAutoClearCacheOption Property (IEdmClearLocalCache3)

Gets or sets whether to use the Clear Cache setting for the logged-in user.

Syntax

Visual Basic
Property UseAutoClearCacheOption As System.Boolean
C#
System.bool UseAutoClearCacheOption {get; set;}
C++/CLI
property System.bool UseAutoClearCacheOption {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to use the Clear Cache setting, false to not

Example

See the IEdmClearLocalCache examples.

See Also

IEdmClearLocalCache3 Interface
IEdmClearLocalCache3 Members


IEdmCmdMgr5 Interface

IEdmCmdMgr5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCmdMgr5 Interface

Allows you to add menu commands, toolbar buttons, and command hooks to SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCmdMgr5
C#
public interface IEdmCmdMgr5
C++/CLI
public interface class IEdmCmdMgr5

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)
Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmCmdMgr6.

A pointer to this interface is provided by SOLIDWORKS PDM Professional when it loads an add-in. IEdmAddIn5::GetAddInInfo's poCmdMgr contains a pointer to this interface. Within your implementation of IEdmAddIn5::GetAddInInfo, use this pointer to call:

  • IEdmCmdMgr5::AddCmd to add menu commands
  • IEdmCmdMgr5::AddToolbarImage to add toolbar buttons
  • IEdmCmdMgr5::AddHook to add command hooks

to SOLIDWORKS PDM Professional.

Accessors

IEdmAddIn5::GetAddInInfo

See Also

IEdmCmdMgr5 Members
EPDM.Interop.epdm Namespace
Creating Menu Commands (VB.NET)
Creating Add-in Hooks (VB.NET)


IEdmCmdMgr5 Interface Members

IEdmCmdMgr5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCmdMgr5 Interface

The following tables list the members exposed by IEdmCmdMgr5.

Public Methods

 | Name | Description
Method | AddCmd | Adds a toolbar button to the File Explorer Tools menu and a menu command to the right-click context-sensitive menu of SOLIDWORKS PDM Professional vault files and folders.
Method | AddHook | Adds a hook that makes SOLIDWORKS PDM Professional call this add-in's implementation of IEdmAddIn5::OnCmd whenever the specified events occur.
Method | AddToolbarImage | Registers an image with a toolbar button. NOTE: This method does not work in Windows Vista and later Windows operating systems.
Top

See Also

IEdmCmdMgr5 Interface
EPDM.Interop.epdm Namespace
Creating Menu Commands (VB.NET)
Creating Add-in Hooks (VB.NET)


IEdmCmdMgr5 Interface Methods

IEdmCmdMgr5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCmdMgr5 Interface

For a list of all members of this type, see IEdmCmdMgr5 members.

Public Methods

 | Name | Description
Method | AddCmd | Adds a toolbar button to the File Explorer Tools menu and a menu command to the right-click context-sensitive menu of SOLIDWORKS PDM Professional vault files and folders.
Method | AddHook | Adds a hook that makes SOLIDWORKS PDM Professional call this add-in's implementation of IEdmAddIn5::OnCmd whenever the specified events occur.
Method | AddToolbarImage | Registers an image with a toolbar button. NOTE: This method does not work in Windows Vista and later Windows operating systems.
Top

See Also

IEdmCmdMgr5 Interface
EPDM.Interop.epdm Namespace
Creating Menu Commands (VB.NET)
Creating Add-in Hooks (VB.NET)


AddCmd Method (IEdmCmdMgr5)

AddCmd Method (IEdmCmdMgr5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCmdMgr5 Interface : AddCmd Method (IEdmCmdMgr5)

lCmdID
Command ID (see Remarks)
bsMenuString
Text to show in the menu
lEdmMenuFlags
Optional combination of EdmMenuFlags
bsStatusBarHelp
Optional text to show in the File Explorer status bar when the user highlights the menu entry in the right-click context menu
bsToolbarToolTip
Optional message to display when the cursor is located over the command's toolbar button
lToolbarButtonIndex
Optional index of a toolbar button in a resource image (see Remarks)
lToolbarImageID
Optional ID of the image to use as a toolbar button (see Remarks)
Adds a toolbar button to the File Explorer Tools menu and a menu command to the right-click context-sensitive menu of SOLIDWORKS PDM Professional vault files and folders.

Syntax

Visual Basic
Sub AddCmd( _
   ByVal lCmdID As System.Integer, _
   ByVal bsMenuString As System.String, _
   Optional ByVal lEdmMenuFlags As System.Integer, _
   Optional ByVal bsStatusBarHelp As System.String, _
   Optional ByVal bsToolbarToolTip As System.String, _
   Optional ByVal lToolbarButtonIndex As System.Integer, _
   Optional ByVal lToolbarImageID As System.Integer _
)
C#
void AddCmd(
   System.int lCmdID,
   System.string bsMenuString,
   System.int lEdmMenuFlags,
   System.string bsStatusBarHelp,
   System.string bsToolbarToolTip,
   System.int lToolbarButtonIndex,
   System.int lToolbarImageID
)
C++/CLI
void AddCmd(
&   System.int lCmdID,
&   System.String^ bsMenuString,
&   System.int lEdmMenuFlags,
&   System.String^ bsStatusBarHelp,
&   System.String^ bsToolbarToolTip,
&   System.int lToolbarButtonIndex,
&   System.int lToolbarImageID
)

Parameters

lCmdID
Command ID (see Remarks)
bsMenuString
Text to show in the menu
lEdmMenuFlags
Optional combination of EdmMenuFlags
bsStatusBarHelp
Optional text to show in the File Explorer status bar when the user highlights the menu entry in the right-click context menu
bsToolbarToolTip
Optional message to display when the cursor is located over the command's toolbar button
lToolbarButtonIndex
Optional index of a toolbar button in a resource image (see Remarks)
lToolbarImageID
Optional ID of the image to use as a toolbar button (see Remarks)

Remarks

Call this method in your implementation of IEdmAddIn5::GetAddInInfo to:

  • Add command buttons to the File Explorer toolbar. Before calling IEdmCmdMgr5::AddCmd, call IEdmCmdMgr5::AddToolbarImage to register an image with the toolbar button you want to add.
  • Add menu commands to the File Explorer Tools menu.
  • Add menu commands to the right-click context menu of files or folders in the SOLIDWORKS PDM Professional vault.

lCmdID can be any value. SOLIDWORKS PDM Professional passes it to your implementation of IEdmAddIn5::OnCmd via EdmCmd::mlCmdID.

lToolbarButtonIndex is the index of the toolbar image in a resource image that contains several images.

lToolbarImageID is the same as the lImageID parameter of IEdmCmdMgr5::AddToolbarImage.

NOTE: Menu commands and toolbar buttons added using this method display only when the user browses a SOLIDWORKS PDM Professional file vault. They do not display for ordinary Windows folders.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCmdMgr5 Interface
IEdmCmdMgr5 Members
Administration Menu for Add-ins
Creating Menu Commands (VB.NET)

Availability

SOLIDWORKS PDM Professional Version 5.2


AddHook Method (IEdmCmdMgr5)

AddHook Method (IEdmCmdMgr5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCmdMgr5 Interface : AddHook Method (IEdmCmdMgr5)

eCmdType
Types of event that trigger IEdmAddIn5::OnCmd as defined in EdmCmdType
poReserved
Null; reserved for future use
Adds a hook that makes SOLIDWORKS PDM Professional call this add-in's implementation of IEdmAddIn5::OnCmd whenever the specified events occur.

Syntax

Visual Basic
Sub AddHook( _
   ByVal eCmdType As EdmCmdType, _
   Optional ByVal poReserved As System.Object _
)
C#
void AddHook(
   EdmCmdType eCmdType,
   System.object poReserved
)
C++/CLI
void AddHook(
&   EdmCmdType eCmdType,
&   System.Object^ poReserved
)

Parameters

eCmdType
Types of event that trigger IEdmAddIn5::OnCmd as defined in EdmCmdType
poReserved
Null; reserved for future use

Example

See IEdmCmdMgr5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCmdMgr5 Interface
IEdmCmdMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


AddToolbarImage Method (IEdmCmdMgr5)

AddToolbarImage Method (IEdmCmdMgr5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCmdMgr5 Interface : AddToolbarImage Method (IEdmCmdMgr5)

lHandleOrResourceID
Resource ID if bIsHandle = false; handle to a bitmap (bIsIcon = false) or icon (bIsIcon = true) if bIsHandle = true
lButtonCount
Number of buttons in the bitmap or icon
eState
State of the toolbar button (see Remarks)
bIsIcon
True if the image is an icon; false if it is a bitmap (see Remarks)
bIsHandle
True if lHandleOrResourceID is a handle, false if it is a resource ID
lBackgroundColorRGB
RGB value of the background color (see Remarks)
lImageID
ID of the image (see Remarks)

Registers an image with a toolbar button.

NOTE: This method does not work in Windows Vista and later Windows operating systems.

Syntax

Visual Basic
Sub AddToolbarImage( _
   ByVal lHandleOrResourceID As System.Integer, _
   ByVal lButtonCount As System.Integer, _
   ByVal eState As EdmButtonState, _
   Optional ByVal bIsIcon As System.Boolean, _
   Optional ByVal bIsHandle As System.Boolean, _
   Optional ByVal lBackgroundColorRGB As System.Integer, _
   Optional ByVal lImageID As System.Integer _
)
C#
void AddToolbarImage(
   System.int lHandleOrResourceID,
   System.int lButtonCount,
   EdmButtonState eState,
   System.bool bIsIcon,
   System.bool bIsHandle,
   System.int lBackgroundColorRGB,
   System.int lImageID
)
C++/CLI
void AddToolbarImage(
&   System.int lHandleOrResourceID,
&   System.int lButtonCount,
&   EdmButtonState eState,
&   System.bool bIsIcon,
&   System.bool bIsHandle,
&   System.int lBackgroundColorRGB,
&   System.int lImageID
)

Parameters

lHandleOrResourceID
Resource ID if bIsHandle = false; handle to a bitmap (bIsIcon = false) or icon (bIsIcon = true) if bIsHandle = true
lButtonCount
Number of buttons in the bitmap or icon
eState
State of the toolbar button (see Remarks)
bIsIcon
True if the image is an icon; false if it is a bitmap (see Remarks)
bIsHandle
True if lHandleOrResourceID is a handle, false if it is a resource ID
lBackgroundColorRGB
RGB value of the background color (see Remarks)
lImageID
ID of the image (see Remarks)

Example

For a more complete description of how to use this method, see Creating a menu command.

The following snippet creates a toolbar button and adds a command in the File Explorer Tools menu. The button uses one icon (resource ID=101) for the cold (standard) state and another one (resource ID=102) for the hot (focus) state. Both icon files must be added using Visual Basic's resource editor before running this snippet:

Private Sub IEdmAddIn5_GetAddInInfo(poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5)

...
poCmdMgr.AddToolbarImage 101, 1, BState_Cold, True, False, 12632256, 1
poCmdMgr.AddToolbarImage 102, 1, BState_Hot, True, False, 12632256, 1
poCmdMgr.AddCmd 1, "My Command", EdmMenu_NeverInContextMenu Or EdmMenu_HasToolbarButton, "String to show in the statusbar", "Tooltip on my command", 0, 1

End Sub

Remarks

Call this method from your add-in's implementation of IEdmAddIn5::GetAddInInfo to create a toolbar button.

Images can be either bitmaps (*.BMP) or icons (*.ICO). A bitmap contains one or more buttons of the same size. An icon contains only one button.

Unlike icons, bitmaps do not contain transparent regions. In order to get transparency in bitmaps, specify in lBackgroundColorRGB the RGB color of the bitmap that should be replaced by the background color.

When you add "hot" buttons (eState = EdmButtonState.BState_Hot), they must be assigned the same image ID as the corresponding "cold" buttons (eState = EdmButtonState.BState_Cold). Additionally, if the images contain several toolbar buttons, the buttons must be ordered the same way in both images.

Toolbar buttons in File Explorer can have several different sizes depending on the operating system version, Internet Explorer version, and user preferences. To make the image compatible, use this method to add several versions of an image using the same image ID but with different image sizes. SOLIDWORKS PDM Professional chooses the image that best matches the system settings. If the image doesn't exactly match the button size, PDM either resizes it (if the button is smaller than the image) or centers it in the button (if the button is bigger than the image).

After calling this method to create a toolbar button, call IEdmCmdMgr5::AddCmd setting lToolbarImageID to this method's lImageID.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCmdMgr5 Interface
IEdmCmdMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmCmdMgr6 Interface

IEdmCmdMgr6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCmdMgr6 Interface

Allows you to add menu commands, toolbar buttons, and command hooks to SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCmdMgr6
   Inherits IEdmCmdMgr5
C#
public interface IEdmCmdMgr6 : IEdmCmdMgr5
C++/CLI
public interface class IEdmCmdMgr6 : public IEdmCmdMgr5

Example

Create Vault View Tab Add-in (C#)

Remarks

This interface extends IEdmCmdMgr5 by providing the ability to add a custom tab to a vault view before it is opened in File Explorer.

A pointer to this interface is provided by SOLIDWORKS PDM Professional when it loads an add-in. IEdmAddIn5::GetAddInInfo's poCmdMgr contains a pointer to this interface. Within your implementation of IEdmAddIn5::GetAddInInfo, use this pointer to call:

  • IEdmCmdMgr5::AddCmd to add menu commands
  • IEdmCmdMgr5::AddToolbarImage to add toolbar buttons
  • IEdmCmdMgr5::AddHook to add command hooks

to SOLIDWORKS PDM Professional.

Accessors

IEdmAddIn5::GetAddInInfo

See Also

IEdmCmdMgr6 Members
EPDM.Interop.epdm Namespace
Creating Menu Commands (VB.NET)
Creating Add-in Hooks (VB.NET)


IEdmCmdMgr6 Interface Members

IEdmCmdMgr6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCmdMgr6 Interface

The following tables list the members exposed by IEdmCmdMgr6.

Public Methods

 | Name | Description
Method | AddVaultViewTab | Adds the specified tab to the right of the tabs in the bottom panel of a vault view before opening it in File Explorer.
Top

See Also

IEdmCmdMgr6 Interface
EPDM.Interop.epdm Namespace
Creating Menu Commands (VB.NET)
Creating Add-in Hooks (VB.NET)


IEdmCmdMgr6 Interface Methods

IEdmCmdMgr6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmCmdMgr6 Interface

For a list of all members of this type, see IEdmCmdMgr6 members.

Public Methods

 | Name | Description
Method | AddVaultViewTab | Adds the specified tab to the right of the tabs in the bottom panel of a vault view before opening it in File Explorer.
Top

See Also

IEdmCmdMgr6 Interface
EPDM.Interop.epdm Namespace
Creating Menu Commands (VB.NET)
Creating Add-in Hooks (VB.NET)


AddVaultViewTab Method (IEdmCmdMgr6)

AddVaultViewTab Method (IEdmCmdMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCmdMgr6 Interface : AddVaultViewTab Method (IEdmCmdMgr6)

hWnd
Handle of the .NET control to display in the tab
bsName
Name of the tab
bsIconPath
Full path and filename of the 16X16 PNG image to display next to bsName on the tab
bsToolTip
Tool tip for the tab
bsUniqueID
Unique ID for this control
Adds the specified tab to the right of the tabs in the bottom panel of a vault view before opening it in File Explorer.

Syntax

Visual Basic
Sub AddVaultViewTab( _
   ByVal hWnd As System.Long, _
   ByVal bsName As System.String, _
   ByVal bsIconPath As System.String, _
   ByVal bsToolTip As System.String, _
   ByVal bsUniqueID As System.String _
)
C#
void AddVaultViewTab(
   System.long hWnd,
   System.string bsName,
   System.string bsIconPath,
   System.string bsToolTip,
   System.string bsUniqueID
)
C++/CLI
void AddVaultViewTab(
&   System.int64 hWnd,
&   System.String^ bsName,
&   System.String^ bsIconPath,
&   System.String^ bsToolTip,
&   System.String^ bsUniqueID
)

Parameters

hWnd
Handle of the .NET control to display in the tab
bsName
Name of the tab
bsIconPath
Full path and filename of the 16X16 PNG image to display next to bsName on the tab
bsToolTip
Tool tip for the tab
bsUniqueID
Unique ID for this control

Example

See the IEdmCmdMgr6 examples.

Remarks

Call this method in your add-in's implementation of IEdmAddIn5::OnCmd where you handle the EdmCmdType.EdmCmd_PreExploreInit notification.

See Also

IEdmCmdMgr6 Interface
IEdmCmdMgr6 Members

Availability

SOLIDWORKS PDM Professional 2018


IEdmCmdNode Interface

IEdmCmdNode Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmCmdNode Interface

Allows you to access a file changing state.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmCmdNode
C#
public interface IEdmCmdNode
C++/CLI
public interface class IEdmCmdNode

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

A pointer to this interface is provided by SOLIDWORKS PDM Professional when one of the add-in's hooks or menu commands is executed. IEdmAddIn5::OnCmd's ppoData (EdmCmdData.mpoExtra) contains the pointer to the interface. Within your implementation of IEdmAddIn5::OnCmd, use this pointer to get the properties of the file changing state.

Accessors

IEdmAddIn5::OnCmd

See Also

IEdmCmdNode Members
EPDM.Interop.epdm Namespace


IEdmCmdNode Interface Members

IEdmCmdNode Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmCmdNode Interface

The following tables list the members exposed by IEdmCmdNode.

Public Methods

 | Name | Description
Method | GetProperty | Gets the specified property for the file changing state.
Top

See Also

IEdmCmdNode Interface
EPDM.Interop.epdm Namespace


IEdmCmdNode Interface Methods

IEdmCmdNode Interface Methods
EPDM.Interop.epdm Namespace : IEdmCmdNode Interface

For a list of all members of this type, see IEdmCmdNode members.

Public Methods

 | Name | Description
Method | GetProperty | Gets the specified property for the file changing state.
Top

See Also

IEdmCmdNode Interface
EPDM.Interop.epdm Namespace


GetProperty Method (IEdmCmdNode)

GetProperty Method (IEdmCmdNode)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCmdNode Interface : GetProperty Method (IEdmCmdNode)

eProperty
Type of property to retrieve as defined in EdmCmdNodeProp
oArg
Null; reserved for future use
Gets the specified property for the file changing state.

Syntax

Visual Basic
Function GetProperty( _
   ByVal eProperty As EdmCmdNodeProp, _
   Optional ByVal oArg As System.Object _
) As System.Object
C#
System.object GetProperty(
   EdmCmdNodeProp eProperty,
   System.object oArg
)
C++/CLI
System.Object^ GetProperty(
&   EdmCmdNodeProp eProperty,
&   System.Object^ oArg
)

Parameters

eProperty
Type of property to retrieve as defined in EdmCmdNodeProp
oArg
Null; reserved for future use

Return Value

Property value

Example

See the IEdmCmdNode examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCmdNode Interface
IEdmCmdNode Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmData Interface

IEdmData Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmData Interface

Allows you to access the properties of an object created by a template.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmData
C#
public interface IEdmData
C++/CLI
public interface class IEdmData

Example

Execute Template and Return Data (VB.NET)
Execute Template and Return Data (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

IEdmTemplate53::RunEx executes a template to create one or more files or folders. It returns an array of these interfaces, one for each file or folder, in its ppoRetData parameter.

Accessors

IEdmTemplate53::RunEx

See Also

IEdmData Members
EPDM.Interop.epdm Namespace


IEdmData Interface Members

IEdmData Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmData Interface

The following tables list the members exposed by IEdmData.

Public Properties

 | Name | Description
Property | Type | Gets or sets the type of this data object.
Top

Public Methods

 | Name | Description
Method | Get | Gets a data object property value.
Method | Set | Sets one of the data object properties to a new value.
Top

See Also

IEdmData Interface
EPDM.Interop.epdm Namespace


IEdmData Interface Methods

IEdmData Interface Methods
EPDM.Interop.epdm Namespace : IEdmData Interface

For a list of all members of this type, see IEdmData members.

Public Methods

 | Name | Description
Method | Get | Gets a data object property value.
Method | Set | Sets one of the data object properties to a new value.
Top

See Also

IEdmData Interface
EPDM.Interop.epdm Namespace


Get Method (IEdmData)

Get Method (IEdmData)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmData Interface : Get Method (IEdmData)

eKey
ID of property to retrieve as defined in EdmDataPropertyType
Gets a data object property value.

Syntax

Visual Basic
Function Get( _
   ByVal eKey As EdmDataPropertyType _
) As System.Object
C#
System.object Get(
   EdmDataPropertyType eKey
)
C++/CLI
System.Object^ Get(
&   EdmDataPropertyType eKey
)

Parameters

eKey
ID of property to retrieve as defined in EdmDataPropertyType

Return Value

Property value or empty if not found

Example

See the IEdmData examples.

Remarks

C++ programmers must remember to intialize the VARIANT struct for poValue with a call to VariantInit before calling the routine and release the returned data with a call to VariantClear.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmData Interface
IEdmData Members
IEdmData::Set Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


Set Method (IEdmData)

Set Method (IEdmData)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmData Interface : Set Method (IEdmData)

eKey
ID of property to update as defined in EdmDataPropertyType
poValue
New value of property
Sets one of the data object properties to a new value.

Syntax

Visual Basic
Sub Set( _
   ByVal eKey As EdmDataPropertyType, _
   ByRef poValue As System.Object _
)
C#
void Set(
   EdmDataPropertyType eKey,
   ref System.object poValue
)
C++/CLI
void Set(
&   EdmDataPropertyType eKey,
&   System.Object^% poValue
)

Parameters

eKey
ID of property to update as defined in EdmDataPropertyType
poValue
New value of property

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmData Interface
IEdmData Members
IEdmData::Get Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmData Interface Properties

IEdmData Interface Properties
EPDM.Interop.epdm Namespace : IEdmData Interface

For a list of all members of this type, see IEdmData members.

Public Properties

 | Name | Description
Property | Type | Gets or sets the type of this data object.
Top

See Also

IEdmData Interface
EPDM.Interop.epdm Namespace


Type Property (IEdmData)

Type Property (IEdmData)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmData Interface : Type Property (IEdmData)

Gets or sets the type of this data object.

Syntax

Visual Basic
Property Type As EdmDataType
C#
EdmDataType Type {get; set;}
C++/CLI
property EdmDataType Type {
   EdmDataType get();
   void set ( &   EdmDataType value);
}

Property Value

Type of data object as defined in EdmDataType

Example

See the IEdmData examples.

See Also

IEdmData Interface
IEdmData Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmDictionary5 Interface

IEdmDictionary5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmDictionary5 Interface

Allows you to access key-value pairs of data in the SOLIDWORKS PDM Professional database.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmDictionary5
   Inherits IEdmObject5
C#
public interface IEdmDictionary5 : IEdmObject5
C++/CLI
public interface class IEdmDictionary5 : public IEdmObject5

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)
Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

This interface inherits from IEdmObject5. Call IEdmObject5::Name to get the name of the dictionary.

To access this interface, call IEdmVault5::GetObject, setting eType to EdmObjectType.EdmObject_Dictionary.

A dictionary in SOLIDWORKS PDM Professional stores data as key-value pairs. Each key is mapped to exactly one value. Both keys and values can be searched using this interface.

Note: Instead of using dictionaries, you can also use IEdmEnumeratorVariable5 to store data in card variables that are connected to files and folders. One advantage of this is that if the data is logically linked to files or folders, the data is deleted and copied whenever the files or folders are deleted or copied.

Accessors

IEdmVault5::GetDictionary

IEdmVault5::GetObject

See Also

IEdmDictionary5 Members
EPDM.Interop.epdm Namespace


IEdmDictionary5 Interface Members

IEdmDictionary5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmDictionary5 Interface

The following tables list the members exposed by IEdmDictionary5.

Public Methods

 | Name | Description
Method | LongFindKeys | Starts an enumeration of all of the key-value pairs that have integer keys in the specified range.
Method | LongFindValues | Starts an enumeration of all of the key-value pairs that have integer keys whose values contain the specified text.
Method | LongGetAt | Gets the value for the specified integer key.
Method | LongGetFirstPosition | Starts an enumeration of all of the key-value pairs that have integer keys.
Method | LongGetNextAssoc | Gets the key-value pair at the next position of an enumeration.
Method | LongRemoveAt | Deletes the specified integer key and its value.
Method | LongSetAt | Sets the value for the specified integer key.
Method | LongTestAndSetAt | Creates the specified integer key if it does not exist and sets its value.
Method | RemoveDictionary | Removes this dictionary and all of its data from the SOLIDWORKS PDM Professional database.
Method | StringFindKeys | Starts an enumeration of all the key-value pairs whose string keys contain the specified text.
Method | StringFindValues | Starts an enumeration of all of the key-value pairs that have string keys whose values contain the specified text.
Method | StringGetAt | Gets the value for the specified string key.
Method | StringGetFirstPosition | Starts an enumeration of all of the key-value pairs that have string keys.
Method | StringGetNextAssoc | Gets the key-value pair at the next position of an enumeration.
Method | StringRemoveAt | Deletes the specified string key and its value.
Method | StringSetAt | Sets the value for the specified string key.
Method | StringTestAndSetAt | Creates the specified string key if it does not exist and sets its value.
Top

See Also

IEdmDictionary5 Interface
EPDM.Interop.epdm Namespace


IEdmDictionary5 Interface Methods

IEdmDictionary5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmDictionary5 Interface

For a list of all members of this type, see IEdmDictionary5 members.

Public Methods

 | Name | Description
Method | LongFindKeys | Starts an enumeration of all of the key-value pairs that have integer keys in the specified range.
Method | LongFindValues | Starts an enumeration of all of the key-value pairs that have integer keys whose values contain the specified text.
Method | LongGetAt | Gets the value for the specified integer key.
Method | LongGetFirstPosition | Starts an enumeration of all of the key-value pairs that have integer keys.
Method | LongGetNextAssoc | Gets the key-value pair at the next position of an enumeration.
Method | LongRemoveAt | Deletes the specified integer key and its value.
Method | LongSetAt | Sets the value for the specified integer key.
Method | LongTestAndSetAt | Creates the specified integer key if it does not exist and sets its value.
Method | RemoveDictionary | Removes this dictionary and all of its data from the SOLIDWORKS PDM Professional database.
Method | StringFindKeys | Starts an enumeration of all the key-value pairs whose string keys contain the specified text.
Method | StringFindValues | Starts an enumeration of all of the key-value pairs that have string keys whose values contain the specified text.
Method | StringGetAt | Gets the value for the specified string key.
Method | StringGetFirstPosition | Starts an enumeration of all of the key-value pairs that have string keys.
Method | StringGetNextAssoc | Gets the key-value pair at the next position of an enumeration.
Method | StringRemoveAt | Deletes the specified string key and its value.
Method | StringSetAt | Sets the value for the specified string key.
Method | StringTestAndSetAt | Creates the specified string key if it does not exist and sets its value.
Top

See Also

IEdmDictionary5 Interface
EPDM.Interop.epdm Namespace


LongFindKeys Method (IEdmDictionary5)

LongFindKeys Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongFindKeys Method (IEdmDictionary5)

lMinKey
Minimum key
lMaxKey
Maximum key
Starts an enumeration of all of the key-value pairs that have integer keys in the specified range.

Syntax

Visual Basic
Function LongFindKeys( _
   ByVal lMinKey As System.Integer, _
   ByVal lMaxKey As System.Integer _
) As IEdmPos5
C#
IEdmPos5 LongFindKeys(
   System.int lMinKey,
   System.int lMaxKey
)
C++/CLI
IEdmPos5^ LongFindKeys(
&   System.int lMinKey,
&   System.int lMaxKey
)

Parameters

lMinKey
Minimum key
lMaxKey
Maximum key

Return Value

IEdmPos5; position of the first key in the search result

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

After calling this method, call IEdmDictionary5::LongGetNextAssoc repeatedly to enumerate the rest of the key-value pairs in the search result.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringFindKeys Method ()
IEdmDictionary5::StringFindValues Method ()
IEdmDictionary5::LongFindValues Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongFindValues Method (IEdmDictionary5)

LongFindValues Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongFindValues Method (IEdmDictionary5)

bsValueSubString
Text to search for
Starts an enumeration of all of the key-value pairs that have integer keys whose values contain the specified text.

Syntax

Visual Basic
Function LongFindValues( _
   ByVal bsValueSubString As System.String _
) As IEdmPos5
C#
IEdmPos5 LongFindValues(
   System.string bsValueSubString
)
C++/CLI
IEdmPos5^ LongFindValues(
&   System.String^ bsValueSubString
)

Parameters

bsValueSubString
Text to search for

Return Value

IEdmPos5; position of the first key in the search result

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

After calling this method, call IEdmDictionary5::LongGetNextAssoc repeatedly to enumerate the rest of the key-value pairs in the search result.

C++ programmers not using smart-pointer wrapper functions must release the returned pointer to IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary::LongFindKeys Method ()
IEdmDictionary::StringFindKeys Method ()
IEdmDictionary::StringFindValues Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongGetAt Method (IEdmDictionary5)

LongGetAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongGetAt Method (IEdmDictionary5)

lKey
Key for which to get a value
pbsRetValue
Value for the specified key
Gets the value for the specified integer key.

Syntax

Visual Basic
Function LongGetAt( _
   ByVal lKey As System.Integer, _
   ByRef pbsRetValue As System.String _
) As System.Boolean
C#
System.bool LongGetAt(
   System.int lKey,
   out System.string pbsRetValue
)
C++/CLI
System.bool LongGetAt(
&   System.int lKey,
&   [Out] System.String^ pbsRetValue
)

Parameters

lKey
Key for which to get a value
pbsRetValue
Value for the specified key

Return Value

True if the key was found, false if not

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

C++ programmers must release the returned string by calling SysFreeString.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The key was not found.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringGetAt Method ()
IEdmDictionary5::LongSetAt Method ()
IEdmDictionary5::LongRemoveAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongGetFirstPosition Method (IEdmDictionary5)

LongGetFirstPosition Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongGetFirstPosition Method (IEdmDictionary5)

Starts an enumeration of all of the key-value pairs that have integer keys.

Syntax

Visual Basic
Function LongGetFirstPosition() As IEdmPos5
C#
IEdmPos5 LongGetFirstPosition()
C++/CLI
IEdmPos5^ LongGetFirstPosition();

Return Value

IEdmPos5; position of the first key-value pair

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

After calling this method, pass the position of the first key-value pair to IEdmDictionary5::LongGetNextAssoc to get the first key-value pair in the search result. Then call IEdmDictionary5::LongGetNextAssoc repeatedly to get the rest of the key-value pairs in the search result.

C++ programmers not using smart-pointer wrapper functions must release the returned pointer to IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringGetFirstPosition Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongGetNextAssoc Method (IEdmDictionary5)

LongGetNextAssoc Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongGetNextAssoc Method (IEdmDictionary5)

poPos
IEdmPos5; position of the next key-value pair (see Remarks)
plRetKey
Key in the next pair
pbsRetValue
Value in the next pair
Gets the key-value pair at the next position of an enumeration.

Syntax

Visual Basic
Sub LongGetNextAssoc( _
   ByVal poPos As IEdmPos5, _
   ByRef plRetKey As System.Integer, _
   ByRef pbsRetValue As System.String _
)
C#
void LongGetNextAssoc(
   IEdmPos5 poPos,
   out System.int plRetKey,
   out System.string pbsRetValue
)
C++/CLI
void LongGetNextAssoc(
&   IEdmPos5^ poPos,
&   [Out] System.int plRetKey,
&   [Out] System.String^ pbsRetValue
)

Parameters

poPos
IEdmPos5; position of the next key-value pair (see Remarks)
plRetKey
Key in the next pair
pbsRetValue
Value in the next pair

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first key-value pair. Call one of the following to obtain IEdmPos5 for the position of the first pair:

  • IEdmDictionary5::LongGetFirstPosition
  • IEdmDictionary5::LongFindKeys
  • IEdmDictionary5::LongFindValues

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the key-value pairs.

Between calls, you should call IEdmPos5::IsNull to verify that you have not gone past the last key-value pair.

C++ programmers must release the returned string by calling SysFreeString.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringGetNextAssoc Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongRemoveAt Method (IEdmDictionary5)

LongRemoveAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongRemoveAt Method (IEdmDictionary5)

lKey
Key to delete
Deletes the specified integer key and its value.

Syntax

Visual Basic
Sub LongRemoveAt( _
   ByVal lKey As System.Integer _
)
C#
void LongRemoveAt(
   System.int lKey
)
C++/CLI
void LongRemoveAt(
&   System.int lKey
)

Parameters

lKey
Key to delete

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::LongSetAt Method ()
IEdmDictionary5::StringRemoveAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongSetAt Method (IEdmDictionary5)

LongSetAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongSetAt Method (IEdmDictionary5)

lKey
Key whose value to set
bsValue
New value
Sets the value for the specified integer key.

Syntax

Visual Basic
Sub LongSetAt( _
   ByVal lKey As System.Integer, _
   ByVal bsValue As System.String _
)
C#
void LongSetAt(
   System.int lKey,
   System.string bsValue
)
C++/CLI
void LongSetAt(
&   System.int lKey,
&   System.String^ bsValue
)

Parameters

lKey
Key whose value to set
bsValue
New value

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringSetAt Method ()
IEdmDictionary5::LongRemoveAt Method ()
IEdmDictionary5::LongGetAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


LongTestAndSetAt Method (IEdmDictionary5)

LongTestAndSetAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : LongTestAndSetAt Method (IEdmDictionary5)

lKey
Key for which to set a value
bsValue
New value
Creates the specified integer key if it does not exist and sets its value.

Syntax

Visual Basic
Function LongTestAndSetAt( _
   ByVal lKey As System.Integer, _
   ByVal bsValue As System.String _
) As System.Boolean
C#
System.bool LongTestAndSetAt(
   System.int lKey,
   System.string bsValue
)
C++/CLI
System.bool LongTestAndSetAt(
&   System.int lKey,
&   System.String^ bsValue
)

Parameters

lKey
Key for which to set a value
bsValue
New value

Return Value

True if the value of a new key is successfully set, false otherwise

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

The testing and the setting are both performed in a single operation. A test-and-set function like this can be useful if you need a semaphore to synchronize several clients accessing the same data.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringTestAndSetAt Method ()
IEdmDictionary5::LongSetAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


RemoveDictionary Method (IEdmDictionary5)

RemoveDictionary Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : RemoveDictionary Method (IEdmDictionary5)

Removes this dictionary and all of its data from the SOLIDWORKS PDM Professional database.

Syntax

Visual Basic
Sub RemoveDictionary()
C#
void RemoveDictionary()
C++/CLI
void RemoveDictionary();

Example

Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


StringFindKeys Method (IEdmDictionary5)

StringFindKeys Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringFindKeys Method (IEdmDictionary5)

bsKeySubString
Text to search for
Starts an enumeration of all the key-value pairs whose string keys contain the specified text.

Syntax

Visual Basic
Function StringFindKeys( _
   ByVal bsKeySubString As System.String _
) As IEdmPos5
C#
IEdmPos5 StringFindKeys(
   System.string bsKeySubString
)
C++/CLI
IEdmPos5^ StringFindKeys(
&   System.String^ bsKeySubString
)

Parameters

bsKeySubString
Text to search for

Return Value

IEdmPos5; position of the first key-value pair in the search result

Example

Get and Set Dictionary Key-Value Pairs (VB.NET)
Get and Set Dictionary Key-Value Pairs (C#)

Remarks

After calling this method, call IEdmDictionary5::StringGetNextAssoc repeatedly to enumerate the rest of the key-value pairs in the search result.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::LongFindKeys Method ()
IEdmDictionary5::LongFindValues Method ()
IEdmDictionary5::StringFindValues Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringFindValues Method (IEdmDictionary5)

StringFindValues Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringFindValues Method (IEdmDictionary5)

bsValueSubString
Text to search for
Starts an enumeration of all of the key-value pairs that have string keys whose values contain the specified text.

Syntax

Visual Basic
Function StringFindValues( _
   ByVal bsValueSubString As System.String _
) As IEdmPos5
C#
IEdmPos5 StringFindValues(
   System.string bsValueSubString
)
C++/CLI
IEdmPos5^ StringFindValues(
&   System.String^ bsValueSubString
)

Parameters

bsValueSubString
Text to search for

Return Value

IEdmPos5; position of the first key-value pair in the search result

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)

Remarks

After calling this method, call IEdmDictionary5::StringGetNextAssoc repeatedly to enumerate the rest of the key-value pairs in the search result.

C++ programmers not using smart-pointer wrapper functions must release the returned pointer to IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::LongFindValues Method ()
IEdmDictionary5::LongFindKeys Method ()
IEdmDictionary5::StringFindKeys Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringGetAt Method (IEdmDictionary5)

StringGetAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringGetAt Method (IEdmDictionary5)

bsKey
Key for which to get a value
pbsRetValue
Value for the specified key
Gets the value for the specified string key.

Syntax

Visual Basic
Function StringGetAt( _
   ByVal bsKey As System.String, _
   ByRef pbsRetValue As System.String _
) As System.Boolean
C#
System.bool StringGetAt(
   System.string bsKey,
   out System.string pbsRetValue
)
C++/CLI
System.bool StringGetAt(
&   System.String^ bsKey,
&   [Out] System.String^ pbsRetValue
)

Parameters

bsKey
Key for which to get a value
pbsRetValue
Value for the specified key

Return Value

True if the key was found, false if not

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)

Remarks

C++ programmers must release the returned string by calling SysFreeString.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The key was not found.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringSetAt Method ()
IEdmDictionary5::StringRemoveAt Method ()
IEdmDictionary5::LongGetAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringGetFirstPosition Method (IEdmDictionary5)

StringGetFirstPosition Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringGetFirstPosition Method (IEdmDictionary5)

Starts an enumeration of all of the key-value pairs that have string keys.

Syntax

Visual Basic
Function StringGetFirstPosition() As IEdmPos5
C#
IEdmPos5 StringGetFirstPosition()
C++/CLI
IEdmPos5^ StringGetFirstPosition();

Return Value

IEdmPos5; position of the first key-value pair

Example

Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)

Remarks

After calling this method, pass the position of the first key-value pair to IEdmDictionary5::StringGetNextAssoc to get the first key-value pair in the search result. Then call IEdmDictionary5::StringGetNextAssoc repeatedly to get the rest of the key-value pairs in the search result.

C++ programmers not using smart-pointer wrapper functions must release the returned pointer to IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::LongGetFirstPosition Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringGetNextAssoc Method (IEdmDictionary5)

StringGetNextAssoc Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringGetNextAssoc Method (IEdmDictionary5)

poPos
IEdmPos5; position of the next key-value pair (see Remarks)
pbsRetKey
Key in the next pair
pbsRetValue
Value in the next pair
Gets the key-value pair at the next position of an enumeration.

Syntax

Visual Basic
Sub StringGetNextAssoc( _
   ByVal poPos As IEdmPos5, _
   ByRef pbsRetKey As System.String, _
   ByRef pbsRetValue As System.String _
)
C#
void StringGetNextAssoc(
   IEdmPos5 poPos,
   out System.string pbsRetKey,
   out System.string pbsRetValue
)
C++/CLI
void StringGetNextAssoc(
&   IEdmPos5^ poPos,
&   [Out] System.String^ pbsRetKey,
&   [Out] System.String^ pbsRetValue
)

Parameters

poPos
IEdmPos5; position of the next key-value pair (see Remarks)
pbsRetKey
Key in the next pair
pbsRetValue
Value in the next pair

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first key-value pair. Call one of the following to obtain IEdmPos5 for the position of the first pair:

  • IEdmDictionary5::StringGetFirstPosition
  • IEdmDictionary5::StringFindKeys
  • IEdmDictionary5::StringFindValues

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the key-value pairs.

Between calls, you should call IEdmPos5::IsNull to verify that you have not gone past the last key-value pair.

C++ programmers must release the returned strings by calling SysFreeString.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::LongGetNextAssoc Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringRemoveAt Method (IEdmDictionary5)

StringRemoveAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringRemoveAt Method (IEdmDictionary5)

bsKey
Key to remove
Deletes the specified string key and its value.

Syntax

Visual Basic
Sub StringRemoveAt( _
   ByVal bsKey As System.String _
)
C#
void StringRemoveAt(
   System.string bsKey
)
C++/CLI
void StringRemoveAt(
&   System.String^ bsKey
)

Parameters

bsKey
Key to remove

Example

Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::LongRemoveAt Method ()
IEdmDictionary5::StringSetAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringSetAt Method (IEdmDictionary5)

StringSetAt Method (IEdmDictionary5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringSetAt Method (IEdmDictionary5)

bsKey
Key whose value to set
bsValue
New value
Sets the value for the specified string key.

Syntax

Visual Basic
Sub StringSetAt( _
   ByVal bsKey As System.String, _
   ByVal bsValue As System.String _
)
C#
void StringSetAt(
   System.string bsKey,
   System.string bsValue
)
C++/CLI
void StringSetAt(
&   System.String^ bsKey,
&   System.String^ bsValue
)

Parameters

bsKey
Key whose value to set
bsValue
New value

Example

See the examples for IEdmDictionary5.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringGetAt Method ()
IEdmDictionary5::StringRemoveAt Method ()
IEdmDictionary5::LongSetAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StringTestAndSetAt Method (IEdmDictionary5)

StringTestAndSetAt Method (IEdmDictionary5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmDictionary5 Interface : StringTestAndSetAt Method (IEdmDictionary5)

bsKey
Key for which to set a value
bsValue
New value
Creates the specified string key if it does not exist and sets its value.

Syntax

Visual Basic
Function StringTestAndSetAt( _
   ByVal bsKey As System.String, _
   ByVal bsValue As System.String _
) As System.Boolean
C#
System.bool StringTestAndSetAt(
   System.string bsKey,
   System.string bsValue
)
C++/CLI
System.bool StringTestAndSetAt(
&   System.String^ bsKey,
&   System.String^ bsValue
)

Parameters

bsKey
Key for which to set a value
bsValue
New value

Return Value

True if the value of a new key is successfully set, false if not

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)

Remarks

The testing and setting are both performed in a single operation. A test-and-set function like this is useful when you need a semaphore to synchronize several clients accessing the same data. See the example in IEdmDictionary5::LongTestAndSetAt.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmDictionary5 Interface
IEdmDictionary5 Members
IEdmDictionary5::StringSetAt Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmEnum Interface

IEdmEnum Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnum Interface

Allows you to access and enumerate a list of elements.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnum
C#
public interface IEdmEnum
C++/CLI
public interface class IEdmEnum

Example

Find Users (VB.NET)
Find Users (C#)

Accessors

IEdmFindUser::Result

See Also

IEdmEnum Members
EPDM.Interop.epdm Namespace


IEdmEnum Interface Members

IEdmEnum Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmEnum Interface

The following tables list the members exposed by IEdmEnum.

Public Properties

 | Name | Description
Property | Count | Gets the number of elements in the list.
Property | Current | Gets the element at the enumeration cursor.
Top

Public Methods

 | Name | Description
Method | GetAt | Gets the element at the specified position in the list.
Method | GetEnumerator | Gets a pointer to this interface.
Method | MoveNext | Forwards the enumeration cursor to the next element in the list.
Method | Reset | Resets the enumerator's cursor to the position before the first element in the list.
Top

See Also

IEdmEnum Interface
EPDM.Interop.epdm Namespace


IEdmEnum Interface Methods

IEdmEnum Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnum Interface

For a list of all members of this type, see IEdmEnum members.

Public Methods

 | Name | Description
Method | GetAt | Gets the element at the specified position in the list.
Method | GetEnumerator | Gets a pointer to this interface.
Method | MoveNext | Forwards the enumeration cursor to the next element in the list.
Method | Reset | Resets the enumerator's cursor to the position before the first element in the list.
Top

See Also

IEdmEnum Interface
EPDM.Interop.epdm Namespace


GetAt Method (IEdmEnum)

GetAt Method (IEdmEnum)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnum Interface : GetAt Method (IEdmEnum)

lIndex
Zero-based index of the element to retrieve
Gets the element at the specified position in the list.

Syntax

Visual Basic
Function GetAt( _
   ByVal lIndex As System.Integer _
) As System.Object
C#
System.object GetAt(
   System.int lIndex
)
C++/CLI
System.Object^ GetAt(
&   System.int lIndex
)

Parameters

lIndex
Zero-based index of the element to retrieve

Return Value

Element at the specified position

Remarks

To enumerate a list, call IEdmEnum::MoveNext and IEdmEnum::Current, both of which are more efficient than this method.

Return codes:

  • S_OK: The method successfully executed.
  • E_INVALIDARG: The specified index is outside the range of this list.

See Also

IEdmEnum Interface
IEdmEnum Members

Availability

SOLIDWORKS PDM Professional 2013


GetEnumerator Method (IEdmEnum)

GetEnumerator Method (IEdmEnum)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnum Interface : GetEnumerator Method (IEdmEnum)

Gets a pointer to this interface.

Syntax

Visual Basic
Function GetEnumerator() As IEdmEnum
C#
IEdmEnum GetEnumerator()
C++/CLI
IEdmEnum^ GetEnumerator();

Return Value

IEdmEnum

Remarks

This method is used implicitly in the For Each command loops of .NET programs.

See Also

IEdmEnum Interface
IEdmEnum Members

Availability

SOLIDWORKS PDM Professional 2013


MoveNext Method (IEdmEnum)

MoveNext Method (IEdmEnum)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnum Interface : MoveNext Method (IEdmEnum)

Forwards the enumeration cursor to the next element in the list.

Syntax

Visual Basic
Function MoveNext() As System.Boolean
C#
System.bool MoveNext()
C++/CLI
System.bool MoveNext();

Return Value

True if the cursor moved to the next element successfully, false if not

Remarks

This method is used implicitly in the For Each command loops of .NET programs.

After calling this method, call IEdmEnum::Current to access the element currently pointed to by the enumerator's cursor.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmEnum Interface
IEdmEnum Members

Availability

SOLIDWORKS PDM Professional 2013


Reset Method (IEdmEnum)

Reset Method (IEdmEnum)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnum Interface : Reset Method (IEdmEnum)

Resets the enumerator's cursor to the position before the first element in the list.

Syntax

Visual Basic
Sub Reset()
C#
void Reset()
C++/CLI
void Reset();

Remarks

After calling this method, you must call IEdmEnum::MoveNext before you can call IEdmEnum::Current to get the first element in the list.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmEnum Interface
IEdmEnum Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmEnum Interface Properties

IEdmEnum Interface Properties
EPDM.Interop.epdm Namespace : IEdmEnum Interface

For a list of all members of this type, see IEdmEnum members.

Public Properties

 | Name | Description
Property | Count | Gets the number of elements in the list.
Property | Current | Gets the element at the enumeration cursor.
Top

See Also

IEdmEnum Interface
EPDM.Interop.epdm Namespace


Count Property (IEdmEnum)

Count Property (IEdmEnum)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnum Interface : Count Property (IEdmEnum)

Gets the number of elements in the list.

Syntax

Visual Basic
ReadOnly Property Count As System.Integer
C#
System.int Count {get;}
C++/CLI
property System.int Count {
   System.int get();
}

Property Value

Number of elements in the list

Example

See the IEdmEnum examples.

See Also

IEdmEnum Interface
IEdmEnum Members

Availability

SOLIDWORKS PDM Professional 2013


Current Property (IEdmEnum)

Current Property (IEdmEnum)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnum Interface : Current Property (IEdmEnum)

Gets the element at the enumeration cursor.

Syntax

Visual Basic
ReadOnly Property Current As System.Object
C#
System.object Current {get;}
C++/CLI
property System.Object^ Current {
   System.Object^ get();
}

Property Value

Element at the cursor

See Also

IEdmEnum Interface
IEdmEnum Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmEnumeratorCustomReference5 Interface

IEdmEnumeratorCustomReference5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference5 Interface

Allows you to access custom file references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorCustomReference5
C#
public interface IEdmEnumeratorCustomReference5
C++/CLI
public interface class IEdmEnumeratorCustomReference5

Example

Access Custom File References (VB.NET)
Access Custom File References (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmEnumeratorCustomReference6 which adds the ability to specify or get the number of times that a file is referenced by this file.

To use this interface:

  1. Get the file to which you want to add references from the vault using IEdmVault5::GetFileFromPath.
  2. Cast the IEdmFile5 object returned in step 1 to IEdmEnumeratorCustomReference5.
  3. Get a pointer to the file reference using IEdmVault5::GetFileFromPath.
  4. Call IEdmEnumeratorCustomReference::AddReference to add the file reference in step 3 to the file in step 1.

In the SOLIDWORKS PDM Professional user interface, you handle file references in the Contains page of the Properties dialog box. Using the API, you can perform the same file reference tasks that you do in the user interface, for example, adding, removing, and viewing file references. File references can be checked in like any other file in SOLIDWORKS PDM Professional.

See Also

IEdmEnumeratorCustomReference5 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorCustomReference5 Interface Members

IEdmEnumeratorCustomReference5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference5 Interface

The following tables list the members exposed by IEdmEnumeratorCustomReference5.

Public Methods

 | Name | Description
Method | AddReference | Obsolete. Superseded by IEdmEnumeratorCustomReference6::AddReference2 .
Method | GetFirstRefPosition | Starts an enumeration of custom file references.
Method | GetNextRef | Obsolete. Supserseded by IEdmEnumeratorCustomReference6::GetNextRef2 .
Method | RemoveReference | Removes the specified custom file reference from this file.
Top

See Also

IEdmEnumeratorCustomReference5 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorCustomReference5 Interface Methods

IEdmEnumeratorCustomReference5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference5 Interface

For a list of all members of this type, see IEdmEnumeratorCustomReference5 members.

Public Methods

 | Name | Description
Method | AddReference | Obsolete. Superseded by IEdmEnumeratorCustomReference6::AddReference2 .
Method | GetFirstRefPosition | Starts an enumeration of custom file references.
Method | GetNextRef | Obsolete. Supserseded by IEdmEnumeratorCustomReference6::GetNextRef2 .
Method | RemoveReference | Removes the specified custom file reference from this file.
Top

See Also

IEdmEnumeratorCustomReference5 Interface
EPDM.Interop.epdm Namespace


AddReference Method (IEdmEnumeratorCustomReference5)

AddReference Method (IEdmEnumeratorCustomReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference5 Interface : AddReference Method (IEdmEnumeratorCustomReference5)

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
Obsolete. Superseded by IEdmEnumeratorCustomReference6::AddReference2 .

Syntax

Visual Basic
Sub AddReference( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer _
)
C#
void AddReference(
   System.int lFileID,
   System.int lFolderID
)
C++/CLI
void AddReference(
&   System.int lFileID,
&   System.int lFolderID
)

Parameters

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: File is not checked out.

See Also

IEdmEnumeratorCustomReference5 Interface
IEdmEnumeratorCustomReference5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstRefPosition Method (IEdmEnumeratorCustomReference5)

GetFirstRefPosition Method (IEdmEnumeratorCustomReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference5 Interface : GetFirstRefPosition Method (IEdmEnumeratorCustomReference5)

Starts an enumeration of custom file references.

Syntax

Visual Basic
Function GetFirstRefPosition() As IEdmPos5
C#
IEdmPos5 GetFirstRefPosition()
C++/CLI
IEdmPos5^ GetFirstRefPosition();

Return Value

IEdmPos5; position of the first custom file reference

Example

See the IEdmEnumeratorCustomReference5 examples.

Remarks

After calling this method, pass the position of the first custom file reference to IEdmEnumeratorCustomReference5::GetNextRef to get the first custom file reference. Then call IEdmEnumeratorCustomReference5::GetNextRef repeatedly to get the rest of the custom file references.

C++ programmers not using smart-pointer wrapper functions must release the returned pointer to IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmEnumeratorCustomReference5 Interface
IEdmEnumeratorCustomReference5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextRef Method (IEdmEnumeratorCustomReference5)

GetNextRef Method (IEdmEnumeratorCustomReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference5 Interface : GetNextRef Method (IEdmEnumeratorCustomReference5)

poPos
IEdmPos5; position of the next custom file reference
plFileID
ID of the referenced file
plFolderID
ID of the parent folder of the referenced file
Obsolete. Supserseded by IEdmEnumeratorCustomReference6::GetNextRef2 .

Syntax

Visual Basic
Function GetNextRef( _
   ByVal poPos As IEdmPos5, _
   ByRef plFileID As System.Integer, _
   ByRef plFolderID As System.Integer _
) As System.String
C#
System.string GetNextRef(
   IEdmPos5 poPos,
   out System.int plFileID,
   out System.int plFolderID
)
C++/CLI
System.String^ GetNextRef(
&   IEdmPos5^ poPos,
&   [Out] System.int plFileID,
&   [Out] System.int plFolderID
)

Parameters

poPos
IEdmPos5; position of the next custom file reference
plFileID
ID of the referenced file
plFolderID
ID of the parent folder of the referenced file

Return Value

Path name of the referenced file

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first custom file reference, IEdmPos5. Call IEdmEnumeratorCustomReference5::GetFirstRefPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the custom file references.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmEnumeratorCustomReference5 Interface
IEdmEnumeratorCustomReference5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


RemoveReference Method (IEdmEnumeratorCustomReference5)

RemoveReference Method (IEdmEnumeratorCustomReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference5 Interface : RemoveReference Method (IEdmEnumeratorCustomReference5)

lFileID
ID of file to remove
lFolderID
ID of the file's parent folder
Removes the specified custom file reference from this file.

Syntax

Visual Basic
Sub RemoveReference( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer _
)
C#
void RemoveReference(
   System.int lFileID,
   System.int lFolderID
)
C++/CLI
void RemoveReference(
&   System.int lFileID,
&   System.int lFolderID
)

Parameters

lFileID
ID of file to remove
lFolderID
ID of the file's parent folder

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: The file is not checked out.

See Also

IEdmEnumeratorCustomReference5 Interface
IEdmEnumeratorCustomReference5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmEnumeratorCustomReference6 Interface

IEdmEnumeratorCustomReference6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference6 Interface

Allows you to access user-defined file references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorCustomReference6
   Inherits IEdmEnumeratorCustomReference5
C#
public interface IEdmEnumeratorCustomReference6 : IEdmEnumeratorCustomReference5
C++/CLI
public interface class IEdmEnumeratorCustomReference6 : public IEdmEnumeratorCustomReference5

Example

Access Custom File References (VB.NET)
Access Custom File References (C#)

Accessors

This interface:

  • extends IEdmEnumeratorCustomReference5 by adding the ability to specify and get the number of times a file is referenced by another file.
  • is extended by IEdmEnumeratorCustomReference7.

See Also

IEdmEnumeratorCustomReference6 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorCustomReference6 Interface Members

IEdmEnumeratorCustomReference6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference6 Interface

The following tables list the members exposed by IEdmEnumeratorCustomReference6.

Public Methods

 | Name | Description
Method | AddReference2 | Obsolete. Superseded by IEdmEnumeratorCustomReference7::AddReference3 .
Method | GetNextRef2 | Gets the custom file reference at the next position of an enumeration.
Top

See Also

IEdmEnumeratorCustomReference6 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorCustomReference6 Interface Methods

IEdmEnumeratorCustomReference6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference6 Interface

For a list of all members of this type, see IEdmEnumeratorCustomReference6 members.

Public Methods

 | Name | Description
Method | AddReference2 | Obsolete. Superseded by IEdmEnumeratorCustomReference7::AddReference3 .
Method | GetNextRef2 | Gets the custom file reference at the next position of an enumeration.
Top

See Also

IEdmEnumeratorCustomReference6 Interface
EPDM.Interop.epdm Namespace


AddReference2 Method (IEdmEnumeratorCustomReference6)

AddReference2 Method (IEdmEnumeratorCustomReference6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference6 Interface : AddReference2 Method (IEdmEnumeratorCustomReference6)

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
lQuantity
Number of times the referenced file is referenced
Obsolete. Superseded by IEdmEnumeratorCustomReference7::AddReference3 .

Syntax

Visual Basic
Sub AddReference2( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer, _
   ByVal lQuantity As System.Integer _
)
C#
void AddReference2(
   System.int lFileID,
   System.int lFolderID,
   System.int lQuantity
)
C++/CLI
void AddReference2(
&   System.int lFileID,
&   System.int lFolderID,
&   System.int lQuantity
)

Parameters

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
lQuantity
Number of times the referenced file is referenced

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: File is not checked out.

See Also

IEdmEnumeratorCustomReference6 Interface
IEdmEnumeratorCustomReference6 Members

Availability

SOLIDWORKS PDM Professional 2013


GetNextRef2 Method (IEdmEnumeratorCustomReference6)

GetNextRef2 Method (IEdmEnumeratorCustomReference6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference6 Interface : GetNextRef2 Method (IEdmEnumeratorCustomReference6)

poPos
IEdmPos5; position of the next custom file reference
plFileID
ID of the referenced file
plFolderID
ID of the parent folder of the referenced file
pbsRetPath
Path name of the referenced file
plQuantity
Number of times the referenced file is referenced
Gets the custom file reference at the next position of an enumeration.

Syntax

Visual Basic
Sub GetNextRef2( _
   ByVal poPos As IEdmPos5, _
   ByRef plFileID As System.Integer, _
   ByRef plFolderID As System.Integer, _
   ByRef pbsRetPath As System.String, _
   ByRef plQuantity As System.Integer _
)
C#
void GetNextRef2(
   IEdmPos5 poPos,
   out System.int plFileID,
   out System.int plFolderID,
   out System.string pbsRetPath,
   out System.int plQuantity
)
C++/CLI
void GetNextRef2(
&   IEdmPos5^ poPos,
&   [Out] System.int plFileID,
&   [Out] System.int plFolderID,
&   [Out] System.String^ pbsRetPath,
&   [Out] System.int plQuantity
)

Parameters

poPos
IEdmPos5; position of the next custom file reference
plFileID
ID of the referenced file
plFolderID
ID of the parent folder of the referenced file
pbsRetPath
Path name of the referenced file
plQuantity
Number of times the referenced file is referenced

Example

See the IEdmEnumeratorCustomReference6 examples.

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first custom file reference, IEdmPos5. Call IEdmEnumeratorCustomReference5::GetFirstRefPosition to obtain IEdmPos5.

After this method is called the first time, poPos is automatically incremented every time it is called.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmEnumeratorCustomReference6 Interface
IEdmEnumeratorCustomReference6 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmEnumeratorCustomReference7 Interface

IEdmEnumeratorCustomReference7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference7 Interface

Allows you to access user-defined file references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorCustomReference7
   Inherits IEdmEnumeratorCustomReference5, IEdmEnumeratorCustomReference6
C#
public interface IEdmEnumeratorCustomReference7 : IEdmEnumeratorCustomReference5, IEdmEnumeratorCustomReference6
C++/CLI
public interface class IEdmEnumeratorCustomReference7 : public IEdmEnumeratorCustomReference5, IEdmEnumeratorCustomReference6

Example

Access Custom File References (VB.NET)
Access Custom File References (C#)

Remarks

This interface extends IEdmEnumeratorCustomReference6 by adding the ability to specify whether to display this custom reference in a BOM.

See Also

IEdmEnumeratorCustomReference7 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorCustomReference7 Interface Members

IEdmEnumeratorCustomReference7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference7 Interface

The following tables list the members exposed by IEdmEnumeratorCustomReference7.

Public Methods

 | Name | Description
Method | AddReference3 | Adds a custom file reference to this file.
Method | GetShowInBOM | Gets whether the specified file's user-defined file references are shown in a BOM.
Method | SetShowInBOM | Sets whether to show the specified file's user-defined file references in a BOM.
Top

See Also

IEdmEnumeratorCustomReference7 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorCustomReference7 Interface Methods

IEdmEnumeratorCustomReference7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorCustomReference7 Interface

For a list of all members of this type, see IEdmEnumeratorCustomReference7 members.

Public Methods

 | Name | Description
Method | AddReference3 | Adds a custom file reference to this file.
Method | GetShowInBOM | Gets whether the specified file's user-defined file references are shown in a BOM.
Method | SetShowInBOM | Sets whether to show the specified file's user-defined file references in a BOM.
Top

See Also

IEdmEnumeratorCustomReference7 Interface
EPDM.Interop.epdm Namespace


AddReference3 Method (IEdmEnumeratorCustomReference7)

AddReference3 Method (IEdmEnumeratorCustomReference7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference7 Interface : AddReference3 Method (IEdmEnumeratorCustomReference7)

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
lQuantity
Number of times the referenced file is referenced
bShowInBOM
True to show this file reference in the BOM, false to not
Adds a custom file reference to this file.

Syntax

Visual Basic
Sub AddReference3( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer, _
   ByVal lQuantity As System.Integer, _
   Optional ByVal bShowInBOM As System.Boolean _
)
C#
void AddReference3(
   System.int lFileID,
   System.int lFolderID,
   System.int lQuantity,
   System.bool bShowInBOM
)
C++/CLI
void AddReference3(
&   System.int lFileID,
&   System.int lFolderID,
&   System.int lQuantity,
&   System.bool bShowInBOM
)

Parameters

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
lQuantity
Number of times the referenced file is referenced
bShowInBOM
True to show this file reference in the BOM, false to not

Example

See the IEdmEnumeratorCustomReference7 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: File is not checked out.

See Also

IEdmEnumeratorCustomReference7 Interface
IEdmEnumeratorCustomReference7 Members

Availability

SOLIDWORKS PDM Professional 2017


GetShowInBOM Method (IEdmEnumeratorCustomReference7)

GetShowInBOM Method (IEdmEnumeratorCustomReference7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference7 Interface : GetShowInBOM Method (IEdmEnumeratorCustomReference7)

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
Gets whether the specified file's user-defined file references are shown in a BOM.

Syntax

Visual Basic
Function GetShowInBOM( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer _
) As System.Boolean
C#
System.bool GetShowInBOM(
   System.int lFileID,
   System.int lFolderID
)
C++/CLI
System.bool GetShowInBOM(
&   System.int lFileID,
&   System.int lFolderID
)

Parameters

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file

Return Value

True if the specified file's user-defined file references are shown in a BOM, false if not

Example

Access Custom File References (C#)
Access Custom File References (VB.NET)

See Also

IEdmEnumeratorCustomReference7 Interface
IEdmEnumeratorCustomReference7 Members
IEdmEnumeratorCustomReference7::GetShowInBOM Method ()

Availability

SOLIDWORKS PDM Professional 2017


SetShowInBOM Method (IEdmEnumeratorCustomReference7)

SetShowInBOM Method (IEdmEnumeratorCustomReference7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorCustomReference7 Interface : SetShowInBOM Method (IEdmEnumeratorCustomReference7)

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
bShowInBOM
True to show the specified file's user-defined file references in a BOM, false to not
Sets whether to show the specified file's user-defined file references in a BOM.

Syntax

Visual Basic
Sub SetShowInBOM( _
   ByVal lFileID As System.Integer, _
   ByVal lFolderID As System.Integer, _
   ByVal bShowInBOM As System.Boolean _
)
C#
void SetShowInBOM(
   System.int lFileID,
   System.int lFolderID,
   System.bool bShowInBOM
)
C++/CLI
void SetShowInBOM(
&   System.int lFileID,
&   System.int lFolderID,
&   System.bool bShowInBOM
)

Parameters

lFileID
ID of referenced file
lFolderID
ID of parent folder of referenced file
bShowInBOM
True to show the specified file's user-defined file references in a BOM, false to not

See Also

IEdmEnumeratorCustomReference7 Interface
IEdmEnumeratorCustomReference7 Members
IEdmEnumeratorCustomReference7::GetShowInBOM Method ()

Availability

SOLIDWORKS PDM Professional 2017


IEdmEnumeratorVariable10 Interface

IEdmEnumeratorVariable10 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable10 Interface

Allows you to access the contents of a file data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVariable10
   Inherits IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7, IEdmEnumeratorVariable8, IEdmEnumeratorVariable9
C#
public interface IEdmEnumeratorVariable10 : IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7, IEdmEnumeratorVariable8, IEdmEnumeratorVariable9
C++/CLI
public interface class IEdmEnumeratorVariable10 : public IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7, IEdmEnumeratorVariable8, IEdmEnumeratorVariable9

Remarks

This interface:

  • extends IEdmEnumeratorVariable9 by providing the ability to get a card variable from a file shared across multiple folders or get a card variable value in text format for a file shared across multiple folders.
  • does not support folder data cards. Use IEdmEnumeratorVariable5 and IEdmEnumeratorVariable6 for folder data cards.

See the Remarks for IEdmEnumeratorVariable5.

If you want to update variables in several files or folders, use IEdmBatchUpdate2, which is more efficient than this interface.

See Also

IEdmEnumeratorVariable10 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable10 Interface Members

IEdmEnumeratorVariable10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable10 Interface

The following tables list the members exposed by IEdmEnumeratorVariable10.

Public Methods

 | Name | Description
Method | GetVar2 | Gets the value of the specified variable from this file that may be shared across multiple folders.
Method | GetVarAsText | Gets the value of the specified variable in text format from this file that may be shared across multiple folders.
Top

See Also

IEdmEnumeratorVariable10 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable10 Interface Methods

IEdmEnumeratorVariable10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable10 Interface

For a list of all members of this type, see IEdmEnumeratorVariable10 members.

Public Methods

 | Name | Description
Method | GetVar2 | Gets the value of the specified variable from this file that may be shared across multiple folders.
Method | GetVarAsText | Gets the value of the specified variable in text format from this file that may be shared across multiple folders.
Top

See Also

IEdmEnumeratorVariable10 Interface
EPDM.Interop.epdm Namespace


GetVar2 Method (IEdmEnumeratorVariable10)

GetVar2 Method (IEdmEnumeratorVariable10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable10 Interface : GetVar2 Method (IEdmEnumeratorVariable10)

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for file types that do not support configurations (see Remarks)
lFolderID
ID of parent folder
poRetValue
Variable value; data type as specified in IEdmVariable5::VariableType (see Remarks)
Gets the value of the specified variable from this file that may be shared across multiple folders.

Syntax

Visual Basic
Function GetVar2( _
   ByVal bsVarName As System.String, _
   ByVal bsCfgName As System.String, _
   ByVal lFolderID As System.Integer, _
   ByRef poRetValue As System.Object _
) As System.Boolean
C#
System.bool GetVar2(
   System.string bsVarName,
   System.string bsCfgName,
   System.int lFolderID,
   out System.object poRetValue
)
C++/CLI
System.bool GetVar2(
&   System.String^ bsVarName,
&   System.String^ bsCfgName,
&   System.int lFolderID,
&   [Out] System.Object^ poRetValue
)

Parameters

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for file types that do not support configurations (see Remarks)
lFolderID
ID of parent folder
poRetValue
Variable value; data type as specified in IEdmVariable5::VariableType (see Remarks)

Return Value

True if the variable is found, false if not

Remarks

To specify bsCfgName:

  • Call IEdmFile5::GetConfigurations to get the available configuration names for this file.
  • If this method is used in your add-in's implementation of IEdmAddIn5::OnCmd, then a list of configuration names for the data card is returned in ppoData that can be cast to EdmCmdData. EdmCmdData.mpoExtra contains an IEdmStrLst5 of configuration names.

C++ users must initialize the VARIANT struct of poRetValue with a call to VariantInit before calling this method. They also must free the contents of the struct with a call to VariantClear.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable was not found.

See Also

IEdmEnumeratorVariable10 Interface
IEdmEnumeratorVariable10 Members
IEdmEnumeratorVariable5::SetVar Method ()
IEdmEnumeratorVariable10::GetVarAsText Method ()

Availability

SOLIDWORKS PDM Professional 2015 SP04


GetVarAsText Method (IEdmEnumeratorVariable10)

GetVarAsText Method (IEdmEnumeratorVariable10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable10 Interface : GetVarAsText Method (IEdmEnumeratorVariable10)

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for file types that do not support configurations (see Remarks)
lFolderID
ID of parent folder
poRetValue
Variable value in text format
Gets the value of the specified variable in text format from this file that may be shared across multiple folders.

Syntax

Visual Basic
Function GetVarAsText( _
   ByVal bsVarName As System.String, _
   ByVal bsCfgName As System.String, _
   ByVal lFolderID As System.Integer, _
   ByRef poRetValue As System.Object _
) As System.Boolean
C#
System.bool GetVarAsText(
   System.string bsVarName,
   System.string bsCfgName,
   System.int lFolderID,
   out System.object poRetValue
)
C++/CLI
System.bool GetVarAsText(
&   System.String^ bsVarName,
&   System.String^ bsCfgName,
&   System.int lFolderID,
&   [Out] System.Object^ poRetValue
)

Parameters

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for file types that do not support configurations (see Remarks)
lFolderID
ID of parent folder
poRetValue
Variable value in text format

Return Value

True if the variable is found, false if not

Remarks

To specify bsCfgName:

  • Call IEdmFile5::GetConfigurations to get the available configuration names for this file.
  • If this method is used in your add-in's implementation of IEdmAddIn5::OnCmd, then a list of configuration names for the data card is returned in ppoData that can be cast to EdmCmdData. EdmCmdData.mpoExtra contains an IEdmStrLst5 of configuration names.

C++ users must initialize the VARIANT struct of poRetValue with a call to VariantInit before calling this method. They also must free the contents of the struct with a call to VariantClear.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable was not found.

See Also

IEdmEnumeratorVariable10 Interface
IEdmEnumeratorVariable10 Members
IEdmEnumeratorVariable10::GetVar2 Method ()
IEdmEnumeratorVariable5::SetVar Method ()

Availability

SOLIDWORKS PDM Professional 2015 SP04


IEdmEnumeratorVariable5 Interface

IEdmEnumeratorVariable5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable5 Interface

Allows you to access the contents of a file or folder data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVariable5
C#
public interface IEdmEnumeratorVariable5
C++/CLI
public interface class IEdmEnumeratorVariable5

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmEnumeratorVariable6 which adds the ability to read a variable directly from the database.

The IEdmEnumeratorVariablen interface is a pointer to a file. If this pointer is not released, then other operations on the file can fail with a sharing violation. The recommendation in SOLIDWORKS PDM Professional 2008 and later is to always call IEdmEnumeratorVariable8::CloseFile when you are finished updating a file to make it possible for other applications and API functions to access the file. This replaces the earlier work-around to explicitly clear IEdmEnumeratorVariable pointers (set them to Nothing in Visual Basic and call Marshal.ReleaseComObject in .NET).

IEdmEnumeratorVariablen interfaces on the following do not need calls to IEdmEnumeratorVariable8::CloseFile:

  • folders (cast IEdmFolder5 to this interface)
  • file data cards (for add-ins, this interface is stored in EdmCmd::mpoExtra of the poCmd argument returned in IEdmAddIn5::OnCmd only when EdmCmd::meCmdType = EdmCmdType.EdmCmd_CardButton or EdmCmdType.EdmCmd_CardInput)

Accessors

IEdmAddIn5::OnCmd

IEdmFile5::GetEnumeratorVariable

IEdmFolder5

See Also

IEdmEnumeratorVariable5 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable5 Interface Members

IEdmEnumeratorVariable5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable5 Interface

The following tables list the members exposed by IEdmEnumeratorVariable5.

Public Methods

 | Name | Description
Method | Flush | Saves data to a file or folder.
Method | GetThumbnail | Gets a preview bitmap of the current file.
Method | GetUpdateVars | Gets values for the variables that can be updated in this file.
Method | GetVar | Gets the value of the specified variable from this file or folder.
Method | SetVar | Sets the value of the specified variable in this file or folder.
Method | StoreValuesFromDatabase | Copies file data card data from the SOLIDWORKS PDM Professional database to the file.
Top

See Also

IEdmEnumeratorVariable5 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable5 Interface Methods

IEdmEnumeratorVariable5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable5 Interface

For a list of all members of this type, see IEdmEnumeratorVariable5 members.

Public Methods

 | Name | Description
Method | Flush | Saves data to a file or folder.
Method | GetThumbnail | Gets a preview bitmap of the current file.
Method | GetUpdateVars | Gets values for the variables that can be updated in this file.
Method | GetVar | Gets the value of the specified variable from this file or folder.
Method | SetVar | Sets the value of the specified variable in this file or folder.
Method | StoreValuesFromDatabase | Copies file data card data from the SOLIDWORKS PDM Professional database to the file.
Top

See Also

IEdmEnumeratorVariable5 Interface
EPDM.Interop.epdm Namespace


Flush Method (IEdmEnumeratorVariable5)

Flush Method (IEdmEnumeratorVariable5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : Flush Method (IEdmEnumeratorVariable5)

Saves data to a file or folder.

Syntax

Visual Basic
Sub Flush()
C#
void Flush()
C++/CLI
void Flush();

Example

See the example for IEdmEnumeratorVariable8.

Remarks

You must call this method after calling IEdmEnumeratorVariable5::SetVar to ensure that new data gets properly saved.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_SHARE_ERROR: The file is opened exclusively in another application.

See Also

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetThumbnail Method (IEdmEnumeratorVariable5)

GetThumbnail Method (IEdmEnumeratorVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : GetThumbnail Method (IEdmEnumeratorVariable5)

Gets a preview bitmap of the current file.

Syntax

Visual Basic
Function GetThumbnail() As IEdmBitmap5
C#
IEdmBitmap5 GetThumbnail()
C++/CLI
IEdmBitmap5^ GetThumbnail();

Return Value

IEdmBitmap5; Null if the file does not support bitmap previews

Example

Get Preview Bitmap of File (VB.NET)
Get Preview Bitmap of File (C#)

Remarks

This method supports only DWG files that are cached.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmBitmap5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The file does not support bitmap previews.

See Also

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetUpdateVars Method (IEdmEnumeratorVariable5)

GetUpdateVars Method (IEdmEnumeratorVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : GetUpdateVars Method (IEdmEnumeratorVariable5)

lFolderID
ID of the file's parent folder
ppoRetVariables
Array of IEdmVariableValue5; one interface for each variable value
Gets values for the variables that can be updated in this file.

Syntax

Visual Basic
Sub GetUpdateVars( _
   ByVal lFolderID As System.Integer, _
   ByRef ppoRetVariables() As System.Object _
)
C#
void GetUpdateVars(
   System.int lFolderID,
   out System.object[] ppoRetVariables
)
C++/CLI
void GetUpdateVars(
&   System.int lFolderID,
&   [Out] System.array<Object^>^ ppoRetVariables
)

Parameters

lFolderID
ID of the file's parent folder
ppoRetVariables
Array of IEdmVariableValue5; one interface for each variable value

Example

Access File Card Variables (VB.NET)
Access File Card Variables (C#)

Remarks

C++ users must call SafeArrayDestroy to free the returned array elements.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: The file is not checked out.

See Also

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members
IEdmEnumeratorVariable5::StoreValuesFromDatabase Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetVar Method (IEdmEnumeratorVariable5)

GetVar Method (IEdmEnumeratorVariable5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : GetVar Method (IEdmEnumeratorVariable5)

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for folders and file types that do not support configurations (see Remarks)
poRetValue
Variable value; data type as specified in IEdmVariable5::VariableType (see Remarks)
Gets the value of the specified variable from this file or folder.

Syntax

Visual Basic
Function GetVar( _
   ByVal bsVarName As System.String, _
   ByVal bsCfgName As System.String, _
   ByRef poRetValue As System.Object _
) As System.Boolean
C#
System.bool GetVar(
   System.string bsVarName,
   System.string bsCfgName,
   out System.object poRetValue
)
C++/CLI
System.bool GetVar(
&   System.String^ bsVarName,
&   System.String^ bsCfgName,
&   [Out] System.Object^ poRetValue
)

Parameters

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for folders and file types that do not support configurations (see Remarks)
poRetValue
Variable value; data type as specified in IEdmVariable5::VariableType (see Remarks)

Return Value

True if the variable is found, false if not

Remarks

To specify bsCfgName:

  • Call IEdmFile5::GetConfigurations to get the available configuration names for this file.
  • If this method is used in your add-in's implementation of IEdmAddIn5::OnCmd, then a list of configuration names for the data card is returned in ppoData that can be cast to EdmCmdData. EdmCmdData.mpoExtra contains an IEdmStrLst5 of configuration names.

C++ users must initialize the VARIANT struct of poRetValue with a call to VariantInit before calling this method. They also must free the contents of the struct with a call to VariantClear.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable was not found.

See Also

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members
IEdmEnumeratorVariable5::SetVar Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


SetVar Method (IEdmEnumeratorVariable5)

SetVar Method (IEdmEnumeratorVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : SetVar Method (IEdmEnumeratorVariable5)

bsVarName
Name of variable to write
bsCfgName
Name of configuration or layout to which to store the variable value; empty string for folders and file types that do not support configurations
poValue
Variable value
bOnlyIfPartOfCard
True to store the variable only if it is part of the file or folder data card, false to store the variable as hidden data if it is not part of the file or folder data card
Sets the value of the specified variable in this file or folder.

Syntax

Visual Basic
Sub SetVar( _
   ByVal bsVarName As System.String, _
   ByVal bsCfgName As System.String, _
   ByRef poValue As System.Object, _
   Optional ByVal bOnlyIfPartOfCard As System.Boolean _
)
C#
void SetVar(
   System.string bsVarName,
   System.string bsCfgName,
   ref System.object poValue,
   System.bool bOnlyIfPartOfCard
)
C++/CLI
void SetVar(
&   System.String^ bsVarName,
&   System.String^ bsCfgName,
&   System.Object^% poValue,
&   System.bool bOnlyIfPartOfCard
)

Parameters

bsVarName
Name of variable to write
bsCfgName
Name of configuration or layout to which to store the variable value; empty string for folders and file types that do not support configurations
poValue
Variable value
bOnlyIfPartOfCard
True to store the variable only if it is part of the file or folder data card, false to store the variable as hidden data if it is not part of the file or folder data card

Example

Change Card Variables Add-in (C#)
Change Card Variables Add-in (VB.NET)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

To specify bsCfgName:

  • Call IEdmFile5::GetConfigurations to get the available configuration names for this file.
  • If this method is used in your add-in's implementation of IEdmAddIn5::OnCmd, then a list of configuration names for the data card is returned in ppoData that can be cast to EdmCmdData. EdmCmdData.mpoExtra contains an IEdmStrLst5 of configuration names.

After calling this method to update the variables that can be updated, you must call IEdmEnumeratorVariable5::Flush or IEdmEnumeratorVariable8::CloseFile with the bFlush argument set to true in order to ensure that the changes are saved properly to the file or folder.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable was not found, and bOnlyIfPartOfCard is true.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: The file is not checked out.

See Also

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members
IEdmEnumeratorVariable10::GetVar2 Method ()
IEdmEnumeratorVariable10::GetVarAsText Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


StoreValuesFromDatabase Method (IEdmEnumeratorVariable5)

StoreValuesFromDatabase Method (IEdmEnumeratorVariable5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : StoreValuesFromDatabase Method (IEdmEnumeratorVariable5)

lFolderID
ID of the file's parent folder
bOnlyMissingValues
True to only copy variables without a value, false to copy all variables
poProgressCb
Not used
Copies file data card data from the SOLIDWORKS PDM Professional database to the file.

Syntax

Visual Basic
Sub StoreValuesFromDatabase( _
   ByVal lFolderID As System.Integer, _
   ByVal bOnlyMissingValues As System.Boolean, _
   Optional ByVal poProgressCb As EdmCallback _
)
C#
void StoreValuesFromDatabase(
   System.int lFolderID,
   System.bool bOnlyMissingValues,
   EdmCallback poProgressCb
)
C++/CLI
void StoreValuesFromDatabase(
&   System.int lFolderID,
&   System.bool bOnlyMissingValues,
&   EdmCallback^ poProgressCb
)

Parameters

lFolderID
ID of the file's parent folder
bOnlyMissingValues
True to only copy variables without a value, false to copy all variables
poProgressCb
Not used

Remarks

This method corresponds to the SOLIDWORKS PDM Professional user interface right-click menu command, Update File Attributes from Database.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_FILE: The file format is not recognized.
  • E_EDM_FILE_SHARE_ERROR: The file is exclusively opened in another application.
  • E_EDM_IO_ERROR: Error writing data to the file.

See Also

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmEnumeratorVariable6 Interface

IEdmEnumeratorVariable6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable6 Interface

Allows you to access the contents of a file or folder data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVariable6
   Inherits IEdmEnumeratorVariable5
C#
public interface IEdmEnumeratorVariable6 : IEdmEnumeratorVariable5
C++/CLI
public interface class IEdmEnumeratorVariable6 : public IEdmEnumeratorVariable5

Example

See the example for IEdmEnumeratorVariable8.

Remarks

This interface:

  • extends IEdmEnumeratorVariable5 by providing the ability to read a variable from the database.
  • is extended by IEdmEnumeratorVariable7.

See the Remarks for IEdmEnumeratorVariable5.

If you want to update variables in several files or folders, use IEdmBatchUpdate2, which is more efficient than this interface.

See Also

IEdmEnumeratorVariable6 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable6 Interface Members

IEdmEnumeratorVariable6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable6 Interface

The following tables list the members exposed by IEdmEnumeratorVariable6.

Public Methods

 | Name | Description
Method | GetVarFromDb | Reads a variable from the SOLIDWORKS PDM Professional database.
Top

See Also

IEdmEnumeratorVariable6 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable6 Interface Methods

IEdmEnumeratorVariable6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable6 Interface

For a list of all members of this type, see IEdmEnumeratorVariable6 members.

Public Methods

 | Name | Description
Method | GetVarFromDb | Reads a variable from the SOLIDWORKS PDM Professional database.
Top

See Also

IEdmEnumeratorVariable6 Interface
EPDM.Interop.epdm Namespace


GetVarFromDb Method (IEdmEnumeratorVariable6)

GetVarFromDb Method (IEdmEnumeratorVariable6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable6 Interface : GetVarFromDb Method (IEdmEnumeratorVariable6)

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for folders and file types that do not support configurations
poRetValue
Variable value
Reads a variable from the SOLIDWORKS PDM Professional database.

Syntax

Visual Basic
Function GetVarFromDb( _
   ByVal bsVarName As System.String, _
   ByVal bsCfgName As System.String, _
   ByRef poRetValue As System.Object _
) As System.Boolean
C#
System.bool GetVarFromDb(
   System.string bsVarName,
   System.string bsCfgName,
   out System.object poRetValue
)
C++/CLI
System.bool GetVarFromDb(
&   System.String^ bsVarName,
&   System.String^ bsCfgName,
&   [Out] System.Object^ poRetValue
)

Parameters

bsVarName
Name of variable to read
bsCfgName
Name of configuration or layout from which to get the variable value; empty string for folders and file types that do not support configurations
poRetValue
Variable value

Return Value

True if a variable is found, false if not

Remarks

To read a variable from a checked out file, call IEdmEnumeratorVariable5::GetVar.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable is not found.

See Also

IEdmEnumeratorVariable6 Interface
IEdmEnumeratorVariable6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmEnumeratorVariable7 Interface

IEdmEnumeratorVariable7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable7 Interface

Allows you to access the contents of a file data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVariable7
   Inherits IEdmEnumeratorVariable5, IEdmEnumeratorVariable6
C#
public interface IEdmEnumeratorVariable7 : IEdmEnumeratorVariable5, IEdmEnumeratorVariable6
C++/CLI
public interface class IEdmEnumeratorVariable7 : public IEdmEnumeratorVariable5, IEdmEnumeratorVariable6

Example

See the example for IEdmEnumeratorVariable8.

Remarks

This interface:

  • extends IEdmEnumeratorVariable6 by providing the ability to generate default values, get values of versioned variables, and get the IDs of all variables that have a specified serial number.
  • does not support folder data cards. Use IEdmEnumeratorVariable5 and IEdmEnumeratorVariable6 for folder data cards.
  • is extended by IEdmEnumeratorVariable8.

See the Remarks for IEdmEnumeratorVariable5.

If you want to update variables in several files or folders, use IEdmBatchUpdate2, which is more efficient than this interface.

See Also

IEdmEnumeratorVariable7 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable7 Interface Members

IEdmEnumeratorVariable7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable7 Interface

The following tables list the members exposed by IEdmEnumeratorVariable7.

Public Methods

 | Name | Description
Method | GenerateDefaultValues | Generates all default values that have not been generated before.
Method | GetSerNoVar | Gets the IDs of all variables that have the specified serial number.
Method | GetVersionVars | Gets the values of variables of the specified version directly from the database.
Top

See Also

IEdmEnumeratorVariable7 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable7 Interface Methods

IEdmEnumeratorVariable7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable7 Interface

For a list of all members of this type, see IEdmEnumeratorVariable7 members.

Public Methods

 | Name | Description
Method | GenerateDefaultValues | Generates all default values that have not been generated before.
Method | GetSerNoVar | Gets the IDs of all variables that have the specified serial number.
Method | GetVersionVars | Gets the values of variables of the specified version directly from the database.
Top

See Also

IEdmEnumeratorVariable7 Interface
EPDM.Interop.epdm Namespace


GenerateDefaultValues Method (IEdmEnumeratorVariable7)

GenerateDefaultValues Method (IEdmEnumeratorVariable7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable7 Interface : GenerateDefaultValues Method (IEdmEnumeratorVariable7)

lFolderID
ID of the file's parent folder
bWriteValuesToFile
True to write values to the file, false to write only to the database
ppoRetVariables
Array of IEdmVariableValue6 interfaces; one interface for each variable value generated (see Remarks)
Generates all default values that have not been generated before.

Syntax

Visual Basic
Function GenerateDefaultValues( _
   ByVal lFolderID As System.Integer, _
   ByVal bWriteValuesToFile As System.Boolean, _
   ByRef ppoRetVariables() As System.Object _
) As System.Boolean
C#
System.bool GenerateDefaultValues(
   System.int lFolderID,
   System.bool bWriteValuesToFile,
   out System.object[] ppoRetVariables
)
C++/CLI
System.bool GenerateDefaultValues(
&   System.int lFolderID,
&   System.bool bWriteValuesToFile,
&   [Out] System.array<Object^>^ ppoRetVariables
)

Parameters

lFolderID
ID of the file's parent folder
bWriteValuesToFile
True to write values to the file, false to write only to the database
ppoRetVariables
Array of IEdmVariableValue6 interfaces; one interface for each variable value generated (see Remarks)

Return Value

True if values were generated, false if not

Remarks

If bWriteValuesToFile is false, then the caller is responsible for writing the values to the file.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: No values needed to be generated.

See Also

IEdmEnumeratorVariable7 Interface
IEdmEnumeratorVariable7 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


GetSerNoVar Method (IEdmEnumeratorVariable7)

GetSerNoVar Method (IEdmEnumeratorVariable7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable7 Interface : GetSerNoVar Method (IEdmEnumeratorVariable7)

bsSerNoName
Serial number of variables to find
lFolderID
ID of the file's parent folder; 0 if the file is not shared
ppoRetIDs
Array of IDs of variables with bSerNoName
Gets the IDs of all variables that have the specified serial number.

Syntax

Visual Basic
Sub GetSerNoVar( _
   ByVal bsSerNoName As System.String, _
   ByVal lFolderID As System.Integer, _
   ByRef ppoRetIDs() As System.Integer _
)
C#
void GetSerNoVar(
   System.string bsSerNoName,
   System.int lFolderID,
   out System.int[] ppoRetIDs
)
C++/CLI
void GetSerNoVar(
&   System.String^ bsSerNoName,
&   System.int lFolderID,
&   [Out] System.array<int>^ ppoRetIDs
)

Parameters

bsSerNoName
Serial number of variables to find
lFolderID
ID of the file's parent folder; 0 if the file is not shared
ppoRetIDs
Array of IDs of variables with bSerNoName

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVariable7 Interface
IEdmEnumeratorVariable7 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


GetVersionVars Method (IEdmEnumeratorVariable7)

GetVersionVars Method (IEdmEnumeratorVariable7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable7 Interface : GetVersionVars Method (IEdmEnumeratorVariable7)

oVersion
Version number of variables to get; 0 to get the latest version
lFolderID
ID of the file's parent folder; 0 if the file is not shared
ppoRetVariables
Array of IEdmVariableValue6 interfaces; one interface for each variable value
ppoRetConfigs
Array of configuration or layout names
poRetData
EdmGetVarData; extra information about the file
Gets the values of variables of the specified version directly from the database.

Syntax

Visual Basic
Sub GetVersionVars( _
   ByVal oVersion As System.Object, _
   ByVal lFolderID As System.Integer, _
   ByRef ppoRetVariables() As System.Object, _
   ByRef ppoRetConfigs() As System.String, _
   ByRef poRetData As EdmGetVarData _
)
C#
void GetVersionVars(
   System.object oVersion,
   System.int lFolderID,
   out System.object[] ppoRetVariables,
   out System.string[] ppoRetConfigs,
   out EdmGetVarData poRetData
)
C++/CLI
void GetVersionVars(
&   System.Object^ oVersion,
&   System.int lFolderID,
&   [Out] System.array<Object^>^ ppoRetVariables,
&   [Out] System.array<String^>^ ppoRetConfigs,
&   [Out] EdmGetVarData poRetData
)

Parameters

oVersion
Version number of variables to get; 0 to get the latest version
lFolderID
ID of the file's parent folder; 0 if the file is not shared
ppoRetVariables
Array of IEdmVariableValue6 interfaces; one interface for each variable value
ppoRetConfigs
Array of configuration or layout names
poRetData
EdmGetVarData; extra information about the file

Example

Get File Variable Data (VB.NET)
Get File Variable Data (C#)

Remarks

In previous versions of the API, you had to call IEdmFile5::GetFileCopy get a local copy of a file and then call IEdmFile5::GetEnumeratorVariable to read variables. This method is more efficient, because it retrieves the variable values directly from the database, removing the need to retrieve the file first.

When retrieving several variables, it is more efficient to use this method instead of multiple calls to IEdmEnumeratorVariable5::GetVar.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVariable7 Interface
IEdmEnumeratorVariable7 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmEnumeratorVariable8 Interface

IEdmEnumeratorVariable8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable8 Interface

Allows you to access the contents of a file data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVariable8
   Inherits IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7
C#
public interface IEdmEnumeratorVariable8 : IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7
C++/CLI
public interface class IEdmEnumeratorVariable8 : public IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

This interface:

  • extends IEdmEnumeratorVariable7 by providing the ability to close the file.
  • does not support folder data cards. Use IEdmEnumeratorVariable5 and IEdmEnumeratorVariable6 for folder data cards.
  • is extended by IEdmEnumeratorVariable9.

See the Remarks for IEdmEnumeratorVariable5.

If you want to update variables in several files or folders, use IEdmBatchUpdate2, which is more efficient than this interface.

See Also

IEdmEnumeratorVariable8 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable8 Interface Members

IEdmEnumeratorVariable8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable8 Interface

The following tables list the members exposed by IEdmEnumeratorVariable8.

Public Methods

 | Name | Description
Method | CloseFile | Closes the file that is open for access by this interface.
Top

See Also

IEdmEnumeratorVariable8 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable8 Interface Methods

IEdmEnumeratorVariable8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable8 Interface

For a list of all members of this type, see IEdmEnumeratorVariable8 members.

Public Methods

 | Name | Description
Method | CloseFile | Closes the file that is open for access by this interface.
Top

See Also

IEdmEnumeratorVariable8 Interface
EPDM.Interop.epdm Namespace


CloseFile Method (IEdmEnumeratorVariable8)

CloseFile Method (IEdmEnumeratorVariable8)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable8 Interface : CloseFile Method (IEdmEnumeratorVariable8)

bFlush
True to call IEdmEnumeratorVariable5::Flush before closing the file, false to not
Closes the file that is open for access by this interface.

Syntax

Visual Basic
Sub CloseFile( _
   ByVal bFlush As System.Boolean _
)
C#
void CloseFile(
   System.bool bFlush
)
C++/CLI
void CloseFile(
&   System.bool bFlush
)

Parameters

bFlush
True to call IEdmEnumeratorVariable5::Flush before closing the file, false to not

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

After closing the file using this method, none of the other methods in this interface work.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVariable8 Interface
IEdmEnumeratorVariable8 Members

Availability

SOLIDWORKS PDM Professional 2008


IEdmEnumeratorVariable9 Interface

IEdmEnumeratorVariable9 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable9 Interface

Allows you to access the contents of a file data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVariable9
   Inherits IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7, IEdmEnumeratorVariable8
C#
public interface IEdmEnumeratorVariable9 : IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7, IEdmEnumeratorVariable8
C++/CLI
public interface class IEdmEnumeratorVariable9 : public IEdmEnumeratorVariable5, IEdmEnumeratorVariable6, IEdmEnumeratorVariable7, IEdmEnumeratorVariable8

Remarks

This interface:

  • extends IEdmEnumeratorVariable8 by allowing you to set the values of multiple file variables.
  • does not support folder data cards. Use IEdmEnumeratorVariable5 and IEdmEnumeratorVariable6 for folder data cards.
  • is extended by IEdmEnumeratorVariable10.

See the Remarks for IEdmEnumeratorVariable5.

If you want to update variables in several files or folders, use IEdmBatchUpdate2, which is more efficient than this interface.

See Also

IEdmEnumeratorVariable9 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable9 Interface Members

IEdmEnumeratorVariable9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable9 Interface

The following tables list the members exposed by IEdmEnumeratorVariable9.

Public Methods

 | Name | Description
Method | SetValueVariables | Sets the values of file variables.
Top

See Also

IEdmEnumeratorVariable9 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVariable9 Interface Methods

IEdmEnumeratorVariable9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVariable9 Interface

For a list of all members of this type, see IEdmEnumeratorVariable9 members.

Public Methods

 | Name | Description
Method | SetValueVariables | Sets the values of file variables.
Top

See Also

IEdmEnumeratorVariable9 Interface
EPDM.Interop.epdm Namespace


SetValueVariables Method (IEdmEnumeratorVariable9)

SetValueVariables Method (IEdmEnumeratorVariable9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable9 Interface : SetValueVariables Method (IEdmEnumeratorVariable9)

poVarNamesList
IEdmStrLst5; list of variable names
poVarValuesList
IEdmStrLst5; list of values for variable names in poVarNamesList
bsCfgName
Configuration name
bOnlyIfPartOfCard
True to set the variable only if the variable is part of the data card, false to always set the variable (see Remarks)
Sets the values of file variables.

Syntax

Visual Basic
Sub SetValueVariables( _
   ByVal poVarNamesList As EdmStrLst5, _
   ByVal poVarValuesList As EdmStrLst5, _
   ByVal bsCfgName As System.String, _
   Optional ByVal bOnlyIfPartOfCard As System.Boolean _
)
C#
void SetValueVariables(
   EdmStrLst5 poVarNamesList,
   EdmStrLst5 poVarValuesList,
   System.string bsCfgName,
   System.bool bOnlyIfPartOfCard
)
C++/CLI
void SetValueVariables(
&   EdmStrLst5^ poVarNamesList,
&   EdmStrLst5^ poVarValuesList,
&   System.String^ bsCfgName,
&   System.bool bOnlyIfPartOfCard
)

Parameters

poVarNamesList
IEdmStrLst5; list of variable names
poVarValuesList
IEdmStrLst5; list of values for variable names in poVarNamesList
bsCfgName
Configuration name
bOnlyIfPartOfCard
True to set the variable only if the variable is part of the data card, false to always set the variable (see Remarks)

Remarks

This method can write the value to the file if the variable is mapped to a custom property.

See Also

IEdmEnumeratorVariable9 Interface
IEdmEnumeratorVariable9 Members

Availability

SOLIDWORKS PDM Professional 2012


IEdmEnumeratorVersion5 Interface

IEdmEnumeratorVersion5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion5 Interface

Allows you to access the versions and revisions of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVersion5
C#
public interface IEdmEnumeratorVersion5
C++/CLI
public interface class IEdmEnumeratorVersion5

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)
Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To access this interface, cast an IEdmFile5 object to this interface.

A new version of a file is created every time the file has been modified and checked in. Versions are denoted by numbers (1,2,3,..,N). In addition to versions, users can also set up revisions. Revisions are user-friendly names that can be set on versions of files.

This interface is extended by IEdmEnumeratorVersion6.

See Also

IEdmEnumeratorVersion5 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion5 Interface Members

IEdmEnumeratorVersion5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion5 Interface

The following tables list the members exposed by IEdmEnumeratorVersion5.

Public Properties

 | Name | Description
Property | LabelCount | Gets the number of labels set on this file.
Property | RevisionCount | Gets the number of revisions of this file.
Property | VersionCount | Gets the number of versions of this file.
Top

Public Methods

 | Name | Description
Method | CreateLabel | Sets a label on the latest version of this file.
Method | GetFileCopy | Retrieves a copy of a file with the specified version from the archive and deposits it in the specified folder.
Method | GetFirstLabelPosition | Starts an enumeration of the labels set on this file.
Method | GetFirstRevisionPosition | Starts an enumeration of the revisions set on this file.
Method | GetFirstVersionPosition | Starts an enumeration of the versions of this file.
Method | GetNextLabel | Gets the label at the next position of this enumeration.
Method | GetNextRevision | Gets the revision at the next position of this enumeration.
Method | GetNextVersion | Gets the version at the next position of this enumeration.
Method | GetVersion | Gets a version object with the specified version number.
Method | Rollback | Obsolete. Superseded by IEdmEnumeratorVersion6::Rollback2 .
Top

See Also

IEdmEnumeratorVersion5 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion5 Interface Methods

IEdmEnumeratorVersion5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion5 Interface

For a list of all members of this type, see IEdmEnumeratorVersion5 members.

Public Methods

 | Name | Description
Method | CreateLabel | Sets a label on the latest version of this file.
Method | GetFileCopy | Retrieves a copy of a file with the specified version from the archive and deposits it in the specified folder.
Method | GetFirstLabelPosition | Starts an enumeration of the labels set on this file.
Method | GetFirstRevisionPosition | Starts an enumeration of the revisions set on this file.
Method | GetFirstVersionPosition | Starts an enumeration of the versions of this file.
Method | GetNextLabel | Gets the label at the next position of this enumeration.
Method | GetNextRevision | Gets the revision at the next position of this enumeration.
Method | GetNextVersion | Gets the version at the next position of this enumeration.
Method | GetVersion | Gets a version object with the specified version number.
Method | Rollback | Obsolete. Superseded by IEdmEnumeratorVersion6::Rollback2 .
Top

See Also

IEdmEnumeratorVersion5 Interface
EPDM.Interop.epdm Namespace


CreateLabel Method (IEdmEnumeratorVersion5)

CreateLabel Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : CreateLabel Method (IEdmEnumeratorVersion5)

bsName
Name of label; maximum 255 characters
bsComment
Label comment; maximum 2000 characters
Sets a label on the latest version of this file.

Syntax

Visual Basic
Function CreateLabel( _
   ByVal bsName As System.String, _
   ByVal bsComment As System.String _
) As System.Integer
C#
System.int CreateLabel(
   System.string bsName,
   System.string bsComment
)
C++/CLI
System.int CreateLabel(
&   System.String^ bsName,
&   System.String^ bsComment
)

Parameters

bsName
Name of label; maximum 255 characters
bsComment
Label comment; maximum 2000 characters

Return Value

ID of the label

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members
IEdmFile16::CreateLabel Method ()
IEdmFolder5::CreateLabel Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFileCopy Method (IEdmEnumeratorVersion5)

GetFileCopy Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetFileCopy Method (IEdmEnumeratorVersion5)

lParentWnd
Parent window handle; 0 if none
poVersionNoOrRevisionName
Version number or revision string; 0 or "" to get the latest version
poPathOrFolderID
Optional ID or path of the folder where to deposit the file; default is to deposit in all of its parent folders (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGet_MakeReadOnly
bsNewName
Optional new name for the retrieved file; "" indicates to use the file's current name
Retrieves a copy of a file with the specified version from the archive and deposits it in the specified folder.

Syntax

Visual Basic
Sub GetFileCopy( _
   ByVal lParentWnd As System.Integer, _
   ByRef poVersionNoOrRevisionName As System.Object, _
   Optional ByRef poPathOrFolderID As System.Object, _
   Optional ByVal lEdmGetFlags As System.Integer, _
   Optional ByVal bsNewName As System.String _
)
C#
void GetFileCopy(
   System.int lParentWnd,
   ref System.object poVersionNoOrRevisionName,
   ref System.object poPathOrFolderID,
   System.int lEdmGetFlags,
   System.string bsNewName
)
C++/CLI
void GetFileCopy(
&   System.int lParentWnd,
&   System.Object^% poVersionNoOrRevisionName,
&   System.Object^% poPathOrFolderID,
&   System.int lEdmGetFlags,
&   System.String^ bsNewName
)

Parameters

lParentWnd
Parent window handle; 0 if none
poVersionNoOrRevisionName
Version number or revision string; 0 or "" to get the latest version
poPathOrFolderID
Optional ID or path of the folder where to deposit the file; default is to deposit in all of its parent folders (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGet_MakeReadOnly
bsNewName
Optional new name for the retrieved file; "" indicates to use the file's current name

Example

See the example for IEdmFile5::GetFileCopy.

Remarks

If you specify a folder ID of 0 in poPathOrFolderID, SOLIDWORKS PDM Professional deposits the file in all of the folders it is shared to. If you specify a path in poPathOrFolderID, it can either be a file path or a folder path. Folder paths must be terminated by a backslash ('\').

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_FOUND: The file is not found in the vault.
  • E_EDM_PERMISSION_DENIED: The user is not permitted to see the specified version of the file.
  • E_EDM_INVALID_REVISION_NUMBER: The revision is not found.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstLabelPosition Method (IEdmEnumeratorVersion5)

GetFirstLabelPosition Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetFirstLabelPosition Method (IEdmEnumeratorVersion5)

Starts an enumeration of the labels set on this file.

Syntax

Visual Basic
Function GetFirstLabelPosition() As IEdmPos5
C#
IEdmPos5 GetFirstLabelPosition()
C++/CLI
IEdmPos5^ GetFirstLabelPosition();

Return Value

IEdmPos5; position of the first label set on this file

Remarks

After calling this method, pass the returned first label position to IEdmEnumeratorVersion5::GetNextLabel to get the first label set on this file. Call IEdmEnumeratorVersion5::GetNextLabel repeatedly to get the rest of the labels set on this file.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstRevisionPosition Method (IEdmEnumeratorVersion5)

GetFirstRevisionPosition Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetFirstRevisionPosition Method (IEdmEnumeratorVersion5)

Starts an enumeration of the revisions set on this file.

Syntax

Visual Basic
Function GetFirstRevisionPosition() As IEdmPos5
C#
IEdmPos5 GetFirstRevisionPosition()
C++/CLI
IEdmPos5^ GetFirstRevisionPosition();

Return Value

IEdmPos5; position of the first revision set on this file

Remarks

After calling this method, pass the returned first revision position to IEdmEnumeratorVersion5::GetNextRevision to get the first revision. Then call IEdmEnumeratorVersion5::GetNextRevision repeatedly to get the rest of the revisions set on this file.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstVersionPosition Method (IEdmEnumeratorVersion5)

GetFirstVersionPosition Method (IEdmEnumeratorVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetFirstVersionPosition Method (IEdmEnumeratorVersion5)

Starts an enumeration of the versions of this file.

Syntax

Visual Basic
Function GetFirstVersionPosition() As IEdmPos5
C#
IEdmPos5 GetFirstVersionPosition()
C++/CLI
IEdmPos5^ GetFirstVersionPosition();

Return Value

IEdmPos5; position of the first version of this file

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

Remarks

After calling this method, pass the returned first version position to IEdmEnumeratorVersion5::GetNextVersion to get the first version. Then call IEdmEnumeratorVersion5::GetNextVersion to get the rest of the versions of this file.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextLabel Method (IEdmEnumeratorVersion5)

GetNextLabel Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetNextLabel Method (IEdmEnumeratorVersion5)

poPos
IEdmPos5; position of the next label
Gets the label at the next position of this enumeration.

Syntax

Visual Basic
Function GetNextLabel( _
   ByVal poPos As IEdmPos5 _
) As IEdmLabel5
C#
IEdmLabel5 GetNextLabel(
   IEdmPos5 poPos
)
C++/CLI
IEdmLabel5^ GetNextLabel(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next label

Return Value

IEdmLabel5

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first label, IEdmPos5. Call IEdmEnumeratorVersion5::GetFirstLabelPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the labels.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextRevision Method (IEdmEnumeratorVersion5)

GetNextRevision Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetNextRevision Method (IEdmEnumeratorVersion5)

poPos
IEdmPos5; position of the next revision
Gets the revision at the next position of this enumeration.

Syntax

Visual Basic
Function GetNextRevision( _
   ByVal poPos As IEdmPos5 _
) As IEdmRevision5
C#
IEdmRevision5 GetNextRevision(
   IEdmPos5 poPos
)
C++/CLI
IEdmRevision5^ GetNextRevision(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next revision

Return Value

IEdmRevision5

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first revision, IEdmPos5. Call IEdmEnumeratorVersion5::GetFirstRevisionPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the revisions.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextVersion Method (IEdmEnumeratorVersion5)

GetNextVersion Method (IEdmEnumeratorVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetNextVersion Method (IEdmEnumeratorVersion5)

poPos
IEdmPos5; position of the next version
Gets the version at the next position of this enumeration.

Syntax

Visual Basic
Function GetNextVersion( _
   ByVal poPos As IEdmPos5 _
) As IEdmVersion5
C#
IEdmVersion5 GetNextVersion(
   IEdmPos5 poPos
)
C++/CLI
IEdmVersion5^ GetNextVersion(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next version

Return Value

IEdmVersion5

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first version, IEdmPos5. Call IEdmEnumeratorVersion5::GetFirstVersionPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the versions.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetVersion Method (IEdmEnumeratorVersion5)

GetVersion Method (IEdmEnumeratorVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : GetVersion Method (IEdmEnumeratorVersion5)

lVersionNo
Number of version to get
Gets a version object with the specified version number.

Syntax

Visual Basic
Function GetVersion( _
   ByVal lVersionNo As System.Integer _
) As IEdmVersion5
C#
IEdmVersion5 GetVersion(
   System.int lVersionNo
)
C++/CLI
IEdmVersion5^ GetVersion(
&   System.int lVersionNo
)

Parameters

lVersionNo
Number of version to get

Return Value

IEdmVersion5

Example

Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_REVISION_NUMBER: The version number is invalid.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Rollback Method (IEdmEnumeratorVersion5)

Rollback Method (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : Rollback Method (IEdmEnumeratorVersion5)

lVersionNo
Version number to which to roll this file back (see Remarks)
Obsolete. Superseded by IEdmEnumeratorVersion6::Rollback2 .

Syntax

Visual Basic
Sub Rollback( _
   ByVal lVersionNo As System.Integer _
)
C#
void Rollback(
   System.int lVersionNo
)
C++/CLI
void Rollback(
&   System.int lVersionNo
)

Parameters

lVersionNo
Version number to which to roll this file back (see Remarks)

Remarks

This method destroys all versions after the version specified by lVersionNo. There is no undoing of the operation short of restoring a backup of the entire database and file archives.

After this method completes successfully, lVersionNo is the new latest version of the file.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_REVISION_NUMBER: The specified version number is out of bounds.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete files.

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members
IEdmVersion5::Rollback Method ()
IEdmRevision5::Rollback Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmEnumeratorVersion5 Interface Properties

IEdmEnumeratorVersion5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion5 Interface

For a list of all members of this type, see IEdmEnumeratorVersion5 members.

Public Properties

 | Name | Description
Property | LabelCount | Gets the number of labels set on this file.
Property | RevisionCount | Gets the number of revisions of this file.
Property | VersionCount | Gets the number of versions of this file.
Top

See Also

IEdmEnumeratorVersion5 Interface
EPDM.Interop.epdm Namespace


LabelCount Property (IEdmEnumeratorVersion5)

LabelCount Property (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : LabelCount Property (IEdmEnumeratorVersion5)

Gets the number of labels set on this file.

Syntax

Visual Basic
ReadOnly Property LabelCount As System.Integer
C#
System.int LabelCount {get;}
C++/CLI
property System.int LabelCount {
   System.int get();
}

Property Value

Number of labels

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


RevisionCount Property (IEdmEnumeratorVersion5)

RevisionCount Property (IEdmEnumeratorVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : RevisionCount Property (IEdmEnumeratorVersion5)

Gets the number of revisions of this file.

Syntax

Visual Basic
ReadOnly Property RevisionCount As System.Integer
C#
System.int RevisionCount {get;}
C++/CLI
property System.int RevisionCount {
   System.int get();
}

Property Value

Number of revisions

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


VersionCount Property (IEdmEnumeratorVersion5)

VersionCount Property (IEdmEnumeratorVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion5 Interface : VersionCount Property (IEdmEnumeratorVersion5)

Gets the number of versions of this file.

Syntax

Visual Basic
ReadOnly Property VersionCount As System.Integer
C#
System.int VersionCount {get;}
C++/CLI
property System.int VersionCount {
   System.int get();
}

Property Value

Number of versions

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

See Also

IEdmEnumeratorVersion5 Interface
IEdmEnumeratorVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmEnumeratorVersion6 Interface

IEdmEnumeratorVersion6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion6 Interface

Allows you to access the versions and revisions of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVersion6
   Inherits IEdmEnumeratorVersion5
C#
public interface IEdmEnumeratorVersion6 : IEdmEnumeratorVersion5
C++/CLI
public interface class IEdmEnumeratorVersion6 : public IEdmEnumeratorVersion5

Remarks

This interface:

  • extends IEdmEnumeratorVersion5.
  • is extended by IEdmEnumeratorVersion7.

See Also

IEdmEnumeratorVersion6 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion6 Interface Members

IEdmEnumeratorVersion6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion6 Interface

The following tables list the members exposed by IEdmEnumeratorVersion6.

Public Methods

 | Name | Description
Method | Rollback2 | Obsolete. Superseded by IEdmEnumeratorVersion7::Rollback3.
Top

See Also

IEdmEnumeratorVersion6 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion6 Interface Methods

IEdmEnumeratorVersion6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion6 Interface

For a list of all members of this type, see IEdmEnumeratorVersion6 members.

Public Methods

 | Name | Description
Method | Rollback2 | Obsolete. Superseded by IEdmEnumeratorVersion7::Rollback3.
Top

See Also

IEdmEnumeratorVersion6 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion7 Interface

IEdmEnumeratorVersion7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion7 Interface

Allows you to access the versions and revisions of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmEnumeratorVersion7
   Inherits IEdmEnumeratorVersion5, IEdmEnumeratorVersion6
C#
public interface IEdmEnumeratorVersion7 : IEdmEnumeratorVersion5, IEdmEnumeratorVersion6
C++/CLI
public interface class IEdmEnumeratorVersion7 : public IEdmEnumeratorVersion5, IEdmEnumeratorVersion6

Example

Roll Back Revisions (C#)
Roll Back Revisions (VB.NET)

Remarks

This interface extends IEdmEnumeratorVersion6.

See Also

IEdmEnumeratorVersion7 Members
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion7 Interface Members

IEdmEnumeratorVersion7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion7 Interface

The following tables list the members exposed by IEdmEnumeratorVersion7.

Public Methods

 | Name | Description
Method | Rollback3 | Rolls this file back to the specified version.
Top

See Also

IEdmEnumeratorVersion7 Interface
EPDM.Interop.epdm Namespace


IEdmEnumeratorVersion7 Interface Methods

IEdmEnumeratorVersion7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmEnumeratorVersion7 Interface

For a list of all members of this type, see IEdmEnumeratorVersion7 members.

Public Methods

 | Name | Description
Method | Rollback3 | Rolls this file back to the specified version.
Top

See Also

IEdmEnumeratorVersion7 Interface
EPDM.Interop.epdm Namespace


Rollback3 Method (IEdmEnumeratorVersion7)

Rollback3 Method (IEdmEnumeratorVersion7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion7 Interface : Rollback3 Method (IEdmEnumeratorVersion7)

lVersionNo
Version number to which to roll this file back (see Remarks)
bsComment
Comment for the rollback
vbRedirectParentRefs
True to roll back the file with parent references, false to roll back the file without parent references
Rolls this file back to the specified version.

Syntax

Visual Basic
Sub Rollback3( _
   ByVal lVersionNo As System.Integer, _
   ByVal bsComment As System.String, _
   ByVal vbRedirectParentRefs As System.Boolean _
)
C#
void Rollback3(
   System.int lVersionNo,
   System.string bsComment,
   System.bool vbRedirectParentRefs
)
C++/CLI
void Rollback3(
&   System.int lVersionNo,
&   System.String^ bsComment,
&   System.bool vbRedirectParentRefs
)

Parameters

lVersionNo
Version number to which to roll this file back (see Remarks)
bsComment
Comment for the rollback
vbRedirectParentRefs
True to roll back the file with parent references, false to roll back the file without parent references

Remarks

This method destroys all versions after the version specified by lVersionNo. There is no undoing of the operation short of restoring a backup of the entire database and file archives.

After this method completes successfully, lVersionNo is the new latest version of the file.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_REVISION_NUMBER: The specified version number is out of bounds.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete files.

See Also

IEdmEnumeratorVersion7 Interface
IEdmEnumeratorVersion7 Members
IEdmRevision7::Rollback3 Method ()
IEdmVersion8::Rollback3 Method ()

Availability

SOLIDWORKS PDM Professional 2017


IEdmFile10 Interface

IEdmFile10 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile10 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile10
   Inherits IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile10 : IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile10 : public IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Remarks

This interface:

  • extends IEdmFile9 by supporting password-protected workflow transitions.
  • is extended by IEdmFile11.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile10 Members
EPDM.Interop.epdm Namespace


IEdmFile10 Interface Members

IEdmFile10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile10 Interface

The following tables list the members exposed by IEdmFile10.

Public Methods

 | Name | Description
Method | ChangeState2 | Obsolete. Superseded by IEdmFile13::ChangeState3.
Top

See Also

IEdmFile10 Interface
EPDM.Interop.epdm Namespace


IEdmFile10 Interface Methods

IEdmFile10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile10 Interface

For a list of all members of this type, see IEdmFile10 members.

Public Methods

 | Name | Description
Method | ChangeState2 | Obsolete. Superseded by IEdmFile13::ChangeState3.
Top

See Also

IEdmFile10 Interface
EPDM.Interop.epdm Namespace


IEdmFile11 Interface

IEdmFile11 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile11 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile11
   Inherits IEdmFile10, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile11 : IEdmFile10, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile11 : public IEdmFile10, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

This interface extends:

  • extends IEdmFile10 by providing the ability to get whether a file is in a private state.
  • is extended by IEdmFile12.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile11 Members
EPDM.Interop.epdm Namespace


IEdmFile11 Interface Members

IEdmFile11 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmFile11 Interface

The following tables list the members exposed by IEdmFile11.

Public Properties

 | Name | Description
Property | PrivateStateFile | Gets whether this file is in a private state.
Top

See Also

IEdmFile11 Interface
EPDM.Interop.epdm Namespace


IEdmFile11 Interface Properties

IEdmFile11 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFile11 Interface

For a list of all members of this type, see IEdmFile11 members.

Public Properties

 | Name | Description
Property | PrivateStateFile | Gets whether this file is in a private state.
Top

See Also

IEdmFile11 Interface
EPDM.Interop.epdm Namespace


PrivateStateFile Property (IEdmFile11)

PrivateStateFile Property (IEdmFile11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile11 Interface : PrivateStateFile Property (IEdmFile11)

Gets whether this file is in a private state.

Syntax

Visual Basic
ReadOnly Property PrivateStateFile As System.Boolean
C#
System.bool PrivateStateFile {get;}
C++/CLI
property System.bool PrivateStateFile {
   System.bool get();
}

Property Value

True if this file is in a private state, false if not

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

Files in a private state:

  • are accessible only to the user adding them and the SOLIDWORKS PDM Professional Admin user.
  • have no assigned workflow or category.

See Also

IEdmFile11 Interface
IEdmFile11 Members

Availability

SOLIDWORKS PDM Professional 2015 SP02


IEdmFile12 Interface

IEdmFile12 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile12 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile12
   Inherits IEdmFile10, IEdmFile11, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile12 : IEdmFile10, IEdmFile11, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile12 : public IEdmFile10, IEdmFile11, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Example

Add Files to Vault (C#)
Add Files to Vault (VB.NET)

Remarks

This interface:

  • extends IEdmFile11 by providing the ability to get the local version of a file.
  • is extended by IEdmFile13.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile12 Members
EPDM.Interop.epdm Namespace


IEdmFile12 Interface Members

IEdmFile12 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile12 Interface

The following tables list the members exposed by IEdmFile12.

Public Methods

 | Name | Description
Method | GetLocalVersionNo2 | Gets the version number of the local copy of this file.
Top

See Also

IEdmFile12 Interface
EPDM.Interop.epdm Namespace


IEdmFile12 Interface Methods

IEdmFile12 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile12 Interface

For a list of all members of this type, see IEdmFile12 members.

Public Methods

 | Name | Description
Method | GetLocalVersionNo2 | Gets the version number of the local copy of this file.
Top

See Also

IEdmFile12 Interface
EPDM.Interop.epdm Namespace


GetLocalVersionNo2 Method (IEdmFile12)

GetLocalVersionNo2 Method (IEdmFile12)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile12 Interface : GetLocalVersionNo2 Method (IEdmFile12)

poPathOrFolderID
ID of a folder, full file path, or folder path of the local copy of this file (see Remarks)
pbLocalOverwrittenVersionObsolete
True if the file in the user's local cache is obsolete, false if it is valid (see Remarks)
Gets the version number of the local copy of this file.

Syntax

Visual Basic
Function GetLocalVersionNo2( _
   ByRef poPathOrFolderID As System.Object, _
   ByRef pbLocalOverwrittenVersionObsolete As System.Boolean _
) As System.Integer
C#
System.int GetLocalVersionNo2(
   ref System.object poPathOrFolderID,
   out System.bool pbLocalOverwrittenVersionObsolete
)
C++/CLI
System.int GetLocalVersionNo2(
&   System.Object^% poPathOrFolderID,
&   [Out] System.bool pbLocalOverwrittenVersionObsolete
)

Parameters

poPathOrFolderID
ID of a folder, full file path, or folder path of the local copy of this file (see Remarks)
pbLocalOverwrittenVersionObsolete
True if the file in the user's local cache is obsolete, false if it is valid (see Remarks)

Return Value

Version number; -1 if the local copy does not match any version in the archive

Remarks

If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

pbLocalOverwrittenVersionObsolete gets whether a file in a user's local cache is obsolete because the file was overwritten by another user who checked out the file, modified the file, and checked in the file.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFile12 Interface
IEdmFile12 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmFile13 Interface

IEdmFile13 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile13 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile13
   Inherits IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile13 : IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile13 : public IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

This interface:

extends IEdmFile12 by providing the ability to:

  • select which transition to use when changing state.
  • get a thumbnail, if available, of a file.

is extended by IEdmFile14.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile13 Members
EPDM.Interop.epdm Namespace


IEdmFile13 Interface Members

IEdmFile13 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile13 Interface

The following tables list the members exposed by IEdmFile13.

Public Methods

 | Name | Description
Method | ChangeState3 | Changes the workflow state of this file.
Method | GetThumbnail | Obsolete. Superseded by IEdmFile15::GetThumbnail2 .
Top

See Also

IEdmFile13 Interface
EPDM.Interop.epdm Namespace


IEdmFile13 Interface Methods

IEdmFile13 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile13 Interface

For a list of all members of this type, see IEdmFile13 members.

Public Methods

 | Name | Description
Method | ChangeState3 | Changes the workflow state of this file.
Method | GetThumbnail | Obsolete. Superseded by IEdmFile15::GetThumbnail2 .
Top

See Also

IEdmFile13 Interface
EPDM.Interop.epdm Namespace


ChangeState3 Method (IEdmFile13)

ChangeState3 Method (IEdmFile13)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile13 Interface : ChangeState3 Method (IEdmFile13)

poStateIdOrName
Workflow state ID or name or IEdmState5 to which this file transitions
poTransitionIdOrName
ID or name of the workflow transition to use to change states (see Remarks)
lFolderID
ID of the file's active parent folder
bsComment
Comment saved to the transition history
lParentWnd
Parent window handle
lEdmStateFlags
Optional combination of EdmStateFlags bits; default is EdmStateFlags.EdmState_Simple
bsPasswd
Password of user executing the transition
Changes the workflow state of this file.

Syntax

Visual Basic
Sub ChangeState3( _
   ByRef poStateIdOrName As System.Object, _
   ByRef poTransitionIdOrName As System.Object, _
   ByVal lFolderID As System.Integer, _
   ByVal bsComment As System.String, _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal lEdmStateFlags As System.Integer, _
   Optional ByVal bsPasswd As System.String _
)
C#
void ChangeState3(
   ref System.object poStateIdOrName,
   ref System.object poTransitionIdOrName,
   System.int lFolderID,
   System.string bsComment,
   System.int lParentWnd,
   System.int lEdmStateFlags,
   System.string bsPasswd
)
C++/CLI
void ChangeState3(
&   System.Object^% poStateIdOrName,
&   System.Object^% poTransitionIdOrName,
&   System.int lFolderID,
&   System.String^ bsComment,
&   System.int lParentWnd,
&   System.int lEdmStateFlags,
&   System.String^ bsPasswd
)

Parameters

poStateIdOrName
Workflow state ID or name or IEdmState5 to which this file transitions
poTransitionIdOrName
ID or name of the workflow transition to use to change states (see Remarks)
lFolderID
ID of the file's active parent folder
bsComment
Comment saved to the transition history
lParentWnd
Parent window handle
lEdmStateFlags
Optional combination of EdmStateFlags bits; default is EdmStateFlags.EdmState_Simple
bsPasswd
Password of user executing the transition

Example

See the IEdmFile13 examples.

Remarks

Specify poTransitionIdOrName to unambiguously specify how to transition to the new state specified by poStateIdOrName.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_TRANSITION_ACTION_FAILED: One of the transition actions set up in the workflow failed.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the EdmCmdType.EdmCmd_PreState hooks did not permit the operation.
  • E_EDM_FILE_IS_LOCKED: The file is checked out. Changing state is only permitted on checked-in files.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks permission to change state.
  • E_EDM_CONDITIONS_NOT_MET: The conditions set up in the Workflow Editor for this transition were not met.
  • E_EDM_STATE_NOT_FOUND: There is no transition going from the file's current state to the specified state.

See Also

IEdmFile13 Interface
IEdmFile13 Members
IEdmWorkflow5 Interface

Availability

SOLIDWORKS PDM Professional 2018


IEdmFile14 Interface

IEdmFile14 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile14 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile14
   Inherits IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile14 : IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile14 : public IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Remarks

This interface

extends IEdmFile13 by:

  • providing the ability to generate configuration values for drawings or files lacking properties at the configuration level.
  • getting the ID of the vault view in which a file is checked out.

is extended by IEdmFile15.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile14 Members
EPDM.Interop.epdm Namespace


IEdmFile14 Interface Members

IEdmFile14 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmFile14 Interface

The following tables list the members exposed by IEdmFile14.

Public Properties

 | Name | Description
Property | LockedOnViewID | Gets the ID of the vault view in which this file is checked out.
Top

Public Methods

 | Name | Description
Method | GenerateDefaultConfigValues | Generates default configuration data for the specified drawing or file that lacks properties at the configuration level.
Top

See Also

IEdmFile14 Interface
EPDM.Interop.epdm Namespace


IEdmFile14 Interface Methods

IEdmFile14 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile14 Interface

For a list of all members of this type, see IEdmFile14 members.

Public Methods

 | Name | Description
Method | GenerateDefaultConfigValues | Generates default configuration data for the specified drawing or file that lacks properties at the configuration level.
Top

See Also

IEdmFile14 Interface
EPDM.Interop.epdm Namespace


GenerateDefaultConfigValues Method (IEdmFile14)

GenerateDefaultConfigValues Method (IEdmFile14)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile14 Interface : GenerateDefaultConfigValues Method (IEdmFile14)

lOldFileID
ID of drawing or file that lacks properties at the configuration level
bsOldConfigName
Name of configuration whose values to copy (see Remarks)
bsNewConfigName
Name of the configuration to which to copy values (see Remarks)
bsActiveConfig
Name of the active configuration (see Remarks)
bOnlyForUpdateAllFlag
True to copy values only for controls for which IEdmCardControl6::UpdatesAllConfigurations is set to true, false to copy values for all variables associated with this file
Generates default configuration data for the specified drawing or file that lacks properties at the configuration level.

Syntax

Visual Basic
Sub GenerateDefaultConfigValues( _
   ByVal lOldFileID As System.Integer, _
   ByVal bsOldConfigName As System.String, _
   ByVal bsNewConfigName As System.String, _
   ByVal bsActiveConfig As System.String, _
   ByVal bOnlyForUpdateAllFlag As System.Boolean _
)
C#
void GenerateDefaultConfigValues(
   System.int lOldFileID,
   System.string bsOldConfigName,
   System.string bsNewConfigName,
   System.string bsActiveConfig,
   System.bool bOnlyForUpdateAllFlag
)
C++/CLI
void GenerateDefaultConfigValues(
&   System.int lOldFileID,
&   System.String^ bsOldConfigName,
&   System.String^ bsNewConfigName,
&   System.String^ bsActiveConfig,
&   System.bool bOnlyForUpdateAllFlag
)

Parameters

lOldFileID
ID of drawing or file that lacks properties at the configuration level
bsOldConfigName
Name of configuration whose values to copy (see Remarks)
bsNewConfigName
Name of the configuration to which to copy values (see Remarks)
bsActiveConfig
Name of the active configuration (see Remarks)
bOnlyForUpdateAllFlag
True to copy values only for controls for which IEdmCardControl6::UpdatesAllConfigurations is set to true, false to copy values for all variables associated with this file

Example

Generate Configuration Values (C#)
Generate Configuration Values (VB.NET)

Remarks

This method:

  • is valid only for files with data card variables.
  • copies values from bsOldConfigName to bsNewConfigName. If it encounters a null control variable in bsOldConfigName, it takes the value from bsActiveConfig instead.

Use IEdmFile5::GetConfigurations to populate the configuration parameters.

See Also

IEdmFile14 Interface
IEdmFile14 Members
IEdmFile8::GenerateDefaultValuesForNewConfiguration Method ()

Availability

SOLIDWORKS PDM Professional 2018 SP03


IEdmFile14 Interface Properties

IEdmFile14 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFile14 Interface

For a list of all members of this type, see IEdmFile14 members.

Public Properties

 | Name | Description
Property | LockedOnViewID | Gets the ID of the vault view in which this file is checked out.
Top

See Also

IEdmFile14 Interface
EPDM.Interop.epdm Namespace


LockedOnViewID Property (IEdmFile14)

LockedOnViewID Property (IEdmFile14)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile14 Interface : LockedOnViewID Property (IEdmFile14)

Gets the ID of the vault view in which this file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedOnViewID As System.String
C#
System.string LockedOnViewID {get;}
C++/CLI
property System.String^ LockedOnViewID {
   System.String^ get();
}

Property Value

Vault view ID

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile14 Interface
IEdmFile14 Members

Availability

SOLIDWORKS PDM Professional 2018 SP03


IEdmFile15 Interface

IEdmFile15 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile15 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile15
   Inherits IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile15 : IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile15 : public IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Remarks

This interface:

  • Extends IEdmFile14 by getting a file's thumbnail by file version.
  • Is extended by IEdmFile16.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile15 Members
EPDM.Interop.epdm Namespace


IEdmFile15 Interface Members

IEdmFile15 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile15 Interface

The following tables list the members exposed by IEdmFile15.

Public Methods

 | Name | Description
Method | GetThumbnail2 | Obsolete. Superseded by IEdmFile18::GetThumbnail3 .
Top

See Also

IEdmFile15 Interface
EPDM.Interop.epdm Namespace


IEdmFile15 Interface Methods

IEdmFile15 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile15 Interface

For a list of all members of this type, see IEdmFile15 members.

Public Methods

 | Name | Description
Method | GetThumbnail2 | Obsolete. Superseded by IEdmFile18::GetThumbnail3 .
Top

See Also

IEdmFile15 Interface
EPDM.Interop.epdm Namespace


IEdmFile16 Interface

IEdmFile16 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile16 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile16
   Inherits IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile16 : IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile16 : public IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Remarks

This interface:

  • Extends IEdmFile15 by allowing you to create a file label.
  • Is extended by IEdmFile17.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile16 Members
EPDM.Interop.epdm Namespace


IEdmFile16 Interface Members

IEdmFile16 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile16 Interface

The following tables list the members exposed by IEdmFile16.

Public Methods

 | Name | Description
Method | CreateLabel | Creates a label with the specified name and description for this file.
Top

See Also

IEdmFile16 Interface
EPDM.Interop.epdm Namespace


IEdmFile16 Interface Methods

IEdmFile16 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile16 Interface

For a list of all members of this type, see IEdmFile16 members.

Public Methods

 | Name | Description
Method | CreateLabel | Creates a label with the specified name and description for this file.
Top

See Also

IEdmFile16 Interface
EPDM.Interop.epdm Namespace


CreateLabel Method (IEdmFile16)

CreateLabel Method (IEdmFile16)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile16 Interface : CreateLabel Method (IEdmFile16)

bsName
Name of the label; maximum of 255 characters
bsDescription
Label description to show in the history dialog box; maximum of 2000 characters
Creates a label with the specified name and description for this file.

Syntax

Visual Basic
Function CreateLabel( _
   ByVal bsName As System.String, _
   ByVal bsDescription As System.String _
) As System.Integer
C#
System.int CreateLabel(
   System.string bsName,
   System.string bsDescription
)
C++/CLI
System.int CreateLabel(
&   System.String^ bsName,
&   System.String^ bsDescription
)

Parameters

bsName
Name of the label; maximum of 255 characters
bsDescription
Label description to show in the history dialog box; maximum of 2000 characters

Return Value

ID of the file label

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

Use IEdmVault5::GetObject to get the IEdmLabel5 object for this label.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments in invalid.

See Also

IEdmFile16 Interface
IEdmFile16 Members
IEdmFolder5::CreateLabel Method ()
IEdmEnumeratorVersion5::CreateLabel Method ()

Availability

SOLIDWORKS PDM Professional 2019 SP04


IEdmFile17 Interface

IEdmFile17 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile17 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile17
   Inherits IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile16, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile17 : IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile16, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile17 : public IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile16, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Remarks

This interface:

  • extends IEdmFile16 by allowing you to determine whether a file has cut list items.
  • is extended by IEdmFile18.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile17 Members
EPDM.Interop.epdm Namespace


IEdmFile17 Interface Members

IEdmFile17 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmFile17 Interface

The following tables list the members exposed by IEdmFile17.

Public Properties

 | Name | Description
Property | HasCutlistItems | Gets whether this file has cut list items.
Top

See Also

IEdmFile17 Interface
EPDM.Interop.epdm Namespace


IEdmFile17 Interface Properties

IEdmFile17 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFile17 Interface

For a list of all members of this type, see IEdmFile17 members.

Public Properties

 | Name | Description
Property | HasCutlistItems | Gets whether this file has cut list items.
Top

See Also

IEdmFile17 Interface
EPDM.Interop.epdm Namespace


HasCutlistItems Property (IEdmFile17)

HasCutlistItems Property (IEdmFile17)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile17 Interface : HasCutlistItems Property (IEdmFile17)

Gets whether this file has cut list items.

Syntax

Visual Basic
ReadOnly Property HasCutlistItems As System.Boolean
C#
System.bool HasCutlistItems {get;}
C++/CLI
property System.bool HasCutlistItems {
   System.bool get();
}

Property Value

True if the file has cut list items, false if not

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile17 Interface
IEdmFile17 Members

Availability

SOLIDWORKS PDM Professional 2020


IEdmFile18 Interface

IEdmFile18 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile18 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile18
   Inherits IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile16, IEdmFile17, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C#
public interface IEdmFile18 : IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile16, IEdmFile17, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5
C++/CLI
public interface class IEdmFile18 : public IEdmFile10, IEdmFile11, IEdmFile12, IEdmFile13, IEdmFile14, IEdmFile15, IEdmFile16, IEdmFile17, IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmFile9, IEdmObject5

Remarks

This interface extends IEdmFile17 by allowing you to retrieve a file's thumbnail handle.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile18 Members
EPDM.Interop.epdm Namespace


IEdmFile18 Interface Members

IEdmFile18 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile18 Interface

The following tables list the members exposed by IEdmFile18.

Public Methods

 | Name | Description
Method | GetThumbnail3 | Gets this file's thumbnail handle.
Top

See Also

IEdmFile18 Interface
EPDM.Interop.epdm Namespace


IEdmFile18 Interface Methods

IEdmFile18 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile18 Interface

For a list of all members of this type, see IEdmFile18 members.

Public Methods

 | Name | Description
Method | GetThumbnail3 | Gets this file's thumbnail handle.
Top

See Also

IEdmFile18 Interface
EPDM.Interop.epdm Namespace


GetThumbnail3 Method (IEdmFile18)

GetThumbnail3 Method (IEdmFile18)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile18 Interface : GetThumbnail3 Method (IEdmFile18)

lVersion
Version of the file whose thumbnail to retrieve
Gets this file's thumbnail handle.

Syntax

Visual Basic
Function GetThumbnail3( _
   ByVal lVersion As System.Integer _
) As System.Integer
C#
System.int GetThumbnail3(
   System.int lVersion
)
C++/CLI
System.int GetThumbnail3(
&   System.int lVersion
)

Parameters

lVersion
Version of the file whose thumbnail to retrieve

Return Value

Thumbnail handle

Example

Get File's Thumbnail Handle by File Version (C#)

See Also

IEdmFile18 Interface
IEdmFile18 Members
IEdmFile15::GetThumbnail2 Method ()

Availability

SOLIDWORKS PDM Professional 2023 SP01


IEdmFile5 Interface

IEdmFile5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile5 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile5
   Inherits IEdmObject5
C#
public interface IEdmFile5 : IEdmObject5
C++/CLI
public interface class IEdmFile5 : public IEdmObject5

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)
Get File References for a File (C#)
Get File References for a File (VB.NET)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)
Get File Information (VB.NET)
Get File Information (C#)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmFile6 which provides the ability to move, rename, and categorize files.

Accessors

IEdmFolder5::GetFile

IEdmFolder5::GetNextFile

IEdmLabel5::GetNextFile

IEdmReference5::File

IEdmState5::GetNextFle

IEdmVault5::GetFileFromPath

IEdmVault5::GetObject

See Also

IEdmFile5 Members
EPDM.Interop.epdm Namespace


IEdmFile5 Interface Members

IEdmFile5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmFile5 Interface

The following tables list the members exposed by IEdmFile5.

Public Properties

 | Name | Description
Property | CurrentRevision | Gets the file's current revision.
Property | CurrentState | Gets the file's current workflow state.
Property | CurrentVersion | Gets the file's current version number.
Property | ID | Gets the database ID of this file.
Property | IsLocked | Gets whether the file is checked out.
Property | LockedByUser | Gets the user who has the file checked out.
Property | LockedByUserID | Gets the ID of the user who has the file checked out.
Property | LockedInFolder | Gets the folder in which this file is checked out.
Property | LockedInFolderID | Gets the ID of the folder in which this file is checked out.
Property | LockedOnComputer | Gets the name of the computer to which the file is checked out.
Property | LockPath | Gets the full path to the checked-out file.
Property | Name | Gets the name of the file.
Property | ObjectType | Gets the type of object.
Property | Vault | Gets the file vault to which this file belongs.
Top

Public Methods

 | Name | Description
Method | ChangeState | Obsolete. Superseded by IEdmFile10::ChangeState2.
Method | GetConfigurations | Gets a list of names of the configurations for the specified version of this file.
Method | GetEnumeratorVariable | Gets an interface to this file's data card variables.
Method | GetFileCopy | Gets a copy of the file with the specified version from the archive and deposits it in the specified location.
Method | GetFirstFolderPosition | Starts an enumeration of the parent folders of this file.
Method | GetLocalFileDate | Gets the date and timestamp of a local copy of this file.
Method | GetLocalFileSize | Obsolete. Superseded by IEdmFile9::GetLocalFileSize2 .
Method | GetLocalPath | Gets the full path to this file in the specified parent folder.
Method | GetLocalRevisionName | Gets the revision name of the local copy of this file.
Method | GetLocalVersionNo | Obsolete. Superseded by IEdmFile12::GetLocalVersionNo2 .
Method | GetNextFolder | Gets the next parent folder of this file.
Method | GetReferenceTree | Gets an interface to the files that reference or are referenced by this file.
Method | GetRevisionGeneratorInfo | Gets information about this file for the revision generator.
Method | IncrementRevision | Creates a new revision of this file.
Method | IsKindOf | Checks whether the object is of a certain type.
Method | LockFile | Checks out this file from the vault to which the user is currently logged in.
Method | Refresh | Refreshes the file.
Method | Rename | Obsolete. Superseded by IEdmFile6::RenameEx .
Method | UndoLockFile | Removes the check-out of a file without saving changes to the archive.
Method | UnlockFile | Checks in this file.
Top

See Also

IEdmFile5 Interface
EPDM.Interop.epdm Namespace


IEdmFile5 Interface Methods

IEdmFile5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile5 Interface

For a list of all members of this type, see IEdmFile5 members.

Public Methods

 | Name | Description
Method | ChangeState | Obsolete. Superseded by IEdmFile10::ChangeState2.
Method | GetConfigurations | Gets a list of names of the configurations for the specified version of this file.
Method | GetEnumeratorVariable | Gets an interface to this file's data card variables.
Method | GetFileCopy | Gets a copy of the file with the specified version from the archive and deposits it in the specified location.
Method | GetFirstFolderPosition | Starts an enumeration of the parent folders of this file.
Method | GetLocalFileDate | Gets the date and timestamp of a local copy of this file.
Method | GetLocalFileSize | Obsolete. Superseded by IEdmFile9::GetLocalFileSize2 .
Method | GetLocalPath | Gets the full path to this file in the specified parent folder.
Method | GetLocalRevisionName | Gets the revision name of the local copy of this file.
Method | GetLocalVersionNo | Obsolete. Superseded by IEdmFile12::GetLocalVersionNo2 .
Method | GetNextFolder | Gets the next parent folder of this file.
Method | GetReferenceTree | Gets an interface to the files that reference or are referenced by this file.
Method | GetRevisionGeneratorInfo | Gets information about this file for the revision generator.
Method | IncrementRevision | Creates a new revision of this file.
Method | IsKindOf | Checks whether the object is of a certain type.
Method | LockFile | Checks out this file from the vault to which the user is currently logged in.
Method | Refresh | Refreshes the file.
Method | Rename | Obsolete. Superseded by IEdmFile6::RenameEx .
Method | UndoLockFile | Removes the check-out of a file without saving changes to the archive.
Method | UnlockFile | Checks in this file.
Top

See Also

IEdmFile5 Interface
EPDM.Interop.epdm Namespace


GetConfigurations Method (IEdmFile5)

GetConfigurations Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetConfigurations Method (IEdmFile5)

poVersionNoOrRevisionName
Version number or revision name; 0 or empty string to get configurations for the latest version of this file
Gets a list of names of the configurations for the specified version of this file.

Syntax

Visual Basic
Function GetConfigurations( _
   Optional ByRef poVersionNoOrRevisionName As System.Object _
) As EdmStrLst5
C#
EdmStrLst5 GetConfigurations(
   ref System.object poVersionNoOrRevisionName
)
C++/CLI
EdmStrLst5^ GetConfigurations(
&   System.Object^% poVersionNoOrRevisionName
)

Parameters

poVersionNoOrRevisionName
Version number or revision name; 0 or empty string to get configurations for the latest version of this file

Return Value

IEdmStrList5

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

Some file types, such as files from AutoCAD and SOLIDWORKS, can contain several configurations or layouts. These configurations are visible as pages in the SOLIDWORKS PDM Professional file data cards.

C++ users not using smart pointer wrapper functions must release the returned interface, IEdmStrLst5.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user does not have read-access to the specified version or revision.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile14::GenerateDefaultConfigValues Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetEnumeratorVariable Method (IEdmFile5)

GetEnumeratorVariable Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetEnumeratorVariable Method (IEdmFile5)

bsOptionalPath
Optional; full file path to the file to access; if not specified, uses location where this file is checked out (see Remarks)
Gets an interface to this file's data card variables.

Syntax

Visual Basic
Function GetEnumeratorVariable( _
   Optional ByVal bsOptionalPath As System.String _
) As IEdmEnumeratorVariable5
C#
IEdmEnumeratorVariable5 GetEnumeratorVariable(
   System.string bsOptionalPath
)
C++/CLI
IEdmEnumeratorVariable5^ GetEnumeratorVariable(
&   System.String^ bsOptionalPath
)

Parameters

bsOptionalPath
Optional; full file path to the file to access; if not specified, uses location where this file is checked out (see Remarks)

Return Value

IEdmEnumeratorVariable5

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

You must check out a file in order to write variables in its data card.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_FOUND: File not found on the specified path.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFileCopy Method (IEdmFile5)

GetFileCopy Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetFileCopy Method (IEdmFile5)

lParentWnd
Parent window handle
poVersionNoOrRevisionName
Version number or revision name of the file to get; 0 or "" to get the latest version
poPathOrFolderID
Optional folder ID or path where to deposit the file; default is to deposit the file in all of its parent folders (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGetFlag.EdmGet_MakeReadOnly
bsNewName
Optional new name of the copy of this file; empty string to use the file's current name
Gets a copy of the file with the specified version from the archive and deposits it in the specified location.

Syntax

Visual Basic
Sub GetFileCopy( _
   ByVal lParentWnd As System.Integer, _
   Optional ByRef poVersionNoOrRevisionName As System.Object, _
   Optional ByRef poPathOrFolderID As System.Object, _
   Optional ByVal lEdmGetFlags As System.Integer, _
   Optional ByVal bsNewName As System.String _
)
C#
void GetFileCopy(
   System.int lParentWnd,
   ref System.object poVersionNoOrRevisionName,
   ref System.object poPathOrFolderID,
   System.int lEdmGetFlags,
   System.string bsNewName
)
C++/CLI
void GetFileCopy(
&   System.int lParentWnd,
&   System.Object^% poVersionNoOrRevisionName,
&   System.Object^% poPathOrFolderID,
&   System.int lEdmGetFlags,
&   System.String^ bsNewName
)

Parameters

lParentWnd
Parent window handle
poVersionNoOrRevisionName
Version number or revision name of the file to get; 0 or "" to get the latest version
poPathOrFolderID
Optional folder ID or path where to deposit the file; default is to deposit the file in all of its parent folders (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGetFlag.EdmGet_MakeReadOnly
bsNewName
Optional new name of the copy of this file; empty string to use the file's current name

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

If poPathOrFolderID = 0, then the file is copied to all folders to which this file is shared. If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

To retrieve several files, use IEdmBatchGet, which is more efficient than calling this method several times.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_REVISION_NUMBER: The revision was not found.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks permission to see the specified version of the file.
  • E_EDM_FILE_NOT_FOUND: The file was not found in the vault.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::LockFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstFolderPosition Method (IEdmFile5)

GetFirstFolderPosition Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetFirstFolderPosition Method (IEdmFile5)

Starts an enumeration of the parent folders of this file.

Syntax

Visual Basic
Function GetFirstFolderPosition() As IEdmPos5
C#
IEdmPos5 GetFirstFolderPosition()
C++/CLI
IEdmPos5^ GetFirstFolderPosition();

Return Value

IEdmPos5; position of the first parent folder

Example

Batch Add Files and Folders to Vault (VB.NET)
Batch Add Files and Folders to Vault (C#)

Remarks

Files can be shared between several folders in SOLIDWORKS PDM Professional. Call IEdmFolder5::AddFileShared to share a file between several folders.

After calling this method to get the postion of the first parent folder in the list, call IEdmFile5::GetNextFolder to get the parent folders.

C++ programmers not using smart-pointer wrapper functions must release the returned pointer to IEdmPos5.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetLocalFileDate Method (IEdmFile5)

GetLocalFileDate Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetLocalFileDate Method (IEdmFile5)

poPathOrFolderID
ID of the folder, full file path, or a folder path (see Remarks)
Gets the date and timestamp of a local copy of this file.

Syntax

Visual Basic
Function GetLocalFileDate( _
   ByRef poPathOrFolderID As System.Object _
) As System.Object
C#
System.object GetLocalFileDate(
   ref System.object poPathOrFolderID
)
C++/CLI
System.Object^ GetLocalFileDate(
&   System.Object^% poPathOrFolderID
)

Parameters

poPathOrFolderID
ID of the folder, full file path, or a folder path (see Remarks)

Return Value

Date and timestamp; Null if the local file is missing

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

The date and timestamp of a file in SOLIDWORKS PDM Professional is adjusted to be backwards compatible with File Allocation Table (FAT) file systems. For example, a file's timestamp is always displayed in even seconds.

If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

If you don't need the IEdmFile5 interface for some other task, it is much more efficient to use Win32 API functions to retrieve the date and timestamp of the file.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: The file does not exist in the specified location.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::GetLocalFileSize Method ()
IEdmFile5::GetLocalRevisionName Method ()
IEdmFile5::GetLocalVersionNo Method ()
IEdmVersion5::FileDate Property ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetLocalFileSize Method (IEdmFile5)

GetLocalFileSize Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetLocalFileSize Method (IEdmFile5)

poPathOrFolderID
ID of the folder, a full file path, or a folder path (see Remarks)
Obsolete. Superseded by IEdmFile9::GetLocalFileSize2 .

Syntax

Visual Basic
Function GetLocalFileSize( _
   ByRef poPathOrFolderID As System.Object _
) As System.Integer
C#
System.int GetLocalFileSize(
   ref System.object poPathOrFolderID
)
C++/CLI
System.int GetLocalFileSize(
&   System.Object^% poPathOrFolderID
)

Parameters

poPathOrFolderID
ID of the folder, a full file path, or a folder path (see Remarks)

Return Value

Size in bytes; -1 if the local file is missing

Remarks

If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: The local copy of the file is missing.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::GetLocalFileDate Method ()
IEdmFile5::GetLocalRevisionName Method ()
IEdmFile5::GetLocalVersionNo Method ()
IEdmVersion5::FileSize Property ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetLocalPath Method (IEdmFile5)

GetLocalPath Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetLocalPath Method (IEdmFile5)

lParentFolderID
ID of parent folder (see Remarks)
Gets the full path to this file in the specified parent folder.

Syntax

Visual Basic
Function GetLocalPath( _
   ByVal lParentFolderID As System.Integer _
) As System.String
C#
System.string GetLocalPath(
   System.int lParentFolderID
)
C++/CLI
System.String^ GetLocalPath(
&   System.int lParentFolderID
)

Parameters

lParentFolderID
ID of parent folder (see Remarks)

Return Value

Full path to this file in the parent folder

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

This method does not verify the existence of the file in lParentFolderID. It only concatenates the path of the specified folder and this file's name.

You can obtain all of the parent folders of this file by calling IEdmFile5::GetFirstFolderPosition and IEdmFile5::GetNextFolder.

C++ users not using bstr_t wrapper functions must free the returned string with a call to SysFreeString.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_FOLDER_NOT_FOUND: The folder ID is invalid.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFolder5::LocalPath Property ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetLocalRevisionName Method (IEdmFile5)

GetLocalRevisionName Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetLocalRevisionName Method (IEdmFile5)

poPathOrFolderID
ID of the folder, full file path or the folder path of the local copy of this file (see Remarks)
Gets the revision name of the local copy of this file.

Syntax

Visual Basic
Function GetLocalRevisionName( _
   ByRef poPathOrFolderID As System.Object _
) As System.String
C#
System.string GetLocalRevisionName(
   ref System.object poPathOrFolderID
)
C++/CLI
System.String^ GetLocalRevisionName(
&   System.Object^% poPathOrFolderID
)

Parameters

poPathOrFolderID
ID of the folder, full file path or the folder path of the local copy of this file (see Remarks)

Return Value

Revision name; "" if the file does not exist locally, or no revisions matches the local version

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

Revisions are "named versions" that can be set up using the Workflow Editor.

C++ users not using bstr_t wrapper functions must free the returned string with a call to SysFreeString.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: The file does not exist locally, or no revision matches the local version.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::GetLocalFileDate Method ()
IEdmFile5::GetLocalFileSize Method ()
IEdmFile5::GetLocalVersionNo Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetLocalVersionNo Method (IEdmFile5)

GetLocalVersionNo Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetLocalVersionNo Method (IEdmFile5)

poPathOrFolderID
ID of a folder, full file path, or folder path of the local copy of this file (see Remarks)
Obsolete. Superseded by IEdmFile12::GetLocalVersionNo2 .

Syntax

Visual Basic
Function GetLocalVersionNo( _
   ByRef poPathOrFolderID As System.Object _
) As System.Integer
C#
System.int GetLocalVersionNo(
   ref System.object poPathOrFolderID
)
C++/CLI
System.int GetLocalVersionNo(
&   System.Object^% poPathOrFolderID
)

Parameters

poPathOrFolderID
ID of a folder, full file path, or folder path of the local copy of this file (see Remarks)

Return Value

Version number; -1 if the local copy does not match any version in the archive

Example

Get File Information (VB.NET)
Get File Information (C#)
Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFolder Method (IEdmFile5)

GetNextFolder Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetNextFolder Method (IEdmFile5)

poPosition
IEdmPos5; position of next parent folder of this file
Gets the next parent folder of this file.

Syntax

Visual Basic
Function GetNextFolder( _
   ByVal poPosition As IEdmPos5 _
) As IEdmFolder5
C#
IEdmFolder5 GetNextFolder(
   IEdmPos5 poPosition
)
C++/CLI
IEdmFolder5^ GetNextFolder(
&   IEdmPos5^ poPosition
)

Parameters

poPosition
IEdmPos5; position of next parent folder of this file

Return Value

IEdmFolder5

Example

Batch Add Files and Folders to Vault (VB.NET)
Batch Add Files and Folders to Vault (C#)

Remarks

Before calling this method the first time, you must populate poPosition with the interface to the position of the first parent folder, IEdmPos5. Call IEdmFile5::GetFirstFolderPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the folders.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmFolder5.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetReferenceTree Method (IEdmFile5)

GetReferenceTree Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetReferenceTree Method (IEdmFile5)

lParentFolderID
ID of the file's parent folder (see Remarks)
lVersionNo
Version of the file for which to get references; 0 to get the latest version
Gets an interface to the files that reference or are referenced by this file.

Syntax

Visual Basic
Function GetReferenceTree( _
   ByVal lParentFolderID As System.Integer, _
   Optional ByVal lVersionNo As System.Integer _
) As IEdmReference5
C#
IEdmReference5 GetReferenceTree(
   System.int lParentFolderID,
   System.int lVersionNo
)
C++/CLI
IEdmReference5^ GetReferenceTree(
&   System.int lParentFolderID,
&   System.int lVersionNo
)

Parameters

lParentFolderID
ID of the file's parent folder (see Remarks)
lVersionNo
Version of the file for which to get references; 0 to get the latest version

Return Value

IEdmReference5

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

Some file types, such as files from AutoCAD, SOLIDWORKS, MS Word, etc., contain references to other files. You can also set up your own references via SOLIDWORKS PDM Professional's User Defined File References dialog box. SOLIDWORKS PDM Professional manages all of these references for you, and they appear in the check-in dialog box in the form of a reference tree.

To specify lParentFolderID, inspect all of the parent folders of this file by calling IEdmFile5::GetFirstFolderPosition and IEdmFile5::GetNextFolder.

Use IEdmReference5 that is returned in ppoRetRoot to enumerate referenced files and referencing files and set up user-defined references.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmReference5.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetRevisionGeneratorInfo Method (IEdmFile5)

GetRevisionGeneratorInfo Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : GetRevisionGeneratorInfo Method (IEdmFile5)

pbIncrementMenu
True if there should be an Increment Revision menu item in the context menu of this file, false if not
Gets information about this file for the revision generator.

Syntax

Visual Basic
Function GetRevisionGeneratorInfo( _
   ByRef pbIncrementMenu As System.Boolean _
) As System.Boolean
C#
System.bool GetRevisionGeneratorInfo(
   out System.bool pbIncrementMenu
)
C++/CLI
System.bool GetRevisionGeneratorInfo(
&   [Out] System.bool pbIncrementMenu
)

Parameters

pbIncrementMenu
True if there should be an Increment Revision menu item in the context menu of this file, false if not

Return Value

True if there is a revision number generator set up for the file's current state in the workflow, false if not

Remarks

This method exists mainly for internal purposes.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_REV_GEN_LIST_STOP: It is not possible to increment revision on this file, because SOLIDWORKS PDM Professional has reached the end of the revision list that was set up in the Workflow Editor.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IncrementRevision Method (IEdmFile5)

IncrementRevision Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : IncrementRevision Method (IEdmFile5)

lParentWnd
Parent window handle
lFolderID
ID of the file's parent folder (see Remarks)
bsComment
Comment to store in revision history
lEdmIncRevFlags
Optional combination of EdmIncRevFlags bits; default is EdmIncRevFlags.EdmIncRev_Simple
Creates a new revision of this file.

Syntax

Visual Basic
Sub IncrementRevision( _
   ByVal lParentWnd As System.Integer, _
   ByVal lFolderID As System.Integer, _
   ByVal bsComment As System.String, _
   Optional ByVal lEdmIncRevFlags As System.Integer _
)
C#
void IncrementRevision(
   System.int lParentWnd,
   System.int lFolderID,
   System.string bsComment,
   System.int lEdmIncRevFlags
)
C++/CLI
void IncrementRevision(
&   System.int lParentWnd,
&   System.int lFolderID,
&   System.String^ bsComment,
&   System.int lEdmIncRevFlags
)

Parameters

lParentWnd
Parent window handle
lFolderID
ID of the file's parent folder (see Remarks)
bsComment
Comment to store in revision history
lEdmIncRevFlags
Optional combination of EdmIncRevFlags bits; default is EdmIncRevFlags.EdmIncRev_Simple

Remarks

Every time you check in a file in SOLIDWORKS PDM Professional, a new version of it is created. Versions are denoted by numbers: 1,2,3...N. In addition to versions you can also have revisions, which can be described as labels for certain versions. Revision numbers are generated by revision number generators which are set up in the Workflow Editor. Revisions let each company specify their own numbering system.

To specify lFolderID, inspect all of the parent folders of this file by calling IEdmFile5::GetFirstFolderPosition and IEdmFile5::GetNextFolder.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_IS_LOCKED: To increment revision of a file, the file must not be checked out.
  • E_EDM_END_OF_REV_GEN_LIST_STOP: It is not possible to increment revision on this file, because SOLIDWORKS PDM Professional has reached the end of the revision list that was set up in the Workflow Editor.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IsKindOf Method (IEdmFile5)

IsKindOf Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : IsKindOf Method (IEdmFile5)

__MIDL__IEdmObject50000
Type of object as defined in EdmObjectType
Checks whether the object is of a certain type.

Syntax

Visual Basic
Function IsKindOf( _
   ByVal __MIDL__IEdmObject50000 As EdmObjectType _
) As System.Boolean
C#
System.bool IsKindOf(
   EdmObjectType __MIDL__IEdmObject50000
)
C++/CLI
System.bool IsKindOf(
&   EdmObjectType __MIDL__IEdmObject50000
)

Parameters

__MIDL__IEdmObject50000
Type of object as defined in EdmObjectType

Return Value

True if the object is of the specified type, false if not

Remarks

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK indicates that the method successfully executed.

See Also

IEdmFile5 Interface
IEdmFile5 Members


LockFile Method (IEdmFile5)

LockFile Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockFile Method (IEdmFile5)

lParentFolderID
ID of parent folder to which to check out the file
lParentWnd
Parent window handle
lEdmLockFlags
Optional combination of EdmLockFlag bits; default is EdmLockFlag.EdmLock_Simple
Checks out this file from the vault to which the user is currently logged in.

Syntax

Visual Basic
Sub LockFile( _
   ByVal lParentFolderID As System.Integer, _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal lEdmLockFlags As System.Integer _
)
C#
void LockFile(
   System.int lParentFolderID,
   System.int lParentWnd,
   System.int lEdmLockFlags
)
C++/CLI
void LockFile(
&   System.int lParentFolderID,
&   System.int lParentWnd,
&   System.int lEdmLockFlags
)

Parameters

lParentFolderID
ID of parent folder to which to check out the file
lParentWnd
Parent window handle
lEdmLockFlags
Optional combination of EdmLockFlag bits; default is EdmLockFlag.EdmLock_Simple

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

When checking out several files, it is more efficient to use IEdmBatchGet than to repeatedly call this method to check out every file.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_IS_LOCKED: The file is already checked out.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to check out this file.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdType.EdmCmd_PreLock hooks did not permit the operation.
  • E_EDM_FILE_NOT_FOUND: The file was not found in the vault.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::UnlockFile Method ()
IEdmFile5::UndoLockFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


Refresh Method (IEdmFile5)

Refresh Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : Refresh Method (IEdmFile5)

Refreshes the file.

Syntax

Visual Basic
Sub Refresh()
C#
void Refresh()
C++/CLI
void Refresh();

Remarks

In a multi-user implementation, a file can be checked in and out by others while you are working on it. Call this method before calling IEdmFile5::IsLocked to obtain the correct checkout status.

See Also

IEdmFile5 Interface
IEdmFile5 Members


Rename Method (IEdmFile5)

Rename Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : Rename Method (IEdmFile5)

lParentWnd
Parent window handle
bsName
New file name
bRenameLocalCopies
Optional; true to rename local copies, false to not; default is true
Obsolete. Superseded by IEdmFile6::RenameEx .

Syntax

Visual Basic
Sub Rename( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsName As System.String, _
   Optional ByVal bRenameLocalCopies As System.Boolean _
)
C#
void Rename(
   System.int lParentWnd,
   System.string bsName,
   System.bool bRenameLocalCopies
)
C++/CLI
void Rename(
&   System.int lParentWnd,
&   System.String^ bsName,
&   System.bool bRenameLocalCopies
)

Parameters

lParentWnd
Parent window handle
bsName
New file name
bRenameLocalCopies
Optional; true to rename local copies, false to not; default is true

Remarks

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_NAME_ALREADY_EXISTS: The specified name already exists.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to rename this file.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


UndoLockFile Method (IEdmFile5)

UndoLockFile Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : UndoLockFile Method (IEdmFile5)

lParentWnd
Parent window handle
bGetLatestVersion
Optional; true to replace the local copy of the file with the latest from the archive, false to not; default is true
Removes the check-out of a file without saving changes to the archive.

Syntax

Visual Basic
Sub UndoLockFile( _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal bGetLatestVersion As System.Boolean _
)
C#
void UndoLockFile(
   System.int lParentWnd,
   System.bool bGetLatestVersion
)
C++/CLI
void UndoLockFile(
&   System.int lParentWnd,
&   System.bool bGetLatestVersion
)

Parameters

lParentWnd
Parent window handle
bGetLatestVersion
Optional; true to replace the local copy of the file with the latest from the archive, false to not; default is true

Example

Access File Card Variables (VB.NET)
Access File Card Variables (C#)

Remarks

Before calling this method, the file must be checked out by the logged-in user.

IEdmBatchUnlock is more efficient than this interface for undoing the check-outs of multiple files.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: The file is not checked out or is checked out by another user.
  • E_EDM_LOCKED_ON_OTHER_COMPUTER: The file is not checked out on the client machine where you ran this method.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the loaded EdmCmdType.EdmCmd_PreUndoLock hooks did not permit the operation.
  • E_EDM_PERMISSION_DENIED: Undoing the check-out of this file is not permitted. You cannot undo the check-out of a file before it has been checked in at least once.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::UnlockFile Method ()
IEdmfile5::LockFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


UnlockFile Method (IEdmFile5)

UnlockFile Method (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : UnlockFile Method (IEdmFile5)

lParentWnd
Parent window handle
bsComment
Version comment to show in the history dialog box
lEdmUnlockFlags
Optional combination of EdmUnlockFlag bits; default is EdmUnlockFlag.EdmUnlock_Simple
poIEdmRefCallback
Optional Nothing or null
Checks in this file.

Syntax

Visual Basic
Sub UnlockFile( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsComment As System.String, _
   Optional ByVal lEdmUnlockFlags As System.Integer, _
   Optional ByVal poIEdmRefCallback As System.Object _
)
C#
void UnlockFile(
   System.int lParentWnd,
   System.string bsComment,
   System.int lEdmUnlockFlags,
   System.object poIEdmRefCallback
)
C++/CLI
void UnlockFile(
&   System.int lParentWnd,
&   System.String^ bsComment,
&   System.int lEdmUnlockFlags,
&   System.Object^ poIEdmRefCallback
)

Parameters

lParentWnd
Parent window handle
bsComment
Version comment to show in the history dialog box
lEdmUnlockFlags
Optional combination of EdmUnlockFlag bits; default is EdmUnlockFlag.EdmUnlock_Simple
poIEdmRefCallback
Optional Nothing or null

Example

Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

If the file or its file data card contents have changed, this method creates a new version.

IEdmBatchUnlock is more efficient than this interface for checking in multiple files.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • S_FALSE: The method successfully executed, but as no file is modified, SOLIDWORKS PDM Professional did not create a new version.
  • E_EDM_FILE_NOT_LOCKED_BY_YOU: The file is not checked out by the logged-in user.
  • E_EDM_LOCKED_ON_OTHER_COMPUTER: The file is not checked out on the client machine where you tried to check it in.
  • E_EDM_FILE_NOT_FOUND: The file is not part of the vault.
  • E_EDM_LOCAL_FILE_NOT_FOUND: There is no copy of the file in the cache folder on the client machine.
  • E_EDM_FILE_SHARE_ERROR: The file is open exclusively in another program.
  • E_EDM_CANCELLED_BY_USER: Not implemented.
  • E_EDM_INVALID_FILE: The file format is not recognized, and you have specified to not check in such files.
  • E_EDM_MISSING_MANDATORY_VALUE: The file lacks a value for a required file data card variable.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the loaded EdmCmdType.EdmCmd_PreUndoLock hooks did not permit the operation.
  • E_EDM_FILE_NOT_REGENERATED: The file needs to be rebuilt.
  • E_EDM_NO_WORKFLOW: The document does not meet the conditions of any workflow.
  • E_EDM_CIRCULAR_XREF: A cyclic file reference was detected.
  • E_EDM_SWDRW_SETTO_USE_INDEPENDENT_REV_TABLE: An independent type revision setting is used in the drawing.
  • E_EDM_NO_DOCTYPE: The document does not meet the conditions of any category.
  • E_EDM_LOCKED_IN_OTHER_FOLDER: The file is checked out in another folder.
  • E_EDM_FILE_NAME_NOT_GLOBALLY_UNIQUE: The file name is not unique.
  • E_EDM_TOOLBOX_FILE_LOCATED_IN_NONTOOLBOX_FOLDER: Toolbox file must be located in a Toolbox folder.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmFile5::LockFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmFile5 Interface Properties

IEdmFile5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFile5 Interface

For a list of all members of this type, see IEdmFile5 members.

Public Properties

 | Name | Description
Property | CurrentRevision | Gets the file's current revision.
Property | CurrentState | Gets the file's current workflow state.
Property | CurrentVersion | Gets the file's current version number.
Property | ID | Gets the database ID of this file.
Property | IsLocked | Gets whether the file is checked out.
Property | LockedByUser | Gets the user who has the file checked out.
Property | LockedByUserID | Gets the ID of the user who has the file checked out.
Property | LockedInFolder | Gets the folder in which this file is checked out.
Property | LockedInFolderID | Gets the ID of the folder in which this file is checked out.
Property | LockedOnComputer | Gets the name of the computer to which the file is checked out.
Property | LockPath | Gets the full path to the checked-out file.
Property | Name | Gets the name of the file.
Property | ObjectType | Gets the type of object.
Property | Vault | Gets the file vault to which this file belongs.
Top

See Also

IEdmFile5 Interface
EPDM.Interop.epdm Namespace


CurrentRevision Property (IEdmFile5)

CurrentRevision Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : CurrentRevision Property (IEdmFile5)

Gets the file's current revision.

Syntax

Visual Basic
ReadOnly Property CurrentRevision As System.String
C#
System.string CurrentRevision {get;}
C++/CLI
property System.String^ CurrentRevision {
   System.String^ get();
}

Property Value

Current revision of the file

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


CurrentState Property (IEdmFile5)

CurrentState Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : CurrentState Property (IEdmFile5)

Gets the file's current workflow state.

Syntax

Visual Basic
ReadOnly Property CurrentState As IEdmState5
C#
IEdmState5 CurrentState {get;}
C++/CLI
property IEdmState5^ CurrentState {
   IEdmState5^ get();
}

Property Value

Current workflow state of the file

Example

Get File's State Transitions (C#)
Get File's State Transitions (VB.NET)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


CurrentVersion Property (IEdmFile5)

CurrentVersion Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : CurrentVersion Property (IEdmFile5)

Gets the file's current version number.

Syntax

Visual Basic
ReadOnly Property CurrentVersion As System.Integer
C#
System.int CurrentVersion {get;}
C++/CLI
property System.int CurrentVersion {
   System.int get();
}

Property Value

Current version number of the file

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


ID Property (IEdmFile5)

ID Property (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : ID Property (IEdmFile5)

Gets the database ID of this file.

Syntax

Visual Basic
Shadows ReadOnly Property ID As System.Integer
C#
new System.int ID {get;}
C++/CLI
new property System.int ID {
   System.int get();
}

Property Value

Database ID of this file

See Also

IEdmFile5 Interface
IEdmFile5 Members


IsLocked Property (IEdmFile5)

IsLocked Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : IsLocked Property (IEdmFile5)

Gets whether the file is checked out.

Syntax

Visual Basic
ReadOnly Property IsLocked As System.Boolean
C#
System.bool IsLocked {get;}
C++/CLI
property System.bool IsLocked {
   System.bool get();
}

Property Value

True if the file is checked out, false if not

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)
Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

In a multi-user implementation, a file can be checked in and out by others while you are working on it. Before using this property, call IEdmFile5::Refresh to ensure this property gets the correct checkout status.

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockedByUser Property (IEdmFile5)

LockedByUser Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockedByUser Property (IEdmFile5)

Gets the user who has the file checked out.

Syntax

Visual Basic
ReadOnly Property LockedByUser As IEdmUser5
C#
IEdmUser5 LockedByUser {get;}
C++/CLI
property IEdmUser5^ LockedByUser {
   IEdmUser5^ get();
}

Property Value

IEdmUser5

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockedByUserID Property (IEdmFile5)

LockedByUserID Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockedByUserID Property (IEdmFile5)

Gets the ID of the user who has the file checked out.

Syntax

Visual Basic
ReadOnly Property LockedByUserID As System.Integer
C#
System.int LockedByUserID {get;}
C++/CLI
property System.int LockedByUserID {
   System.int get();
}

Property Value

ID of the user who has the file checked out

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockedInFolder Property (IEdmFile5)

LockedInFolder Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockedInFolder Property (IEdmFile5)

Gets the folder in which this file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedInFolder As IEdmFolder5
C#
IEdmFolder5 LockedInFolder {get;}
C++/CLI
property IEdmFolder5^ LockedInFolder {
   IEdmFolder5^ get();
}

Property Value

IEdmFolder5

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockedInFolderID Property (IEdmFile5)

LockedInFolderID Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockedInFolderID Property (IEdmFile5)

Gets the ID of the folder in which this file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedInFolderID As System.Integer
C#
System.int LockedInFolderID {get;}
C++/CLI
property System.int LockedInFolderID {
   System.int get();
}

Property Value

ID of the folder in which this file is checked out

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockedOnComputer Property (IEdmFile5)

LockedOnComputer Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockedOnComputer Property (IEdmFile5)

Gets the name of the computer to which the file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedOnComputer As System.String
C#
System.string LockedOnComputer {get;}
C++/CLI
property System.String^ LockedOnComputer {
   System.String^ get();
}

Property Value

Name of computer to which the file is checked out

Example

Get File Information (VB.NET)
Get File Information (C#)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockPath Property (IEdmFile5)

LockPath Property (IEdmFile5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : LockPath Property (IEdmFile5)

Gets the full path to the checked-out file.

Syntax

Visual Basic
ReadOnly Property LockPath As System.String
C#
System.string LockPath {get;}
C++/CLI
property System.String^ LockPath {
   System.String^ get();
}

Property Value

Full path to the checked-out file

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

See Also

IEdmFile5 Interface
IEdmFile5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Name Property (IEdmFile5)

Name Property (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : Name Property (IEdmFile5)

Gets the name of the file.

Syntax

Visual Basic
Shadows ReadOnly Property Name As System.String
C#
new System.string Name {get;}
C++/CLI
new property System.String^ Name {
   System.String^ get();
}

Property Value

Name of the file

See Also

IEdmFile5 Interface
IEdmFile5 Members


ObjectType Property (IEdmFile5)

ObjectType Property (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : ObjectType Property (IEdmFile5)

Gets the type of object.

Syntax

Visual Basic
Shadows ReadOnly Property ObjectType As EdmObjectType
C#
new EdmObjectType ObjectType {get;}
C++/CLI
new property EdmObjectType ObjectType {
   EdmObjectType get();
}

Property Value

Type of object as defined in EdmObjectType

See Also

IEdmFile5 Interface
IEdmFile5 Members


Vault Property (IEdmFile5)

Vault Property (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : Vault Property (IEdmFile5)

Gets the file vault to which this file belongs.

Syntax

Visual Basic
Shadows ReadOnly Property Vault As IEdmVault5
C#
new IEdmVault5 Vault {get;}
C++/CLI
new property IEdmVault5^ Vault {
   IEdmVault5^ get();
}

Property Value

File vault to which this file belongs

See Also

IEdmFile5 Interface
IEdmFile5 Members


IEdmFile6 Interface

IEdmFile6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile6 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile6
   Inherits IEdmFile5, IEdmObject5
C#
public interface IEdmFile6 : IEdmFile5, IEdmObject5
C++/CLI
public interface class IEdmFile6 : public IEdmFile5, IEdmObject5

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

This interface:

  • inherits from IEdmFile5.
  • is extended by IEdmFile7 which provides the ability to get computed and derived bills of materials and check whether a file needs to be rebuilt.

See Also

IEdmFile6 Members
EPDM.Interop.epdm Namespace


IEdmFile6 Interface Members

IEdmFile6 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmFile6 Interface

The following tables list the members exposed by IEdmFile6.

Public Properties

 | Name | Description
Property | Category | Gets the category to which this file belongs.
Property | CategoryID | Gets the ID of the category to which this file belongs.
Top

Public Methods

 | Name | Description
Method | Move | Moves this file to another location in the vault.
Method | RenameEx | Changes the name of this file.
Top

See Also

IEdmFile6 Interface
EPDM.Interop.epdm Namespace


IEdmFile6 Interface Methods

IEdmFile6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile6 Interface

For a list of all members of this type, see IEdmFile6 members.

Public Methods

 | Name | Description
Method | Move | Moves this file to another location in the vault.
Method | RenameEx | Changes the name of this file.
Top

See Also

IEdmFile6 Interface
EPDM.Interop.epdm Namespace


Move Method (IEdmFile6)

Move Method (IEdmFile6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile6 Interface : Move Method (IEdmFile6)

lParentWnd
Parent window handle
lParentID
ID of the source folder
lNewParentID
ID of the destination folder
lFlags
0; reserved
Moves this file to another location in the vault.

Syntax

Visual Basic
Sub Move( _
   ByVal lParentWnd As System.Integer, _
   ByVal lParentID As System.Integer, _
   ByVal lNewParentID As System.Integer, _
   ByVal lFlags As System.Integer _
)
C#
void Move(
   System.int lParentWnd,
   System.int lParentID,
   System.int lNewParentID,
   System.int lFlags
)
C++/CLI
void Move(
&   System.int lParentWnd,
&   System.int lParentID,
&   System.int lNewParentID,
&   System.int lFlags
)

Parameters

lParentWnd
Parent window handle
lParentID
ID of the source folder
lNewParentID
ID of the destination folder
lFlags
0; reserved

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

If the file has references, the paths of those references are updated to match the new location. If the file is being referenced by other files, the referencing files are updated to point to the new location.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.
  • E_EDM_MOVE_FILE_PERMISSION_DENIED: The user does not have permission to move the file.

See Also

IEdmFile6 Interface
IEdmFile6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


RenameEx Method (IEdmFile6)

RenameEx Method (IEdmFile6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile6 Interface : RenameEx Method (IEdmFile6)

lParentWnd
Parent window handle
bsNewName
New file name
lFlags
0; reserved
Changes the name of this file.

Syntax

Visual Basic
Sub RenameEx( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsNewName As System.String, _
   ByVal lFlags As System.Integer _
)
C#
void RenameEx(
   System.int lParentWnd,
   System.string bsNewName,
   System.int lFlags
)
C++/CLI
void RenameEx(
&   System.int lParentWnd,
&   System.String^ bsNewName,
&   System.int lFlags
)

Parameters

lParentWnd
Parent window handle
bsNewName
New file name
lFlags
0; reserved

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFile6 Interface
IEdmFile6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmFile6 Interface Properties

IEdmFile6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFile6 Interface

For a list of all members of this type, see IEdmFile6 members.

Public Properties

 | Name | Description
Property | Category | Gets the category to which this file belongs.
Property | CategoryID | Gets the ID of the category to which this file belongs.
Top

See Also

IEdmFile6 Interface
EPDM.Interop.epdm Namespace


Category Property (IEdmFile6)

Category Property (IEdmFile6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile6 Interface : Category Property (IEdmFile6)

Gets the category to which this file belongs.

Syntax

Visual Basic
ReadOnly Property Category As IEdmCategory6
C#
IEdmCategory6 Category {get;}
C++/CLI
property IEdmCategory6^ Category {
   IEdmCategory6^ get();
}

Property Value

IEdmCategory6

Example

See the IEdmFile6 examples.

See Also

IEdmFile6 Interface
IEdmFile6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


CategoryID Property (IEdmFile6)

CategoryID Property (IEdmFile6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile6 Interface : CategoryID Property (IEdmFile6)

Gets the ID of the category to which this file belongs.

Syntax

Visual Basic
ReadOnly Property CategoryID As System.Integer
C#
System.int CategoryID {get;}
C++/CLI
property System.int CategoryID {
   System.int get();
}

Property Value

ID of the category of this file

Example

See the IEdmFile6 examples.

See Also

IEdmFile6 Interface
IEdmFile6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmFile7 Interface

IEdmFile7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile7 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile7
   Inherits IEdmFile5, IEdmFile6, IEdmObject5
C#
public interface IEdmFile7 : IEdmFile5, IEdmFile6, IEdmObject5
C++/CLI
public interface class IEdmFile7 : public IEdmFile5, IEdmFile6, IEdmObject5

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

This interface:

  • inherits from IEdmFile6.
  • is extended by IEdmFile8 which provides the ability to get the file type and update the file data card with default values when a new configuration is added by SOLIDWORKS.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile7 Members
EPDM.Interop.epdm Namespace


IEdmFile7 Interface Members

IEdmFile7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile7 Interface

The following tables list the members exposed by IEdmFile7.

Public Methods

 | Name | Description
Method | GetComputedBOM | Gets an interface to a computed Bill of Materials.
Method | GetDerivedBOMs | Gets the derived Bills of Materials for this file.
Method | NeedsRegeneration | Gets whether the file with the specified version and location needs to be rebuilt in its associated CAD program.
Top

See Also

IEdmFile7 Interface
EPDM.Interop.epdm Namespace


IEdmFile7 Interface Methods

IEdmFile7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile7 Interface

For a list of all members of this type, see IEdmFile7 members.

Public Methods

 | Name | Description
Method | GetComputedBOM | Gets an interface to a computed Bill of Materials.
Method | GetDerivedBOMs | Gets the derived Bills of Materials for this file.
Method | NeedsRegeneration | Gets whether the file with the specified version and location needs to be rebuilt in its associated CAD program.
Top

See Also

IEdmFile7 Interface
EPDM.Interop.epdm Namespace


GetComputedBOM Method (IEdmFile7)

GetComputedBOM Method (IEdmFile7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile7 Interface : GetComputedBOM Method (IEdmFile7)

oBomLayoutNameOrID
Name or ID of a Bill of Materials layout (see Remarks)
lVersionNo
Version of file for which to get the Bill of Materials; 0 or -1 to use the latest version
bsConfiguration
Name of the file configuration
lEdmBomFlags
Combination of EdmBomFlag bits
Gets an interface to a computed Bill of Materials.

Syntax

Visual Basic
Function GetComputedBOM( _
   ByVal oBomLayoutNameOrID As System.Object, _
   ByVal lVersionNo As System.Integer, _
   ByVal bsConfiguration As System.String, _
   ByVal lEdmBomFlags As System.Integer _
) As EdmBomView
C#
EdmBomView GetComputedBOM(
   System.object oBomLayoutNameOrID,
   System.int lVersionNo,
   System.string bsConfiguration,
   System.int lEdmBomFlags
)
C++/CLI
EdmBomView^ GetComputedBOM(
&   System.Object^ oBomLayoutNameOrID,
&   System.int lVersionNo,
&   System.String^ bsConfiguration,
&   System.int lEdmBomFlags
)

Parameters

oBomLayoutNameOrID
Name or ID of a Bill of Materials layout (see Remarks)
lVersionNo
Version of file for which to get the Bill of Materials; 0 or -1 to use the latest version
bsConfiguration
Name of the file configuration
lEdmBomFlags
Combination of EdmBomFlag bits

Return Value

IEdmBomView

Example

See the IEdmFile7 examples.

Remarks

To specify oBomLayoutNameOrID, use IEdmBomMgr.GetBomLayouts to enumerate the existing Bill of Materials layouts.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFile7 Interface
IEdmFile7 Members

Availability

SOLIDWORKS PDM Professional 2009


GetDerivedBOMs Method (IEdmFile7)

GetDerivedBOMs Method (IEdmFile7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile7 Interface : GetDerivedBOMs Method (IEdmFile7)

ppoBoms
Array of EdmBomInfos
Gets the derived Bills of Materials for this file.

Syntax

Visual Basic
Sub GetDerivedBOMs( _
   ByRef ppoBoms() As EdmBomInfo _
)
C#
void GetDerivedBOMs(
   out EdmBomInfo[] ppoBoms
)
C++/CLI
void GetDerivedBOMs(
&   [Out] array<EdmBomInfo>^ ppoBoms
)

Parameters

ppoBoms
Array of EdmBomInfos

Example

See the IEdmFile7 examples.

Remarks

A derived Bill of Materials is also known as a named or saved Bill of Materials.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFile7 Interface
IEdmFile7 Members

Availability

SOLIDWORKS PDM Professional 2009


NeedsRegeneration Method (IEdmFile7)

NeedsRegeneration Method (IEdmFile7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile7 Interface : NeedsRegeneration Method (IEdmFile7)

lVersion
File version; 0 to check the version in the local cache
oFolderPathOrID
Path or ID of the file's parent folder; valid only if lVersion is not 0
Gets whether the file with the specified version and location needs to be rebuilt in its associated CAD program.

Syntax

Visual Basic
Function NeedsRegeneration( _
   ByVal lVersion As System.Integer, _
   Optional ByVal oFolderPathOrID As System.Object _
) As System.Boolean
C#
System.bool NeedsRegeneration(
   System.int lVersion,
   System.object oFolderPathOrID
)
C++/CLI
System.bool NeedsRegeneration(
&   System.int lVersion,
&   System.Object^ oFolderPathOrID
)

Parameters

lVersion
File version; 0 to check the version in the local cache
oFolderPathOrID
Path or ID of the file's parent folder; valid only if lVersion is not 0

Return Value

True if the file needs to be rebuilt in its associated CAD program, false if not

Remarks

If you have a drawing that references a part, and you make a model change on the part and don't rebuild the drawing in the CAD program, then the drawing shows the earlier version of the part. Use this method to check whether the drawing needs to be rebuilt with the newer version of the part in the associated CAD program.

Support for rebuild checks is only available for files saved with SOLIDWORKS 2009 or later.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFile7 Interface
IEdmFile7 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmFile8 Interface

IEdmFile8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFile8 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile8
   Inherits IEdmFile5, IEdmFile6, IEdmFile7, IEdmObject5
C#
public interface IEdmFile8 : IEdmFile5, IEdmFile6, IEdmFile7, IEdmObject5
C++/CLI
public interface class IEdmFile8 : public IEdmFile5, IEdmFile6, IEdmFile7, IEdmObject5

Remarks

This interface:

  • inherits from IEdmFile7.
  • is extended by IEdmFile9.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile8 Members
EPDM.Interop.epdm Namespace


IEdmFile8 Interface Members

IEdmFile8 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmFile8 Interface

The following tables list the members exposed by IEdmFile8.

Public Properties

 | Name | Description
Property | FileType | Gets the type of this file.
Top

Public Methods

 | Name | Description
Method | GenerateDefaultValuesForNewConfiguration | Populates the file data card with default data when a new configuration is added in SOLIDWORKS.
Top

See Also

IEdmFile8 Interface
EPDM.Interop.epdm Namespace


IEdmFile8 Interface Methods

IEdmFile8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile8 Interface

For a list of all members of this type, see IEdmFile8 members.

Public Methods

 | Name | Description
Method | GenerateDefaultValuesForNewConfiguration | Populates the file data card with default data when a new configuration is added in SOLIDWORKS.
Top

See Also

IEdmFile8 Interface
EPDM.Interop.epdm Namespace


GenerateDefaultValuesForNewConfiguration Method (IEdmFile8)

GenerateDefaultValuesForNewConfiguration Method (IEdmFile8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile8 Interface : GenerateDefaultValuesForNewConfiguration Method (IEdmFile8)

bsConfiguration
Name of the new configuration
llCfgPersistID
SOLIDWORKS configuration ID; 0 if ID is not available (see Remarks)
poAux
Null; for internal use only
ppoRetVariables
Array of IEdmVariableValue5s for the file data card
Populates the file data card with default data when a new configuration is added in SOLIDWORKS.

Syntax

Visual Basic
Sub GenerateDefaultValuesForNewConfiguration( _
   ByVal bsConfiguration As System.String, _
   ByVal llCfgPersistID As System.Long, _
   ByVal poAux As System.Object, _
   ByRef ppoRetVariables() As System.Object _
)
C#
void GenerateDefaultValuesForNewConfiguration(
   System.string bsConfiguration,
   System.long llCfgPersistID,
   System.object poAux,
   out System.object[] ppoRetVariables
)
C++/CLI
void GenerateDefaultValuesForNewConfiguration(
&   System.String^ bsConfiguration,
&   System.int64 llCfgPersistID,
&   System.Object^ poAux,
&   [Out] System.array<Object^>^ ppoRetVariables
)

Parameters

bsConfiguration
Name of the new configuration
llCfgPersistID
SOLIDWORKS configuration ID; 0 if ID is not available (see Remarks)
poAux
Null; for internal use only
ppoRetVariables
Array of IEdmVariableValue5s for the file data card

Remarks

This method is called by the SOLIDWORKS add-in when a new configuration is added to a file. Its purpose is to populate the file data card with default data for the new configuration.

llCfgPersistID is a unique SOLIDWORKS API configuration ID.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFile8 Interface
IEdmFile8 Members
IEdmFile14::GenerateDefaultConfigValues Method ()

Availability

SOLIDWORKS PDM Professional 2010


IEdmFile8 Interface Properties

IEdmFile8 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFile8 Interface

For a list of all members of this type, see IEdmFile8 members.

Public Properties

 | Name | Description
Property | FileType | Gets the type of this file.
Top

See Also

IEdmFile8 Interface
EPDM.Interop.epdm Namespace


FileType Property (IEdmFile8)

FileType Property (IEdmFile8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile8 Interface : FileType Property (IEdmFile8)

Gets the type of this file.

Syntax

Visual Basic
ReadOnly Property FileType As EdmFileType
C#
EdmFileType FileType {get;}
C++/CLI
property EdmFileType FileType {
   EdmFileType get();
}

Property Value

Type of file as defined in EdmFileType

Example

See the IEdmFile9 examples.

See Also

IEdmFile8 Interface
IEdmFile8 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmFile9 Interface

IEdmFile9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFile9 Interface

Allows you to access a file in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFile9
   Inherits IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmObject5
C#
public interface IEdmFile9 : IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmObject5
C++/CLI
public interface class IEdmFile9 : public IEdmFile5, IEdmFile6, IEdmFile7, IEdmFile8, IEdmObject5

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

This interface inherits from IEdmFile8.

To access an item in the vault, cast this interface's object to an IEdmItem.

See Also

IEdmFile9 Members
EPDM.Interop.epdm Namespace


IEdmFile9 Interface Members

IEdmFile9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFile9 Interface

The following tables list the members exposed by IEdmFile9.

Public Methods

 | Name | Description
Method | GetLocalFileSize2 | Gets the size of a local copy of this file.
Top

See Also

IEdmFile9 Interface
EPDM.Interop.epdm Namespace


IEdmFile9 Interface Methods

IEdmFile9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFile9 Interface

For a list of all members of this type, see IEdmFile9 members.

Public Methods

 | Name | Description
Method | GetLocalFileSize2 | Gets the size of a local copy of this file.
Top

See Also

IEdmFile9 Interface
EPDM.Interop.epdm Namespace


GetLocalFileSize2 Method (IEdmFile9)

GetLocalFileSize2 Method (IEdmFile9)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile9 Interface : GetLocalFileSize2 Method (IEdmFile9)

poPathOrFolderID
ID of the folder, a full file path, or a folder path (see Remarks)
Gets the size of a local copy of this file.

Syntax

Visual Basic
Function GetLocalFileSize2( _
   ByRef poPathOrFolderID As System.Object _
) As System.Long
C#
System.long GetLocalFileSize2(
   ref System.object poPathOrFolderID
)
C++/CLI
System.int64 GetLocalFileSize2(
&   System.Object^% poPathOrFolderID
)

Parameters

poPathOrFolderID
ID of the folder, a full file path, or a folder path (see Remarks)

Return Value

Size in bytes; -1 if the local file is missing

Example

Get File Information (VB.NET)
Get File Information (C#)

Remarks

If poPathOrFolderID is a folder path, it must be terminated by a backslash ('\').

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The local copy of the file is missing.

See Also

IEdmFile9 Interface
IEdmFile9 Members
IEdmFile5::GetLocalFileDate Method ()
IEdmFile5::GetLocalRevisionName Method ()
IEdmFile5::GetLocalVersionNo Method ()
IEdmVersion5::FileSize Property ()

Availability

SOLIDWORKS PDM Professional 2015


IEdmFindUser Interface

IEdmFindUser Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFindUser Interface

Allows you to search for users in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFindUser
C#
public interface IEdmFindUser
C++/CLI
public interface class IEdmFindUser

Example

Find Users (VB.NET)
Find Users (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To access this interface, call IEdmVault7::CreateUtility with eType set to EdmUtility.EdmUtil_FindUser.

SOLIDWORKS PDM Professional uses this interface internally when you have linked a card button to the Find User command.

This interface provides for both silent and interactive searches of users. Interactive searches display the same user interface that SOLIDWORKS PDM Professional displays when searching the vault for users.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmFindUser Members
EPDM.Interop.epdm Namespace


IEdmFindUser Interface Members

IEdmFindUser Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmFindUser Interface

The following tables list the members exposed by IEdmFindUser.

Public Properties

 | Name | Description
Property | Result | Gets the result of the last search for users.
Top

Public Methods

 | Name | Description
Method | Clear | Clears all of the search criteria created by IEdmFindUser::SetPropt for finding users.
Method | GetPropt | Gets the search criteria previously set by IEdmFindUser::SetPropt for finding users.
Method | SetPropt | Sets the search criteria for finding users.
Method | ShowFindUI | Displays the Find User dialog box so the user can enter search criteria and select users from the result list.
Method | SilentFind | Silently searches for users with search criteria specified by IEdmFindUser::SetPropt.
Top

See Also

IEdmFindUser Interface
EPDM.Interop.epdm Namespace


IEdmFindUser Interface Methods

IEdmFindUser Interface Methods
EPDM.Interop.epdm Namespace : IEdmFindUser Interface

For a list of all members of this type, see IEdmFindUser members.

Public Methods

 | Name | Description
Method | Clear | Clears all of the search criteria created by IEdmFindUser::SetPropt for finding users.
Method | GetPropt | Gets the search criteria previously set by IEdmFindUser::SetPropt for finding users.
Method | SetPropt | Sets the search criteria for finding users.
Method | ShowFindUI | Displays the Find User dialog box so the user can enter search criteria and select users from the result list.
Method | SilentFind | Silently searches for users with search criteria specified by IEdmFindUser::SetPropt.
Top

See Also

IEdmFindUser Interface
EPDM.Interop.epdm Namespace


Clear Method (IEdmFindUser)

Clear Method (IEdmFindUser)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFindUser Interface : Clear Method (IEdmFindUser)

Clears all of the search criteria created by IEdmFindUser::SetPropt for finding users.

Syntax

Visual Basic
Sub Clear()
C#
void Clear()
C++/CLI
void Clear();

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFindUser Interface
IEdmFindUser Members

Availability

SOLIDWORKS PDM Professional 2013


GetPropt Method (IEdmFindUser)

GetPropt Method (IEdmFindUser)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFindUser Interface : GetPropt Method (IEdmFindUser)

eProp
User property to search for as defined by EdmFindUserProp
Gets the search criteria previously set by IEdmFindUser::SetPropt for finding users.

Syntax

Visual Basic
Function GetPropt( _
   ByVal eProp As EdmFindUserProp _
) As System.Object
C#
System.object GetPropt(
   EdmFindUserProp eProp
)
C++/CLI
System.Object^ GetPropt(
&   EdmFindUserProp eProp
)

Parameters

eProp
User property to search for as defined by EdmFindUserProp

Return Value

Value of the property specified in eProp

Example

See the IEdmFindUser examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFindUser Interface
IEdmFindUser Members

Availability

SOLIDWORKS PDM Professional 2013


SetPropt Method (IEdmFindUser)

SetPropt Method (IEdmFindUser)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFindUser Interface : SetPropt Method (IEdmFindUser)

eProp
User property to search for as defined by EdmFindUserProp
oValue
Value of the property specified in eProp
Sets the search criteria for finding users.

Syntax

Visual Basic
Sub SetPropt( _
   ByVal eProp As EdmFindUserProp, _
   ByVal oValue As System.Object _
)
C#
void SetPropt(
   EdmFindUserProp eProp,
   System.object oValue
)
C++/CLI
void SetPropt(
&   EdmFindUserProp eProp,
&   System.Object^ oValue
)

Parameters

eProp
User property to search for as defined by EdmFindUserProp
oValue
Value of the property specified in eProp

Example

See the IEdmFindUser examples.

Remarks

After calling this method, call one of the following:

  • IEdmFindUser::SilentFind to silently search for users matching the criteria specified by this method.
  • IEdmFindUser::ShowFindUI to display a search user interface that is populated with the criteria specified by this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFindUser Interface
IEdmFindUser Members

Availability

SOLIDWORKS PDM Professional 2013


ShowFindUI Method (IEdmFindUser)

ShowFindUI Method (IEdmFindUser)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFindUser Interface : ShowFindUI Method (IEdmFindUser)

lParentWnd
Parent window handle of the search dialog box
bAllowMultiSelect
True to permit the user to select more than one user in the search result, false to not
bsCaption
Caption for the dialog box; "" to use the default, localized caption
Displays the Find User dialog box so the user can enter search criteria and select users from the result list.

Syntax

Visual Basic
Function ShowFindUI( _
   ByVal lParentWnd As System.Integer, _
   ByVal bAllowMultiSelect As System.Boolean, _
   Optional ByVal bsCaption As System.String _
) As System.Boolean
C#
System.bool ShowFindUI(
   System.int lParentWnd,
   System.bool bAllowMultiSelect,
   System.string bsCaption
)
C++/CLI
System.bool ShowFindUI(
&   System.int lParentWnd,
&   System.bool bAllowMultiSelect,
&   System.String^ bsCaption
)

Parameters

lParentWnd
Parent window handle of the search dialog box
bAllowMultiSelect
True to permit the user to select more than one user in the search result, false to not
bsCaption
Caption for the dialog box; "" to use the default, localized caption

Return Value

True if a user is selected in the search result, false if the dialog box is canceled

Example

See the IEdmFindUser examples.

Remarks

Before calling this method, call IEdmFindUser::SetPropt to set the search criteria for finding users. The search criteria become the default values in the Find User dialog box that is launched when this method is called.

After successfully calling this method, the IEdmFindUser.Result property contains the users selected in the result list of the Find User dialog box.

SOLIDWORKS PDM Professional calls this function when you link a card button to the Find User command.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFindUser Interface
IEdmFindUser Members

Availability

SOLIDWORKS PDM Professional 2013


SilentFind Method (IEdmFindUser)

SilentFind Method (IEdmFindUser)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFindUser Interface : SilentFind Method (IEdmFindUser)

Silently searches for users with search criteria specified by IEdmFindUser::SetPropt.

Syntax

Visual Basic
Sub SilentFind()
C#
void SilentFind()
C++/CLI
void SilentFind();

Example

See the example for IEdmFindUser.

Remarks

The result of the search is returned in the property, IEdmFindUser.Result.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: An argument is invalid.

See Also

IEdmFindUser Interface
IEdmFindUser Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmFindUser Interface Properties

IEdmFindUser Interface Properties
EPDM.Interop.epdm Namespace : IEdmFindUser Interface

For a list of all members of this type, see IEdmFindUser members.

Public Properties

 | Name | Description
Property | Result | Gets the result of the last search for users.
Top

See Also

IEdmFindUser Interface
EPDM.Interop.epdm Namespace


Result Property (IEdmFindUser)

Result Property (IEdmFindUser)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFindUser Interface : Result Property (IEdmFindUser)

Gets the result of the last search for users.

Syntax

Visual Basic
ReadOnly Property Result As IEdmEnum
C#
IEdmEnum Result {get;}
C++/CLI
property IEdmEnum^ Result {
   IEdmEnum^ get();
}

Property Value

IEdmEnum (see Remarks)

Example

See the IEdmFindUser examples.

Remarks

If IEdmFindUser::ShowFindUI is called, this property contains only the users that were selected in the search dialog box's result list.

See Also

IEdmFindUser Interface
IEdmFindUser Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmFolder10 Interface

IEdmFolder10 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolder10 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder10
   Inherits IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C#
public interface IEdmFolder10 : IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C++/CLI
public interface class IEdmFolder10 : public IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5

Example

Create Card View (C#)
Create Card View (VB.NET)

Remarks

This interface:

  • extends IEdmFolder9 by providing the ability to specify the appearance and functionality of card views.
  • is extended by IEdmFolder11.

See Also

IEdmFolder10 Members
EPDM.Interop.epdm Namespace


IEdmFolder10 Interface Members

IEdmFolder10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder10 Interface

The following tables list the members exposed by IEdmFolder10.

Public Methods

 | Name | Description
Method | CreateCardView2 | Creates a data card view for the specified file or folder.
Top

See Also

IEdmFolder10 Interface
EPDM.Interop.epdm Namespace


IEdmFolder10 Interface Methods

IEdmFolder10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder10 Interface

For a list of all members of this type, see IEdmFolder10 members.

Public Methods

 | Name | Description
Method | CreateCardView2 | Creates a data card view for the specified file or folder.
Top

See Also

IEdmFolder10 Interface
EPDM.Interop.epdm Namespace


CreateCardView2 Method (IEdmFolder10)

CreateCardView2 Method (IEdmFolder10)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder10 Interface : CreateCardView2 Method (IEdmFolder10)

lFileID
ID of the file for which to create a data card view; 0 to create a view only for this folder
lParentWindow
Handle of the window in which to create the data card view
lX
X coordinate where to place the data card view relative to the upper-left corner of the window
lY
Y coordinate where to place the data card view relative to the upper-left corner of the window
poCallback
Optional pointer to a class that implements IEdmCallback to handle notifications from the data card view (see Remarks)
lEdmCardViewFlags
Appearance and functionality of the data card view as defined in EmdCardViewFlag
Creates a data card view for the specified file or folder.

Syntax

Visual Basic
Function CreateCardView2( _
   ByVal lFileID As System.Integer, _
   ByVal lParentWindow As System.Integer, _
   ByVal lX As System.Integer, _
   ByVal lY As System.Integer, _
   Optional ByVal poCallback As EdmCallback, _
   Optional ByVal lEdmCardViewFlags As System.Integer _
) As IEdmCardView5
C#
IEdmCardView5 CreateCardView2(
   System.int lFileID,
   System.int lParentWindow,
   System.int lX,
   System.int lY,
   EdmCallback poCallback,
   System.int lEdmCardViewFlags
)
C++/CLI
IEdmCardView5^ CreateCardView2(
&   System.int lFileID,
&   System.int lParentWindow,
&   System.int lX,
&   System.int lY,
&   EdmCallback^ poCallback,
&   System.int lEdmCardViewFlags
)

Parameters

lFileID
ID of the file for which to create a data card view; 0 to create a view only for this folder
lParentWindow
Handle of the window in which to create the data card view
lX
X coordinate where to place the data card view relative to the upper-left corner of the window
lY
Y coordinate where to place the data card view relative to the upper-left corner of the window
poCallback
Optional pointer to a class that implements IEdmCallback to handle notifications from the data card view (see Remarks)
lEdmCardViewFlags
Appearance and functionality of the data card view as defined in EmdCardViewFlag

Return Value

IEdmCardView5; Nothing or null if the file does not have a data card associated with it

Example

Create Card View (C#)
Create Card View (VB.NET)

Remarks

If the callback is implemented for this card view:

  • IEdmCallback::SetModifiedFlag is called whenever the user makes a change in the file data card.
  • IEdmCallback::SetProgressRange is called if the file data card contains a button connected to an add-in, and the add-in returns a combination of EdmCardFlag values other than EdmCardFlag.EdmCF_Nothing. IEdmCallback::SetProgressRange is called with its lMin and lMax set to the EdmCardFlags passed in by the add-in. See Calling VB.NET Add-ins.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmCardView5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The file does not have a card associated with it.

See Also

IEdmFolder10 Interface
IEdmFolder10 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmFolder11 Interface

IEdmFolder11 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolder11 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder11
   Inherits IEdmFolder10, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C#
public interface IEdmFolder11 : IEdmFolder10, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C++/CLI
public interface class IEdmFolder11 : public IEdmFolder10, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

This interface extends IEdmFolder10 by providing the ability to restore deleted items from the recycle bin to the vault view.

See Also

IEdmFolder11 Members
EPDM.Interop.epdm Namespace


IEdmFolder11 Interface Members

IEdmFolder11 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder11 Interface

The following tables list the members exposed by IEdmFolder11.

Public Methods

 | Name | Description
Method | GetDeletedItems | Gets items deleted from this folder.
Method | RecoverDeletedItems | Restores the specified deleted items in the recycle bin to this folder in the vault view.
Top

See Also

IEdmFolder11 Interface
EPDM.Interop.epdm Namespace


IEdmFolder11 Interface Methods

IEdmFolder11 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder11 Interface

For a list of all members of this type, see IEdmFolder11 members.

Public Methods

 | Name | Description
Method | GetDeletedItems | Gets items deleted from this folder.
Method | RecoverDeletedItems | Restores the specified deleted items in the recycle bin to this folder in the vault view.
Top

See Also

IEdmFolder11 Interface
EPDM.Interop.epdm Namespace


GetDeletedItems Method (IEdmFolder11)

GetDeletedItems Method (IEdmFolder11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder11 Interface : GetDeletedItems Method (IEdmFolder11)

poDeletedItems
Array of EdmDeletedItems
bRecursive
True to recursively restore subfolder contents, false to not
Gets items deleted from this folder.

Syntax

Visual Basic
Sub GetDeletedItems( _
   ByRef poDeletedItems() As EdmDeletedItems, _
   Optional ByVal bRecursive As System.Boolean _
)
C#
void GetDeletedItems(
   out EdmDeletedItems[] poDeletedItems,
   System.bool bRecursive
)
C++/CLI
void GetDeletedItems(
&   [Out] array<EdmDeletedItems>^ poDeletedItems,
&   System.bool bRecursive
)

Parameters

poDeletedItems
Array of EdmDeletedItems
bRecursive
True to recursively restore subfolder contents, false to not

Example

See the IEdmFolder11 examples.

Remarks

Use IEdmFolder11::RecoverDeletedItems to restore poDeletedItems to the vault view.

See Also

IEdmFolder11 Interface
IEdmFolder11 Members

Availability

SOLIDWORKS PDM Professional 2018


RecoverDeletedItems Method (IEdmFolder11)

RecoverDeletedItems Method (IEdmFolder11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder11 Interface : RecoverDeletedItems Method (IEdmFolder11)

poDeletedItems
Array of EdmDeletedItems
Restores the specified deleted items in the recycle bin to this folder in the vault view.

Syntax

Visual Basic
Sub RecoverDeletedItems( _
   ByVal poDeletedItems() As EdmDeletedItems _
)
C#
void RecoverDeletedItems(
   EdmDeletedItems[] poDeletedItems
)
C++/CLI
void RecoverDeletedItems(
&   array<EdmDeletedItems>^ poDeletedItems
)

Parameters

poDeletedItems
Array of EdmDeletedItems

Example

See the IEdmFolder11 examples.

Remarks

Use IEdmFolder11::GetDeletedItems to populate poDeletedItems.

Note that you cannot use this method to recover items that have been completely destroyed using IEdmFolder7::DestroyDeletedItems.

See Also

IEdmFolder11 Interface
IEdmFolder11 Members
IEdmFolder5::DeleteFile Method ()
IEdmFolder5::DeleteFolder Method ()

Availability

SOLIDWORKS PDM Professional 2018


IEdmFolder13 Interface

IEdmFolder13 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolder13 Interface

Allows you to access the contents of a file system folder in the vault.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder13
   Inherits IEdmFolder10, IEdmFolder11, IEdmFolder12, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C#
public interface IEdmFolder13 : IEdmFolder10, IEdmFolder11, IEdmFolder12, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C++/CLI
public interface class IEdmFolder13 : public IEdmFolder10, IEdmFolder11, IEdmFolder12, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5

Example

Destroy Deleted Files in Vault (VB.NET)
Destroy Deleted Files in Vault (C#)

Remarks

This interface extends IEdmFolder12 by providing the ability to destroy deleted items.

Accessors

See the IEdmFolder5 accessors.

See Also

IEdmFolder13 Members
EPDM.Interop.epdm Namespace


IEdmFolder13 Interface Members

IEdmFolder13 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder13 Interface

The following tables list the members exposed by IEdmFolder13.

Public Methods

 | Name | Description
Method | DestroyDeletedItems2 | Destroys the specified deleted items in this folder.
Top

See Also

IEdmFolder13 Interface
EPDM.Interop.epdm Namespace


IEdmFolder13 Interface Methods

IEdmFolder13 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder13 Interface

For a list of all members of this type, see IEdmFolder13 members.

Public Methods

 | Name | Description
Method | DestroyDeletedItems2 | Destroys the specified deleted items in this folder.
Top

See Also

IEdmFolder13 Interface
EPDM.Interop.epdm Namespace


DestroyDeletedItems2 Method (IEdmFolder13)

DestroyDeletedItems2 Method (IEdmFolder13)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder13 Interface : DestroyDeletedItems2 Method (IEdmFolder13)

poDeletedItems
Array of EdmDeletedItems structures; one structure for each deleted file
ppoFiles
Array of EdmFileInfo structures; one structure for each destroyed file containing information about the file
poErrors
Array of EdmBatchDelErrInfo structures; one structure for each destroyed file containing information about errors that occurred during this operation
Destroys the specified deleted items in this folder.

Syntax

Visual Basic
Sub DestroyDeletedItems2( _
   ByVal poDeletedItems() As EdmDeletedItems, _
   ByRef ppoFiles() As EdmFileInfo, _
   ByRef poErrors() As EdmBatchDelErrInfo _
)
C#
void DestroyDeletedItems2(
   EdmDeletedItems[] poDeletedItems,
   out EdmFileInfo[] ppoFiles,
   out EdmBatchDelErrInfo[] poErrors
)
C++/CLI
void DestroyDeletedItems2(
&   array<EdmDeletedItems>^ poDeletedItems,
&   [Out] array<EdmFileInfo>^ ppoFiles,
&   [Out] array<EdmBatchDelErrInfo>^ poErrors
)

Parameters

poDeletedItems
Array of EdmDeletedItems structures; one structure for each deleted file
ppoFiles
Array of EdmFileInfo structures; one structure for each destroyed file containing information about the file
poErrors
Array of EdmBatchDelErrInfo structures; one structure for each destroyed file containing information about errors that occurred during this operation

Example

Destroy Deleted Files in Vault (VB.NET)
Destroy Deleted Files in Vault (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder13 Interface
IEdmFolder13 Members
IEdmFolder11::RecoverDeletedItems Method ()

Availability

SOLIDWORKS PDM Professional 2022


IEdmFolder5 Interface

IEdmFolder5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolder5 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder5
   Inherits IEdmObject5
C#
public interface IEdmFolder5 : IEdmObject5
C++/CLI
public interface class IEdmFolder5 : public IEdmObject5

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)
Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)
Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmFolder6, which provides the ability to add files to a folder, move a folder, and rename a folder.

Use this interface to enumerate the files and subfolders of a folder.

Access the contents of a folder's data card by assigning an IEdmEnumeratorVariable5 pointer to an IEdmFolder5 object.

To update multiple folder data cards, use IEdmBatchUpdate2 which is more efficient than updating each folder data card using this interface.

Accessors

IEdmFile5::GetNextFolder

IEdmFile5::LockedInFolder

IEdmFolder5::AddFolder

IEdmFolder5::CreateFolderPath

IEdmFolder5::GetNextSubFolder

IEdmFolder5::GetSubFolder

IEdmFolder5::ParentFolder

IEdmLabel5::GetNextFolder

IEdmReference5::Folder

IEdmReference5::LockedInFolder

IEdmVault5::BrowseForFolder

IEdmVault5::GetFileFromPath

IEdmVault5::GetFolderFromPath

IEdmVault5::GetObject

IEdmVault5::GetFileFromPath

IEdmVault5::GetFolderFromPath

IEdmVault5::RootFolder

See Also

IEdmFolder5 Members
EPDM.Interop.epdm Namespace


IEdmFolder5 Interface Members

IEdmFolder5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmFolder5 Interface

The following tables list the members exposed by IEdmFolder5.

Public Properties

 | Name | Description
Property | ID | Gets the database ID of this folder.
Property | LocalPath | Gets the full file system path to this local folder.
Property | Name | Gets the name of the folder.
Property | ObjectType | Gets the type of object.
Property | ParentFolder | Gets the interface to the parent folder of this folder.
Property | Vault | Gets the file vault to which this folder belongs.
Top

Public Methods

 | Name | Description
Method | AddFile | Obsolete. Superseded by IEdmFolder8::AddFile2.
Method | AddFileShared | Shares a file in another folder with this folder.
Method | AddFolder | Creates a subfolder in this folder.
Method | CopyFile | Obsolete. Superseded by IEdmFolder8::CopyFile2.
Method | CreateCardView | Obsolete. Superseded by IEdmFolder10::CreateCardView2.
Method | CreateFolderPath | Creates all subfolders in a path relative to this folder.
Method | CreateLabel | Creates a label on this folder and its subfolders.
Method | DeleteFile | Deletes a file having the specified ID from this folder.
Method | DeleteFolder | Deletes the specified subfolder from this folder.
Method | GetCard | Gets the interface to a data card of a file of the specified file type or the interface to the data card of this folder.
Method | GetCardID | Gets the ID of the data card of a file with the specified extension or the ID of the data card of this folder.
Method | GetFile | Gets the interface to a file with the specified name in this folder.
Method | GetFirstFilePosition | Starts an enumeration of the files in this folder.
Method | GetFirstLabelPosition | Starts an enumeration of the labels in this folder.
Method | GetFirstSubFolderPosition | Starts an enumeration of the subfolders in this folder.
Method | GetNextFile | Gets the next file in the enumeration.
Method | GetNextLabel | Gets the next label in the enumeration.
Method | GetNextSubFolder | Gets the next subfolder in the enumeration.
Method | GetSubFolder | Gets the interface to the subfolder with the specified name.
Method | HasRights | Obsolete. Superseded by IEdmFolder5::HasRightsEx.
Method | HasRightsEx | Gets whether the user has the specified rights for the specified file in this folder.
Method | IsKindOf | Checks whether the object is of a certain type.
Method | Refresh | Refreshes the file listing for the folder.
Top

See Also

IEdmFolder5 Interface
EPDM.Interop.epdm Namespace


IEdmFolder5 Interface Methods

IEdmFolder5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder5 Interface

For a list of all members of this type, see IEdmFolder5 members.

Public Methods

 | Name | Description
Method | AddFile | Obsolete. Superseded by IEdmFolder8::AddFile2.
Method | AddFileShared | Shares a file in another folder with this folder.
Method | AddFolder | Creates a subfolder in this folder.
Method | CopyFile | Obsolete. Superseded by IEdmFolder8::CopyFile2.
Method | CreateCardView | Obsolete. Superseded by IEdmFolder10::CreateCardView2.
Method | CreateFolderPath | Creates all subfolders in a path relative to this folder.
Method | CreateLabel | Creates a label on this folder and its subfolders.
Method | DeleteFile | Deletes a file having the specified ID from this folder.
Method | DeleteFolder | Deletes the specified subfolder from this folder.
Method | GetCard | Gets the interface to a data card of a file of the specified file type or the interface to the data card of this folder.
Method | GetCardID | Gets the ID of the data card of a file with the specified extension or the ID of the data card of this folder.
Method | GetFile | Gets the interface to a file with the specified name in this folder.
Method | GetFirstFilePosition | Starts an enumeration of the files in this folder.
Method | GetFirstLabelPosition | Starts an enumeration of the labels in this folder.
Method | GetFirstSubFolderPosition | Starts an enumeration of the subfolders in this folder.
Method | GetNextFile | Gets the next file in the enumeration.
Method | GetNextLabel | Gets the next label in the enumeration.
Method | GetNextSubFolder | Gets the next subfolder in the enumeration.
Method | GetSubFolder | Gets the interface to the subfolder with the specified name.
Method | HasRights | Obsolete. Superseded by IEdmFolder5::HasRightsEx.
Method | HasRightsEx | Gets whether the user has the specified rights for the specified file in this folder.
Method | IsKindOf | Checks whether the object is of a certain type.
Method | Refresh | Refreshes the file listing for the folder.
Top

See Also

IEdmFolder5 Interface
EPDM.Interop.epdm Namespace


AddFileShared Method (IEdmFolder5)

AddFileShared Method (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : AddFileShared Method (IEdmFolder5)

lFileID
ID of file to share
lParentWindow
Parent window handle
Shares a file in another folder with this folder.

Syntax

Visual Basic
Sub AddFileShared( _
   ByVal lFileID As System.Integer, _
   ByVal lParentWindow As System.Integer _
)
C#
void AddFileShared(
   System.int lFileID,
   System.int lParentWindow
)
C++/CLI
void AddFileShared(
&   System.int lFileID,
&   System.int lParentWindow
)

Parameters

lFileID
ID of file to share
lParentWindow
Parent window handle

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file with the same name in this folder.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdData.EdmCmd_PreShare hooks did not permit the operation.
  • E_EDM_FILE_NOT_FOUND: The source file was not found. (The ID is invalid.)
  • E_EDM_PERMISSION_DENIED: The user lacks permission to share the specified file.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::AddFile Method ()
IEdmFolder5::CopyFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


AddFolder Method (IEdmFolder5)

AddFolder Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : AddFolder Method (IEdmFolder5)

lParentWnd
Parent window handle
bsFolderName
Name of the new folder
poData
IEdmFolderData5; optional additional data (see Remarks)
Creates a subfolder in this folder.

Syntax

Visual Basic
Function AddFolder( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsFolderName As System.String, _
   Optional ByVal poData As EdmFolderData _
) As IEdmFolder5
C#
IEdmFolder5 AddFolder(
   System.int lParentWnd,
   System.string bsFolderName,
   EdmFolderData poData
)
C++/CLI
IEdmFolder5^ AddFolder(
&   System.int lParentWnd,
&   System.String^ bsFolderName,
&   EdmFolderData^ poData
)

Parameters

lParentWnd
Parent window handle
bsFolderName
Name of the new folder
poData
IEdmFolderData5; optional additional data (see Remarks)

Return Value

IEdmFolder5

Example

Add Folder (VB.NET)
Add Folder (C#)

Remarks

To create all the folders in a path in one operation, call IEdmFolder5::CreateFolderPath.

To add more than one folder, use IEdmBatchAddFolders to add them all at once, which is much more efficient than using this method, which adds folders only one at a time.

If poData is null, the user rights and file data card for the new folder are inherited from the parent folder.

C++ users not using smart-pointer wrapper functions must release the returned pointer to IEdmFolder5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_NAME: The folder name contained invalid characters.
  • E_EDM_COULD_NOT_CREATE_LOCAL_FOLDER: Could not create the new folder in the local disk cache.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file or folder with the specified name in this folder.
  • E_EDM_FOLDER_NOT_FOUND: This folder has been deleted.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to create sub-folders here.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: The operation was not permitted by one of the installed EdmCmdData.EdmCmd_PreAddFolder hooks.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::CreateFolderPath Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


CreateCardView Method (IEdmFolder5)

CreateCardView Method (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : CreateCardView Method (IEdmFolder5)

lFileID
ID of the file for which to create a data card view; 0 to create a view only for this folder
lParentWindow
Handle of the window in which to create the data card view
lX
X coordinate where to place the data card view relative to the upper left-hand corner of the window
lY
Y coordinate where to place the data card view relative to the upper left-hand corner of the window
poCallback
Optional pointer to a class that implements IEdmCallback to handle notifications from the data card view (see Remarks)
Obsolete. Superseded by IEdmFolder10::CreateCardView2.

Syntax

Visual Basic
Function CreateCardView( _
   ByVal lFileID As System.Integer, _
   ByVal lParentWindow As System.Integer, _
   ByVal lX As System.Integer, _
   ByVal lY As System.Integer, _
   Optional ByVal poCallback As EdmCallback _
) As IEdmCardView5
C#
IEdmCardView5 CreateCardView(
   System.int lFileID,
   System.int lParentWindow,
   System.int lX,
   System.int lY,
   EdmCallback poCallback
)
C++/CLI
IEdmCardView5^ CreateCardView(
&   System.int lFileID,
&   System.int lParentWindow,
&   System.int lX,
&   System.int lY,
&   EdmCallback^ poCallback
)

Parameters

lFileID
ID of the file for which to create a data card view; 0 to create a view only for this folder
lParentWindow
Handle of the window in which to create the data card view
lX
X coordinate where to place the data card view relative to the upper left-hand corner of the window
lY
Y coordinate where to place the data card view relative to the upper left-hand corner of the window
poCallback
Optional pointer to a class that implements IEdmCallback to handle notifications from the data card view (see Remarks)

Return Value

IEdmCardView5; Nothing or null if the file does not have a data card associated with it

Remarks

If the callback is implemented for this card view:

  • IEdmCallback::SetModifiedFlag is called whenever the user makes a change in the file data card.
  • IEdmCallback::SetProgressRange is called if the file data card contains a button connected to an add-in, and the add-in returns a combination of EdmCardFlag values other than EdmCardFlag.EdmCF_Nothing. IEdmCallback::SetProgressRange is called with its lMin and lMax set to the EdmCardFlags passed in by the add-in. See Calling VB.NET Add-ins.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmCardView5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The file does not have a card associated with it.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


CreateFolderPath Method (IEdmFolder5)

CreateFolderPath Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : CreateFolderPath Method (IEdmFolder5)

bsPath
Path of subfolders to create
lParentWnd
Parent window handle
Creates all subfolders in a path relative to this folder.

Syntax

Visual Basic
Function CreateFolderPath( _
   ByVal bsPath As System.String, _
   ByVal lParentWnd As System.Integer _
) As IEdmFolder5
C#
IEdmFolder5 CreateFolderPath(
   System.string bsPath,
   System.int lParentWnd
)
C++/CLI
IEdmFolder5^ CreateFolderPath(
&   System.String^ bsPath,
&   System.int lParentWnd
)

Parameters

bsPath
Path of subfolders to create
lParentWnd
Parent window handle

Return Value

IEdmFolder5; interface to the top folder

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

This method does not fail if one of the subfolders in bsPath already exists.

This method does not specify file data cards or user rights for the new subfolders in bsPath. Instead of calling this method, call IEdmFolder5::AddFolder to create each subfolder in the path and also specify file data cards or user rights.

It is more efficient to use IEdmBatchAddFolders to create many folder paths at once than to use this method to create each folder path separately.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmFolder5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_NAME: The folder name contained invalid characters.
  • E_EDM_COULD_NOT_CREATE_LOCAL_FOLDER: Could not create the new folder in the local disk cache.
  • E_EDM_FOLDER_NOT_FOUND: This folder has been deleted.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to create sub-folders here.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: The operation was not permitted by one of the installed EdmCmdData.EdmCmd_PreAddFolder hooks.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


CreateLabel Method (IEdmFolder5)

CreateLabel Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : CreateLabel Method (IEdmFolder5)

bsName
Name of the label; maximum of 255 characters
bsDescription
Label description to show in the history dialog box; maximum of 2000 characters
bRecursively
Optionally, true to set the label recursively on subfolders, false to not; default is true
Creates a label on this folder and its subfolders.

Syntax

Visual Basic
Function CreateLabel( _
   ByVal bsName As System.String, _
   ByVal bsDescription As System.String, _
   Optional ByVal bRecursively As System.Boolean _
) As System.Integer
C#
System.int CreateLabel(
   System.string bsName,
   System.string bsDescription,
   System.bool bRecursively
)
C++/CLI
System.int CreateLabel(
&   System.String^ bsName,
&   System.String^ bsDescription,
&   System.bool bRecursively
)

Parameters

bsName
Name of the label; maximum of 255 characters
bsDescription
Label description to show in the history dialog box; maximum of 2000 characters
bRecursively
Optionally, true to set the label recursively on subfolders, false to not; default is true

Return Value

ID of the new label

Example

Create Labels on Folders (VB.NET)
Create Labels on Folders (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments in invalid.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmLabel5 Interface
IEdmFolder5::GetFirstLabelPosition Method ()
IEdmFile16::CreateLabel Method ()
IEdmEnumeratorVersion5::CreateLabel Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


DeleteFile Method (IEdmFolder5)

DeleteFile Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : DeleteFile Method (IEdmFolder5)

lParentWnd
Parent window handle
lFileID
ID of file to delete
bRemoveLocalCopy
Optionally, true to erase the local copy of the file, false to not; default is true
Deletes a file having the specified ID from this folder.

Syntax

Visual Basic
Sub DeleteFile( _
   ByVal lParentWnd As System.Integer, _
   ByVal lFileID As System.Integer, _
   Optional ByVal bRemoveLocalCopy As System.Boolean _
)
C#
void DeleteFile(
   System.int lParentWnd,
   System.int lFileID,
   System.bool bRemoveLocalCopy
)
C++/CLI
void DeleteFile(
&   System.int lParentWnd,
&   System.int lFileID,
&   System.bool bRemoveLocalCopy
)

Parameters

lParentWnd
Parent window handle
lFileID
ID of file to delete
bRemoveLocalCopy
Optionally, true to erase the local copy of the file, false to not; default is true

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

If the specified file is shared to other folders, it is deleted only from this folder.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_FOUND: The file ID is invalid.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: The operation is not permitted by one of the installed EdmCmdData.EdmCmd_PreDelete hooks.
  • E_EDM_LOCKED_BY_ANOTHER_USER: The file cannot be deleted since it is checked out by another user.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete the file.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::DeleteFolder Method ()
IEdmFolder11::RecoverDeletedItems Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


DeleteFolder Method (IEdmFolder5)

DeleteFolder Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : DeleteFolder Method (IEdmFolder5)

lParentWnd
Parent window handle
lSubfolderID
ID of folder to delete
bRemoveLocalCopy
Optionally true to remove the folder from the local disk, false to not; default is true
Deletes the specified subfolder from this folder.

Syntax

Visual Basic
Sub DeleteFolder( _
   ByVal lParentWnd As System.Integer, _
   ByVal lSubfolderID As System.Integer, _
   Optional ByVal bRemoveLocalCopy As System.Boolean _
)
C#
void DeleteFolder(
   System.int lParentWnd,
   System.int lSubfolderID,
   System.bool bRemoveLocalCopy
)
C++/CLI
void DeleteFolder(
&   System.int lParentWnd,
&   System.int lSubfolderID,
&   System.bool bRemoveLocalCopy
)

Parameters

lParentWnd
Parent window handle
lSubfolderID
ID of folder to delete
bRemoveLocalCopy
Optionally true to remove the folder from the local disk, false to not; default is true

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

This method deletes only folders that are empty.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FOLDER_NOT_FOUND: The specified ID is not a subfolder of this folder.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdData.EdmCmd_PreDeleteFolder hooks did not permit the operation.
  • E_EDM_FOLDER_NOT_EMPTY: The folder cannot be deleted, because it has files or subfolders in it.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete the specified folder.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::DeleteFile Method ()
IEdmFolder11::RecoverDeletedItems Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetCard Method (IEdmFolder5)

GetCard Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetCard Method (IEdmFolder5)

bsExtension
Extension of file for which to get a data card; for example, "DWG" or "DOC" or "." to get the data card for this folder
Gets the interface to a data card of a file of the specified file type or the interface to the data card of this folder.

Syntax

Visual Basic
Function GetCard( _
   ByVal bsExtension As System.String _
) As IEdmCard5
C#
IEdmCard5 GetCard(
   System.string bsExtension
)
C++/CLI
IEdmCard5^ GetCard(
&   System.String^ bsExtension
)

Parameters

bsExtension
Extension of file for which to get a data card; for example, "DWG" or "DOC" or "." to get the data card for this folder

Return Value

IEdmCard5

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)
Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

If you only need the card ID, it is faster to call IEdmfolder5::GetCardID than to call this method.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmCard5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_NAME: There is no data card matching the specified extension.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetCardID Method (IEdmFolder5)

GetCardID Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetCardID Method (IEdmFolder5)

bsExtension
Extension of file for which to get a data card ID; for example, "DWG" or "DOC" or "." to get the ID of the data card for this folder
Gets the ID of the data card of a file with the specified extension or the ID of the data card of this folder.

Syntax

Visual Basic
Function GetCardID( _
   ByVal bsExtension As System.String _
) As System.Integer
C#
System.int GetCardID(
   System.string bsExtension
)
C++/CLI
System.int GetCardID(
&   System.String^ bsExtension
)

Parameters

bsExtension
Extension of file for which to get a data card ID; for example, "DWG" or "DOC" or "." to get the ID of the data card for this folder

Return Value

ID of the data card; 0 if not found

Example

Get Card Control Information (VB.NET)
Get Card Control Information (C#)

Remarks

If you need to access the entire card, call IEdmFolder5::GetCard.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The card is not found.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFile Method (IEdmFolder5)

GetFile Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetFile Method (IEdmFolder5)

bsFileName
Name of file to get
Gets the interface to a file with the specified name in this folder.

Syntax

Visual Basic
Function GetFile( _
   ByVal bsFileName As System.String _
) As IEdmFile5
C#
IEdmFile5 GetFile(
   System.string bsFileName
)
C++/CLI
IEdmFile5^ GetFile(
&   System.String^ bsFileName
)

Parameters

bsFileName
Name of file to get

Return Value

IEdmFile5

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmFile5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_NAME: A file with the specified name is not found.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to read the file.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::GetFirstFilePosition Method ()
IEdmFolder5::GetSubFolder Method ()
IEdmFolder5::GetFirstSubFolderPosition Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstFilePosition Method (IEdmFolder5)

GetFirstFilePosition Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetFirstFilePosition Method (IEdmFolder5)

Starts an enumeration of the files in this folder.

Syntax

Visual Basic
Function GetFirstFilePosition() As IEdmPos5
C#
IEdmPos5 GetFirstFilePosition()
C++/CLI
IEdmPos5^ GetFirstFilePosition();

Return Value

IEdmPos5; position of the first file in this folder

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

Remarks

After calling this method, pass the returned first file position to IEdmFolder5::GetNextFile to get the first file in the list. Then call IEdmFolder5::GetNextFile repeatedly to get the rest of the files in the list.

C++ users not using smart-pointer wrapper functions must release the returned pointer, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::GetFirstSubFolderPosition Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstLabelPosition Method (IEdmFolder5)

GetFirstLabelPosition Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetFirstLabelPosition Method (IEdmFolder5)

Starts an enumeration of the labels in this folder.

Syntax

Visual Basic
Function GetFirstLabelPosition() As IEdmPos5
C#
IEdmPos5 GetFirstLabelPosition()
C++/CLI
IEdmPos5^ GetFirstLabelPosition();

Return Value

IEdmPos5; position of the first label in this folder

Example

Create Labels on Folders (VB.NET)
Create Labels on Folders (C#)

Remarks

After calling this method, pass the returned first label position to IEdmFolder5::GetNextLabel to get the first label in the list. Then call IEdmFolder5::GetNextFile repeatedly to get the rest of the labels in the list.

C++ users not using smart-pointer wrapper functions must release the returned pointer, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstSubFolderPosition Method (IEdmFolder5)

GetFirstSubFolderPosition Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetFirstSubFolderPosition Method (IEdmFolder5)

Starts an enumeration of the subfolders in this folder.

Syntax

Visual Basic
Function GetFirstSubFolderPosition() As IEdmPos5
C#
IEdmPos5 GetFirstSubFolderPosition()
C++/CLI
IEdmPos5^ GetFirstSubFolderPosition();

Return Value

IEdmPos5; position of the first sub-folder in this folder

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

Remarks

After calling this method, pass the returned first subfolder position to IEdmFolder5::GetNextSubFolder to get the first subfolder in the list. Then call IEdmFolder5::GetNextSubFolder repeatedly to get the rest of the subfolders in the list.

C++ users not using smart-pointer wrapper functions must release the returned pointer, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::GetFirstFilePosition Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFile Method (IEdmFolder5)

GetNextFile Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetNextFile Method (IEdmFolder5)

poPosition
IEdmPos5; position of file to retrieve (see Remarks)
Gets the next file in the enumeration.

Syntax

Visual Basic
Function GetNextFile( _
   ByVal poPosition As IEdmPos5 _
) As IEdmFile5
C#
IEdmFile5 GetNextFile(
   IEdmPos5 poPosition
)
C++/CLI
IEdmFile5^ GetNextFile(
&   IEdmPos5^ poPosition
)

Parameters

poPosition
IEdmPos5; position of file to retrieve (see Remarks)

Return Value

IEdmFile5

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

Remarks

Before calling this method the first time, you must populate poPosition with the interface to the position of the first file, IEdmPos5. Call IEdmFolder5::GetFirstFilePosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the files.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextLabel Method (IEdmFolder5)

GetNextLabel Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetNextLabel Method (IEdmFolder5)

poPos
IEdmPos5; position of label to retrieve (see Remarks)
Gets the next label in the enumeration.

Syntax

Visual Basic
Function GetNextLabel( _
   ByVal poPos As IEdmPos5 _
) As IEdmLabel5
C#
IEdmLabel5 GetNextLabel(
   IEdmPos5 poPos
)
C++/CLI
IEdmLabel5^ GetNextLabel(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of label to retrieve (see Remarks)

Return Value

IEdmLabel5

Example

Create Labels on Folders (VB.NET)
Create Labels on Folders (C#)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first label, IEdmPos5. Call IEdmFolder5::GetFirstLabelPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the labels.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextSubFolder Method (IEdmFolder5)

GetNextSubFolder Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetNextSubFolder Method (IEdmFolder5)

poPosition
IEdmPos5; position of the subfolder to retrieve (see Remarks)
Gets the next subfolder in the enumeration.

Syntax

Visual Basic
Function GetNextSubFolder( _
   ByVal poPosition As IEdmPos5 _
) As IEdmFolder5
C#
IEdmFolder5 GetNextSubFolder(
   IEdmPos5 poPosition
)
C++/CLI
IEdmFolder5^ GetNextSubFolder(
&   IEdmPos5^ poPosition
)

Parameters

poPosition
IEdmPos5; position of the subfolder to retrieve (see Remarks)

Return Value

IEdmFolder5

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

Remarks

Before calling this method the first time, you must populate poPosition with the interface to the position of the first subfolder, IEdmPos5. Call IEdmFolder5::GetFirstSubFolderPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the subfolders.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetSubFolder Method (IEdmFolder5)

GetSubFolder Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : GetSubFolder Method (IEdmFolder5)

bsFolderName
Name of subfolder to get
Gets the interface to the subfolder with the specified name.

Syntax

Visual Basic
Function GetSubFolder( _
   ByVal bsFolderName As System.String _
) As IEdmFolder5
C#
IEdmFolder5 GetSubFolder(
   System.string bsFolderName
)
C++/CLI
IEdmFolder5^ GetSubFolder(
&   System.String^ bsFolderName
)

Parameters

bsFolderName
Name of subfolder to get

Return Value

IEdmFolder5

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

C++ users not using smart-pointer wrapper functions must release the returned pointer to IEdmFolder5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FOLDER_NOT_FOUND: No subfolder with the specified name is found.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::ParentFolder Property ()
IEdmFolder5::GetFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


HasRightsEx Method (IEdmFolder5)

HasRightsEx Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : HasRightsEx Method (IEdmFolder5)

lRights
Combination of EdmRightFlags bits
lFileID
Optional ID of file on which to check lRights; 0 or null to check lRights on this folder only
Gets whether the user has the specified rights for the specified file in this folder.

Syntax

Visual Basic
Function HasRightsEx( _
   ByVal lRights As System.Integer, _
   Optional ByVal lFileID As System.Integer _
) As System.Boolean
C#
System.bool HasRightsEx(
   System.int lRights,
   System.int lFileID
)
C++/CLI
System.bool HasRightsEx(
&   System.int lRights,
&   System.int lFileID
)

Parameters

lRights
Combination of EdmRightFlags bits
lFileID
Optional ID of file on which to check lRights; 0 or null to check lRights on this folder only

Return Value

True if the user has all of the specified permissions, false if the user is missing one or more of the specified permissions

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

This method takes into account both the rights set explicitly on the user and those inherited from groups of which the user is a member. Optionally, you can specify the ID of a file for which to check rights. In that case, the rights-check includes workflow rights set on the current status of the file. If no file ID is specified, or it is 0, the rights-check is performed only on this folder.

Note: This method is only available in SOLIDWORKS PDM Professional Version 5.3 and later. If the program must have backward compatibility with SOLIDWORKS PDM Professional 5.2, use IEdmFolder5::HasRights instead.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The user lacks one or more of the specified rights.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.3


IsKindOf Method (IEdmFolder5)

IsKindOf Method (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : IsKindOf Method (IEdmFolder5)

__MIDL__IEdmObject50000
Type of object as defined in EdmObjectType
Checks whether the object is of a certain type.

Syntax

Visual Basic
Function IsKindOf( _
   ByVal __MIDL__IEdmObject50000 As EdmObjectType _
) As System.Boolean
C#
System.bool IsKindOf(
   EdmObjectType __MIDL__IEdmObject50000
)
C++/CLI
System.bool IsKindOf(
&   EdmObjectType __MIDL__IEdmObject50000
)

Parameters

__MIDL__IEdmObject50000
Type of object as defined in EdmObjectType

Remarks

Return code S_OK indicates that the method successfully executed.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members


Refresh Method (IEdmFolder5)

Refresh Method (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : Refresh Method (IEdmFolder5)

Refreshes the file listing for the folder.

Syntax

Visual Basic
Sub Refresh()
C#
void Refresh()
C++/CLI
void Refresh();

Remarks

In a multi-user implementation, the contents of this folder may change as you are working on it. Call this method before using other methods of this interface to ensure that you are seeing the latest state of the folder.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members


IEdmFolder5 Interface Properties

IEdmFolder5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmFolder5 Interface

For a list of all members of this type, see IEdmFolder5 members.

Public Properties

 | Name | Description
Property | ID | Gets the database ID of this folder.
Property | LocalPath | Gets the full file system path to this local folder.
Property | Name | Gets the name of the folder.
Property | ObjectType | Gets the type of object.
Property | ParentFolder | Gets the interface to the parent folder of this folder.
Property | Vault | Gets the file vault to which this folder belongs.
Top

See Also

IEdmFolder5 Interface
EPDM.Interop.epdm Namespace


ID Property (IEdmFolder5)

ID Property (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : ID Property (IEdmFolder5)

Gets the database ID of this folder.

Syntax

Visual Basic
Shadows ReadOnly Property ID As System.Integer
C#
new System.int ID {get;}
C++/CLI
new property System.int ID {
   System.int get();
}

Property Value

Database ID of the folder

See Also

IEdmFolder5 Interface
IEdmFolder5 Members


LocalPath Property (IEdmFolder5)

LocalPath Property (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : LocalPath Property (IEdmFolder5)

Gets the full file system path to this local folder.

Syntax

Visual Basic
ReadOnly Property LocalPath As System.String
C#
System.string LocalPath {get;}
C++/CLI
property System.String^ LocalPath {
   System.String^ get();
}

Property Value

Full file system path to this folder

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Name Property (IEdmFolder5)

Name Property (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : Name Property (IEdmFolder5)

Gets the name of the folder.

Syntax

Visual Basic
Shadows ReadOnly Property Name As System.String
C#
new System.string Name {get;}
C++/CLI
new property System.String^ Name {
   System.String^ get();
}

Property Value

Name of the folder

See Also

IEdmFolder5 Interface
IEdmFolder5 Members


ObjectType Property (IEdmFolder5)

ObjectType Property (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : ObjectType Property (IEdmFolder5)

Gets the type of object.

Syntax

Visual Basic
Shadows ReadOnly Property ObjectType As EdmObjectType
C#
new EdmObjectType ObjectType {get;}
C++/CLI
new property EdmObjectType ObjectType {
   EdmObjectType get();
}

Property Value

Type of object as defined in EdmObjectType

See Also

IEdmFolder5 Interface
IEdmFolder5 Members


ParentFolder Property (IEdmFolder5)

ParentFolder Property (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : ParentFolder Property (IEdmFolder5)

Gets the interface to the parent folder of this folder.

Syntax

Visual Basic
ReadOnly Property ParentFolder As IEdmFolder5
C#
IEdmFolder5 ParentFolder {get;}
C++/CLI
property IEdmFolder5^ ParentFolder {
   IEdmFolder5^ get();
}

Property Value

IEdmFolder5; Null if this folder is the root folder

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Vault Property (IEdmFolder5)

Vault Property (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : Vault Property (IEdmFolder5)

Gets the file vault to which this folder belongs.

Syntax

Visual Basic
Shadows ReadOnly Property Vault As IEdmVault5
C#
new IEdmVault5 Vault {get;}
C++/CLI
new property IEdmVault5^ Vault {
   IEdmVault5^ get();
}

Property Value

File vault to which this folder belongs

See Also

IEdmFolder5 Interface
IEdmFolder5 Members


IEdmFolder6 Interface

IEdmFolder6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFolder6 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder6
   Inherits IEdmFolder5, IEdmObject5
C#
public interface IEdmFolder6 : IEdmFolder5, IEdmObject5
C++/CLI
public interface class IEdmFolder6 : public IEdmFolder5, IEdmObject5

Remarks

This interface:

  • extends IEdmFolder5.
  • is extended by IEdmFolder7, which adds the ability to destroy deleted items in this folder.

Accessors

IEdmVault5::GetObject

See Also

IEdmFolder6 Members
EPDM.Interop.epdm Namespace


IEdmFolder6 Interface Members

IEdmFolder6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder6 Interface

The following tables list the members exposed by IEdmFolder6.

Public Methods

 | Name | Description
Method | AddFiles | Adds one or more files to this folder.
Method | Move | Moves this folder to a new location.
Method | Rename | Renames this folder.
Top

See Also

IEdmFolder6 Interface
EPDM.Interop.epdm Namespace


IEdmFolder6 Interface Methods

IEdmFolder6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder6 Interface

For a list of all members of this type, see IEdmFolder6 members.

Public Methods

 | Name | Description
Method | AddFiles | Adds one or more files to this folder.
Method | Move | Moves this folder to a new location.
Method | Rename | Renames this folder.
Top

See Also

IEdmFolder6 Interface
EPDM.Interop.epdm Namespace


AddFiles Method (IEdmFolder6)

AddFiles Method (IEdmFolder6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder6 Interface : AddFiles Method (IEdmFolder6)

lParentWnd
Parent window handle
ppoFiles
Array of EdmAddFileInfo structures; one structure for each added file
poCallback
Optional pointer to a class that implements IEdmCallback6 to control this add operation and obtain progress information about it
Adds one or more files to this folder.

Syntax

Visual Basic
Sub AddFiles( _
   ByVal lParentWnd As System.Integer, _
   ByRef ppoFiles() As EdmAddFileInfo, _
   ByVal poCallback As IEdmCallback6 _
)
C#
void AddFiles(
   System.int lParentWnd,
   out EdmAddFileInfo[] ppoFiles,
   IEdmCallback6 poCallback
)
C++/CLI
void AddFiles(
&   System.int lParentWnd,
&   [Out] array<EdmAddFileInfo>^ ppoFiles,
&   IEdmCallback6^ poCallback
)

Parameters

lParentWnd
Parent window handle
ppoFiles
Array of EdmAddFileInfo structures; one structure for each added file
poCallback
Optional pointer to a class that implements IEdmCallback6 to control this add operation and obtain progress information about it

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

This method is more efficient than IEdmFolder5::AddFile when adding many files.

Before calling this method, call IFolder12::SetFileNameSerNo for each new file to specify how to create the name of the new file's data card.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_SN_FILE: The operation needs to generate serial numbers from a file but the end of the file has been reached.
  • E_EDM_SN_FILE_NOT_FOUND: The operation needs to generate serial numbers from a file that cannot be found.
  • E_EDM_CANCELLED_BY_USER: The operation was cancelled via the optional callback interface.

See Also

IEdmFolder6 Interface
IEdmFolder6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


Move Method (IEdmFolder6)

Move Method (IEdmFolder6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder6 Interface : Move Method (IEdmFolder6)

lParentWnd
Parent window handle
lNewParentID
ID of new parent folder
lFlags
0; reserved for future use
Moves this folder to a new location.

Syntax

Visual Basic
Sub Move( _
   ByVal lParentWnd As System.Integer, _
   ByVal lNewParentID As System.Integer, _
   ByVal lFlags As System.Integer _
)
C#
void Move(
   System.int lParentWnd,
   System.int lNewParentID,
   System.int lFlags
)
C++/CLI
void Move(
&   System.int lParentWnd,
&   System.int lNewParentID,
&   System.int lFlags
)

Parameters

lParentWnd
Parent window handle
lNewParentID
ID of new parent folder
lFlags
0; reserved for future use

Remarks

If this folder contains files with external references, this method could take an extended period of time to rewrite the include paths.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder6 Interface
IEdmFolder6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


Rename Method (IEdmFolder6)

Rename Method (IEdmFolder6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder6 Interface : Rename Method (IEdmFolder6)

lParentWnd
Parent window handle
bsNewName
New name of the folder
lFlags
0; reserved for future use
Renames this folder.

Syntax

Visual Basic
Sub Rename( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsNewName As System.String, _
   ByVal lFlags As System.Integer _
)
C#
void Rename(
   System.int lParentWnd,
   System.string bsNewName,
   System.int lFlags
)
C++/CLI
void Rename(
&   System.int lParentWnd,
&   System.String^ bsNewName,
&   System.int lFlags
)

Parameters

lParentWnd
Parent window handle
bsNewName
New name of the folder
lFlags
0; reserved for future use

Remarks

If this folder contains files with external references, this method could take an extended period of time to rewrite the include paths.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder6 Interface
IEdmFolder6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmFolder7 Interface

IEdmFolder7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFolder7 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder7
   Inherits IEdmFolder5, IEdmFolder6, IEdmObject5
C#
public interface IEdmFolder7 : IEdmFolder5, IEdmFolder6, IEdmObject5
C++/CLI
public interface class IEdmFolder7 : public IEdmFolder5, IEdmFolder6, IEdmObject5

Remarks

This interface:

  • extends IEdmFolder6 by adding the ability to destroy deleted items in this folder.
  • is extended by IEdmFolder8 by adding the ability to add or copy a file, which already exists in the vault, to a different folder in the vault.

See Also

IEdmFolder7 Members
EPDM.Interop.epdm Namespace


IEdmFolder7 Interface Members

IEdmFolder7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder7 Interface

The following tables list the members exposed by IEdmFolder7.

Public Methods

 | Name | Description
Method | DestroyDeletedItems | Obsolete. Superseded by IEdmFolder13::DestroyDeletedItems2 .
Top

See Also

IEdmFolder7 Interface
EPDM.Interop.epdm Namespace


IEdmFolder7 Interface Methods

IEdmFolder7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder7 Interface

For a list of all members of this type, see IEdmFolder7 members.

Public Methods

 | Name | Description
Method | DestroyDeletedItems | Obsolete. Superseded by IEdmFolder13::DestroyDeletedItems2 .
Top

See Also

IEdmFolder7 Interface
EPDM.Interop.epdm Namespace


DestroyDeletedItems Method (IEdmFolder7)

DestroyDeletedItems Method (IEdmFolder7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder7 Interface : DestroyDeletedItems Method (IEdmFolder7)

bRecursive
True to return a list containing all of the sub-items, false to return just the root items
vDeleteDate
Latest delete date of items to destroy; items deleted after this date are not destroyed
ppoFiles
Array of EdmFileInfo structures; one structure for each destroyed file containing information about the file
poErrors
Array of EdmBatchDelErrInfo structures; one structure for each destroyed file containing information about errors that occurred during this operation
Obsolete. Superseded by IEdmFolder13::DestroyDeletedItems2 .

Syntax

Visual Basic
Sub DestroyDeletedItems( _
   ByVal bRecursive As System.Boolean, _
   ByVal vDeleteDate As System.Object, _
   ByRef ppoFiles() As EdmFileInfo, _
   ByRef poErrors() As EdmBatchDelErrInfo _
)
C#
void DestroyDeletedItems(
   System.bool bRecursive,
   System.object vDeleteDate,
   out EdmFileInfo[] ppoFiles,
   out EdmBatchDelErrInfo[] poErrors
)
C++/CLI
void DestroyDeletedItems(
&   System.bool bRecursive,
&   System.Object^ vDeleteDate,
&   [Out] array<EdmFileInfo>^ ppoFiles,
&   [Out] array<EdmBatchDelErrInfo>^ poErrors
)

Parameters

bRecursive
True to return a list containing all of the sub-items, false to return just the root items
vDeleteDate
Latest delete date of items to destroy; items deleted after this date are not destroyed
ppoFiles
Array of EdmFileInfo structures; one structure for each destroyed file containing information about the file
poErrors
Array of EdmBatchDelErrInfo structures; one structure for each destroyed file containing information about errors that occurred during this operation

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder7 Interface
IEdmFolder7 Members
IEdmFolder11::RecoverDeletedItems Method ()

Availability

SOLIDWORKS PDM Professional Version 12.0


IEdmFolder8 Interface

IEdmFolder8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolder8 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder8
   Inherits IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmObject5
C#
public interface IEdmFolder8 : IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmObject5
C++/CLI
public interface class IEdmFolder8 : public IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmObject5

Example

Add File (C#)
Add File (VB.NET)
Copy File (VB.NET)
Copy File (C#)

Remarks

This interface:

  • extends IEdmFolder7 by adding the ability to add or copy a file, which already exists in the vault, to a different folder in the vault.
  • is extended by IEdmFolder9.

See Also

IEdmFolder8 Members
EPDM.Interop.epdm Namespace


IEdmFolder8 Interface Members

IEdmFolder8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder8 Interface

The following tables list the members exposed by IEdmFolder8.

Public Methods

 | Name | Description
Method | AddFile2 | Adds a file to this folder.
Method | CopyFile2 | Copies a file from a different folder in the vault to this folder.
Top

See Also

IEdmFolder8 Interface
EPDM.Interop.epdm Namespace


IEdmFolder8 Interface Methods

IEdmFolder8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder8 Interface

For a list of all members of this type, see IEdmFolder8 members.

Public Methods

 | Name | Description
Method | AddFile2 | Adds a file to this folder.
Method | CopyFile2 | Copies a file from a different folder in the vault to this folder.
Top

See Also

IEdmFolder8 Interface
EPDM.Interop.epdm Namespace


AddFile2 Method (IEdmFolder8)

AddFile2 Method (IEdmFolder8)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder8 Interface : AddFile2 Method (IEdmFolder8)

lParentWnd

Parent window handle

bsSrcPath
Path of file to copy; "" to create an empty file with the name specified by bsNewFileName (see Remarks)
plErrorCode
If bsSrcPath is... Then plErrorCode is...

Uniquely named

- or -

Not uniquely named and the Allow duplicate file names in this file vault option is selected for the vault

 0, and the file is added to the vault

Not uniquely named and one of the following options is selected for the vault:

  • Do not allow duplicate file names in this file vault
    - or -
  • Do not allow duplicate file names of files with these extensions

EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY, and the file is added to the vault if you are adding the file to a different folder in the vault; otherwise, the file is not added the vault

bsNewFileName
Optional new file name; "" to use the file name specified in bsSrcPath (see Remarks)
lEdmAddFlags
Combination of EdmAddFlag bits
Adds a file to this folder.

Syntax

Visual Basic
Function AddFile2( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsSrcPath As System.String, _
   ByRef plErrorCode As System.Integer, _
   Optional ByVal bsNewFileName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
) As System.Integer
C#
System.int AddFile2(
   System.int lParentWnd,
   System.string bsSrcPath,
   out System.int plErrorCode,
   System.string bsNewFileName,
   System.int lEdmAddFlags
)
C++/CLI
System.int AddFile2(
&   System.int lParentWnd,
&   System.String^ bsSrcPath,
&   [Out] System.int plErrorCode,
&   System.String^ bsNewFileName,
&   System.int lEdmAddFlags
)

Parameters

lParentWnd

Parent window handle

bsSrcPath
Path of file to copy; "" to create an empty file with the name specified by bsNewFileName (see Remarks)
plErrorCode
If bsSrcPath is... Then plErrorCode is...

Uniquely named

- or -

Not uniquely named and the Allow duplicate file names in this file vault option is selected for the vault

 0, and the file is added to the vault

Not uniquely named and one of the following options is selected for the vault:

  • Do not allow duplicate file names in this file vault
    - or -
  • Do not allow duplicate file names of files with these extensions

EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY, and the file is added to the vault if you are adding the file to a different folder in the vault; otherwise, the file is not added the vault

bsNewFileName
Optional new file name; "" to use the file name specified in bsSrcPath (see Remarks)
lEdmAddFlags
Combination of EdmAddFlag bits

Return Value

ID of the new file

Example

Add File (C#)
Add File (VB.NET)

Remarks

Use this method to:

  • add a file from outside of the vault or copy a file inside the vault.
  • create a new empty file.

Use:

  • IEdmFolder8::CopyFile2 to copy a file inside the vault using the ID of the file.
  • IEdmFolder5::AddFileShared to share files between folders.

To add multiple files to this folder, use IEdmFolder6::AddFiles to add them all at once, which is more efficient than adding them one at a time.

Before calling this method, use IFolder12::SetFileNameSerNo to specify how to create the name of the new file data card.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to add files to this folder.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file with the specified name in this folder.
  • E_EDM_INVALID_NAME: The suggested file name is invalid.
  • E_EDM_FILE_SHARE_ERROR: The source or destination file is opened exclusively by another program.
  • E_EDM_FILE_NOT_FOUND: The source file could not be found.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdType.EdmCmd_PreAdd hooks did not permit the operation.

To create a virtual document in a folder, pass an empty string as the source file. For example:

eFolder.AddFile2(Me.Handle.ToInt32, '', addFileStatus, path, 0)

See Also

IEdmFolder8 Interface
IEdmFolder8 Members

Availability

SOLIDWORKS PDM Professional 2015


CopyFile2 Method (IEdmFolder8)

CopyFile2 Method (IEdmFolder8)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder8 Interface : CopyFile2 Method (IEdmFolder8)

lFileID
ID of the file to copy
lSrcFolderID
ID of the folder from which to copy the file
lParentWnd
Parent window handle
plErrorCode
  • 0 indicates that the file is copied
  • EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY indicates that the file is copied if you are copying the file to a different folder in the vault; otherwise, the file is not copied
bsNewName
Optional new name of the file; "" to use the original file name
lFlags
Combination of EdmAddFlag bits
Copies a file from a different folder in the vault to this folder.

Syntax

Visual Basic
Function CopyFile2( _
   ByVal lFileID As System.Integer, _
   ByVal lSrcFolderID As System.Integer, _
   ByVal lParentWnd As System.Integer, _
   ByRef plErrorCode As System.Integer, _
   Optional ByVal bsNewName As System.String, _
   Optional ByVal lFlags As System.Integer _
) As System.Integer
C#
System.int CopyFile2(
   System.int lFileID,
   System.int lSrcFolderID,
   System.int lParentWnd,
   out System.int plErrorCode,
   System.string bsNewName,
   System.int lFlags
)
C++/CLI
System.int CopyFile2(
&   System.int lFileID,
&   System.int lSrcFolderID,
&   System.int lParentWnd,
&   [Out] System.int plErrorCode,
&   System.String^ bsNewName,
&   System.int lFlags
)

Parameters

lFileID
ID of the file to copy
lSrcFolderID
ID of the folder from which to copy the file
lParentWnd
Parent window handle
plErrorCode
  • 0 indicates that the file is copied
  • EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY indicates that the file is copied if you are copying the file to a different folder in the vault; otherwise, the file is not copied
bsNewName
Optional new name of the file; "" to use the original file name
lFlags
Combination of EdmAddFlag bits

Return Value

ID of the new file

Example

Copy File (C#)
Copy File (VB.NET)

Remarks

This method uses the ID of a file to copy a file inside the vault. Use IEdmFolder8::AddFile2 to copy a file by its path. IEdmFolder8::AddFile2 can handle source files both inside and outside the vault.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file or folder with the same name in this folder.
  • E_EDM_FILE_NOT_FOUND: The source file was not found. (The ID is invalid.)
  • E_EDM_PERMISSION_DENIED: The user lacks permission to copy the specified file.
  • E_EDM_FILE_SHARE_ERROR: Cannot copy the file because it is exclusively opened in another application.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdData.EdmCmd_PreCopy hooks didn't permit the operation.

See Also

IEdmFolder8 Interface
IEdmFolder8 Members

Availability

SOLIDWORKS PDM Professional 2015


IEdmFolder9 Interface

IEdmFolder9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolder9 Interface

Allows you to access the contents of a file system folder in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder9
   Inherits IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmObject5
C#
public interface IEdmFolder9 : IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmObject5
C++/CLI
public interface class IEdmFolder9 : public IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmObject5

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

This interface:

  • extends IEdmFolder8 by providing the ability to query whether the user has permission to rename a file in this folder.
  • is extended by IEdmFolder10.

See Also

IEdmFolder9 Members
EPDM.Interop.epdm Namespace


IEdmFolder9 Interface Members

IEdmFolder9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder9 Interface

The following tables list the members exposed by IEdmFolder9.

Public Methods

 | Name | Description
Method | HasRenameRights | Gets whether the user has permission to rename the specified file in this folder.
Top

See Also

IEdmFolder9 Interface
EPDM.Interop.epdm Namespace


IEdmFolder9 Interface Methods

IEdmFolder9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder9 Interface

For a list of all members of this type, see IEdmFolder9 members.

Public Methods

 | Name | Description
Method | HasRenameRights | Gets whether the user has permission to rename the specified file in this folder.
Top

See Also

IEdmFolder9 Interface
EPDM.Interop.epdm Namespace


HasRenameRights Method (IEdmFolder9)

HasRenameRights Method (IEdmFolder9)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder9 Interface : HasRenameRights Method (IEdmFolder9)

lParentWnd
Parent window handle
lFileID
ID of the file to rename
bsOldFileName
Old file name
bsRenamedFileName
New file name
pbSilent
True to silently check for permissions to rename the file (i.e., do not display message box), false to not
Gets whether the user has permission to rename the specified file in this folder.

Syntax

Visual Basic
Function HasRenameRights( _
   ByVal lParentWnd As System.Integer, _
   ByVal lFileID As System.Integer, _
   ByVal bsOldFileName As System.String, _
   ByVal bsRenamedFileName As System.String, _
   ByVal pbSilent As System.Boolean _
) As System.Boolean
C#
System.bool HasRenameRights(
   System.int lParentWnd,
   System.int lFileID,
   System.string bsOldFileName,
   System.string bsRenamedFileName,
   System.bool pbSilent
)
C++/CLI
System.bool HasRenameRights(
&   System.int lParentWnd,
&   System.int lFileID,
&   System.String^ bsOldFileName,
&   System.String^ bsRenamedFileName,
&   System.bool pbSilent
)

Parameters

lParentWnd
Parent window handle
lFileID
ID of the file to rename
bsOldFileName
Old file name
bsRenamedFileName
New file name
pbSilent
True to silently check for permissions to rename the file (i.e., do not display message box), false to not

Return Value

True if the user has permission to rename the specified file, false if not

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

See Also

IEdmFolder9 Interface
IEdmFolder9 Members

Availability

SOLIDWORKS PDM Professional 2016


IEdmFolderData5 Interface

IEdmFolderData5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmFolderData5 Interface

Allows you to specify user and group permissions and file data cards when creating a folder with IEdmFolder5::AddFolder.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolderData5
C#
public interface IEdmFolderData5
C++/CLI
public interface class IEdmFolderData5

Example

Add Folder (VB.NET)
Add Folder (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

By default, user permissions and file data card definitions are inherited from the parent folder.

Accessors

IEdmFolder5::AddFolder

See Also

IEdmFolderData5 Members
EPDM.Interop.epdm Namespace


IEdmFolderData5 Interface Members

IEdmFolderData5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolderData5 Interface

The following tables list the members exposed by IEdmFolderData5.

Public Methods

 | Name | Description
Method | Clear | Removes all settings for the folder.
Method | SetCardSource | Sets the specified file card ID to use for the specified file extensions.
Method | SetGroupRights | Sets the specified permissions for the specified user group.
Method | SetUserRights | Sets the specified permissions for the specified user.
Top

See Also

IEdmFolderData5 Interface
EPDM.Interop.epdm Namespace


IEdmFolderData5 Interface Methods

IEdmFolderData5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolderData5 Interface

For a list of all members of this type, see IEdmFolderData5 members.

Public Methods

 | Name | Description
Method | Clear | Removes all settings for the folder.
Method | SetCardSource | Sets the specified file card ID to use for the specified file extensions.
Method | SetGroupRights | Sets the specified permissions for the specified user group.
Method | SetUserRights | Sets the specified permissions for the specified user.
Top

See Also

IEdmFolderData5 Interface
EPDM.Interop.epdm Namespace


Clear Method (IEdmFolderData5)

Clear Method (IEdmFolderData5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolderData5 Interface : Clear Method (IEdmFolderData5)

Removes all settings for the folder.

Syntax

Visual Basic
Sub Clear()
C#
void Clear()
C++/CLI
void Clear();

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmFolderData5 Interface
IEdmFolderData5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SetCardSource Method (IEdmFolderData5)

SetCardSource Method (IEdmFolderData5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolderData5 Interface : SetCardSource Method (IEdmFolderData5)

lCardID
ID of card to use
bsExtensions
Semicolon-delimited list of extensions; e.g., "DOC;XLS"
Sets the specified file card ID to use for the specified file extensions.

Syntax

Visual Basic
Sub SetCardSource( _
   ByVal lCardID As System.Integer, _
   Optional ByVal bsExtensions As System.String _
)
C#
void SetCardSource(
   System.int lCardID,
   System.string bsExtensions
)
C++/CLI
void SetCardSource(
&   System.int lCardID,
&   System.String^ bsExtensions
)

Parameters

lCardID
ID of card to use
bsExtensions
Semicolon-delimited list of extensions; e.g., "DOC;XLS"

Example

See the IEdmFolderData5 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolderData5 Interface
IEdmFolderData5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SetGroupRights Method (IEdmFolderData5)

SetGroupRights Method (IEdmFolderData5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolderData5 Interface : SetGroupRights Method (IEdmFolderData5)

lGroupID
ID of user group for which to set permissions
lEdmRightFlags
Combination of EdmRightFlags bits
Sets the specified permissions for the specified user group.

Syntax

Visual Basic
Sub SetGroupRights( _
   ByVal lGroupID As System.Integer, _
   ByVal lEdmRightFlags As System.Integer _
)
C#
void SetGroupRights(
   System.int lGroupID,
   System.int lEdmRightFlags
)
C++/CLI
void SetGroupRights(
&   System.int lGroupID,
&   System.int lEdmRightFlags
)

Parameters

lGroupID
ID of user group for which to set permissions
lEdmRightFlags
Combination of EdmRightFlags bits

Example

See the IEdmFolderData5 examples.

Remarks

Retrieve user groups using IEdmUserMgr5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolderData5 Interface
IEdmFolderData5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SetUserRights Method (IEdmFolderData5)

SetUserRights Method (IEdmFolderData5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolderData5 Interface : SetUserRights Method (IEdmFolderData5)

lUserID
ID of user for which to set permissions
lEdmRightFlags
Combination of EdmRightFlags bits
Sets the specified permissions for the specified user.

Syntax

Visual Basic
Sub SetUserRights( _
   ByVal lUserID As System.Integer, _
   ByVal lEdmRightFlags As System.Integer _
)
C#
void SetUserRights(
   System.int lUserID,
   System.int lEdmRightFlags
)
C++/CLI
void SetUserRights(
&   System.int lUserID,
&   System.int lEdmRightFlags
)

Parameters

lUserID
ID of user for which to set permissions
lEdmRightFlags
Combination of EdmRightFlags bits

Example

See the IEdmFolderData5 examples.

Remarks

Retrieve users using IEdmUserMgr5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolderData5 Interface
IEdmFolderData5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmGetCSVersionDialog Interface

IEdmGetCSVersionDialog Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmGetCSVersionDialog Interface

Allows you to restore files in cold storage.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmGetCSVersionDialog
C#
public interface IEdmGetCSVersionDialog
C++/CLI
public interface class IEdmGetCSVersionDialog

See Also

IEdmGetCSVersionDialog Members
EPDM.Interop.epdm Namespace


IEdmGetCSVersionDialog Interface Members

IEdmGetCSVersionDialog Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmGetCSVersionDialog Interface

The following tables list the members exposed by IEdmGetCSVersionDialog.

Public Methods

 | Name | Description
Method | Init | Populates the Restore coldstored file version dialog with data.
Method | Show | Shows the Restore coldstored file version dialog.
Top

See Also

IEdmGetCSVersionDialog Interface
EPDM.Interop.epdm Namespace


IEdmGetCSVersionDialog Interface Methods

IEdmGetCSVersionDialog Interface Methods
EPDM.Interop.epdm Namespace : IEdmGetCSVersionDialog Interface

For a list of all members of this type, see IEdmGetCSVersionDialog members.

Public Methods

 | Name | Description
Method | Init | Populates the Restore coldstored file version dialog with data.
Method | Show | Shows the Restore coldstored file version dialog.
Top

See Also

IEdmGetCSVersionDialog Interface
EPDM.Interop.epdm Namespace


Init Method (IEdmGetCSVersionDialog)

Init Method (IEdmGetCSVersionDialog)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetCSVersionDialog Interface : Init Method (IEdmGetCSVersionDialog)

poVault
IEdmVault5; pointer to the vault
lArcSrvID
Archive server ID
eError
EdmGetOpError; error code returned after getting coldstored version
bsFileName
Name of the file being restored from cold storage
lDocID
ID of the document being restored from cold storage
lVersionNo
Version number of the file being restored from cold storage
lDateFmt
SQL Server date format code (see Remarks in IEdmVault11::CreateNewVault)
lDisplayErrCode
Not implemented
Populates the Restore coldstored file version dialog with data.

Syntax

Visual Basic
Sub Init( _
   ByVal poVault As IEdmVault5, _
   ByVal lArcSrvID As System.Integer, _
   ByVal eError As EdmGetOpError, _
   ByVal bsFileName As System.String, _
   ByVal lDocID As System.Integer, _
   ByVal lVersionNo As System.Integer, _
   ByVal lDateFmt As System.Integer, _
   ByVal lDisplayErrCode As System.Integer _
)
C#
void Init(
   IEdmVault5 poVault,
   System.int lArcSrvID,
   EdmGetOpError eError,
   System.string bsFileName,
   System.int lDocID,
   System.int lVersionNo,
   System.int lDateFmt,
   System.int lDisplayErrCode
)
C++/CLI
void Init(
&   IEdmVault5^ poVault,
&   System.int lArcSrvID,
&   EdmGetOpError eError,
&   System.String^ bsFileName,
&   System.int lDocID,
&   System.int lVersionNo,
&   System.int lDateFmt,
&   System.int lDisplayErrCode
)

Parameters

poVault
IEdmVault5; pointer to the vault
lArcSrvID
Archive server ID
eError
EdmGetOpError; error code returned after getting coldstored version
bsFileName
Name of the file being restored from cold storage
lDocID
ID of the document being restored from cold storage
lVersionNo
Version number of the file being restored from cold storage
lDateFmt
SQL Server date format code (see Remarks in IEdmVault11::CreateNewVault)
lDisplayErrCode
Not implemented

See Also

IEdmGetCSVersionDialog Interface
IEdmGetCSVersionDialog Members


Show Method (IEdmGetCSVersionDialog)

Show Method (IEdmGetCSVersionDialog)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetCSVersionDialog Interface : Show Method (IEdmGetCSVersionDialog)

peReply
EdmGetOpReply; user-defined action
vbApplyForAll
True to apply peReply to all items, false to not
Shows the Restore coldstored file version dialog.

Syntax

Visual Basic
Sub Show( _
   ByRef peReply As EdmGetOpReply, _
   ByRef vbApplyForAll As System.Boolean _
)
C#
void Show(
   out EdmGetOpReply peReply,
   out System.bool vbApplyForAll
)
C++/CLI
void Show(
&   [Out] EdmGetOpReply peReply,
&   [Out] System.bool vbApplyForAll
)

Parameters

peReply
EdmGetOpReply; user-defined action
vbApplyForAll
True to apply peReply to all items, false to not

See Also

IEdmGetCSVersionDialog Interface
IEdmGetCSVersionDialog Members


IEdmGetOpCallback Interface

IEdmGetOpCallback Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmGetOpCallback Interface

Controls and monitors IEdmBatchGet operations.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmGetOpCallback
C#
public interface IEdmGetOpCallback
C++/CLI
public interface class IEdmGetOpCallback

Remarks

This interface:

  • inherits from IUnknown. See Using and Implementing IUnknown (COM).
  • is extended by IEdmGetOpCallback2.

See Also

IEdmGetOpCallback Members
EPDM.Interop.epdm Namespace
IEdmBatchGet::GetFiles Method ()


IEdmGetOpCallback Interface Members

IEdmGetOpCallback Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmGetOpCallback Interface

The following tables list the members exposed by IEdmGetOpCallback.

Public Methods

 | Name | Description
Method | ConfirmReplace | Gets whether to replace an existing file.
Method | LogMessage | Notifies about an error that occurred during the process.
Method | ProgressBegin | Marks the beginning of the process.
Method | ProgressEnd | Marks the end of the operation.
Method | ProgressStep | Updates the progress bar.
Method | ReportFailure | Obsolete. Superseded by IEdmGetOpCallback2::ReportFailureEx .
Top

See Also

IEdmGetOpCallback Interface
EPDM.Interop.epdm Namespace
IEdmBatchGet::GetFiles Method ()


IEdmGetOpCallback Interface Methods

IEdmGetOpCallback Interface Methods
EPDM.Interop.epdm Namespace : IEdmGetOpCallback Interface

For a list of all members of this type, see IEdmGetOpCallback members.

Public Methods

 | Name | Description
Method | ConfirmReplace | Gets whether to replace an existing file.
Method | LogMessage | Notifies about an error that occurred during the process.
Method | ProgressBegin | Marks the beginning of the process.
Method | ProgressEnd | Marks the end of the operation.
Method | ProgressStep | Updates the progress bar.
Method | ReportFailure | Obsolete. Superseded by IEdmGetOpCallback2::ReportFailureEx .
Top

See Also

IEdmGetOpCallback Interface
EPDM.Interop.epdm Namespace
IEdmBatchGet::GetFiles Method ()


ConfirmReplace Method (IEdmGetOpCallback)

ConfirmReplace Method (IEdmGetOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback Interface : ConfirmReplace Method (IEdmGetOpCallback)

eReason
Reason for calling this method as defined in EdmGetConfirmReason
bsPath
Full path to the local file
Gets whether to replace an existing file.

Syntax

Visual Basic
Function ConfirmReplace( _
   ByVal eReason As EdmGetConfirmReason, _
   ByVal bsPath As System.String _
) As System.Boolean
C#
System.bool ConfirmReplace(
   EdmGetConfirmReason eReason,
   System.string bsPath
)
C++/CLI
System.bool ConfirmReplace(
&   EdmGetConfirmReason eReason,
&   System.String^ bsPath
)

Parameters

eReason
Reason for calling this method as defined in EdmGetConfirmReason
bsPath
Full path to the local file

Return Value

True to replace an existing file, false to leave an existing file

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback Interface
IEdmGetOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


LogMessage Method (IEdmGetOpCallback)

LogMessage Method (IEdmGetOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback Interface : LogMessage Method (IEdmGetOpCallback)

eMsgID
Message to display to the user as defined in EdmGetOpMsg
hCode
Error code causing this method to be called
bsDetails
Reason for calling this method
Notifies about an error that occurred during the process.

Syntax

Visual Basic
Sub LogMessage( _
   ByVal eMsgID As EdmGetOpMsg, _
   ByVal hCode As System.Integer, _
   ByVal bsDetails As System.String _
)
C#
void LogMessage(
   EdmGetOpMsg eMsgID,
   System.int hCode,
   System.string bsDetails
)
C++/CLI
void LogMessage(
&   EdmGetOpMsg eMsgID,
&   System.int hCode,
&   System.String^ bsDetails
)

Parameters

eMsgID
Message to display to the user as defined in EdmGetOpMsg
hCode
Error code causing this method to be called
bsDetails
Reason for calling this method

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback Interface
IEdmGetOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressBegin Method (IEdmGetOpCallback)

ProgressBegin Method (IEdmGetOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback Interface : ProgressBegin Method (IEdmGetOpCallback)

eType
Type of progress bar as defined in EdmProgressType
lSteps
Number of times that IEdmGetOpCallback::ProgressStep is to be called
Marks the beginning of the process.

Syntax

Visual Basic
Sub ProgressBegin( _
   ByVal eType As EdmProgressType, _
   ByVal lSteps As System.Integer _
)
C#
void ProgressBegin(
   EdmProgressType eType,
   System.int lSteps
)
C++/CLI
void ProgressBegin(
&   EdmProgressType eType,
&   System.int lSteps
)

Parameters

eType
Type of progress bar as defined in EdmProgressType
lSteps
Number of times that IEdmGetOpCallback::ProgressStep is to be called

Remarks

Implement this method to display a progress bar. After this method is called, SOLIDWORKS PDM Professional calls IEdmGetOpCallback::ProgressStep lSteps times.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback Interface
IEdmGetOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressEnd Method (IEdmGetOpCallback)

ProgressEnd Method (IEdmGetOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback Interface : ProgressEnd Method (IEdmGetOpCallback)

eType
Type of progress bar as defined in EdmProgressType
Marks the end of the operation.

Syntax

Visual Basic
Sub ProgressEnd( _
   ByVal eType As EdmProgressType _
)
C#
void ProgressEnd(
   EdmProgressType eType
)
C++/CLI
void ProgressEnd(
&   EdmProgressType eType
)

Parameters

eType
Type of progress bar as defined in EdmProgressType

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback Interface
IEdmGetOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressStep Method (IEdmGetOpCallback)

ProgressStep Method (IEdmGetOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback Interface : ProgressStep Method (IEdmGetOpCallback)

eType
Type of progress bar as defined in EdmProgressType
bsMessage
Full path to the processed file
lProgressPos
New position of the progress bar pointer
Updates the progress bar.

Syntax

Visual Basic
Function ProgressStep( _
   ByVal eType As EdmProgressType, _
   ByVal bsMessage As System.String, _
   ByVal lProgressPos As System.Integer _
) As System.Boolean
C#
System.bool ProgressStep(
   EdmProgressType eType,
   System.string bsMessage,
   System.int lProgressPos
)
C++/CLI
System.bool ProgressStep(
&   EdmProgressType eType,
&   System.String^ bsMessage,
&   System.int lProgressPos
)

Parameters

eType
Type of progress bar as defined in EdmProgressType
bsMessage
Full path to the processed file
lProgressPos
New position of the progress bar pointer

Return Value

True to continue, false to cancel the operation

Remarks

This method is called periodically by SOLIDWORKS PDM Professional during the operation. IEdmGetOpCallback::ProgressBegin is called before this method is called. Implement this method to update a progress bar and to implement a button that, when clicked, halts the operation.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback Interface
IEdmGetOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ReportFailure Method (IEdmGetOpCallback)

ReportFailure Method (IEdmGetOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback Interface : ReportFailure Method (IEdmGetOpCallback)

lFileID
ID of affected file
bsPath
Path to the affected file
hError
Error code
bsDetails
Detailed description of the error
Obsolete. Superseded by IEdmGetOpCallback2::ReportFailureEx .

Syntax

Visual Basic
Function ReportFailure( _
   ByVal lFileID As System.Integer, _
   ByVal bsPath As System.String, _
   ByVal hError As System.Integer, _
   ByVal bsDetails As System.String _
) As System.Boolean
C#
System.bool ReportFailure(
   System.int lFileID,
   System.string bsPath,
   System.int hError,
   System.string bsDetails
)
C++/CLI
System.bool ReportFailure(
&   System.int lFileID,
&   System.String^ bsPath,
&   System.int hError,
&   System.String^ bsDetails
)

Parameters

lFileID
ID of affected file
bsPath
Path to the affected file
hError
Error code
bsDetails
Detailed description of the error

Return Value

True to continue, false to cancel the operation

Remarks

SOLIDWORKS PDM Professional calls this method when an error related to a specific file has occurred. Implement this method to display a message box to the user or to automatically process the error.

This method is extended by IEdmGetOpCallback2::ReportFailureEx which provides support for recovering from archive file errors.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback Interface
IEdmGetOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


IEdmGetOpCallback2 Interface

IEdmGetOpCallback2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmGetOpCallback2 Interface

Controls and monitors IEdmBatchGet operations.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmGetOpCallback2
   Inherits IEdmGetOpCallback
C#
public interface IEdmGetOpCallback2 : IEdmGetOpCallback
C++/CLI
public interface class IEdmGetOpCallback2 : public IEdmGetOpCallback

Remarks

This interface:

  • extends IEdmGetOpCallback.
  • is extended by IEdmGetOpCallback3 which provides support for recovering files from an archive.

See Also

IEdmGetOpCallback2 Members
EPDM.Interop.epdm Namespace


IEdmGetOpCallback2 Interface Members

IEdmGetOpCallback2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmGetOpCallback2 Interface

The following tables list the members exposed by IEdmGetOpCallback2.

Public Methods

 | Name | Description
Method | ReportFailureEx | Notifies about a file error.
Method | Reset | Resets the last reply.
Top

See Also

IEdmGetOpCallback2 Interface
EPDM.Interop.epdm Namespace


IEdmGetOpCallback2 Interface Methods

IEdmGetOpCallback2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmGetOpCallback2 Interface

For a list of all members of this type, see IEdmGetOpCallback2 members.

Public Methods

 | Name | Description
Method | ReportFailureEx | Notifies about a file error.
Method | Reset | Resets the last reply.
Top

See Also

IEdmGetOpCallback2 Interface
EPDM.Interop.epdm Namespace


ReportFailureEx Method (IEdmGetOpCallback2)

ReportFailureEx Method (IEdmGetOpCallback2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback2 Interface : ReportFailureEx Method (IEdmGetOpCallback2)

lFileID
ID of the affected file
lVersionNo
Version of the affected file
bsPath
Path to the affected file
eError
Error code as defined in EdmGetOpError
oArg1
Unique 64-bit version ID
oArg2
Reserved for future use
oArg3
Reserved for future use
Notifies about a file error.

Syntax

Visual Basic
Function ReportFailureEx( _
   ByVal lFileID As System.Integer, _
   ByVal lVersionNo As System.Integer, _
   ByVal bsPath As System.String, _
   ByVal eError As EdmGetOpError, _
   ByVal oArg1 As System.Object, _
   ByVal oArg2 As System.Object, _
   ByVal oArg3 As System.Object _
) As EdmGetOpReply
C#
EdmGetOpReply ReportFailureEx(
   System.int lFileID,
   System.int lVersionNo,
   System.string bsPath,
   EdmGetOpError eError,
   System.object oArg1,
   System.object oArg2,
   System.object oArg3
)
C++/CLI
EdmGetOpReply ReportFailureEx(
&   System.int lFileID,
&   System.int lVersionNo,
&   System.String^ bsPath,
&   EdmGetOpError eError,
&   System.Object^ oArg1,
&   System.Object^ oArg2,
&   System.Object^ oArg3
)

Parameters

lFileID
ID of the affected file
lVersionNo
Version of the affected file
bsPath
Path to the affected file
eError
Error code as defined in EdmGetOpError
oArg1
Unique 64-bit version ID
oArg2
Reserved for future use
oArg3
Reserved for future use

Return Value

Reply with how to proceed as defined in EdmGetOpReply

Remarks

This method extends IEdmGetOpCallback::ReportFailure which does not support recovering from archive file errors.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmGetOpCallback2 Interface
IEdmGetOpCallback2 Members

Availability

SOLIDWORKS PDM Professional 2011


Reset Method (IEdmGetOpCallback2)

Reset Method (IEdmGetOpCallback2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback2 Interface : Reset Method (IEdmGetOpCallback2)

Resets the last reply.

Syntax

Visual Basic
Sub Reset()
C#
void Reset()
C++/CLI
void Reset();

See Also

IEdmGetOpCallback2 Interface
IEdmGetOpCallback2 Members


IEdmGetOpCallback3 Interface

IEdmGetOpCallback3 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmGetOpCallback3 Interface

Controls and monitors IEdmBatchGet operations.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmGetOpCallback3
   Inherits IEdmGetOpCallback, IEdmGetOpCallback2
C#
public interface IEdmGetOpCallback3 : IEdmGetOpCallback, IEdmGetOpCallback2
C++/CLI
public interface class IEdmGetOpCallback3 : public IEdmGetOpCallback, IEdmGetOpCallback2

Remarks

This interface extends IEdmGetOpCallback2.

See Also

IEdmGetOpCallback3 Members
EPDM.Interop.epdm Namespace


IEdmGetOpCallback3 Interface Members

IEdmGetOpCallback3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmGetOpCallback3 Interface

The following tables list the members exposed by IEdmGetOpCallback3.

Public Methods

 | Name | Description
Method | IsCancelPressed | Checks whether the user canceled the operation.
Method | SetProgressMessage | Sets the progress bar message.
Top

See Also

IEdmGetOpCallback3 Interface
EPDM.Interop.epdm Namespace


IEdmGetOpCallback3 Interface Methods

IEdmGetOpCallback3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmGetOpCallback3 Interface

For a list of all members of this type, see IEdmGetOpCallback3 members.

Public Methods

 | Name | Description
Method | IsCancelPressed | Checks whether the user canceled the operation.
Method | SetProgressMessage | Sets the progress bar message.
Top

See Also

IEdmGetOpCallback3 Interface
EPDM.Interop.epdm Namespace


IsCancelPressed Method (IEdmGetOpCallback3)

IsCancelPressed Method (IEdmGetOpCallback3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback3 Interface : IsCancelPressed Method (IEdmGetOpCallback3)

Checks whether the user canceled the operation.

Syntax

Visual Basic
Sub IsCancelPressed()
C#
void IsCancelPressed()
C++/CLI
void IsCancelPressed();

See Also

IEdmGetOpCallback3 Interface
IEdmGetOpCallback3 Members


SetProgressMessage Method (IEdmGetOpCallback3)

SetProgressMessage Method (IEdmGetOpCallback3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmGetOpCallback3 Interface : SetProgressMessage Method (IEdmGetOpCallback3)

bsMessage
Progress bar message
Sets the progress bar message.

Syntax

Visual Basic
Sub SetProgressMessage( _
   ByVal bsMessage As System.String _
)
C#
void SetProgressMessage(
   System.string bsMessage
)
C++/CLI
void SetProgressMessage(
&   System.String^ bsMessage
)

Parameters

bsMessage
Progress bar message

See Also

IEdmGetOpCallback3 Interface
IEdmGetOpCallback3 Members


IEdmHistory Interface

IEdmHistory Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmHistory Interface

Allows you to access the history listing of files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmHistory
C#
public interface IEdmHistory
C++/CLI
public interface class IEdmHistory

Example

Get Histories of Files (VB.NET)
Get Histories of Files (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmHistory2.

To access this interface, call IEdmVault7::CreateUtility with eType set to EdmUtility.EdmUtil_History.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmHistory Members
EPDM.Interop.epdm Namespace


IEdmHistory Interface Members

IEdmHistory Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmHistory Interface

The following tables list the members exposed by IEdmHistory.

Public Methods

 | Name | Description
Method | AddFile | Adds a file to the history listing.
Method | AddFolder | Adds a folder to the history listing.
Method | GetHistory | Gets the unsorted history listing for the specified history types.
Top

See Also

IEdmHistory Interface
EPDM.Interop.epdm Namespace


IEdmHistory Interface Methods

IEdmHistory Interface Methods
EPDM.Interop.epdm Namespace : IEdmHistory Interface

For a list of all members of this type, see IEdmHistory members.

Public Methods

 | Name | Description
Method | AddFile | Adds a file to the history listing.
Method | AddFolder | Adds a folder to the history listing.
Method | GetHistory | Gets the unsorted history listing for the specified history types.
Top

See Also

IEdmHistory Interface
EPDM.Interop.epdm Namespace


AddFile Method (IEdmHistory)

AddFile Method (IEdmHistory)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory Interface : AddFile Method (IEdmHistory)

lFileID
ID of file to add
Adds a file to the history listing.

Syntax

Visual Basic
Sub AddFile( _
   ByVal lFileID As System.Integer _
)
C#
void AddFile(
   System.int lFileID
)
C++/CLI
void AddFile(
&   System.int lFileID
)

Parameters

lFileID
ID of file to add

Example

See the IEdmHistory examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistory Interface
IEdmHistory Members

Availability

SOLIDWORKS PDM Professional Version 6.4


AddFolder Method (IEdmHistory)

AddFolder Method (IEdmHistory)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory Interface : AddFolder Method (IEdmHistory)

lFolderID
ID of folder to add
lEdmFolderHistoryFlags
Combination of EdmFolderHistoryFlag bits (see Remarks)
Adds a folder to the history listing.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal lFolderID As System.Integer, _
   ByVal lEdmFolderHistoryFlags As System.Integer _
)
C#
void AddFolder(
   System.int lFolderID,
   System.int lEdmFolderHistoryFlags
)
C++/CLI
void AddFolder(
&   System.int lFolderID,
&   System.int lEdmFolderHistoryFlags
)

Parameters

lFolderID
ID of folder to add
lEdmFolderHistoryFlags
Combination of EdmFolderHistoryFlag bits (see Remarks)

Remarks

lEdmFolderHistoryFlags indicates whether subfolders are added recursively and whether files in the specified folder are added.

After all the files and folders have been added, call IEdmHistory::GetHistory to obtain the actual history listing.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistory Interface
IEdmHistory Members

Availability

SOLIDWORKS PDM Professional Version 6.4


GetHistory Method (IEdmHistory)

GetHistory Method (IEdmHistory)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory Interface : GetHistory Method (IEdmHistory)

ppoRetHistory
Array of EdmHistoryItem structures; one structure for each history item (see Remarks)
lEdmHistoryTypes
Combination of EdmHistoryType bits; indicates the kinds of records to retrieve
Gets the unsorted history listing for the specified history types.

Syntax

Visual Basic
Sub GetHistory( _
   ByRef ppoRetHistory() As EdmHistoryItem, _
   Optional ByVal lEdmHistoryTypes As System.Integer _
)
C#
void GetHistory(
   out EdmHistoryItem[] ppoRetHistory,
   System.int lEdmHistoryTypes
)
C++/CLI
void GetHistory(
&   [Out] array<EdmHistoryItem>^ ppoRetHistory,
&   System.int lEdmHistoryTypes
)

Parameters

ppoRetHistory
Array of EdmHistoryItem structures; one structure for each history item (see Remarks)
lEdmHistoryTypes
Combination of EdmHistoryType bits; indicates the kinds of records to retrieve

Remarks

Call this method after calling IEdmHistory::AddFile and IEdmHistory::AddFolder.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistory Interface
IEdmHistory Members
IEdmHistory2::Rollback Method ()
IEdmHistory3::GetSortedHistory Method ()

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmHistory2 Interface

IEdmHistory2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmHistory2 Interface

Allows you to access the history listing of files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmHistory2
   Inherits IEdmHistory
C#
public interface IEdmHistory2 : IEdmHistory
C++/CLI
public interface class IEdmHistory2 : public IEdmHistory

Remarks

This interface:

  • Extends IEdmHistory by adding the ability to roll back a file.
  • Is extended by IEdmHistory3.

To access this interface, call IEdmVault7::CreateUtility with eType set to EdmUtility.EdmUtil_History.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmHistory2 Members
EPDM.Interop.epdm Namespace


IEdmHistory2 Interface Members

IEdmHistory2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmHistory2 Interface

The following tables list the members exposed by IEdmHistory2.

Public Methods

 | Name | Description
Method | Rollback | Rolls back the specified file.
Top

See Also

IEdmHistory2 Interface
EPDM.Interop.epdm Namespace


IEdmHistory2 Interface Methods

IEdmHistory2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmHistory2 Interface

For a list of all members of this type, see IEdmHistory2 members.

Public Methods

 | Name | Description
Method | Rollback | Rolls back the specified file.
Top

See Also

IEdmHistory2 Interface
EPDM.Interop.epdm Namespace


Rollback Method (IEdmHistory2)

Rollback Method (IEdmHistory2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory2 Interface : Rollback Method (IEdmHistory2)

historyItem
EdmHistoryItem to which to roll back
Rolls back the specified file.

Syntax

Visual Basic
Sub Rollback( _
   ByRef historyItem As EdmHistoryItem _
)
C#
void Rollback(
   ref EdmHistoryItem historyItem
)
C++/CLI
void Rollback(
&   EdmHistoryItem% historyItem
)

Parameters

historyItem
EdmHistoryItem to which to roll back

Example

See the IEdmHistory3 examples.

Remarks

To populate historyItem, get the collection of history items by calling IEdmHistory::GetHistory.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistory2 Interface
IEdmHistory2 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmHistory3 Interface

IEdmHistory3 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmHistory3 Interface

Allows you to access the sorted history listing of files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmHistory3
   Inherits IEdmHistory, IEdmHistory2
C#
public interface IEdmHistory3 : IEdmHistory, IEdmHistory2
C++/CLI
public interface class IEdmHistory3 : public IEdmHistory, IEdmHistory2

Example

Get Histories of Files (VB.NET)
Get Histories of Files (C#)

Remarks

This interface:

  • extends IEdmHistory2 by providing:
    • support for Web 2 applications,
    • the ability to get a sorted history listing, and
    • the ability to get the event description of a history item.
  • is extended by IEdmHistory4.

To access this interface, call IEdmVault7::CreateUtility with eType set to EdmUtility.EdmUtil_History.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmHistory3 Members
EPDM.Interop.epdm Namespace


IEdmHistory3 Interface Members

IEdmHistory3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmHistory3 Interface

The following tables list the members exposed by IEdmHistory3.

Public Methods

 | Name | Description
Method | GetEventDescription | Gets the event description for the specified history item in the specified language.
Method | GetSortedHistory | Gets the history listing for the specified history types.
Top

See Also

IEdmHistory3 Interface
EPDM.Interop.epdm Namespace


IEdmHistory3 Interface Methods

IEdmHistory3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmHistory3 Interface

For a list of all members of this type, see IEdmHistory3 members.

Public Methods

 | Name | Description
Method | GetEventDescription | Gets the event description for the specified history item in the specified language.
Method | GetSortedHistory | Gets the history listing for the specified history types.
Top

See Also

IEdmHistory3 Interface
EPDM.Interop.epdm Namespace


GetEventDescription Method (IEdmHistory3)

GetEventDescription Method (IEdmHistory3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory3 Interface : GetEventDescription Method (IEdmHistory3)

historyItem
EdmHistoryItem (see Remarks)
eLancode
Localization language as defined in EdmLangCode
Gets the event description for the specified history item in the specified language.

Syntax

Visual Basic
Function GetEventDescription( _
   ByRef historyItem As EdmHistoryItem, _
   Optional ByVal eLancode As EdmLangCode _
) As System.String
C#
System.string GetEventDescription(
   ref EdmHistoryItem historyItem,
   EdmLangCode eLancode
)
C++/CLI
System.String^ GetEventDescription(
&   EdmHistoryItem% historyItem,
&   EdmLangCode eLancode
)

Parameters

historyItem
EdmHistoryItem (see Remarks)
eLancode
Localization language as defined in EdmLangCode

Return Value

History item event description

Example

See the IEdmHistory3 examples.

Remarks

Before calling this method, call IEdmHistory3::GetSortedHistory to specify a historyItem.

See Also

IEdmHistory3 Interface
IEdmHistory3 Members

Availability

SOLIDWORKS PDM Professional 2020


GetSortedHistory Method (IEdmHistory3)

GetSortedHistory Method (IEdmHistory3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory3 Interface : GetSortedHistory Method (IEdmHistory3)

ppoRetHistory
Array of EdmHistoryItem structures; one structure for each history item (see Remarks)
lEdmHistoryTypes
Combination of EdmHistoryType bits; indicates the kinds of records to retrieve
Gets the history listing for the specified history types.

Syntax

Visual Basic
Sub GetSortedHistory( _
   ByRef ppoRetHistory() As EdmHistoryItem, _
   Optional ByVal lEdmHistoryTypes As System.Integer _
)
C#
void GetSortedHistory(
   out EdmHistoryItem[] ppoRetHistory,
   System.int lEdmHistoryTypes
)
C++/CLI
void GetSortedHistory(
&   [Out] array<EdmHistoryItem>^ ppoRetHistory,
&   System.int lEdmHistoryTypes
)

Parameters

ppoRetHistory
Array of EdmHistoryItem structures; one structure for each history item (see Remarks)
lEdmHistoryTypes
Combination of EdmHistoryType bits; indicates the kinds of records to retrieve

Example

See the IEdmHistory3 examples.

Remarks

This method works in both Web 2 and thick client applications.

Call this method after calling IEdmHistory::AddFile and IEdmHistory::AddFolder.

The returned array of history items in ppoRetHistory is sorted with the most recent records at the beginning.

Call IEdmHistory3::GetEventDescription, passing one of the EdmHistoryItem structures returned by this method, to obtain its event description.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistory3 Interface
IEdmHistory3 Members
IEdmHistory2::Rollback Method ()
IEdmHistory::GetHistory Method ()

Availability

SOLIDWORKS PDM Professional 2020


IEdmHistory4 Interface

IEdmHistory4 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmHistory4 Interface

Allows you to access the sorted history of files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmHistory4
   Inherits IEdmHistory, IEdmHistory2, IEdmHistory3
C#
public interface IEdmHistory4 : IEdmHistory, IEdmHistory2, IEdmHistory3
C++/CLI
public interface class IEdmHistory4 : public IEdmHistory, IEdmHistory2, IEdmHistory3

Example

Tailor the IEdmHistory3 examples to use this interface.

Remarks

This interface extends IEdmHistory3 by providing the ability to show:

  • a file's history using the same history dialog that is employed in the user interface
  • a folder's history using the same history dialog that is employed in the user interface

To access this interface, call IEdmVault7::CreateUtility with eType set to EdmUtility.EdmUtil_History.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmHistory4 Members
EPDM.Interop.epdm Namespace


IEdmHistory4 Interface Members

IEdmHistory4 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmHistory4 Interface

The following tables list the members exposed by IEdmHistory4.

Public Methods

 | Name | Description
Method | ShowHistoryFile | Displays a history dialog for the specified file.
Method | ShowHistoryFolder | Displays a history dialog for the specified folder.
Top

See Also

IEdmHistory4 Interface
EPDM.Interop.epdm Namespace


IEdmHistory4 Interface Methods

IEdmHistory4 Interface Methods
EPDM.Interop.epdm Namespace : IEdmHistory4 Interface

For a list of all members of this type, see IEdmHistory4 members.

Public Methods

 | Name | Description
Method | ShowHistoryFile | Displays a history dialog for the specified file.
Method | ShowHistoryFolder | Displays a history dialog for the specified folder.
Top

See Also

IEdmHistory4 Interface
EPDM.Interop.epdm Namespace


ShowHistoryFile Method (IEdmHistory4)

ShowHistoryFile Method (IEdmHistory4)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory4 Interface : ShowHistoryFile Method (IEdmHistory4)

lFileID
File ID
lParentFolderID
Parent folder ID
lParentWnd
Parent window handle
Displays a history dialog for the specified file.

Syntax

Visual Basic
Sub ShowHistoryFile( _
   ByVal lFileID As System.Integer, _
   ByVal lParentFolderID As System.Integer, _
   Optional ByVal lParentWnd As System.Integer _
)
C#
void ShowHistoryFile(
   System.int lFileID,
   System.int lParentFolderID,
   System.int lParentWnd
)
C++/CLI
void ShowHistoryFile(
&   System.int lFileID,
&   System.int lParentFolderID,
&   System.int lParentWnd
)

Parameters

lFileID
File ID
lParentFolderID
Parent folder ID
lParentWnd
Parent window handle

See Also

IEdmHistory4 Interface
IEdmHistory4 Members

Availability

SOLIDWORKS PDM Professional 2025


ShowHistoryFolder Method (IEdmHistory4)

ShowHistoryFolder Method (IEdmHistory4)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistory4 Interface : ShowHistoryFolder Method (IEdmHistory4)

lFolderID
Folder ID
lParentWnd
Parent window handle
Displays a history dialog for the specified folder.

Syntax

Visual Basic
Sub ShowHistoryFolder( _
   ByVal lFolderID As System.Integer, _
   Optional ByVal lParentWnd As System.Integer _
)
C#
void ShowHistoryFolder(
   System.int lFolderID,
   System.int lParentWnd
)
C++/CLI
void ShowHistoryFolder(
&   System.int lFolderID,
&   System.int lParentWnd
)

Parameters

lFolderID
Folder ID
lParentWnd
Parent window handle

See Also

IEdmHistory4 Interface
IEdmHistory4 Members

Availability

SOLIDWORKS PDM Professional 2025


IEdmHistoryUpdate Interface

IEdmHistoryUpdate Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmHistoryUpdate Interface

Allows you to access the version and revision comments of files.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmHistoryUpdate
C#
public interface IEdmHistoryUpdate
C++/CLI
public interface class IEdmHistoryUpdate

Example

Get Histories of Files (VB.NET)
Get Histories of Files (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To use this interface:

  1. Access this interface by calling IEdmVault7::CreateUtility with eType set to EdmUtility.EdmUtil_HistoryUpdate.
  2. Call IEdmHistoryUpdate::UpdateRevisionComment one or more times to add revision comments to the batch.
  3. Call IEdmHistoryUpdate::UpdateVersionComment one or more times to add version comments to the batch.
  4. Call IEdmHistoryUpdate::CommitUpdates to commit the batch of changes to the database.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmHistoryUpdate Members
EPDM.Interop.epdm Namespace


IEdmHistoryUpdate Interface Members

IEdmHistoryUpdate Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmHistoryUpdate Interface

The following tables list the members exposed by IEdmHistoryUpdate.

Public Methods

 | Name | Description
Method | CommitUpdates | Commits all of the updates in this batch.
Method | UpdateRevisionComment | Updates a revision comment.
Method | UpdateVersionComment | Updates a version comment.
Top

See Also

IEdmHistoryUpdate Interface
EPDM.Interop.epdm Namespace


IEdmHistoryUpdate Interface Methods

IEdmHistoryUpdate Interface Methods
EPDM.Interop.epdm Namespace : IEdmHistoryUpdate Interface

For a list of all members of this type, see IEdmHistoryUpdate members.

Public Methods

 | Name | Description
Method | CommitUpdates | Commits all of the updates in this batch.
Method | UpdateRevisionComment | Updates a revision comment.
Method | UpdateVersionComment | Updates a version comment.
Top

See Also

IEdmHistoryUpdate Interface
EPDM.Interop.epdm Namespace


CommitUpdates Method (IEdmHistoryUpdate)

CommitUpdates Method (IEdmHistoryUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistoryUpdate Interface : CommitUpdates Method (IEdmHistoryUpdate)

Commits all of the updates in this batch.

Syntax

Visual Basic
Sub CommitUpdates()
C#
void CommitUpdates()
C++/CLI
void CommitUpdates();

Example

See the IEdmHistoryUpdate examples.

Remarks

This method must be called after calling IEdmHistoryUpdate::UpdateVersionComment and IEdmHistoryUpdate::UpdateRevisionComment, or all updates are discarded.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmHistoryUpdate Interface
IEdmHistoryUpdate Members

Availability

SOLIDWORKS PDM Professional 2008


UpdateRevisionComment Method (IEdmHistoryUpdate)

UpdateRevisionComment Method (IEdmHistoryUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistoryUpdate Interface : UpdateRevisionComment Method (IEdmHistoryUpdate)

lFileID
ID of file for which to update a comment
bsRevisionName
Name of revision for which to update a comment: "" for all revisions
lVersionNo
ID of version for which to update a comment; -1 for all versions
bsNewComment
New revision comment
Updates a revision comment.

Syntax

Visual Basic
Sub UpdateRevisionComment( _
   ByVal lFileID As System.Integer, _
   ByVal bsRevisionName As System.String, _
   ByVal lVersionNo As System.Integer, _
   ByVal bsNewComment As System.String _
)
C#
void UpdateRevisionComment(
   System.int lFileID,
   System.string bsRevisionName,
   System.int lVersionNo,
   System.string bsNewComment
)
C++/CLI
void UpdateRevisionComment(
&   System.int lFileID,
&   System.String^ bsRevisionName,
&   System.int lVersionNo,
&   System.String^ bsNewComment
)

Parameters

lFileID
ID of file for which to update a comment
bsRevisionName
Name of revision for which to update a comment: "" for all revisions
lVersionNo
ID of version for which to update a comment; -1 for all versions
bsNewComment
New revision comment

Remarks

After calling this method, you must call IEdmHistoryUpdate::CommitUpdates to write the change to the database.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistoryUpdate Interface
IEdmHistoryUpdate Members

Availability

SOLIDWORKS PDM Professional 2008


UpdateVersionComment Method (IEdmHistoryUpdate)

UpdateVersionComment Method (IEdmHistoryUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmHistoryUpdate Interface : UpdateVersionComment Method (IEdmHistoryUpdate)

lFileID
ID of file for which to update a comment
lVersionNo
ID of version for which to update a comment; -1 for all versions
bsNewComment
New version comment
Updates a version comment.

Syntax

Visual Basic
Sub UpdateVersionComment( _
   ByVal lFileID As System.Integer, _
   ByVal lVersionNo As System.Integer, _
   ByVal bsNewComment As System.String _
)
C#
void UpdateVersionComment(
   System.int lFileID,
   System.int lVersionNo,
   System.string bsNewComment
)
C++/CLI
void UpdateVersionComment(
&   System.int lFileID,
&   System.int lVersionNo,
&   System.String^ bsNewComment
)

Parameters

lFileID
ID of file for which to update a comment
lVersionNo
ID of version for which to update a comment; -1 for all versions
bsNewComment
New version comment

Example

See the IEdmHistoryUpdate examples.

Remarks

After calling this method, you must call IEdmHistoryUpdate::CommitUpdates to write the change to the database.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmHistoryUpdate Interface
IEdmHistoryUpdate Members

Availability

SOLIDWORKS PDM Professional 2008


IEdmImage Interface

IEdmImage Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmImage Interface

Allows you to paint an image on a window.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmImage
C#
public interface IEdmImage
C++/CLI
public interface class IEdmImage

Example

Create User Picture (VB.NET)
Create User Picture (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

User images should have a width that is 80% of its height.

Accessors

IEdmUserMgr8::CreateUserPicture

See Also

IEdmImage Members
EPDM.Interop.epdm Namespace


IEdmImage Interface Members

IEdmImage Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmImage Interface

The following tables list the members exposed by IEdmImage.

Public Methods

 | Name | Description
Method | GetPosition | Gets the bounding rectangle where the image is drawn.
Method | Paint | Paints an image on the specified device context in the specified bounding rectangle.
Method | Reposition | Changes the bounding rectangle where to draw the image.
Top

See Also

IEdmImage Interface
EPDM.Interop.epdm Namespace


IEdmImage Interface Methods

IEdmImage Interface Methods
EPDM.Interop.epdm Namespace : IEdmImage Interface

For a list of all members of this type, see IEdmImage members.

Public Methods

 | Name | Description
Method | GetPosition | Gets the bounding rectangle where the image is drawn.
Method | Paint | Paints an image on the specified device context in the specified bounding rectangle.
Method | Reposition | Changes the bounding rectangle where to draw the image.
Top

See Also

IEdmImage Interface
EPDM.Interop.epdm Namespace


GetPosition Method (IEdmImage)

GetPosition Method (IEdmImage)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmImage Interface : GetPosition Method (IEdmImage)

poDestRect
EdmRect structure; contains the size and position where to draw the image
Gets the bounding rectangle where the image is drawn.

Syntax

Visual Basic
Sub GetPosition( _
   ByRef poDestRect As EdmRect _
)
C#
void GetPosition(
   out EdmRect poDestRect
)
C++/CLI
void GetPosition(
&   [Out] EdmRect poDestRect
)

Parameters

poDestRect
EdmRect structure; contains the size and position where to draw the image

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmImage Interface
IEdmImage Members

Availability

SOLIDWORKS PDM Professional 2013


Paint Method (IEdmImage)

Paint Method (IEdmImage)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmImage Interface : Paint Method (IEdmImage)

llHDC
Device context handle
poDestRect
EdmRect structure; contains the size and position where to draw the image; null to use the size and position of the image when it was created or the size and position that was passed in the last call to IEdmImage::Reposition
Paints an image on the specified device context in the specified bounding rectangle.

Syntax

Visual Basic
Sub Paint( _
   ByVal llHDC As System.Long, _
   Optional ByRef poDestRect As EdmRect _
)
C#
void Paint(
   System.long llHDC,
   ref EdmRect poDestRect
)
C++/CLI
void Paint(
&   System.int64 llHDC,
&   EdmRect% poDestRect
)

Parameters

llHDC
Device context handle
poDestRect
EdmRect structure; contains the size and position where to draw the image; null to use the size and position of the image when it was created or the size and position that was passed in the last call to IEdmImage::Reposition

Example

See the IEdmImage examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmImage Interface
IEdmImage Members

Availability

SOLIDWORKS PDM Professional 2013


Reposition Method (IEdmImage)

Reposition Method (IEdmImage)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmImage Interface : Reposition Method (IEdmImage)

poDestRect
EdmRect structure; size and position where to draw the image
eRefresh
Type of refresh of the window as defined in EdmRepaintType
Changes the bounding rectangle where to draw the image.

Syntax

Visual Basic
Sub Reposition( _
   ByRef poDestRect As EdmRect, _
   Optional ByVal eRefresh As EdmRepaintType _
)
C#
void Reposition(
   ref EdmRect poDestRect,
   EdmRepaintType eRefresh
)
C++/CLI
void Reposition(
&   EdmRect% poDestRect,
&   EdmRepaintType eRefresh
)

Parameters

poDestRect
EdmRect structure; size and position where to draw the image
eRefresh
Type of refresh of the window as defined in EdmRepaintType

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmImage Interface
IEdmImage Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmInbox5 Interface

IEdmInbox5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmInbox5 Interface

Allows you to access the messages sent to a user.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmInbox5
C#
public interface IEdmInbox5
C++/CLI
public interface class IEdmInbox5

Example

Get Messages (C#)
Get Messages (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To access this interface, cast an IEdmUser5 object to an IEdmInbox5 pointer.

See Also

IEdmInbox5 Members
EPDM.Interop.epdm Namespace


IEdmInbox5 Interface Members

IEdmInbox5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmInbox5 Interface

The following tables list the members exposed by IEdmInbox5.

Public Methods

 | Name | Description
Method | GetFirstMessagePosition | Starts an enumeration of the messages in this inbox.
Method | GetNextMessage | Gets the next message in the enumeration.
Method | SendMsg | Emails the current user.
Top

See Also

IEdmInbox5 Interface
EPDM.Interop.epdm Namespace


IEdmInbox5 Interface Methods

IEdmInbox5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmInbox5 Interface

For a list of all members of this type, see IEdmInbox5 members.

Public Methods

 | Name | Description
Method | GetFirstMessagePosition | Starts an enumeration of the messages in this inbox.
Method | GetNextMessage | Gets the next message in the enumeration.
Method | SendMsg | Emails the current user.
Top

See Also

IEdmInbox5 Interface
EPDM.Interop.epdm Namespace


GetFirstMessagePosition Method (IEdmInbox5)

GetFirstMessagePosition Method (IEdmInbox5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmInbox5 Interface : GetFirstMessagePosition Method (IEdmInbox5)

lEdmGetMsgFlags
Combination of EdmGetMsgFlag bits indicating which messages to enumerate
Starts an enumeration of the messages in this inbox.

Syntax

Visual Basic
Function GetFirstMessagePosition( _
   Optional ByVal lEdmGetMsgFlags As System.Integer _
) As IEdmPos5
C#
IEdmPos5 GetFirstMessagePosition(
   System.int lEdmGetMsgFlags
)
C++/CLI
IEdmPos5^ GetFirstMessagePosition(
&   System.int lEdmGetMsgFlags
)

Parameters

lEdmGetMsgFlags
Combination of EdmGetMsgFlag bits indicating which messages to enumerate

Return Value

IEdmPos5; position of the first message in the inbox

Example

Get Messages (C#)
Get Messages (VB.NET)

Remarks

This method only works to enumerate messages of the user currently logged in to the vault.

After calling this method, pass the returned first message position to IEdmInbox5::GetNextMessage to get the first message in the inbox. Then call IEdmInbox5::GetNextMessage repeatedly to get the rest of the messages in the inbox.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: You tried to access somebody else's messages.

See Also

IEdmInbox5 Interface
IEdmInbox5 Members

Availability

SOLIDWORKS PDM Professional Version 5.3


GetNextMessage Method (IEdmInbox5)

GetNextMessage Method (IEdmInbox5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmInbox5 Interface : GetNextMessage Method (IEdmInbox5)

poPos
IEdmPos5; position of the next message (see Remarks)
Gets the next message in the enumeration.

Syntax

Visual Basic
Function GetNextMessage( _
   ByVal poPos As IEdmPos5 _
) As IEdmMessage5
C#
IEdmMessage5 GetNextMessage(
   IEdmPos5 poPos
)
C++/CLI
IEdmMessage5^ GetNextMessage(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next message (see Remarks)

Return Value

IEdmMessage5

Example

Get Messages (C#)
Get Messages (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first message, IEdmPos5. Call IEdmInbox5::GetFirstMessagePosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the messages.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmMessage5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmInbox5 Interface
IEdmInbox5 Members

Availability

SOLIDWORKS PDM Professional Version 5.3


SendMsg Method (IEdmInbox5)

SendMsg Method (IEdmInbox5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmInbox5 Interface : SendMsg Method (IEdmInbox5)

bsSubject
Subject of the email
bsMessageText
Message detail (see Remarks)
Emails the current user.

Syntax

Visual Basic
Sub SendMsg( _
   ByVal bsSubject As System.String, _
   ByVal bsMessageText As System.String _
)
C#
void SendMsg(
   System.string bsSubject,
   System.string bsMessageText
)
C++/CLI
void SendMsg(
&   System.String^ bsSubject,
&   System.String^ bsMessageText
)

Parameters

bsSubject
Subject of the email
bsMessageText
Message detail (see Remarks)

Example

See the IEdmUser5::SendMsg example.

Remarks

It is possible to send HTML-formatted email, if the recipient uses a mail system that supports HTML. If so, then add HTML tags to the text in bsMessageText.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmInbox5 Interface
IEdmInbox5 Members
IEdmUserGroup5::SendMsg Method ()

Availability

SOLIDWORKS PDM Professional Version 5.3


IEdmItem Interface

IEdmItem Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmItem Interface

Allows you to access an item.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmItem
   Inherits IEdmObject5
C#
public interface IEdmItem : IEdmObject5
C++/CLI
public interface class IEdmItem : public IEdmObject5

Example

Get and Set Item References (VB.NET)
Get and Set Item References (C#)

Remarks

This interface inherits from IEdmObject5.

To access this interface, you can:

  • Cast IEdmFileX objects to an IEdmItem pointer.
  • Call IEdmVault5::GetObject, setting eType to EdmObjectType.EdmObject_Item.

See the Programming Items topic for more information.

Accessors

IEdmVault5::GetObject

See Also

IEdmItem Members
EPDM.Interop.epdm Namespace


IEdmItem Interface Members

IEdmItem Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmItem Interface

The following tables list the members exposed by IEdmItem.

Public Properties

 | Name | Description
Property | ItemDescriptiveName | Gets the descriptive name of this item.
Top

Public Methods

 | Name | Description
Method | GetReferences | Gets item references.
Method | UpdateReferences | Adds and removes references to and from this item.
Top

See Also

IEdmItem Interface
EPDM.Interop.epdm Namespace


IEdmItem Interface Methods

IEdmItem Interface Methods
EPDM.Interop.epdm Namespace : IEdmItem Interface

For a list of all members of this type, see IEdmItem members.

Public Methods

 | Name | Description
Method | GetReferences | Gets item references.
Method | UpdateReferences | Adds and removes references to and from this item.
Top

See Also

IEdmItem Interface
EPDM.Interop.epdm Namespace


GetReferences Method (IEdmItem)

GetReferences Method (IEdmItem)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmItem Interface : GetReferences Method (IEdmItem)

lEdmRefFlags
Combination of EdmRefFlags bits
ppoRetReferences
Array of EdmItemRef structures; one structure for each item reference
Gets item references.

Syntax

Visual Basic
Sub GetReferences( _
   ByVal lEdmRefFlags As System.Integer, _
   ByRef ppoRetReferences() As EdmItemRef _
)
C#
void GetReferences(
   System.int lEdmRefFlags,
   out EdmItemRef[] ppoRetReferences
)
C++/CLI
void GetReferences(
&   System.int lEdmRefFlags,
&   [Out] array<EdmItemRef>^ ppoRetReferences
)

Parameters

lEdmRefFlags
Combination of EdmRefFlags bits
ppoRetReferences
Array of EdmItemRef structures; one structure for each item reference

Example

See the IEdmItem examples.

Remarks

Call IEdmItem::UpdateReferences to add, update, or remove item references.

Use IEdmFile5::GetReferenceTree to enumerate item references.

Use IEdmBatchItemReferenceUpdate to quickly update the references of many items at the same time.

See the Programming Items topic for more information.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmItem Interface
IEdmItem Members

Availability

SOLIDWORKS PDM Professional 2010


UpdateReferences Method (IEdmItem)

UpdateReferences Method (IEdmItem)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmItem Interface : UpdateReferences Method (IEdmItem)

ppoAddReferences
Array of EdmItemRef structures; one structure for each item reference to add or update
ppoRemoveReferences
Array of EdmItemRef structures; one structure for each item reference to remove
Adds and removes references to and from this item.

Syntax

Visual Basic
Sub UpdateReferences( _
   ByRef ppoAddReferences() As EdmItemRef, _
   ByRef ppoRemoveReferences() As EdmItemRef _
)
C#
void UpdateReferences(
   out EdmItemRef[] ppoAddReferences,
   out EdmItemRef[] ppoRemoveReferences
)
C++/CLI
void UpdateReferences(
&   [Out] array<EdmItemRef>^ ppoAddReferences,
&   [Out] array<EdmItemRef>^ ppoRemoveReferences
)

Parameters

ppoAddReferences
Array of EdmItemRef structures; one structure for each item reference to add or update
ppoRemoveReferences
Array of EdmItemRef structures; one structure for each item reference to remove

Example

See the IEdmItem examples.

Remarks

It is more efficient to use IEdmBatchItemReferenceUpdate, if you need to update the references of several items at the same time.

Note that the references in argument ppoRemoveReferences are deleted after references in ppoAddReferences are created or updated. A reference present in both lists is, therefore, updated and then immediately deleted.

See the Programming Items topic for more information.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmItem Interface
IEdmItem Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmItem Interface Properties

IEdmItem Interface Properties
EPDM.Interop.epdm Namespace : IEdmItem Interface

For a list of all members of this type, see IEdmItem members.

Public Properties

 | Name | Description
Property | ItemDescriptiveName | Gets the descriptive name of this item.
Top

See Also

IEdmItem Interface
EPDM.Interop.epdm Namespace


ItemDescriptiveName Property (IEdmItem)

ItemDescriptiveName Property (IEdmItem)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmItem Interface : ItemDescriptiveName Property (IEdmItem)

Gets the descriptive name of this item.

Syntax

Visual Basic
ReadOnly Property ItemDescriptiveName As System.String
C#
System.string ItemDescriptiveName {get;}
C++/CLI
property System.String^ ItemDescriptiveName {
   System.String^ get();
}

Property Value

Descriptive name of this item

Example

See the IEdmItem examples.

Remarks

The descriptive name of an item is based on a variable in its data card.

An item also has an "item ID", which is its file name counterpart, accessible via the IEdmItem::Name.

See Also

IEdmItem Interface
IEdmItem Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmLabel5 Interface

IEdmLabel5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmLabel5 Interface

Allows you to access a file or folder label.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmLabel5
   Inherits IEdmObject5
C#
public interface IEdmLabel5 : IEdmObject5
C++/CLI
public interface class IEdmLabel5 : public IEdmObject5

Example

Create Labels on Folders (VB.NET)
Create Labels on Folders (C#)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmLabel6 which provides the ability to update the history of, delete, and rename file labels.

Accessors

IEdmEnumeratorVersion5::GetNextLabel

IEdmFolder5::GetNextLabel

IEdmVault5::GetObject

See Also

IEdmLabel5 Members
EPDM.Interop.epdm Namespace
IEdmFile16::CreateLabel Method ()
IEdmFolder5::CreateLabel Method ()


IEdmLabel5 Interface Members

IEdmLabel5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmLabel5 Interface

The following tables list the members exposed by IEdmLabel5.

Public Properties

 | Name | Description
Property | Comment | Gets the label comment.
Property | Time | Gets the date and time of label creation.
Property | User | Gets the user who created the label.
Property | UserID | Gets the ID of the user who created the label.
Top

Public Methods

 | Name | Description
Method | AddFile | Sets this label on the latest version of the specified file.
Method | AddFolder | Sets this label on the specified folder and all of the files in that folder.
Method | GetFirstFilePosition | Starts an enumeration of the files set with this label.
Method | GetFirstFolderPosition | Starts an enumeration of the folders set with this label.
Method | GetNextFile | Gets the next file with this label in the enumeration.
Method | GetNextFileID | Gets the next ID of a file with this label in the enumeration.
Method | GetNextFolder | Gets the next folder with this label in the enumeration.
Method | GetNextFolderID | Gets the next ID of a folder with this label in the enumeration.
Method | GetVersionNo | Gets the version of the specified file on which this label is set.
Top

See Also

IEdmLabel5 Interface
EPDM.Interop.epdm Namespace
IEdmFile16::CreateLabel Method ()
IEdmFolder5::CreateLabel Method ()


IEdmLabel5 Interface Methods

IEdmLabel5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmLabel5 Interface

For a list of all members of this type, see IEdmLabel5 members.

Public Methods

 | Name | Description
Method | AddFile | Sets this label on the latest version of the specified file.
Method | AddFolder | Sets this label on the specified folder and all of the files in that folder.
Method | GetFirstFilePosition | Starts an enumeration of the files set with this label.
Method | GetFirstFolderPosition | Starts an enumeration of the folders set with this label.
Method | GetNextFile | Gets the next file with this label in the enumeration.
Method | GetNextFileID | Gets the next ID of a file with this label in the enumeration.
Method | GetNextFolder | Gets the next folder with this label in the enumeration.
Method | GetNextFolderID | Gets the next ID of a folder with this label in the enumeration.
Method | GetVersionNo | Gets the version of the specified file on which this label is set.
Top

See Also

IEdmLabel5 Interface
EPDM.Interop.epdm Namespace
IEdmFile16::CreateLabel Method ()
IEdmFolder5::CreateLabel Method ()


AddFile Method (IEdmLabel5)

AddFile Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : AddFile Method (IEdmLabel5)

lFileID
ID of file to set label on
Sets this label on the latest version of the specified file.

Syntax

Visual Basic
Sub AddFile( _
   ByVal lFileID As System.Integer _
)
C#
void AddFile(
   System.int lFileID
)
C++/CLI
void AddFile(
&   System.int lFileID
)

Parameters

lFileID
ID of file to set label on

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


AddFolder Method (IEdmLabel5)

AddFolder Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : AddFolder Method (IEdmLabel5)

lFolderID
ID of folder on which to set this label
bRecursive
True to recursively set this label on all subfolders, false to not
Sets this label on the specified folder and all of the files in that folder.

Syntax

Visual Basic
Sub AddFolder( _
   ByVal lFolderID As System.Integer, _
   ByVal bRecursive As System.Boolean _
)
C#
void AddFolder(
   System.int lFolderID,
   System.bool bRecursive
)
C++/CLI
void AddFolder(
&   System.int lFolderID,
&   System.bool bRecursive
)

Parameters

lFolderID
ID of folder on which to set this label
bRecursive
True to recursively set this label on all subfolders, false to not

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstFilePosition Method (IEdmLabel5)

GetFirstFilePosition Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetFirstFilePosition Method (IEdmLabel5)

Starts an enumeration of the files set with this label.

Syntax

Visual Basic
Function GetFirstFilePosition() As IEdmPos5
C#
IEdmPos5 GetFirstFilePosition()
C++/CLI
IEdmPos5^ GetFirstFilePosition();

Return Value

IEdmPos5; position of the first file set with this label

Remarks

After calling this method, pass the returned first file position to IEdmLabel5::GetNextFile or IEdmLabel5::GetNextFileID to get the first file in the list of files set with this label. Then call IEdmLabel5::GetNextFile or IEdmLabel5::GetNextFileID repeatedly to get the rest of the files set with this label.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstFolderPosition Method (IEdmLabel5)

GetFirstFolderPosition Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetFirstFolderPosition Method (IEdmLabel5)

Starts an enumeration of the folders set with this label.

Syntax

Visual Basic
Function GetFirstFolderPosition() As IEdmPos5
C#
IEdmPos5 GetFirstFolderPosition()
C++/CLI
IEdmPos5^ GetFirstFolderPosition();

Return Value

IEdmPos5; position of the first folder set with this label

Remarks

After calling this method, pass the returned first folder position to IEdmLabel5::GetNextFolder or IEdmLabel5::GetNextFolderID to get the first folder in the list of folders set with this label. Then call IEdmLabel5::GetNextFolder or IEdmLabel5::GetNextFolderID repeatedly to get the rest of the folders set with this label.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFile Method (IEdmLabel5)

GetNextFile Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetNextFile Method (IEdmLabel5)

poPos
IEdmPos5; position of the next file (see Remarks)
plVersion
Version of file on which this label is set
Gets the next file with this label in the enumeration.

Syntax

Visual Basic
Function GetNextFile( _
   ByVal poPos As IEdmPos5, _
   ByRef plVersion As System.Integer _
) As IEdmFile5
C#
IEdmFile5 GetNextFile(
   IEdmPos5 poPos,
   out System.int plVersion
)
C++/CLI
IEdmFile5^ GetNextFile(
&   IEdmPos5^ poPos,
&   [Out] System.int plVersion
)

Parameters

poPos
IEdmPos5; position of the next file (see Remarks)
plVersion
Version of file on which this label is set

Return Value

IEdmFile5

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first file with this label, IEdmPos5. Call IEdmLabel5::GetFirstFilePosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the files with this label.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

If you only need the ID of the next file with this label, call IEdmLabel5::GetNextFileID instead of this method.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmFile5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFileID Method (IEdmLabel5)

GetNextFileID Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetNextFileID Method (IEdmLabel5)

poPos
IEdmPos5; position of the next file (see Remarks)
plVersion
Version of file on which this label is set
Gets the next ID of a file with this label in the enumeration.

Syntax

Visual Basic
Function GetNextFileID( _
   ByVal poPos As IEdmPos5, _
   ByRef plVersion As System.Integer _
) As System.Integer
C#
System.int GetNextFileID(
   IEdmPos5 poPos,
   out System.int plVersion
)
C++/CLI
System.int GetNextFileID(
&   IEdmPos5^ poPos,
&   [Out] System.int plVersion
)

Parameters

poPos
IEdmPos5; position of the next file (see Remarks)
plVersion
Version of file on which this label is set

Return Value

ID of file on which this label is set

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first file with this label, IEdmPos5. Call IEdmLabel5::GetFirstFilePosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the file IDs.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFolder Method (IEdmLabel5)

GetNextFolder Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetNextFolder Method (IEdmLabel5)

poPos
IEdmPos5; position of the next folder (see Remarks)
Gets the next folder with this label in the enumeration.

Syntax

Visual Basic
Function GetNextFolder( _
   ByVal poPos As IEdmPos5 _
) As IEdmFolder5
C#
IEdmFolder5 GetNextFolder(
   IEdmPos5 poPos
)
C++/CLI
IEdmFolder5^ GetNextFolder(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next folder (see Remarks)

Return Value

IEdmFolder5

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first folder with this label, IEdmPos5. Call IEdmLabel5::GetFirstFolderPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the folders with this label.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

If you only need the ID of the next folder with this label, call IEdmLabel5::GetNextFolderID instead of this method.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmFile5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFolderID Method (IEdmLabel5)

GetNextFolderID Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetNextFolderID Method (IEdmLabel5)

poPos
IEdmPos5; position of the next folder (see Remarks)
Gets the next ID of a folder with this label in the enumeration.

Syntax

Visual Basic
Function GetNextFolderID( _
   ByVal poPos As IEdmPos5 _
) As System.Integer
C#
System.int GetNextFolderID(
   IEdmPos5 poPos
)
C++/CLI
System.int GetNextFolderID(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next folder (see Remarks)

Return Value

ID of folder on which this label is set

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first folder with this label, IEdmPos5. Call IEdmLabel5::GetFirstFolderPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the folder IDs.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetVersionNo Method (IEdmLabel5)

GetVersionNo Method (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : GetVersionNo Method (IEdmLabel5)

lFileID
ID of file for which to get the version
Gets the version of the specified file on which this label is set.

Syntax

Visual Basic
Function GetVersionNo( _
   ByVal lFileID As System.Integer _
) As System.Integer
C#
System.int GetVersionNo(
   System.int lFileID
)
C++/CLI
System.int GetVersionNo(
&   System.int lFileID
)

Parameters

lFileID
ID of file for which to get the version

Return Value

Version number

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_INVALIDARG: The label is not set on the specified file.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmLabel5 Interface Properties

IEdmLabel5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmLabel5 Interface

For a list of all members of this type, see IEdmLabel5 members.

Public Properties

 | Name | Description
Property | Comment | Gets the label comment.
Property | Time | Gets the date and time of label creation.
Property | User | Gets the user who created the label.
Property | UserID | Gets the ID of the user who created the label.
Top

See Also

IEdmLabel5 Interface
EPDM.Interop.epdm Namespace
IEdmFile16::CreateLabel Method ()
IEdmFolder5::CreateLabel Method ()


Comment Property (IEdmLabel5)

Comment Property (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : Comment Property (IEdmLabel5)

Gets the label comment.

Syntax

Visual Basic
ReadOnly Property Comment As System.String
C#
System.string Comment {get;}
C++/CLI
property System.String^ Comment {
   System.String^ get();
}

Property Value

Label comment

Example

See the IEdmLabel5 examples.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Time Property (IEdmLabel5)

Time Property (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : Time Property (IEdmLabel5)

Gets the date and time of label creation.

Syntax

Visual Basic
ReadOnly Property Time As System.Object
C#
System.object Time {get;}
C++/CLI
property System.Object^ Time {
   System.Object^ get();
}

Property Value

Date and time of label creation

Example

See the IEdmLabel5 examples.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


User Property (IEdmLabel5)

User Property (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : User Property (IEdmLabel5)

Gets the user who created the label.

Syntax

Visual Basic
ReadOnly Property User As IEdmUser5
C#
IEdmUser5 User {get;}
C++/CLI
property IEdmUser5^ User {
   IEdmUser5^ get();
}

Property Value

IEdmUser5

Example

See the IEdmLabel5 examples.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


UserID Property (IEdmLabel5)

UserID Property (IEdmLabel5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel5 Interface : UserID Property (IEdmLabel5)

Gets the ID of the user who created the label.

Syntax

Visual Basic
ReadOnly Property UserID As System.Integer
C#
System.int UserID {get;}
C++/CLI
property System.int UserID {
   System.int get();
}

Property Value

ID of user who created the label

Example

See the IEdmLabel5 examples.

See Also

IEdmLabel5 Interface
IEdmLabel5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmLabel6 Interface

IEdmLabel6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmLabel6 Interface

Allows you to access a file or folder label.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmLabel6
   Inherits IEdmLabel5, IEdmObject5
C#
public interface IEdmLabel6 : IEdmLabel5, IEdmObject5
C++/CLI
public interface class IEdmLabel6 : public IEdmLabel5, IEdmObject5

Remarks

This interface extends IEdmLabel5.

See Also

IEdmLabel6 Members
EPDM.Interop.epdm Namespace


IEdmLabel6 Interface Members

IEdmLabel6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmLabel6 Interface

The following tables list the members exposed by IEdmLabel6.

Public Methods

 | Name | Description
Method | ChangeComment | Updates the comment of this label.
Method | Delete | Deletes this label.
Method | Rename | Renames this label.
Top

See Also

IEdmLabel6 Interface
EPDM.Interop.epdm Namespace


IEdmLabel6 Interface Methods

IEdmLabel6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmLabel6 Interface

For a list of all members of this type, see IEdmLabel6 members.

Public Methods

 | Name | Description
Method | ChangeComment | Updates the comment of this label.
Method | Delete | Deletes this label.
Method | Rename | Renames this label.
Top

See Also

IEdmLabel6 Interface
EPDM.Interop.epdm Namespace


ChangeComment Method (IEdmLabel6)

ChangeComment Method (IEdmLabel6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel6 Interface : ChangeComment Method (IEdmLabel6)

bsComment
New comment for this label
hParentWnd
Parent window handle; passed to add-ins that have registered the hooks, EdmCmdData.EdmCmd_PreLabelModify and EdmCmdData.EdmCmd_PostLabelModify
Updates the comment of this label.

Syntax

Visual Basic
Sub ChangeComment( _
   ByVal bsComment As System.String, _
   ByVal hParentWnd As System.Integer _
)
C#
void ChangeComment(
   System.string bsComment,
   System.int hParentWnd
)
C++/CLI
void ChangeComment(
&   System.String^ bsComment,
&   System.int hParentWnd
)

Parameters

bsComment
New comment for this label
hParentWnd
Parent window handle; passed to add-ins that have registered the hooks, EdmCmdData.EdmCmd_PreLabelModify and EdmCmdData.EdmCmd_PostLabelModify

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel6 Interface
IEdmLabel6 Members

Availability

SOLIDWORKS PDM Professional 2011


Delete Method (IEdmLabel6)

Delete Method (IEdmLabel6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel6 Interface : Delete Method (IEdmLabel6)

hParentWnd
Parent window handle; passed to add-ins that have registered the hooks, EdmCmdData.EdmCmd_PreLabelModify and EdmCmdData.EdmCmd_PostLabelModify
Deletes this label.

Syntax

Visual Basic
Sub Delete( _
   ByVal hParentWnd As System.Integer _
)
C#
void Delete(
   System.int hParentWnd
)
C++/CLI
void Delete(
&   System.int hParentWnd
)

Parameters

hParentWnd
Parent window handle; passed to add-ins that have registered the hooks, EdmCmdData.EdmCmd_PreLabelModify and EdmCmdData.EdmCmd_PostLabelModify

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel6 Interface
IEdmLabel6 Members

Availability

SOLIDWORKS PDM Professional 2011


Rename Method (IEdmLabel6)

Rename Method (IEdmLabel6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmLabel6 Interface : Rename Method (IEdmLabel6)

bsName
New name of label
hParentWnd
Parent window handle; passed to add-ins that have registered the hooks, EdmCmdData.EdmCmd_PreLabelModify and EdmCmdData.EdmCmd_PostLabelModify
Renames this label.

Syntax

Visual Basic
Sub Rename( _
   ByVal bsName As System.String, _
   ByVal hParentWnd As System.Integer _
)
C#
void Rename(
   System.string bsName,
   System.int hParentWnd
)
C++/CLI
void Rename(
&   System.String^ bsName,
&   System.int hParentWnd
)

Parameters

bsName
New name of label
hParentWnd
Parent window handle; passed to add-ins that have registered the hooks, EdmCmdData.EdmCmd_PreLabelModify and EdmCmdData.EdmCmd_PostLabelModify

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmLabel6 Interface
IEdmLabel6 Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmMenu5 Interface

IEdmMenu5 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmMenu5 Interface

Allows you to add add-ins registered in SOLIDWORKS PDM Professional to your own menus and toolbars.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmMenu5
C#
public interface IEdmMenu5
C++/CLI
public interface class IEdmMenu5

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmMenu6.

Accessors

IEdmVault5::CreatePluginMenu

See Also

IEdmMenu5 Members
EPDM.Interop.epdm Namespace
IEdmMenu7 Interface


IEdmMenu5 Interface Members

IEdmMenu5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmMenu5 Interface

The following tables list the members exposed by IEdmMenu5.

Public Methods

 | Name | Description
Method | Compare | Compares this IEdmMenu5 menu with another menu to see if they contain the same menu items.
Method | GetButtonImages | Gets the toolbar-button images of a range of commands.
Method | GetString | Gets a string for a menu item in this menu.
Method | GetToolbarItemIDs | Gets the toolbar buttons associated with the menu commands.
Method | OnMenuItem | Obsolete. Superseded by IEdmMenu7::OnMenuItem2.
Method | OnUpdateUI | Updates the menu based on a new selection of files and folders.
Top

See Also

IEdmMenu5 Interface
EPDM.Interop.epdm Namespace
IEdmMenu7 Interface


IEdmMenu5 Interface Methods

IEdmMenu5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmMenu5 Interface

For a list of all members of this type, see IEdmMenu5 members.

Public Methods

 | Name | Description
Method | Compare | Compares this IEdmMenu5 menu with another menu to see if they contain the same menu items.
Method | GetButtonImages | Gets the toolbar-button images of a range of commands.
Method | GetString | Gets a string for a menu item in this menu.
Method | GetToolbarItemIDs | Gets the toolbar buttons associated with the menu commands.
Method | OnMenuItem | Obsolete. Superseded by IEdmMenu7::OnMenuItem2.
Method | OnUpdateUI | Updates the menu based on a new selection of files and folders.
Top

See Also

IEdmMenu5 Interface
EPDM.Interop.epdm Namespace
IEdmMenu7 Interface


Compare Method (IEdmMenu5)

Compare Method (IEdmMenu5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMenu5 Interface : Compare Method (IEdmMenu5)

poMenu
Menu
Compares this IEdmMenu5 menu with another menu to see if they contain the same menu items.

Syntax

Visual Basic
Function Compare( _
   ByVal poMenu As IEdmMenu5 _
) As System.Boolean
C#
System.bool Compare(
   IEdmMenu5 poMenu
)
C++/CLI
System.bool Compare(
&   IEdmMenu5^ poMenu
)

Parameters

poMenu
Menu

Return Value

True if the objects are equal, false if not

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: Success, but the objects are different (pbEqual returned false).

See Also

IEdmMenu5 Interface
IEdmMenu5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetButtonImages Method (IEdmMenu5)

GetButtonImages Method (IEdmMenu5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMenu5 Interface : GetButtonImages Method (IEdmMenu5)

hDestImageList
Handle of the image list (HIMAGELIST) to which to add images; the images are appended at the end of the list
eState
State of buttons to get as defined in EdmButtonState
poItemIDArray
Array of menu command IDs for which to get images
Gets the toolbar-button images of a range of commands.

Syntax

Visual Basic
Sub GetButtonImages( _
   ByVal hDestImageList As System.Integer, _
   ByVal eState As EdmButtonState, _
   ByVal poItemIDArray() As System.Integer _
)
C#
void GetButtonImages(
   System.int hDestImageList,
   EdmButtonState eState,
   System.int[] poItemIDArray
)
C++/CLI
void GetButtonImages(
&   System.int hDestImageList,
&   EdmButtonState eState,
&   System.array<int>^ poItemIDArray
)

Parameters

hDestImageList
Handle of the image list (HIMAGELIST) to which to add images; the images are appended at the end of the list
eState
State of buttons to get as defined in EdmButtonState
poItemIDArray
Array of menu command IDs for which to get images

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmMenu5 Interface
IEdmMenu5 Members
IEdmMenu6::GetItems Method ()

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetString Method (IEdmMenu5)

GetString Method (IEdmMenu5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMenu5 Interface : GetString Method (IEdmMenu5)

lItemID
ID of menu item for which to get a string
eType
Type of string to get as defined in EdmMenuStrType
Gets a string for a menu item in this menu.

Syntax

Visual Basic
Function GetString( _
   ByVal lItemID As System.Integer, _
   ByVal eType As EdmMenuStrType _
) As System.String
C#
System.string GetString(
   System.int lItemID,
   EdmMenuStrType eType
)
C++/CLI
System.String^ GetString(
&   System.int lItemID,
&   EdmMenuStrType eType
)

Parameters

lItemID
ID of menu item for which to get a string
eType
Type of string to get as defined in EdmMenuStrType

Return Value

String (see Remarks)

Remarks

C++ programmers must free the returned string with SysFreeString.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmMenu5 Interface
IEdmMenu5 Members
IEdmMenu6::GetItems Method ()

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetToolbarItemIDs Method (IEdmMenu5)

GetToolbarItemIDs Method (IEdmMenu5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMenu5 Interface : GetToolbarItemIDs Method (IEdmMenu5)

ppoRetID
Array of IDs (see Remarks)
Gets the toolbar buttons associated with the menu commands.

Syntax

Visual Basic
Sub GetToolbarItemIDs( _
   ByRef ppoRetID() As System.Integer _
)
C#
void GetToolbarItemIDs(
   out System.int[] ppoRetID
)
C++/CLI
void GetToolbarItemIDs(
&   [Out] System.array<int>^ ppoRetID
)

Parameters

ppoRetID
Array of IDs (see Remarks)

Remarks

The toolbar buttons were added to SOLIDWORKS PDM Professional with the EdmMenuFlags.EdmMenu_HasToolbarButton flag specified in the call to IEdmCmdMgr5::AddCmd.

C++ programmers must remember to correctly create and destroy the returned SAFEARRAY of IDs to avoid errors.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmMenu5 Interface
IEdmMenu5 Members
IEdmMenu6::GetItems Method ()

Availability

Version 5.2 of SOLIDWORKS PDM Professional


OnUpdateUI Method (IEdmMenu5)

OnUpdateUI Method (IEdmMenu5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMenu5 Interface : OnUpdateUI Method (IEdmMenu5)

lSelFileCount
Number of selected files
lSelFolderCount
Number of selected folders
bAllItemsInSameFolder
True if all of the selected files and folders are located in the same parent folder, false if not
Updates the menu based on a new selection of files and folders.

Syntax

Visual Basic
Sub OnUpdateUI( _
   ByVal lSelFileCount As System.Integer, _
   ByVal lSelFolderCount As System.Integer, _
   Optional ByVal bAllItemsInSameFolder As System.Boolean _
)
C#
void OnUpdateUI(
   System.int lSelFileCount,
   System.int lSelFolderCount,
   System.bool bAllItemsInSameFolder
)
C++/CLI
void OnUpdateUI(
&   System.int lSelFileCount,
&   System.int lSelFolderCount,
&   System.bool bAllItemsInSameFolder
)

Parameters

lSelFileCount
Number of selected files
lSelFolderCount
Number of selected folders
bAllItemsInSameFolder
True if all of the selected files and folders are located in the same parent folder, false if not

Remarks

Some items in the menu might be grayed out or removed due to the currently selected number of files and folders. This method updates the menu based on a new selection of files and folders.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmMenu5 Interface
IEdmMenu5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmMenu6 Interface

IEdmMenu6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmMenu6 Interface

Allows you to add add-ins registered in SOLIDWORKS PDM Professional to your own menus and toolbars.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmMenu6
   Inherits IEdmMenu5
C#
public interface IEdmMenu6 : IEdmMenu5
C++/CLI
public interface class IEdmMenu6 : public IEdmMenu5

Remarks

This interface:

  • extends the IEdmMenu5 interface.
  • is extended by the IEdmMenu7 interface.

See Also

IEdmMenu6 Members
EPDM.Interop.epdm Namespace


IEdmMenu6 Interface Members

IEdmMenu6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmMenu6 Interface

The following tables list the members exposed by IEdmMenu6.

Public Methods

 | Name | Description
Method | GetItems | Gets the commands that appear on the toolbar.
Top

See Also

IEdmMenu6 Interface
EPDM.Interop.epdm Namespace


IEdmMenu6 Interface Methods

IEdmMenu6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmMenu6 Interface

For a list of all members of this type, see IEdmMenu6 members.

Public Methods

 | Name | Description
Method | GetItems | Gets the commands that appear on the toolbar.
Top

See Also

IEdmMenu6 Interface
EPDM.Interop.epdm Namespace


GetItems Method (IEdmMenu6)

GetItems Method (IEdmMenu6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmMenu6 Interface : GetItems Method (IEdmMenu6)

lEdmMenuFlags
Types of item you want returned as defined in EdmMenuFlags
ppoRetItems
Array of EdmCmdInfo structs of the returned items
Gets the commands that appear on the toolbar.

Syntax

Visual Basic
Sub GetItems( _
   ByVal lEdmMenuFlags As System.Integer, _
   ByRef ppoRetItems() As EdmCmdInfo _
)
C#
void GetItems(
   System.int lEdmMenuFlags,
   out EdmCmdInfo[] ppoRetItems
)
C++/CLI
void GetItems(
&   System.int lEdmMenuFlags,
&   [Out] array<EdmCmdInfo>^ ppoRetItems
)

Parameters

lEdmMenuFlags
Types of item you want returned as defined in EdmMenuFlags
ppoRetItems
Array of EdmCmdInfo structs of the returned items

Example

Get Menu Command Items (VB.NET)
Get Menu Command Items (C#)

Remarks

Calling IEdmMenu5::GetToolbarItemIDs, IEdmMenu5::GetButtonImages, or IEdmMenu5::GetString also gets the commands that should appear on the toolbar.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmMenu6 Interface
IEdmMenu6 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmMenu7 Interface

IEdmMenu7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmMenu7 Interface

Allows you to add add-ins registered in SOLIDWORKS PDM Professional to your own menus and toolbars.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmMenu7
   Inherits IEdmMenu5, IEdmMenu6
C#
public interface IEdmMenu7 : IEdmMenu5, IEdmMenu6
C++/CLI
public interface class IEdmMenu7 : public IEdmMenu5, IEdmMenu6

Example

Display Menu of Commands (VB.NET)

Remarks

This extended interface also works with object types other than files and folders, and this interface inherits from IEdmMenu6.

Accessors

IEdmVault12::CreatePluginMenu2

See Also

IEdmMenu7 Members
EPDM.Interop.epdm Namespace


IEdmMenu7 Interface Members

IEdmMenu7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmMenu7 Interface

The following tables list the members exposed by IEdmMenu7.

Public Methods

 | Name | Description
Method | OnMenuItem2 | Executes the command for the selected menu item.
Top

See Also

IEdmMenu7 Interface
EPDM.Interop.epdm Namespace


IEdmMenu7 Interface Methods

IEdmMenu7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmMenu7 Interface

For a list of all members of this type, see IEdmMenu7 members.

Public Methods

 | Name | Description
Method | OnMenuItem2 | Executes the command for the selected menu item.
Top

See Also

IEdmMenu7 Interface
EPDM.Interop.epdm Namespace


OnMenuItem2 Method (IEdmMenu7)

OnMenuItem2 Method (IEdmMenu7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmMenu7 Interface : OnMenuItem2 Method (IEdmMenu7)

lItemID
ID of the selected menu item
lParentWnd
Parent window handle (HWND)
lCurrentFolderID
ID of currently active folder
poSelObjects
List of selected objects (files, folders, items, etc.)
Executes the command for the selected menu item.

Syntax

Visual Basic
Function OnMenuItem2( _
   ByVal lItemID As System.Integer, _
   ByVal lParentWnd As System.Integer, _
   ByVal lCurrentFolderID As System.Integer, _
   ByVal poSelObjects As IEdmSelectionList6 _
) As System.Integer
C#
System.int OnMenuItem2(
   System.int lItemID,
   System.int lParentWnd,
   System.int lCurrentFolderID,
   IEdmSelectionList6 poSelObjects
)
C++/CLI
System.int OnMenuItem2(
&   System.int lItemID,
&   System.int lParentWnd,
&   System.int lCurrentFolderID,
&   IEdmSelectionList6^ poSelObjects
)

Parameters

lItemID
ID of the selected menu item
lParentWnd
Parent window handle (HWND)
lCurrentFolderID
ID of currently active folder
poSelObjects
List of selected objects (files, folders, items, etc.)

Return Value

User-interface elements that should be refreshed as defined in EdmRefreshFlag

Example

Display Menu of Commands (VB.NET)

Remarks

You should call this method when a user selects a menu item belonging to this menu.

NOTE: This method supersedes IEdmMenu5::OnMenuItem, which only works with files and folders. IEdmMenu7::OnMenuItem2 works with files and folders as well as other object types such as items.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: Menu item does not belong to this menu.
  • S_EDM_MENU_ITEM_NOT_APPLICABLE: The current selection of objects do not satisfy the constraints set by the command author. See EdmMenuFlags sent to IEdmCmdMgr5::AddCmd.

See Also

IEdmMenu7 Interface
IEdmMenu7 Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmMessage5 Interface

IEdmMessage5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmMessage5 Interface

Allows you to encapsulate a single message in the inbox.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmMessage5
C#
public interface IEdmMessage5
C++/CLI
public interface class IEdmMessage5

Example

Get Messages (C#)
Get Messages (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmInbox5::GetNextMessage

See Also

IEdmMessage5 Members
EPDM.Interop.epdm Namespace
IEdmInbox5::GetFirstMessagePosition
IEdmInbox5 Interface


IEdmMessage5 Interface Members

IEdmMessage5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmMessage5 Interface

The following tables list the members exposed by IEdmMessage5.

Public Properties

 | Name | Description
Property | Body | Gets the text of the message.
Property | Date | Gets the date and time that the message was sent.
Property | IsRead | Gets or sets whether the message has been read.
Property | MessageType | Gets the type of the message.
Property | SenderID | Gets the ID of the user who sent the message.
Property | SenderName | Gets the name of the user who sent the message.
Property | Subject | Gets the subject of the message.
Top

Public Methods

 | Name | Description
Method | Remove | Removes this message from the inbox.
Top

See Also

IEdmMessage5 Interface
EPDM.Interop.epdm Namespace
IEdmInbox5::GetFirstMessagePosition
IEdmInbox5 Interface


IEdmMessage5 Interface Methods

IEdmMessage5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmMessage5 Interface

For a list of all members of this type, see IEdmMessage5 members.

Public Methods

 | Name | Description
Method | Remove | Removes this message from the inbox.
Top

See Also

IEdmMessage5 Interface
EPDM.Interop.epdm Namespace
IEdmInbox5::GetFirstMessagePosition
IEdmInbox5 Interface


Remove Method (IEdmMessage5)

Remove Method (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : Remove Method (IEdmMessage5)

Removes this message from the inbox.

Syntax

Visual Basic
Sub Remove()
C#
void Remove()
C++/CLI
void Remove();

Remarks

Return code S_OK indicates that the method successfully executed.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


IEdmMessage5 Interface Properties

IEdmMessage5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmMessage5 Interface

For a list of all members of this type, see IEdmMessage5 members.

Public Properties

 | Name | Description
Property | Body | Gets the text of the message.
Property | Date | Gets the date and time that the message was sent.
Property | IsRead | Gets or sets whether the message has been read.
Property | MessageType | Gets the type of the message.
Property | SenderID | Gets the ID of the user who sent the message.
Property | SenderName | Gets the name of the user who sent the message.
Property | Subject | Gets the subject of the message.
Top

See Also

IEdmMessage5 Interface
EPDM.Interop.epdm Namespace
IEdmInbox5::GetFirstMessagePosition
IEdmInbox5 Interface


Body Property (IEdmMessage5)

Body Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : Body Property (IEdmMessage5)

Gets the text of the message.

Syntax

Visual Basic
ReadOnly Property Body As System.String
C#
System.string Body {get;}
C++/CLI
property System.String^ Body {
   System.String^ get();
}

Property Value

Message text

Example

See the IEdmMessage5 examples.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


Date Property (IEdmMessage5)

Date Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : Date Property (IEdmMessage5)

Gets the date and time that the message was sent.

Syntax

Visual Basic
ReadOnly Property Date As System.Object
C#
System.object Date {get;}
C++/CLI
property System.Object^ Date {
   System.Object^ get();
}

Property Value

Array of the date and time that the message was sent

Example

See the IEdmMessage5 examples.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


IsRead Property (IEdmMessage5)

IsRead Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : IsRead Property (IEdmMessage5)

Gets or sets whether the message has been read.

Syntax

Visual Basic
Property IsRead As System.Boolean
C#
System.bool IsRead {get; set;}
C++/CLI
property System.bool IsRead {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True if the message has been read, false if not (see Remarks)

Example

See the IEdmMessage5 examples.

Remarks

You can only set this property to true; you cannot set it to false.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


MessageType Property (IEdmMessage5)

MessageType Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : MessageType Property (IEdmMessage5)

Gets the type of the message.

Syntax

Visual Basic
ReadOnly Property MessageType As EdmMsgType
C#
EdmMsgType MessageType {get;}
C++/CLI
property EdmMsgType MessageType {
   EdmMsgType get();
}

Property Value

Type of the message as defined in EdmMsgType

Example

See the IEdmMessage5 examples.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


SenderID Property (IEdmMessage5)

SenderID Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : SenderID Property (IEdmMessage5)

Gets the ID of the user who sent the message.

Syntax

Visual Basic
ReadOnly Property SenderID As System.Integer
C#
System.int SenderID {get;}
C++/CLI
property System.int SenderID {
   System.int get();
}

Property Value

ID of the user who sent the message; 0 indicates that the message is a notification

Example

See the IEdmMessage5 examples.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

SOLIDWORKS PDM Professional version 5.3


SenderName Property (IEdmMessage5)

SenderName Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : SenderName Property (IEdmMessage5)

Gets the name of the user who sent the message.

Syntax

Visual Basic
ReadOnly Property SenderName As System.String
C#
System.string SenderName {get;}
C++/CLI
property System.String^ SenderName {
   System.String^ get();
}

Property Value

Name of the user who sent the message; an empty string indicates that the message was a notification

Example

See the IEdmMessage5 examples.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


Subject Property (IEdmMessage5)

Subject Property (IEdmMessage5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMessage5 Interface : Subject Property (IEdmMessage5)

Gets the subject of the message.

Syntax

Visual Basic
ReadOnly Property Subject As System.String
C#
System.string Subject {get;}
C++/CLI
property System.String^ Subject {
   System.String^ get();
}

Property Value

Subject of the message

Example

See the IEdmMessage5 examples.

See Also

IEdmMessage5 Interface
IEdmMessage5 Members

Availability

Version 5.3 of SOLIDWORKS PDM Professional


IEdmObject5 Interface

IEdmObject5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmObject5 Interface

Contains several properties and methods that are common to all derived interfaces.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmObject5
C#
public interface IEdmObject5
C++/CLI
public interface class IEdmObject5

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

Almost all objects that are stored in SOLIDWORKS PDM Professional's database inherit from this parent interface. See EmdObjectType for a list of all of the interfaces that inherit from IEdmObject5.

You can retrieve all objects inheriting from IEdmObject5 using IEdmVault5::GetObject if you know the type and the database ID.

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmVault5::GetObject

See Also

IEdmObject5 Members
EPDM.Interop.epdm Namespace


IEdmObject5 Interface Members

IEdmObject5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmObject5 Interface

The following tables list the members exposed by IEdmObject5.

Public Properties

 | Name | Description
Property | ID | Gets the database ID of this object.
Property | Name | Gets the name of the object.
Property | ObjectType | Gets the type of object.
Property | Vault | Gets the file vault to which this object belongs.
Top

Public Methods

 | Name | Description
Method | IsKindOf | Checks whether the object is of a certain type.
Method | Refresh | Re-reads cached properties from the database.
Top

See Also

IEdmObject5 Interface
EPDM.Interop.epdm Namespace


IEdmObject5 Interface Methods

IEdmObject5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmObject5 Interface

For a list of all members of this type, see IEdmObject5 members.

Public Methods

 | Name | Description
Method | IsKindOf | Checks whether the object is of a certain type.
Method | Refresh | Re-reads cached properties from the database.
Top

See Also

IEdmObject5 Interface
EPDM.Interop.epdm Namespace


IsKindOf Method (IEdmObject5)

IsKindOf Method (IEdmObject5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmObject5 Interface : IsKindOf Method (IEdmObject5)

__MIDL__IEdmObject50000
Type of object as defined in EdmObjectType
Checks whether the object is of a certain type.

Syntax

Visual Basic
Function IsKindOf( _
   ByVal __MIDL__IEdmObject50000 As EdmObjectType _
) As System.Boolean
C#
System.bool IsKindOf(
   EdmObjectType __MIDL__IEdmObject50000
)
C++/CLI
System.bool IsKindOf(
&   EdmObjectType __MIDL__IEdmObject50000
)

Parameters

__MIDL__IEdmObject50000
Type of object as defined in EdmObjectType

Return Value

True if the object is of the specified type, false if not

Example

Get and Set Item References (C#)
Get and Set Item References (VB.NET)

Remarks

Return code S_OK indicates that the method successfully executed.

See Also

IEdmObject5 Interface
IEdmObject5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


Refresh Method (IEdmObject5)

Refresh Method (IEdmObject5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmObject5 Interface : Refresh Method (IEdmObject5)

Re-reads cached properties from the database.

Syntax

Visual Basic
Sub Refresh()
C#
void Refresh()
C++/CLI
void Refresh();

Remarks

In a multi-user implementation, the object may change as you are working on it. Call this method to ensure that you are seeing the latest state of the object.

For performance reasons, some object properties might be cached in the object itself. This method ensures that cached properties are re-read from the database.

Return codes:

  • S_OK: The method successfully executed.
  • S_EDM_DATABASE_ACCESS: General error accessing the database.

See Also

IEdmObject5 Interface
IEdmObject5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmObject5 Interface Properties

IEdmObject5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmObject5 Interface

For a list of all members of this type, see IEdmObject5 members.

Public Properties

 | Name | Description
Property | ID | Gets the database ID of this object.
Property | Name | Gets the name of the object.
Property | ObjectType | Gets the type of object.
Property | Vault | Gets the file vault to which this object belongs.
Top

See Also

IEdmObject5 Interface
EPDM.Interop.epdm Namespace


ID Property (IEdmObject5)

ID Property (IEdmObject5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmObject5 Interface : ID Property (IEdmObject5)

Gets the database ID of this object.

Syntax

Visual Basic
ReadOnly Property ID As System.Integer
C#
System.int ID {get;}
C++/CLI
property System.int ID {
   System.int get();
}

Property Value

Database ID of this object

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Get File References for a File (C#)
Get File References for a File (VB.NET)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

Database IDs are unique for same-type objects. For example, two files can never have the same database ID; however, a file and a folder might have the same database ID.

See Also

IEdmObject5 Interface
IEdmObject5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


Name Property (IEdmObject5)

Name Property (IEdmObject5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmObject5 Interface : Name Property (IEdmObject5)

Gets the name of the object.

Syntax

Visual Basic
ReadOnly Property Name As System.String
C#
System.string Name {get;}
C++/CLI
property System.String^ Name {
   System.String^ get();
}

Property Value

Name of the object

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

The type of object determines the contents of the return value. For example, this property gets the filename for a file, the user name for a user, etc.

See Also

IEdmObject5 Interface
IEdmObject5 Members

Availability

Version 5.2 SOLIDWORKS PDM Professional


ObjectType Property (IEdmObject5)

ObjectType Property (IEdmObject5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmObject5 Interface : ObjectType Property (IEdmObject5)

Gets the type of object.

Syntax

Visual Basic
ReadOnly Property ObjectType As EdmObjectType
C#
EdmObjectType ObjectType {get;}
C++/CLI
property EdmObjectType ObjectType {
   EdmObjectType get();
}

Property Value

Type of object as defined in EdmObjectType

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

See Also

IEdmObject5 Interface
IEdmObject5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


Vault Property (IEdmObject5)

Vault Property (IEdmObject5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmObject5 Interface : Vault Property (IEdmObject5)

Gets the file vault to which this object belongs.

Syntax

Visual Basic
ReadOnly Property Vault As IEdmVault5
C#
IEdmVault5 Vault {get;}
C++/CLI
property IEdmVault5^ Vault {
   IEdmVault5^ get();
}

Property Value

File vault to which this object belongs

See Also

IEdmObject5 Interface
IEdmObject5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmPos5 Interface

IEdmPos5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmPos5 Interface

Allows you to identify the position of an element in a list of elements.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmPos5
C#
public interface IEdmPos5
C++/CLI
public interface class IEdmPos5

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

Remarks

This object indicates the current position in a list of elements.

Typically you obtain this object using an object's "get first" method and then enumerate the list of elements by passing an IEdmPos5 object to an object's "get next" method.

Accessors

IEdmCard5::GetFirstControlPosition

IEdmCard5::GetNextControl

IEdmCategoryMgr6::GetFirstCategoryPosition

IEdmCategoryMgr6::GetNextCategory

IEdmDictionary5::LongFindKeys

IEdmDictionary5::LongFindValues

IEdmDictionary5::LongGetFirstPosition

IEdmDictionary5::LongGetNextAssoc

IEdmDictionary5::StringFindKeys

IEdmDictionary5::StringFindValues

IEdmDictionary5::StringGetFirstPosition

IEdmDictionary5::StringGetNextAssoc

IEdmEnumeratorCustomReference5::GetFirstRefPosition

IEdmEnumeratorCustomReference5::GetNextRef

IEdmEnumeratorVersion5::GetFirstLabelPosition

IEdmEnumeratorVersion5::GetFirstRevisionPosition

IEdmEnumeratorVersion5::GetFirstVersionPosition

IEdmEnumeratorVersion5::GetNextLabel

IEdmEnumeratorVersion5::GetNextRevision

IEdmEnumeratorVersion5::GetNextVersion

IEdmFile5::GetFirstFolderPosition

IEdmFile5::GetNextFolder

IEdmFolder5::GetFirstFilePosition

IEdmFolder5::GetFirstLabelPosition

IEdmFolder5::GetFirstSubFolderPosition

IEdmFolder5::GetNextFile

IEdmFolder5::GetNextLabel

IEdmFolder5::GetNextSubFolder

IEdmInbox5::GetFirstMessagePosition

IEdmInbox5::GetNextMessage

IEdmLabel5::GetFirstFilePosition

IEdmLabel5::GetFirstFolderPosition

IEdmLabel5::GetNextFile

IEdmLabel5::GetNextFileID

IEdmLabel5::GetNextFolder

IEdmLabel5::GetNextFolderID

IEdmPos5::Clone

IEdmReference5::GetFirstChildPosition

IEdmReference5::GetFirstParentPosition

IEdmReference5::GetNextChild

IEdmReference5::GetNextParent

IEdmSelectionList5::GetHeadPosition

IEdmSelectionList5::GetNext

IEdmState5::GetFirstFilePosition

IEdmState5::GetFirstTransitionPosition

IEdmState5::GetNextFile

IEdmState5::GetNextTransition

IEdmStrLst5::GetHeadPosition

IEdmStrLst5::GetNext

IEdmTemplateMgr5::GetFirstTemplatePosition

IEdmTemplateMgr5::GetNextTemplate

IEdmUserGroup5::GetFirstUserPosition

IEdmUserGroup5::GetNextUser

IEdmUserMgr5::GetFirstLoggedInUserPosition

IEdmUserMgr5::GetFirstUserGroupPosition

IEdmUserMgr5::GetFirstUserPosition

IEdmUserMgr5::GetNextLoggedInUser

IEdmUserMgr5::GetNextUser

IEdmUserMgr5::GetNextUserGroup

IEdmVariable5::GetFirstAttributePosition

IEdmVariable5::GetNextAttribute

IEdmVariableMgr5::GetFirstVariablePosition

IEdmVariableMgr5::GetNextVariable

IEdmVariableValue5::GetFirstAttributePosition

IEdmVariableValue5::GetNextAttribute

IEdmVersion5::GetFirstRevisionPosition

IEdmVersion5::GetNextRevision

IEdmWorkflow5::GetFirstStatePosition

IEdmWorkflow5::GetFirstTransitionPosition

IEdmWorkflow5::GetNextState

IEdmWorkflow5::GetNextTransition

IEdmWorkflow6::GetFirstStatePosition

IEdmWorkflow6::GetFirstTransitionPosition

IEdmWorkflow6::GetNextState

IEdmWorkflow6::GetNextTransition

IEdmWorkflowMgr6::GetFirstWorkflowPosition

IEdmWorkflowMgr6::GetNextWorkflow

See Also

IEdmPos5 Members
EPDM.Interop.epdm Namespace


IEdmPos5 Interface Members

IEdmPos5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmPos5 Interface

The following tables list the members exposed by IEdmPos5.

Public Properties

 | Name | Description
Property | IsNull | Gets whether any elements remain to be enumerated.
Top

Public Methods

 | Name | Description
Method | Clone | Creates a copy of an IEdmPos5 object.
Top

See Also

IEdmPos5 Interface
EPDM.Interop.epdm Namespace


IEdmPos5 Interface Methods

IEdmPos5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmPos5 Interface

For a list of all members of this type, see IEdmPos5 members.

Public Methods

 | Name | Description
Method | Clone | Creates a copy of an IEdmPos5 object.
Top

See Also

IEdmPos5 Interface
EPDM.Interop.epdm Namespace


Clone Method (IEdmPos5)

Clone Method (IEdmPos5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmPos5 Interface : Clone Method (IEdmPos5)

Creates a copy of an IEdmPos5 object.

Syntax

Visual Basic
Function Clone() As IEdmPos5
C#
IEdmPos5 Clone()
C++/CLI
IEdmPos5^ Clone();

Return Value

Copy of an IEdmPos5 object

Remarks

C++ users must release the returned pointer.

You can use a copy of an IEdmPos5 object as a bookmark in an enumeration that you are performing with this object.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmPos5 Interface
IEdmPos5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmPos5 Interface Properties

IEdmPos5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmPos5 Interface

For a list of all members of this type, see IEdmPos5 members.

Public Properties

 | Name | Description
Property | IsNull | Gets whether any elements remain to be enumerated.
Top

See Also

IEdmPos5 Interface
EPDM.Interop.epdm Namespace


IsNull Property (IEdmPos5)

IsNull Property (IEdmPos5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmPos5 Interface : IsNull Property (IEdmPos5)

Gets whether any elements remain to be enumerated.

Syntax

Visual Basic
ReadOnly Property IsNull As System.Boolean
C#
System.bool IsNull {get;}
C++/CLI
property System.bool IsNull {
   System.bool get();
}

Property Value

True if there any elements to be enumerated, false if not

Example

Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

See Also

IEdmPos5 Interface
IEdmPos5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmRawReferenceMgr Interface

IEdmRawReferenceMgr Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmRawReferenceMgr Interface

Allows you to update file reference paths directly in the checked-out files.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRawReferenceMgr
C#
public interface IEdmRawReferenceMgr
C++/CLI
public interface class IEdmRawReferenceMgr

Example

Update File Raw References (C#)
Update File Raw References (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmVault7::CreateUtility

See Also

IEdmRawReferenceMgr Members
EPDM.Interop.epdm Namespace


IEdmRawReferenceMgr Interface Members

IEdmRawReferenceMgr Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRawReferenceMgr Interface

The following tables list the members exposed by IEdmRawReferenceMgr.

Public Methods

 | Name | Description
Method | Close | Closes the opened file.
Method | GetReferences | Get a list of all of the file references in the opened file.
Method | Open | Opens a file.
Method | UpdateReferences | Updates the include paths for the file references.
Top

See Also

IEdmRawReferenceMgr Interface
EPDM.Interop.epdm Namespace


IEdmRawReferenceMgr Interface Methods

IEdmRawReferenceMgr Interface Methods
EPDM.Interop.epdm Namespace : IEdmRawReferenceMgr Interface

For a list of all members of this type, see IEdmRawReferenceMgr members.

Public Methods

 | Name | Description
Method | Close | Closes the opened file.
Method | GetReferences | Get a list of all of the file references in the opened file.
Method | Open | Opens a file.
Method | UpdateReferences | Updates the include paths for the file references.
Top

See Also

IEdmRawReferenceMgr Interface
EPDM.Interop.epdm Namespace


Close Method (IEdmRawReferenceMgr)

Close Method (IEdmRawReferenceMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRawReferenceMgr Interface : Close Method (IEdmRawReferenceMgr)

Closes the opened file.

Syntax

Visual Basic
Sub Close()
C#
void Close()
C++/CLI
void Close();

Example

See the IEdmRawReferenceMgr examples.

Remarks

Return code S_OK indicates that the method successfully executed.

See Also

IEdmRawReferenceMgr Interface
IEdmRawReferenceMgr Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


GetReferences Method (IEdmRawReferenceMgr)

GetReferences Method (IEdmRawReferenceMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRawReferenceMgr Interface : GetReferences Method (IEdmRawReferenceMgr)

ppoReferences
Array of EdmRawReference structs of the file references
Get a list of all of the file references in the opened file.

Syntax

Visual Basic
Sub GetReferences( _
   ByRef ppoReferences() As EdmRawReference _
)
C#
void GetReferences(
   out EdmRawReference[] ppoReferences
)
C++/CLI
void GetReferences(
&   [Out] array<EdmRawReference>^ ppoReferences
)

Parameters

ppoReferences
Array of EdmRawReference structs of the file references

Example

See the IEdmRawReferenceMgr examples.

Remarks

Before calling this method, you must call IEdmRawReferenceMgr::Open.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmRawReferenceMgr Interface
IEdmRawReferenceMgr Members
IEdmRawReferenceMgr::UpdateReferences Method ()

Availability

Version 6.4 of SOLIDWORKS PDM Professional


Open Method (IEdmRawReferenceMgr)

Open Method (IEdmRawReferenceMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRawReferenceMgr Interface : Open Method (IEdmRawReferenceMgr)

bsPath
Path to the file to open
Opens a file.

Syntax

Visual Basic
Function Open( _
   ByVal bsPath As System.String _
) As System.Boolean
C#
System.bool Open(
   System.string bsPath
)
C++/CLI
System.bool Open(
&   System.String^ bsPath
)

Parameters

bsPath
Path to the file to open

Return Value

True if the file's format supports file references, false if not

Example

See the IEdmRawReferenceMgr examples.

Remarks

You must call this method before you call any of the other methods in this interface.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The file's format does not support file references.

See Also

IEdmRawReferenceMgr Interface
IEdmRawReferenceMgr Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


UpdateReferences Method (IEdmRawReferenceMgr)

UpdateReferences Method (IEdmRawReferenceMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRawReferenceMgr Interface : UpdateReferences Method (IEdmRawReferenceMgr)

poReferences
Array of EdmRawReference structs of the references to update (see Remarks)
Updates the include paths for the file references.

Syntax

Visual Basic
Sub UpdateReferences( _
   ByVal poReferences() As EdmRawReference _
)
C#
void UpdateReferences(
   EdmRawReference[] poReferences
)
C++/CLI
void UpdateReferences(
&   array<EdmRawReference>^ poReferences
)

Parameters

poReferences
Array of EdmRawReference structs of the references to update (see Remarks)

Example

See the IEdmRawReferenceMgr examples.

Remarks

Use IEdmRawReferenceMgr::GetReferences to get the array of EdmRawReference structs to pass to this method.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmRawReferenceMgr Interface
IEdmRawReferenceMgr Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


IEdmReference10 Interface

IEdmReference10 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmReference10 Interface

Allows you to enumerate referenced and referencing files and set up user-defined references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmReference10
   Inherits IEdmReference5, IEdmReference6, IEdmReference7, IEdmReference8, IEdmReference9
C#
public interface IEdmReference10 : IEdmReference5, IEdmReference6, IEdmReference7, IEdmReference8, IEdmReference9
C++/CLI
public interface class IEdmReference10 : public IEdmReference5, IEdmReference6, IEdmReference7, IEdmReference8, IEdmReference9

Example

Get File References for a File (VB.NET)
Get File References for a File (C#)

Remarks

This interface:

  • allows you to start an enumeration of child references for a specified project.
  • inherits from IEdmReference9.

See Also

IEdmReference10 Members
EPDM.Interop.epdm Namespace


IEdmReference10 Interface Members

IEdmReference10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmReference10 Interface

The following tables list the members exposed by IEdmReference10.

Public Methods

 | Name | Description
Method | GetFirstChildPosition4 | Starts an enumeration of child references for the specified configuration.
Top

See Also

IEdmReference10 Interface
EPDM.Interop.epdm Namespace


IEdmReference10 Interface Methods

IEdmReference10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmReference10 Interface

For a list of all members of this type, see IEdmReference10 members.

Public Methods

 | Name | Description
Method | GetFirstChildPosition4 | Starts an enumeration of child references for the specified configuration.
Top

See Also

IEdmReference10 Interface
EPDM.Interop.epdm Namespace


GetFirstChildPosition4 Method (IEdmReference10)

GetFirstChildPosition4 Method (IEdmReference10)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmReference10 Interface : GetFirstChildPosition4 Method (IEdmReference10)

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
bGetSuppressedComponent
True to get a suppressed reference, false to not
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
bsConfiguration
Configuration name for which to get child references (see Remarks)
lVersion
Version for which to get references; use 0 for latest version
Starts an enumeration of child references for the specified configuration.

Syntax

Visual Basic
Function GetFirstChildPosition4( _
   ByRef pbsProjectName As System.String, _
   ByVal bIsTopParent As System.Boolean, _
   ByVal bPermitReadLocal As System.Boolean, _
   ByVal bGetSuppressedComponent As System.Boolean, _
   ByVal lEdmRefFlags As System.Integer, _
   ByVal bsConfiguration As System.String, _
   Optional ByVal lVersion As System.Integer _
) As IEdmPos5
C#
IEdmPos5 GetFirstChildPosition4(
   out System.string pbsProjectName,
   System.bool bIsTopParent,
   System.bool bPermitReadLocal,
   System.bool bGetSuppressedComponent,
   System.int lEdmRefFlags,
   System.string bsConfiguration,
   System.int lVersion
)
C++/CLI
IEdmPos5^ GetFirstChildPosition4(
&   [Out] System.String^ pbsProjectName,
&   System.bool bIsTopParent,
&   System.bool bPermitReadLocal,
&   System.bool bGetSuppressedComponent,
&   System.int lEdmRefFlags,
&   System.String^ bsConfiguration,
&   System.int lVersion
)

Parameters

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
bGetSuppressedComponent
True to get a suppressed reference, false to not
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
bsConfiguration
Configuration name for which to get child references (see Remarks)
lVersion
Version for which to get references; use 0 for latest version

Return Value

Position of the first file referenced by this file (see Remarks)

Example

Get File References for a File (VB.NET)
Get File References for a File (C#)

Remarks

You should maintain and pass in a string, by reference, in this argument for all calls to this method in a reference tree. The project name can be allocated and returned by the topmost node in the tree and is used by its children.

IEdmReference6::RefCount and IEdmReference8::RefCountEdited for child references return values for corresponding referenced configurations. If an empty string is passed to bsConfiguration, then the file's common configuration is used.

Pass the position returned by this method to IEdmReference5::GetNextChild to continue to enumerate the referenced files.

C++ programmers not using smart-pointer wrapper functions must release the position.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference10 Interface
IEdmReference10 Members

Availability

SOLIDWORKS PDM Professional 2015


IEdmReference5 Interface

IEdmReference5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmReference5 Interface

Allows you to enumerate referenced and referencing files and set up user-defined references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmReference5
C#
public interface IEdmReference5
C++/CLI
public interface class IEdmReference5

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

The interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmReference6.

Some file types, such as files from AutoCAD, SOLIDWORKS, Microsoft Word, etc., can contain references to other files. Regardless of file type, you can also set up your own references using SOLIDWORKS PDM Professional's User Defined File References dialog box in file properties. SOLIDWORKS PDM Professional manages all of these references for you and they show up, for example, in the check-in dialog box in the form of a reference tree.

Using IEdmReference5, you can enumerate referenced files and referencing files. You can also set up user-defined references using IEdmReference5.

Accessors

IEdmFile5::GetReferenceTree

IEdmReference5::GetNextChild

IEdmReference5::GetNextParent

See Also

IEdmReference5 Members
EPDM.Interop.epdm Namespace
IEdmReference7 Interface
IEdmReference8 Interface
IEdmReference9 Interface


IEdmReference5 Interface Members

IEdmReference5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmReference5 Interface

The following tables list the members exposed by IEdmReference5.

Public Properties

 | Name | Description
Property | File | Gets the file.
Property | FileID | Gets the ID of the file.
Property | Folder | Gets the file's parent folder.
Property | FolderID | Gets the ID of the file's parent folder.
Property | FoundPath | Gets the file system path where the file was found.
Property | IsLocked | Gets whether the file is checked out.
Property | LockedByUser | Gets the the user who checked out the file.
Property | LockedInFolder | Gets the folder in which the file is checked out.
Property | LockedOnComputer | Gets the name of the computer on which the file is checked out.
Property | LockPath | Gets the file's check-out path.
Property | Name | Gets the name of the file.
Property | ReferencedAs | Gets how the file is included by the referencing file.
Property | VersionLocal | Gets the local version number of the file.
Property | VersionRef | Gets the referenced version number of the file.
Top

Public Methods

 | Name | Description
Method | GetCustomData | Gets data stored with IEdmReference5::SetCustomData in this file reference.
Method | GetFirstChildPosition | Obsolete. Superseded by IEdmReference7::GetFirstChildPosition2.
Method | GetFirstParentPosition | Obsolete. Superseded by IEdmReference7::GetFirstParentPosition2.
Method | GetNextChild | Enumerates the files referenced by this file.
Method | GetNextParent | Enumerates the files referencing this file.
Method | SetCustomData | Stores an arbitrary piece of data in this object.
Top

See Also

IEdmReference5 Interface
EPDM.Interop.epdm Namespace
IEdmReference7 Interface
IEdmReference8 Interface
IEdmReference9 Interface


IEdmReference5 Interface Methods

IEdmReference5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmReference5 Interface

For a list of all members of this type, see IEdmReference5 members.

Public Methods

 | Name | Description
Method | GetCustomData | Gets data stored with IEdmReference5::SetCustomData in this file reference.
Method | GetFirstChildPosition | Obsolete. Superseded by IEdmReference7::GetFirstChildPosition2.
Method | GetFirstParentPosition | Obsolete. Superseded by IEdmReference7::GetFirstParentPosition2.
Method | GetNextChild | Enumerates the files referenced by this file.
Method | GetNextParent | Enumerates the files referencing this file.
Method | SetCustomData | Stores an arbitrary piece of data in this object.
Top

See Also

IEdmReference5 Interface
EPDM.Interop.epdm Namespace
IEdmReference7 Interface
IEdmReference8 Interface
IEdmReference9 Interface


GetCustomData Method (IEdmReference5)

GetCustomData Method (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : GetCustomData Method (IEdmReference5)

lDataID
User-defined ID of data to get
poData
Buffer in which to return data
Gets data stored with IEdmReference5::SetCustomData in this file reference.

Syntax

Visual Basic
Function GetCustomData( _
   ByVal lDataID As System.Integer, _
   ByRef poData As System.Object _
) As System.Boolean
C#
System.bool GetCustomData(
   System.int lDataID,
   out System.object poData
)
C++/CLI
System.bool GetCustomData(
&   System.int lDataID,
&   [Out] System.Object^ poData
)

Parameters

lDataID
User-defined ID of data to get
poData
Buffer in which to return data

Return Value

True if the data was found, false if not

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The data was not found (pbFoundlt returned false).

See Also

IEdmReference5 Interface
IEdmReference5 Members
IEdmReference5::SetCustomData Method ()

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetFirstParentPosition Method (IEdmReference5)

GetFirstParentPosition Method (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : GetFirstParentPosition Method (IEdmReference5)

lVersionOrZero
Non-zero value enumerates the files referencing the specified version of the file; argument is ignored if value is 0
bGetAllParentVersions
True to return all versions, of all parents, referencing this file; false to return on the latest referencing version
Obsolete. Superseded by IEdmReference7::GetFirstParentPosition2.

Syntax

Visual Basic
Function GetFirstParentPosition( _
   ByVal lVersionOrZero As System.Integer, _
   ByVal bGetAllParentVersions As System.Boolean _
) As IEdmPos5
C#
IEdmPos5 GetFirstParentPosition(
   System.int lVersionOrZero,
   System.bool bGetAllParentVersions
)
C++/CLI
IEdmPos5^ GetFirstParentPosition(
&   System.int lVersionOrZero,
&   System.bool bGetAllParentVersions
)

Parameters

lVersionOrZero
Non-zero value enumerates the files referencing the specified version of the file; argument is ignored if value is 0
bGetAllParentVersions
True to return all versions, of all parents, referencing this file; false to return on the latest referencing version

Return Value

Position of first file referencing this file

Remarks

Pass the position to IEdmReference6::GetNextParent to continue to enumerate all of the parent files.

C++ programmers not using smart-pointer wrapper functions must release the position.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetNextChild Method (IEdmReference5)

GetNextChild Method (IEdmReference5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : GetNextChild Method (IEdmReference5)

poPos
Position of next child file to get
Enumerates the files referenced by this file.

Syntax

Visual Basic
Function GetNextChild( _
   ByVal poPos As IEdmPos5 _
) As IEdmReference5
C#
IEdmReference5 GetNextChild(
   IEdmPos5 poPos
)
C++/CLI
IEdmReference5^ GetNextChild(
&   IEdmPos5^ poPos
)

Parameters

poPos
Position of next child file to get

Return Value

Child file

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

Call IEdmReference5::GetFirstChildPosition to get the position of the first referenced child file, before you call IEdmReference5::GetNextChild for the first time.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the referenced child files.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetNextParent Method (IEdmReference5)

GetNextParent Method (IEdmReference5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : GetNextParent Method (IEdmReference5)

poPos
Position of the next parent file to get
Enumerates the files referencing this file.

Syntax

Visual Basic
Function GetNextParent( _
   ByVal poPos As IEdmPos5 _
) As IEdmReference5
C#
IEdmReference5 GetNextParent(
   IEdmPos5 poPos
)
C++/CLI
IEdmReference5^ GetNextParent(
&   IEdmPos5^ poPos
)

Parameters

poPos
Position of the next parent file to get

Return Value

Parent file

Example

Get Parent References of File (VB.NET)
Get Parent References of File (C#)

Remarks

Call IEdmReference7::GetFirstParentPosition2 to get the position of the first referenced parent file, before you call this method the first time.

After calling this method the first time, poPos is automatically incremented every time this method is called. Call this method repeatedly to obtain the rest of the referenced parent files.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


SetCustomData Method (IEdmReference5)

SetCustomData Method (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : SetCustomData Method (IEdmReference5)

lDataID
User-defined ID of data to store
poData
Data to store
Stores an arbitrary piece of data in this object.

Syntax

Visual Basic
Sub SetCustomData( _
   ByVal lDataID As System.Integer, _
   ByRef poData As System.Object _
)
C#
void SetCustomData(
   System.int lDataID,
   ref System.object poData
)
C++/CLI
void SetCustomData(
&   System.int lDataID,
&   System.Object^% poData
)

Parameters

lDataID
User-defined ID of data to store
poData
Data to store

Remarks

The data is only stored in memory and is kept as long as IEdmReference5 is add-referenced. You can get the stored data by calling IEdmReference5::GetCustomData.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmReference5 Interface Properties

IEdmReference5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmReference5 Interface

For a list of all members of this type, see IEdmReference5 members.

Public Properties

 | Name | Description
Property | File | Gets the file.
Property | FileID | Gets the ID of the file.
Property | Folder | Gets the file's parent folder.
Property | FolderID | Gets the ID of the file's parent folder.
Property | FoundPath | Gets the file system path where the file was found.
Property | IsLocked | Gets whether the file is checked out.
Property | LockedByUser | Gets the the user who checked out the file.
Property | LockedInFolder | Gets the folder in which the file is checked out.
Property | LockedOnComputer | Gets the name of the computer on which the file is checked out.
Property | LockPath | Gets the file's check-out path.
Property | Name | Gets the name of the file.
Property | ReferencedAs | Gets how the file is included by the referencing file.
Property | VersionLocal | Gets the local version number of the file.
Property | VersionRef | Gets the referenced version number of the file.
Top

See Also

IEdmReference5 Interface
EPDM.Interop.epdm Namespace
IEdmReference7 Interface
IEdmReference8 Interface
IEdmReference9 Interface


File Property (IEdmReference5)

File Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : File Property (IEdmReference5)

Gets the file.

Syntax

Visual Basic
ReadOnly Property File As IEdmFile5
C#
IEdmFile5 File {get;}
C++/CLI
property IEdmFile5^ File {
   IEdmFile5^ get();
}

Property Value

File

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


FileID Property (IEdmReference5)

FileID Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : FileID Property (IEdmReference5)

Gets the ID of the file.

Syntax

Visual Basic
ReadOnly Property FileID As System.Integer
C#
System.int FileID {get;}
C++/CLI
property System.int FileID {
   System.int get();
}

Property Value

ID of the file

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


Folder Property (IEdmReference5)

Folder Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : Folder Property (IEdmReference5)

Gets the file's parent folder.

Syntax

Visual Basic
ReadOnly Property Folder As IEdmFolder5
C#
IEdmFolder5 Folder {get;}
C++/CLI
property IEdmFolder5^ Folder {
   IEdmFolder5^ get();
}

Property Value

File's parent folder

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


FolderID Property (IEdmReference5)

FolderID Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : FolderID Property (IEdmReference5)

Gets the ID of the file's parent folder.

Syntax

Visual Basic
ReadOnly Property FolderID As System.Integer
C#
System.int FolderID {get;}
C++/CLI
property System.int FolderID {
   System.int get();
}

Property Value

ID of the file's parent folder

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


FoundPath Property (IEdmReference5)

FoundPath Property (IEdmReference5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : FoundPath Property (IEdmReference5)

Gets the file system path where the file was found.

Syntax

Visual Basic
ReadOnly Property FoundPath As System.String
C#
System.string FoundPath {get;}
C++/CLI
property System.String^ FoundPath {
   System.String^ get();
}

Property Value

File system path where the file was found

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IsLocked Property (IEdmReference5)

IsLocked Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : IsLocked Property (IEdmReference5)

Gets whether the file is checked out.

Syntax

Visual Basic
ReadOnly Property IsLocked As System.Boolean
C#
System.bool IsLocked {get;}
C++/CLI
property System.bool IsLocked {
   System.bool get();
}

Property Value

True if the file is checked out, false if not

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


LockedByUser Property (IEdmReference5)

LockedByUser Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : LockedByUser Property (IEdmReference5)

Gets the the user who checked out the file.

Syntax

Visual Basic
ReadOnly Property LockedByUser As IEdmUser5
C#
IEdmUser5 LockedByUser {get;}
C++/CLI
property IEdmUser5^ LockedByUser {
   IEdmUser5^ get();
}

Property Value

User who checked out the file

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


LockedInFolder Property (IEdmReference5)

LockedInFolder Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : LockedInFolder Property (IEdmReference5)

Gets the folder in which the file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedInFolder As IEdmFolder5
C#
IEdmFolder5 LockedInFolder {get;}
C++/CLI
property IEdmFolder5^ LockedInFolder {
   IEdmFolder5^ get();
}

Property Value

Folder in which the file is checked out

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


LockedOnComputer Property (IEdmReference5)

LockedOnComputer Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : LockedOnComputer Property (IEdmReference5)

Gets the name of the computer on which the file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedOnComputer As System.String
C#
System.string LockedOnComputer {get;}
C++/CLI
property System.String^ LockedOnComputer {
   System.String^ get();
}

Property Value

Name of the computer on which the file is checked out

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


LockPath Property (IEdmReference5)

LockPath Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : LockPath Property (IEdmReference5)

Gets the file's check-out path.

Syntax

Visual Basic
ReadOnly Property LockPath As System.String
C#
System.string LockPath {get;}
C++/CLI
property System.String^ LockPath {
   System.String^ get();
}

Remarks

The retrun value is empty if the file is not checked out.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


Name Property (IEdmReference5)

Name Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : Name Property (IEdmReference5)

Gets the name of the file.

Syntax

Visual Basic
ReadOnly Property Name As System.String
C#
System.string Name {get;}
C++/CLI
property System.String^ Name {
   System.String^ get();
}

Property Value

Name of the file

Remarks

The return value does not include the directory path.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


ReferencedAs Property (IEdmReference5)

ReferencedAs Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : ReferencedAs Property (IEdmReference5)

Gets how the file is included by the referencing file.

Syntax

Visual Basic
ReadOnly Property ReferencedAs As System.String
C#
System.string ReferencedAs {get;}
C++/CLI
property System.String^ ReferencedAs {
   System.String^ get();
}

Property Value

How the file is included by the referencing file

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


VersionLocal Property (IEdmReference5)

VersionLocal Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : VersionLocal Property (IEdmReference5)

Gets the local version number of the file.

Syntax

Visual Basic
ReadOnly Property VersionLocal As System.Integer
C#
System.int VersionLocal {get;}
C++/CLI
property System.int VersionLocal {
   System.int get();
}

Property Value

Local version number of the file

See Also

IEdmReference5 Interface
IEdmReference5 Members
IEdmReference5::VersionRef Property ()

Availability

Version 5.2 of SOLIDWORKS PDM Professional


VersionRef Property (IEdmReference5)

VersionRef Property (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : VersionRef Property (IEdmReference5)

Gets the referenced version number of the file.

Syntax

Visual Basic
ReadOnly Property VersionRef As System.Integer
C#
System.int VersionRef {get;}
C++/CLI
property System.int VersionRef {
   System.int get();
}

Property Value

Referenced version number of the file

Remarks

The referenced version number is also known as the attached version.

See Also

IEdmReference5 Interface
IEdmReference5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


IEdmReference6 Interface

IEdmReference6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmReference6 Interface

Allows you to enumerate referenced and referencing files and set up user-defined references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmReference6
   Inherits IEdmReference5
C#
public interface IEdmReference6 : IEdmReference5
C++/CLI
public interface class IEdmReference6 : public IEdmReference5

Remarks

The interface:

  • inherits from IEdmReference5.
  • is extended by IEdmReference7.

Some file types, such as files from AutoCAD, SOLIDWORKS, Microsoft Word, etc., can contain references to other files. Regardless of file type, you can also set up your own references using SOLIDWORKS PDM Professional's User Defined File References dialog box in file properties. SOLIDWORKS PDM Professional manages all of these references for you and they show up, for example, in the check-in dialog box in the form of a reference tree.

Using IEdmReference5, you can enumerate referenced files and referencing files. You can also set up user-defined references using IEdmReference5.

See Also

IEdmReference6 Members
EPDM.Interop.epdm Namespace
IEdmReference8 Interface
IEdmReference9 Interface


IEdmReference6 Interface Members

IEdmReference6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmReference6 Interface

The following tables list the members exposed by IEdmReference6.

Public Properties

 | Name | Description
Property | RefCount | Gets the number of times the referenced file is included by the referencing file.
Top

See Also

IEdmReference6 Interface
EPDM.Interop.epdm Namespace
IEdmReference8 Interface
IEdmReference9 Interface


IEdmReference6 Interface Properties

IEdmReference6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmReference6 Interface

For a list of all members of this type, see IEdmReference6 members.

Public Properties

 | Name | Description
Property | RefCount | Gets the number of times the referenced file is included by the referencing file.
Top

See Also

IEdmReference6 Interface
EPDM.Interop.epdm Namespace
IEdmReference8 Interface
IEdmReference9 Interface


RefCount Property (IEdmReference6)

RefCount Property (IEdmReference6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference6 Interface : RefCount Property (IEdmReference6)

Gets the number of times the referenced file is included by the referencing file.

Syntax

Visual Basic
ReadOnly Property RefCount As System.Integer
C#
System.int RefCount {get;}
C++/CLI
property System.int RefCount {
   System.int get();
}

Property Value

Number of times the referenced file is included by the referencing file (see Remarks)

Remarks

This property is 0 if the file format does not allow SOLIDWORKS PDM Professional to access the information.

See Also

IEdmReference6 Interface
IEdmReference6 Members
IEdmReference8::RefCountEdited Property ()

Availability

Version 6.0 of SOLIDWORKS PDM Professional


IEdmReference7 Interface

IEdmReference7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmReference7 Interface

Allows you to enumerate referenced and referencing files and set up user-defined references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmReference7
   Inherits IEdmReference5, IEdmReference6
C#
public interface IEdmReference7 : IEdmReference5, IEdmReference6
C++/CLI
public interface class IEdmReference7 : public IEdmReference5, IEdmReference6

Example

Get Parent References of File (VB.NET)
Get Parent References of File (C#)

Remarks

This interface:

  • provides more control over which children or parent files to enumerate than earlier versions of this interface.
  • inherits from IEdmReference6.
  • is extended by IEdmReference8.

See Also

IEdmReference7 Members
EPDM.Interop.epdm Namespace
IEdmReference5 Interface
IEdmReference9 Interface


IEdmReference7 Interface Members

IEdmReference7 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmReference7 Interface

The following tables list the members exposed by IEdmReference7.

Public Properties

 | Name | Description
Property | EdmRefFlags | Gets the types of references.
Top

Public Methods

 | Name | Description
Method | GetFirstChildPosition2 | Obsolete. Superseded by IEdmReference9::GetFirstChildPosition3 .
Method | GetFirstParentPosition2 | Starts an enumeration of parent references.
Top

See Also

IEdmReference7 Interface
EPDM.Interop.epdm Namespace
IEdmReference5 Interface
IEdmReference9 Interface


IEdmReference7 Interface Methods

IEdmReference7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmReference7 Interface

For a list of all members of this type, see IEdmReference7 members.

Public Methods

 | Name | Description
Method | GetFirstChildPosition2 | Obsolete. Superseded by IEdmReference9::GetFirstChildPosition3 .
Method | GetFirstParentPosition2 | Starts an enumeration of parent references.
Top

See Also

IEdmReference7 Interface
EPDM.Interop.epdm Namespace
IEdmReference5 Interface
IEdmReference9 Interface


GetFirstParentPosition2 Method (IEdmReference7)

GetFirstParentPosition2 Method (IEdmReference7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference7 Interface : GetFirstParentPosition2 Method (IEdmReference7)

lVersionOrZero
Non-0 value enumerates the files referencing the specified version of the file; argument is ignored if value is 0
bGetAllParentVersions
True to return all versions, of all parents, referencing this file; false to return on the latest referencing version
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
Starts an enumeration of parent references.

Syntax

Visual Basic
Function GetFirstParentPosition2( _
   ByVal lVersionOrZero As System.Integer, _
   ByVal bGetAllParentVersions As System.Boolean, _
   ByVal lEdmRefFlags As System.Integer _
) As IEdmPos5
C#
IEdmPos5 GetFirstParentPosition2(
   System.int lVersionOrZero,
   System.bool bGetAllParentVersions,
   System.int lEdmRefFlags
)
C++/CLI
IEdmPos5^ GetFirstParentPosition2(
&   System.int lVersionOrZero,
&   System.bool bGetAllParentVersions,
&   System.int lEdmRefFlags
)

Parameters

lVersionOrZero
Non-0 value enumerates the files referencing the specified version of the file; argument is ignored if value is 0
bGetAllParentVersions
True to return all versions, of all parents, referencing this file; false to return on the latest referencing version
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags

Return Value

Position of first file referencing this file

Example

See the IEdmReference7 examples.

Remarks

Pass the position to IEdmReference5::GetNextParent to continue to enumerate all of the parent files.

C++ programmers not using smart-pointer wrapper functions must release the position.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference7 Interface
IEdmReference7 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmReference7 Interface Properties

IEdmReference7 Interface Properties
EPDM.Interop.epdm Namespace : IEdmReference7 Interface

For a list of all members of this type, see IEdmReference7 members.

Public Properties

 | Name | Description
Property | EdmRefFlags | Gets the types of references.
Top

See Also

IEdmReference7 Interface
EPDM.Interop.epdm Namespace
IEdmReference5 Interface
IEdmReference9 Interface


EdmRefFlags Property (IEdmReference7)

EdmRefFlags Property (IEdmReference7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference7 Interface : EdmRefFlags Property (IEdmReference7)

Gets the types of references.

Syntax

Visual Basic
ReadOnly Property EdmRefFlags As System.Integer
C#
System.int EdmRefFlags {get;}
C++/CLI
property System.int EdmRefFlags {
   System.int get();
}

Property Value

Types of references as defined in EdmRefFlags

See Also

IEdmReference7 Interface
IEdmReference7 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmReference8 Interface

IEdmReference8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmReference8 Interface

Allows you to enumerate referenced and referencing files and set up user-defined references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmReference8
   Inherits IEdmReference5, IEdmReference6, IEdmReference7
C#
public interface IEdmReference8 : IEdmReference5, IEdmReference6, IEdmReference7
C++/CLI
public interface class IEdmReference8 : public IEdmReference5, IEdmReference6, IEdmReference7

Remarks

This interface:

  • allows you to read and update the reference count used in bills of materials.
  • inherits from IEdmReference7.
  • is extended by IEdmReference9.

See Also

IEdmReference8 Members
EPDM.Interop.epdm Namespace


IEdmReference8 Interface Members

IEdmReference8 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmReference8 Interface

The following tables list the members exposed by IEdmReference8.

Public Properties

 | Name | Description
Property | RefCountEdited | Gets or sets the reference count used in bills of materials.
Top

See Also

IEdmReference8 Interface
EPDM.Interop.epdm Namespace


IEdmReference8 Interface Properties

IEdmReference8 Interface Properties
EPDM.Interop.epdm Namespace : IEdmReference8 Interface

For a list of all members of this type, see IEdmReference8 members.

Public Properties

 | Name | Description
Property | RefCountEdited | Gets or sets the reference count used in bills of materials.
Top

See Also

IEdmReference8 Interface
EPDM.Interop.epdm Namespace


RefCountEdited Property (IEdmReference8)

RefCountEdited Property (IEdmReference8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference8 Interface : RefCountEdited Property (IEdmReference8)

Gets or sets the reference count used in bills of materials.

Syntax

Visual Basic
Property RefCountEdited As System.Integer
C#
System.int RefCountEdited {get; set;}
C++/CLI
property System.int RefCountEdited {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Reference count used in bills of materials

Remarks

A value of -1 is returned if the reference count has not been edited.

See Also

IEdmReference8 Interface
IEdmReference8 Members
IEdmReference6::RefCount Property ()

Availability

SOLIDWORKS PDM Professional 2011


IEdmReference9 Interface

IEdmReference9 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmReference9 Interface

Allows you to enumerate referenced and referencing files and set up user-defined references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmReference9
   Inherits IEdmReference5, IEdmReference6, IEdmReference7, IEdmReference8
C#
public interface IEdmReference9 : IEdmReference5, IEdmReference6, IEdmReference7, IEdmReference8
C++/CLI
public interface class IEdmReference9 : public IEdmReference5, IEdmReference6, IEdmReference7, IEdmReference8

Remarks

This interface:

  • allows you to get the name of this reference's configuration and start an enumeration of child references for a specified project.
  • inherits from IEdmReference8.
  • is extended by IEdmReference10.

See Also

IEdmReference9 Members
EPDM.Interop.epdm Namespace


IEdmReference9 Interface Members

IEdmReference9 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmReference9 Interface

The following tables list the members exposed by IEdmReference9.

Public Properties

 | Name | Description
Property | RefConfiguration | Gets the name of this reference's configuration.
Top

Public Methods

 | Name | Description
Method | GetFirstChildPosition3 | Obsolete. Superseded by IEdmReference10::GetFirstChildPosition4 .
Top

See Also

IEdmReference9 Interface
EPDM.Interop.epdm Namespace


IEdmReference9 Interface Methods

IEdmReference9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmReference9 Interface

For a list of all members of this type, see IEdmReference9 members.

Public Methods

 | Name | Description
Method | GetFirstChildPosition3 | Obsolete. Superseded by IEdmReference10::GetFirstChildPosition4 .
Top

See Also

IEdmReference9 Interface
EPDM.Interop.epdm Namespace


GetFirstChildPosition3 Method (IEdmReference9)

GetFirstChildPosition3 Method (IEdmReference9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference9 Interface : GetFirstChildPosition3 Method (IEdmReference9)

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
bsConfiguration
Configuration name for which to get child references (see Remarks)
lVersion
Version for which to get references; use 0 for latest version
Obsolete. Superseded by IEdmReference10::GetFirstChildPosition4 .

Syntax

Visual Basic
Function GetFirstChildPosition3( _
   ByRef pbsProjectName As System.String, _
   ByVal bIsTopParent As System.Boolean, _
   ByVal bPermitReadLocal As System.Boolean, _
   ByVal lEdmRefFlags As System.Integer, _
   ByVal bsConfiguration As System.String, _
   Optional ByVal lVersion As System.Integer _
) As IEdmPos5
C#
IEdmPos5 GetFirstChildPosition3(
   out System.string pbsProjectName,
   System.bool bIsTopParent,
   System.bool bPermitReadLocal,
   System.int lEdmRefFlags,
   System.string bsConfiguration,
   System.int lVersion
)
C++/CLI
IEdmPos5^ GetFirstChildPosition3(
&   [Out] System.String^ pbsProjectName,
&   System.bool bIsTopParent,
&   System.bool bPermitReadLocal,
&   System.int lEdmRefFlags,
&   System.String^ bsConfiguration,
&   System.int lVersion
)

Parameters

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
bsConfiguration
Configuration name for which to get child references (see Remarks)
lVersion
Version for which to get references; use 0 for latest version

Return Value

Position of the first file referenced by this file (see Remarks)

Remarks

You should maintain and pass in a string, by reference, in this argument for all calls to this method in a reference tree. The project name can be allocated and returned by the topmost node in the tree and is used by its children.

IEdmReference6::RefCount and IEdmReference8::RefCountEdited for child references return values for corresponding referenced configurations. If an empty string is passed to bsConfiguration, then the file's common configuration is used.

Pass the position returned by this method to IEdmReference5::GetNextChild to continue to enumerate the referenced files.

C++ programmers not using smart-pointer wrapper functions must release the position.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference9 Interface
IEdmReference9 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmReference9 Interface Properties

IEdmReference9 Interface Properties
EPDM.Interop.epdm Namespace : IEdmReference9 Interface

For a list of all members of this type, see IEdmReference9 members.

Public Properties

 | Name | Description
Property | RefConfiguration | Gets the name of this reference's configuration.
Top

See Also

IEdmReference9 Interface
EPDM.Interop.epdm Namespace


RefConfiguration Property (IEdmReference9)

RefConfiguration Property (IEdmReference9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference9 Interface : RefConfiguration Property (IEdmReference9)

Gets the name of this reference's configuration.

Syntax

Visual Basic
ReadOnly Property RefConfiguration As System.String
C#
System.string RefConfiguration {get;}
C++/CLI
property System.String^ RefConfiguration {
   System.String^ get();
}

Property Value

Name of this reference's configuration

See Also

IEdmReference9 Interface
IEdmReference9 Members

Availability

SOLIDWORKS PDM Professional 2011 SP3


IEdmRefItem Interface

IEdmRefItem Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmRefItem Interface

Allows you to access an item in an IEdmRefItemContainer.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRefItem
C#
public interface IEdmRefItem
C++/CLI
public interface class IEdmRefItem

Example

Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmRefItem2.

See Also

IEdmRefItem Members
EPDM.Interop.epdm Namespace


IEdmRefItem Interface Members

IEdmRefItem Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRefItem Interface

The following tables list the members exposed by IEdmRefItem.

Public Methods

 | Name | Description
Method | GetProperty | Gets the value of the specified property of this item.
Method | GetRefs | Gets the references of this item.
Method | SetProperty | Updates the specified property of this item.
Top

See Also

IEdmRefItem Interface
EPDM.Interop.epdm Namespace


IEdmRefItem Interface Methods

IEdmRefItem Interface Methods
EPDM.Interop.epdm Namespace : IEdmRefItem Interface

For a list of all members of this type, see IEdmRefItem members.

Public Methods

 | Name | Description
Method | GetProperty | Gets the value of the specified property of this item.
Method | GetRefs | Gets the references of this item.
Method | SetProperty | Updates the specified property of this item.
Top

See Also

IEdmRefItem Interface
EPDM.Interop.epdm Namespace


GetProperty Method (IEdmRefItem)

GetProperty Method (IEdmRefItem)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRefItem Interface : GetProperty Method (IEdmRefItem)

eProperty
Type of property for which to get a value as defined in EdmRefItemProperty
poValue
Property value
Gets the value of the specified property of this item.

Syntax

Visual Basic
Function GetProperty( _
   ByVal eProperty As EdmRefItemProperty, _
   ByRef poValue As System.Object _
) As System.Boolean
C#
System.bool GetProperty(
   EdmRefItemProperty eProperty,
   out System.object poValue
)
C++/CLI
System.bool GetProperty(
&   EdmRefItemProperty eProperty,
&   [Out] System.Object^ poValue
)

Parameters

eProperty
Type of property for which to get a value as defined in EdmRefItemProperty
poValue
Property value

Return Value

True if this property can be modified, false if not

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_INVALIDARG: One of the arguments is invalid.

See Also

IEdmRefItem Interface
IEdmRefItem Members

Availability

SOLIDWORKS PDM Professional Version 6.4


GetRefs Method (IEdmRefItem)

GetRefs Method (IEdmRefItem)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRefItem Interface : GetRefs Method (IEdmRefItem)

eType
Type of reference to get as defined in EdmRefType
ppoRetItems
Array of IEdmRefItems; one interface pointer for each item reference
Gets the references of this item.

Syntax

Visual Basic
Sub GetRefs( _
   ByVal eType As EdmRefType, _
   ByRef ppoRetItems() As System.Object _
)
C#
void GetRefs(
   EdmRefType eType,
   out System.object[] ppoRetItems
)
C++/CLI
void GetRefs(
&   EdmRefType eType,
&   [Out] System.array<Object^>^ ppoRetItems
)

Parameters

eType
Type of reference to get as defined in EdmRefType
ppoRetItems
Array of IEdmRefItems; one interface pointer for each item reference

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRefItem Interface
IEdmRefItem Members

Availability

SOLIDWORKS PDM Professional Version 6.4


SetProperty Method (IEdmRefItem)

SetProperty Method (IEdmRefItem)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRefItem Interface : SetProperty Method (IEdmRefItem)

eProperty
Type of property to update as defined in EdmRefItemProperty
oValue
New property value
Updates the specified property of this item.

Syntax

Visual Basic
Sub SetProperty( _
   ByVal eProperty As EdmRefItemProperty, _
   ByVal oValue As System.Object _
)
C#
void SetProperty(
   EdmRefItemProperty eProperty,
   System.object oValue
)
C++/CLI
void SetProperty(
&   EdmRefItemProperty eProperty,
&   System.Object^ oValue
)

Parameters

eProperty
Type of property to update as defined in EdmRefItemProperty
oValue
New property value

Example

Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_INVALIDARG: The eProperty argument contains a property that cannot be updated in this container, or oValue does not match the type specified in eProperty.

See Also

IEdmRefItem Interface
IEdmRefItem Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmRefItem2 Interface

IEdmRefItem2 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmRefItem2 Interface

Allows you to access an item in an IEdmRefItemContainer.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRefItem2
   Inherits IEdmRefItem
C#
public interface IEdmRefItem2 : IEdmRefItem
C++/CLI
public interface class IEdmRefItem2 : public IEdmRefItem

Remarks

This interface extends IEdmRefItem by providing the ability to get the old and new paths of references that have been moved or renamed by another client.

Accessors

IEdmRefItemContainer::GetItems

See Also

IEdmRefItem2 Members
EPDM.Interop.epdm Namespace


IEdmRefItem2 Interface Members

IEdmRefItem2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRefItem2 Interface

The following tables list the members exposed by IEdmRefItem2.

Public Methods

 | Name | Description
Method | GetUpdatedPaths | Gets the old and new paths of references that have been moved or renamed by another client.
Top

See Also

IEdmRefItem2 Interface
EPDM.Interop.epdm Namespace


IEdmRefItem2 Interface Methods

IEdmRefItem2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmRefItem2 Interface

For a list of all members of this type, see IEdmRefItem2 members.

Public Methods

 | Name | Description
Method | GetUpdatedPaths | Gets the old and new paths of references that have been moved or renamed by another client.
Top

See Also

IEdmRefItem2 Interface
EPDM.Interop.epdm Namespace


GetUpdatedPaths Method (IEdmRefItem2)

GetUpdatedPaths Method (IEdmRefItem2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRefItem2 Interface : GetUpdatedPaths Method (IEdmRefItem2)

ppoUpdatedPathArr
Array of EdmUpdatedRefPaths
Gets the old and new paths of references that have been moved or renamed by another client.

Syntax

Visual Basic
Sub GetUpdatedPaths( _
   ByRef ppoUpdatedPathArr() As EdmUpdatedRefPath _
)
C#
void GetUpdatedPaths(
   out EdmUpdatedRefPath[] ppoUpdatedPathArr
)
C++/CLI
void GetUpdatedPaths(
&   [Out] array<EdmUpdatedRefPath>^ ppoUpdatedPathArr
)

Parameters

ppoUpdatedPathArr
Array of EdmUpdatedRefPaths

See Also

IEdmRefItem2 Interface
IEdmRefItem2 Members

Availability

SOLIDWORKS PDM Professional 2021 SP04


IEdmRefItemContainer Interface

IEdmRefItemContainer Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmRefItemContainer Interface

Allows you to access items in file reference dialogs.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRefItemContainer
C#
public interface IEdmRefItemContainer
C++/CLI
public interface class IEdmRefItemContainer

Example

Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To access this interface, cast an IEdmBatchUnlock object to a pointer to IEdmRefItemContainer, or use QueryInterface in C++.

See Also

IEdmRefItemContainer Members
EPDM.Interop.epdm Namespace


IEdmRefItemContainer Interface Members

IEdmRefItemContainer Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRefItemContainer Interface

The following tables list the members exposed by IEdmRefItemContainer.

Public Methods

 | Name | Description
Method | GetItems | Gets items from this container.
Top

See Also

IEdmRefItemContainer Interface
EPDM.Interop.epdm Namespace


IEdmRefItemContainer Interface Methods

IEdmRefItemContainer Interface Methods
EPDM.Interop.epdm Namespace : IEdmRefItemContainer Interface

For a list of all members of this type, see IEdmRefItemContainer members.

Public Methods

 | Name | Description
Method | GetItems | Gets items from this container.
Top

See Also

IEdmRefItemContainer Interface
EPDM.Interop.epdm Namespace


GetItems Method (IEdmRefItemContainer)

GetItems Method (IEdmRefItemContainer)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRefItemContainer Interface : GetItems Method (IEdmRefItemContainer)

eType
Type of items to get as defined in EdmRefItemType
ppoRetItems
Array of IEdmRefItems; one interface for each reference item
Gets items from this container.

Syntax

Visual Basic
Sub GetItems( _
   ByVal eType As EdmRefItemType, _
   ByRef ppoRetItems() As System.Object _
)
C#
void GetItems(
   EdmRefItemType eType,
   out System.object[] ppoRetItems
)
C++/CLI
void GetItems(
&   EdmRefItemType eType,
&   [Out] System.array<Object^>^ ppoRetItems
)

Parameters

eType
Type of items to get as defined in EdmRefItemType
ppoRetItems
Array of IEdmRefItems; one interface for each reference item

Example

Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRefItemContainer Interface
IEdmRefItemContainer Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmRevision5 Interface

IEdmRevision5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmRevision5 Interface

Allows you to access a single revision of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRevision5
C#
public interface IEdmRevision5
C++/CLI
public interface class IEdmRevision5

Example

Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmRevision6.

Accessors

IEdmEnumeratorVersion5::GetNextRevision

IEdmVersion5::GetNextRevision

See Also

IEdmRevision5 Members
EPDM.Interop.epdm Namespace


IEdmRevision5 Interface Members

IEdmRevision5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmRevision5 Interface

The following tables list the members exposed by IEdmRevision5.

Public Properties

 | Name | Description
Property | Name | Gets the name of this revision.
Property | Time | Gets the creation date and time of this revision.
Property | User | Gets the user who created this revision.
Property | UserID | Gets the ID of the user who created this revision.
Property | Version | Gets the version on which this revision is set.
Property | VersionNo | Gets the version number of the version on which this revision is set.
Top

Public Methods

 | Name | Description
Method | GetFileCopy | Gets a copy of this revision of the file from the archive and places it in the specified folder on the client machine.
Method | Rollback | Obsolete. Superseded by IEdmRevision6::Rollback2 .
Top

See Also

IEdmRevision5 Interface
EPDM.Interop.epdm Namespace


IEdmRevision5 Interface Methods

IEdmRevision5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmRevision5 Interface

For a list of all members of this type, see IEdmRevision5 members.

Public Methods

 | Name | Description
Method | GetFileCopy | Gets a copy of this revision of the file from the archive and places it in the specified folder on the client machine.
Method | Rollback | Obsolete. Superseded by IEdmRevision6::Rollback2 .
Top

See Also

IEdmRevision5 Interface
EPDM.Interop.epdm Namespace


GetFileCopy Method (IEdmRevision5)

GetFileCopy Method (IEdmRevision5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : GetFileCopy Method (IEdmRevision5)

lParentWnd
Parent window handle
poPathOrFolderID
Path or ID of the folder where to place the file; default copies the file to all of the folders to which it is shared (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGetFlag.EdmGet_MakeReadOnly
bsNewName
Optional new name of the file copy; "" to use the file's current name
Gets a copy of this revision of the file from the archive and places it in the specified folder on the client machine.

Syntax

Visual Basic
Sub GetFileCopy( _
   ByVal lParentWnd As System.Integer, _
   Optional ByRef poPathOrFolderID As System.Object, _
   Optional ByVal lEdmGetFlags As System.Integer, _
   Optional ByVal bsNewName As System.String _
)
C#
void GetFileCopy(
   System.int lParentWnd,
   ref System.object poPathOrFolderID,
   System.int lEdmGetFlags,
   System.string bsNewName
)
C++/CLI
void GetFileCopy(
&   System.int lParentWnd,
&   System.Object^% poPathOrFolderID,
&   System.int lEdmGetFlags,
&   System.String^ bsNewName
)

Parameters

lParentWnd
Parent window handle
poPathOrFolderID
Path or ID of the folder where to place the file; default copies the file to all of the folders to which it is shared (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGetFlag.EdmGet_MakeReadOnly
bsNewName
Optional new name of the file copy; "" to use the file's current name

Remarks

If you specify a path for poPathOrFolderID, you can either give a file path or a folder path. Folder paths must be terminated by a backslash ('\').

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_FOUND: The file was not found in the vault.
  • E_EDM_PERMISSION_DENIED: The user is not permitted to see the specified version of the file.
  • E_EDM_INVALID_REVISION_NUMBER: The revision was not found.

See Also

IEdmRevision5 Interface
IEdmRevision5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Rollback Method (IEdmRevision5)

Rollback Method (IEdmRevision5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : Rollback Method (IEdmRevision5)

Obsolete. Superseded by IEdmRevision6::Rollback2 .

Syntax

Visual Basic
Sub Rollback()
C#
void Rollback()
C++/CLI
void Rollback();

Remarks

This method destroys all versions after this revision number. To undo this rollback operation, you need to restore a backup of the entire database and file archives.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete files.

See Also

IEdmRevision5 Interface
IEdmRevision5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmRevision5 Interface Properties

IEdmRevision5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmRevision5 Interface

For a list of all members of this type, see IEdmRevision5 members.

Public Properties

 | Name | Description
Property | Name | Gets the name of this revision.
Property | Time | Gets the creation date and time of this revision.
Property | User | Gets the user who created this revision.
Property | UserID | Gets the ID of the user who created this revision.
Property | Version | Gets the version on which this revision is set.
Property | VersionNo | Gets the version number of the version on which this revision is set.
Top

See Also

IEdmRevision5 Interface
EPDM.Interop.epdm Namespace


Name Property (IEdmRevision5)

Name Property (IEdmRevision5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : Name Property (IEdmRevision5)

Gets the name of this revision.

Syntax

Visual Basic
ReadOnly Property Name As System.String
C#
System.string Name {get;}
C++/CLI
property System.String^ Name {
   System.String^ get();
}

Property Value

Revision name

Example

Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

See Also

IEdmRevision5 Interface
IEdmRevision5 Members


Time Property (IEdmRevision5)

Time Property (IEdmRevision5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : Time Property (IEdmRevision5)

Gets the creation date and time of this revision.

Syntax

Visual Basic
ReadOnly Property Time As System.Object
C#
System.object Time {get;}
C++/CLI
property System.Object^ Time {
   System.Object^ get();
}

Property Value

Creation date and time

See Also

IEdmRevision5 Interface
IEdmRevision5 Members


User Property (IEdmRevision5)

User Property (IEdmRevision5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : User Property (IEdmRevision5)

Gets the user who created this revision.

Syntax

Visual Basic
ReadOnly Property User As IEdmUser5
C#
IEdmUser5 User {get;}
C++/CLI
property IEdmUser5^ User {
   IEdmUser5^ get();
}

Property Value

IEdmUser5

See Also

IEdmRevision5 Interface
IEdmRevision5 Members


UserID Property (IEdmRevision5)

UserID Property (IEdmRevision5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : UserID Property (IEdmRevision5)

Gets the ID of the user who created this revision.

Syntax

Visual Basic
ReadOnly Property UserID As System.Integer
C#
System.int UserID {get;}
C++/CLI
property System.int UserID {
   System.int get();
}

Property Value

ID of the user who created this revision

See Also

IEdmRevision5 Interface
IEdmRevision5 Members


Version Property (IEdmRevision5)

Version Property (IEdmRevision5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : Version Property (IEdmRevision5)

Gets the version on which this revision is set.

Syntax

Visual Basic
ReadOnly Property Version As IEdmVersion5
C#
IEdmVersion5 Version {get;}
C++/CLI
property IEdmVersion5^ Version {
   IEdmVersion5^ get();
}

Property Value

IEdmVersion5

See Also

IEdmRevision5 Interface
IEdmRevision5 Members


VersionNo Property (IEdmRevision5)

VersionNo Property (IEdmRevision5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevision5 Interface : VersionNo Property (IEdmRevision5)

Gets the version number of the version on which this revision is set.

Syntax

Visual Basic
ReadOnly Property VersionNo As System.Integer
C#
System.int VersionNo {get;}
C++/CLI
property System.int VersionNo {
   System.int get();
}

Property Value

Version number

Example

Roll Back Revisions (C#)
Roll Back Revisions (VB.NET)

See Also

IEdmRevision5 Interface
IEdmRevision5 Members


IEdmRevision6 Interface

IEdmRevision6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmRevision6 Interface

Allows you to access a single revision of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRevision6
   Inherits IEdmRevision5
C#
public interface IEdmRevision6 : IEdmRevision5
C++/CLI
public interface class IEdmRevision6 : public IEdmRevision5

Remarks

This interface:

  • extends IEdmRevision5.
  • is extended by IEdmRevision7.

See Also

IEdmRevision6 Members
EPDM.Interop.epdm Namespace


IEdmRevision6 Interface Members

IEdmRevision6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRevision6 Interface

The following tables list the members exposed by IEdmRevision6.

Public Methods

 | Name | Description
Method | Rollback2 | Obsolete. Superseded by IEdmRevision7::Rollback3.
Top

See Also

IEdmRevision6 Interface
EPDM.Interop.epdm Namespace


IEdmRevision6 Interface Methods

IEdmRevision6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmRevision6 Interface

For a list of all members of this type, see IEdmRevision6 members.

Public Methods

 | Name | Description
Method | Rollback2 | Obsolete. Superseded by IEdmRevision7::Rollback3.
Top

See Also

IEdmRevision6 Interface
EPDM.Interop.epdm Namespace


IEdmRevision7 Interface

IEdmRevision7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmRevision7 Interface

Allows you to access a single revision of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRevision7
   Inherits IEdmRevision5, IEdmRevision6
C#
public interface IEdmRevision7 : IEdmRevision5, IEdmRevision6
C++/CLI
public interface class IEdmRevision7 : public IEdmRevision5, IEdmRevision6

Example

Roll Back Revisions (C#)
Roll Back Revisions (VB.NET)

Remarks

This interface extends IEdmRevision6.

See Also

IEdmRevision7 Members
EPDM.Interop.epdm Namespace


IEdmRevision7 Interface Members

IEdmRevision7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRevision7 Interface

The following tables list the members exposed by IEdmRevision7.

Public Methods

 | Name | Description
Method | Rollback3 | Rolls this file back to the version of this revision.
Top

See Also

IEdmRevision7 Interface
EPDM.Interop.epdm Namespace


IEdmRevision7 Interface Methods

IEdmRevision7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmRevision7 Interface

For a list of all members of this type, see IEdmRevision7 members.

Public Methods

 | Name | Description
Method | Rollback3 | Rolls this file back to the version of this revision.
Top

See Also

IEdmRevision7 Interface
EPDM.Interop.epdm Namespace


Rollback3 Method (IEdmRevision7)

Rollback3 Method (IEdmRevision7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevision7 Interface : Rollback3 Method (IEdmRevision7)

bsComment
Comment for this revision
vbRedirectParentRefs
True to roll back the file with its parent references, false to roll back the file without its parent references
Rolls this file back to the version of this revision.

Syntax

Visual Basic
Sub Rollback3( _
   ByVal bsComment As System.String, _
   ByVal vbRedirectParentRefs As System.Boolean _
)
C#
void Rollback3(
   System.string bsComment,
   System.bool vbRedirectParentRefs
)
C++/CLI
void Rollback3(
&   System.String^ bsComment,
&   System.bool vbRedirectParentRefs
)

Parameters

bsComment
Comment for this revision
vbRedirectParentRefs
True to roll back the file with its parent references, false to roll back the file without its parent references

Example

Roll Back Revisions (C#)
Roll Back Revisions (VB.NET)

Remarks

This method destroys all versions after this revision number. To undo this rollback operation, you need to restore a backup of the entire database and file archives.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete files.

See Also

IEdmRevision7 Interface
IEdmRevision7 Members
IEdmEnumeratorVersion7::Rollback3 Method ()
IEdmVersion8::Rollback3 Method ()

Availability

SOLIDWORKS PDM Professional 2017


IEdmRevisionMgr Interface

IEdmRevisionMgr Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmRevisionMgr Interface

Allows you to update revision numbers on many files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRevisionMgr
C#
public interface IEdmRevisionMgr
C++/CLI
public interface class IEdmRevisionMgr

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmRevisionMgr2.
  • is more efficient than calling IEdmFile5::IncrementRevision for each file whose revision number you want to update.

Typical usage of this interface:

  1. Access this interface by calling IEdmVault7::CreateUtility, setting eType to EdmUtility.EdmUtil_RevisionMgr.
  2. Call IEdmRevisionMgr::SetRevisionCounters for each file whose revision counters you want to set.
  3. Call IEdmRevisionMgr::IncrementRevision for each file whose revision you want to increment.
  4. Call IEdmRevisionMgr::Commit to commit all of the changes to the database.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmRevisionMgr Members
EPDM.Interop.epdm Namespace


IEdmRevisionMgr Interface Members

IEdmRevisionMgr Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRevisionMgr Interface

The following tables list the members exposed by IEdmRevisionMgr.

Public Methods

 | Name | Description
Method | Commit | Commits all of the changes made in this batch object.
Method | GetRevisionNumberComponents | Obsolete. Superseded by IEdmRevisionMgr2::GetRevisionNumberComponents2 .
Method | IncrementRevision | Increments the revision of the specified file.
Method | SetRevisionCounters | Sets the revision number component counters to specified values.
Top

See Also

IEdmRevisionMgr Interface
EPDM.Interop.epdm Namespace


IEdmRevisionMgr Interface Methods

IEdmRevisionMgr Interface Methods
EPDM.Interop.epdm Namespace : IEdmRevisionMgr Interface

For a list of all members of this type, see IEdmRevisionMgr members.

Public Methods

 | Name | Description
Method | Commit | Commits all of the changes made in this batch object.
Method | GetRevisionNumberComponents | Obsolete. Superseded by IEdmRevisionMgr2::GetRevisionNumberComponents2 .
Method | IncrementRevision | Increments the revision of the specified file.
Method | SetRevisionCounters | Sets the revision number component counters to specified values.
Top

See Also

IEdmRevisionMgr Interface
EPDM.Interop.epdm Namespace


Commit Method (IEdmRevisionMgr)

Commit Method (IEdmRevisionMgr)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr Interface : Commit Method (IEdmRevisionMgr)

bsComment
Comment to show in the file history of revision increments
ppoErrors
Array of EdmRevError structures; one structure for each error that occurred during processing
Commits all of the changes made in this batch object.

Syntax

Visual Basic
Sub Commit( _
   ByVal bsComment As System.String, _
   ByRef ppoErrors() As EdmRevError _
)
C#
void Commit(
   System.string bsComment,
   out EdmRevError[] ppoErrors
)
C++/CLI
void Commit(
&   System.String^ bsComment,
&   [Out] array<EdmRevError>^ ppoErrors
)

Parameters

bsComment
Comment to show in the file history of revision increments
ppoErrors
Array of EdmRevError structures; one structure for each error that occurred during processing

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr Interface
IEdmRevisionMgr Members

Availability

SOLIDWORKS PDM Professional 2007


GetRevisionNumberComponents Method (IEdmRevisionMgr)

GetRevisionNumberComponents Method (IEdmRevisionMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr Interface : GetRevisionNumberComponents Method (IEdmRevisionMgr)

ppoComponents
Array of EdmRevComponent structures; one structure for each revision number component
Obsolete. Superseded by IEdmRevisionMgr2::GetRevisionNumberComponents2 .

Syntax

Visual Basic
Sub GetRevisionNumberComponents( _
   ByRef ppoComponents() As EdmRevComponent _
)
C#
void GetRevisionNumberComponents(
   out EdmRevComponent[] ppoComponents
)
C++/CLI
void GetRevisionNumberComponents(
&   [Out] array<EdmRevComponent>^ ppoComponents
)

Parameters

ppoComponents
Array of EdmRevComponent structures; one structure for each revision number component

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr Interface
IEdmRevisionMgr Members

Availability

SOLIDWORKS PDM Professional 2007


IncrementRevision Method (IEdmRevisionMgr)

IncrementRevision Method (IEdmRevisionMgr)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr Interface : IncrementRevision Method (IEdmRevisionMgr)

lFileID
ID of file on which to increment the revision
Increments the revision of the specified file.

Syntax

Visual Basic
Sub IncrementRevision( _
   ByVal lFileID As System.Integer _
)
C#
void IncrementRevision(
   System.int lFileID
)
C++/CLI
void IncrementRevision(
&   System.int lFileID
)

Parameters

lFileID
ID of file on which to increment the revision

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

Remarks

If you call IEdmRevisionMgr::SetRevisionCounters before calling this method, the new revision number that gets generated uses the counters that are specified in the call to IEdmRevisionMgr::SetRevisionCounters. If counters have not been explicitly set, the component counters are incremented by one.

The order of calls to IEdmRevisionMgr::SetRevisionCounters and this method does not matter. Calls to this method are always processed after calls to IEdmRevisionMgr::SetRevisionCounters.

After calling this method, call IEdmRevisionMgr::Commit to commit the revision increment to the database.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr Interface
IEdmRevisionMgr Members

Availability

SOLIDWORKS PDM Professional 2007


SetRevisionCounters Method (IEdmRevisionMgr)

SetRevisionCounters Method (IEdmRevisionMgr)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr Interface : SetRevisionCounters Method (IEdmRevisionMgr)

lFileID
ID of file in which to set counters
poCounters
Array of EdmRevCounter structures; one structure for each revision component
Sets the revision number component counters to specified values.

Syntax

Visual Basic
Sub SetRevisionCounters( _
   ByVal lFileID As System.Integer, _
   ByVal poCounters() As EdmRevCounter _
)
C#
void SetRevisionCounters(
   System.int lFileID,
   EdmRevCounter[] poCounters
)
C++/CLI
void SetRevisionCounters(
&   System.int lFileID,
&   array<EdmRevCounter>^ poCounters
)

Parameters

lFileID
ID of file in which to set counters
poCounters
Array of EdmRevCounter structures; one structure for each revision component

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

Remarks

This method only adds the new counters to this batch. After calling this method, you must call IEdmRevisionMgr::Commit to commit the changes to the database.

This method only sets the revision component counters. It does not generate new revision numbers using any of the revision number generators that may be using the components. To create a new revision number for the file, you must also call IEdmRevisionMgr::IncrementRevision.

The order of calls to this method and IEdmRevisionMgr::IncrementRevision does not matter. Calls to IRevisionMgr::IncrementRevision are always processed after calls to this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr Interface
IEdmRevisionMgr Members

Availability

SOLIDWORKS PDM Professional 2007


IEdmRevisionMgr2 Interface

IEdmRevisionMgr2 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmRevisionMgr2 Interface

Allows you to update revision numbers on many files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRevisionMgr2
   Inherits IEdmRevisionMgr
C#
public interface IEdmRevisionMgr2 : IEdmRevisionMgr
C++/CLI
public interface class IEdmRevisionMgr2 : public IEdmRevisionMgr

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)

Remarks

This interface:

  • extends IEdmRevisionMgr.
  • is extended by IEdmRevisionMgr3.

See Also

IEdmRevisionMgr2 Members
EPDM.Interop.epdm Namespace


IEdmRevisionMgr2 Interface Members

IEdmRevisionMgr2 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRevisionMgr2 Interface

The following tables list the members exposed by IEdmRevisionMgr2.

Public Methods

 | Name | Description
Method | GetRevisionNumberComponents2 | Gets the specified revision number components in the vault.
Method | GetRevisionNumberIDFromFile | Gets the active revision number of the specified file.
Method | GetRevisionNumberIDFromState | Gets the ID of the revision number used in the specified workflow state.
Method | GetRevisionNumbers | Gets the specified revision number in the vault.
Top

See Also

IEdmRevisionMgr2 Interface
EPDM.Interop.epdm Namespace


IEdmRevisionMgr2 Interface Methods

IEdmRevisionMgr2 Interface Methods
EPDM.Interop.epdm Namespace : IEdmRevisionMgr2 Interface

For a list of all members of this type, see IEdmRevisionMgr2 members.

Public Methods

 | Name | Description
Method | GetRevisionNumberComponents2 | Gets the specified revision number components in the vault.
Method | GetRevisionNumberIDFromFile | Gets the active revision number of the specified file.
Method | GetRevisionNumberIDFromState | Gets the ID of the revision number used in the specified workflow state.
Method | GetRevisionNumbers | Gets the specified revision number in the vault.
Top

See Also

IEdmRevisionMgr2 Interface
EPDM.Interop.epdm Namespace


GetRevisionNumberComponents2 Method (IEdmRevisionMgr2)

GetRevisionNumberComponents2 Method (IEdmRevisionMgr2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr2 Interface : GetRevisionNumberComponents2 Method (IEdmRevisionMgr2)

oNameIDorEmpty
Name or ID of revision number component to retrieve, null to retrieve all components (see Remarks)
ppoRetData
Array of EdmRevComponent2 structures; one structure for each revision number component
Gets the specified revision number components in the vault.

Syntax

Visual Basic
Sub GetRevisionNumberComponents2( _
   ByVal oNameIDorEmpty As System.Object, _
   ByRef ppoRetData() As EdmRevComponent2 _
)
C#
void GetRevisionNumberComponents2(
   System.object oNameIDorEmpty,
   out EdmRevComponent2[] ppoRetData
)
C++/CLI
void GetRevisionNumberComponents2(
&   System.Object^ oNameIDorEmpty,
&   [Out] array<EdmRevComponent2>^ ppoRetData
)

Parameters

oNameIDorEmpty
Name or ID of revision number component to retrieve, null to retrieve all components (see Remarks)
ppoRetData
Array of EdmRevComponent2 structures; one structure for each revision number component

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)

Remarks

If oNameIDorEmpty is a positive integer, it is interpreted as the ID of the component to retrieve. If it is a negative integer, it is interpreted as a revision number, and all components with that revision number are returned.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr2 Interface
IEdmRevisionMgr2 Members

Availability

SOLIDWORKS PDM Professional 2007 SP03


GetRevisionNumberIDFromFile Method (IEdmRevisionMgr2)

GetRevisionNumberIDFromFile Method (IEdmRevisionMgr2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr2 Interface : GetRevisionNumberIDFromFile Method (IEdmRevisionMgr2)

lFileID
ID of file for which to get a revision number (see Remarks)
pbCanIncrement
True if the next increment will succeed, false if not
Gets the active revision number of the specified file.

Syntax

Visual Basic
Function GetRevisionNumberIDFromFile( _
   ByVal lFileID As System.Integer, _
   ByRef pbCanIncrement As System.Boolean _
) As System.Integer
C#
System.int GetRevisionNumberIDFromFile(
   System.int lFileID,
   out System.bool pbCanIncrement
)
C++/CLI
System.int GetRevisionNumberIDFromFile(
&   System.int lFileID,
&   [Out] System.bool pbCanIncrement
)

Parameters

lFileID
ID of file for which to get a revision number (see Remarks)
pbCanIncrement
True if the next increment will succeed, false if not

Return Value

Revision number ID; 0 if no revision number is found for the file

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

Remarks

Before calling this method, set lFileID using IEdmFile5.ID.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr2 Interface
IEdmRevisionMgr2 Members

Availability

SOLIDWORKS PDM Professional 2007 SP03


GetRevisionNumberIDFromState Method (IEdmRevisionMgr2)

GetRevisionNumberIDFromState Method (IEdmRevisionMgr2)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr2 Interface : GetRevisionNumberIDFromState Method (IEdmRevisionMgr2)

lStateID
ID of workflow state for which to get a revision number (see Remarks)
Gets the ID of the revision number used in the specified workflow state.

Syntax

Visual Basic
Function GetRevisionNumberIDFromState( _
   ByVal lStateID As System.Integer _
) As System.Integer
C#
System.int GetRevisionNumberIDFromState(
   System.int lStateID
)
C++/CLI
System.int GetRevisionNumberIDFromState(
&   System.int lStateID
)

Parameters

lStateID
ID of workflow state for which to get a revision number (see Remarks)

Return Value

Revision number ID; 0 if no revision number is found for the specified workflow state

Remarks

Before calling this method, set lStateID using IEdmState5.ID.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_WORKFLOW_STATE_ID: The supplied state ID is out of bounds.

See Also

IEdmRevisionMgr2 Interface
IEdmRevisionMgr2 Members

Availability

SOLIDWORKS PDM Professional 2007 SP03


GetRevisionNumbers Method (IEdmRevisionMgr2)

GetRevisionNumbers Method (IEdmRevisionMgr2)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr2 Interface : GetRevisionNumbers Method (IEdmRevisionMgr2)

oIDorEmpty
ID of revision number to get or null to get all revision numbers in the vault
ppoRetData
Array of EdmRevNo structures; one structure for each revision number
Gets the specified revision number in the vault.

Syntax

Visual Basic
Sub GetRevisionNumbers( _
   ByVal oIDorEmpty As System.Object, _
   ByRef ppoRetData() As EdmRevNo _
)
C#
void GetRevisionNumbers(
   System.object oIDorEmpty,
   out EdmRevNo[] ppoRetData
)
C++/CLI
void GetRevisionNumbers(
&   System.Object^ oIDorEmpty,
&   [Out] array<EdmRevNo>^ ppoRetData
)

Parameters

oIDorEmpty
ID of revision number to get or null to get all revision numbers in the vault
ppoRetData
Array of EdmRevNo structures; one structure for each revision number

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr2 Interface
IEdmRevisionMgr2 Members

Availability

SOLIDWORKS PDM Professional 2007 SP03


IEdmRevisionMgr3 Interface

IEdmRevisionMgr3 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmRevisionMgr3 Interface

Allows you to update revision numbers on many files all at once.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmRevisionMgr3
   Inherits IEdmRevisionMgr, IEdmRevisionMgr2
C#
public interface IEdmRevisionMgr3 : IEdmRevisionMgr, IEdmRevisionMgr2
C++/CLI
public interface class IEdmRevisionMgr3 : public IEdmRevisionMgr, IEdmRevisionMgr2

Remarks

This interface extends IEdmRevisionMgr2.

This interface contains methods that are used internally to upgrade program versions of files in vaults. The methods are probably not of much interest to the ordinary programmer.

See Also

IEdmRevisionMgr3 Members
EPDM.Interop.epdm Namespace


IEdmRevisionMgr3 Interface Members

IEdmRevisionMgr3 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmRevisionMgr3 Interface

The following tables list the members exposed by IEdmRevisionMgr3.

Public Methods

 | Name | Description
Method | VerUpgrade_BumpRevisions | Moves all revisions set on the second-to-latest version to the latest version.
Method | VerUpgrade_ReferenceCheck | Finds parts that are referenced by assemblies and where the referenced part version is not the latest version.
Top

See Also

IEdmRevisionMgr3 Interface
EPDM.Interop.epdm Namespace


IEdmRevisionMgr3 Interface Methods

IEdmRevisionMgr3 Interface Methods
EPDM.Interop.epdm Namespace : IEdmRevisionMgr3 Interface

For a list of all members of this type, see IEdmRevisionMgr3 members.

Public Methods

 | Name | Description
Method | VerUpgrade_BumpRevisions | Moves all revisions set on the second-to-latest version to the latest version.
Method | VerUpgrade_ReferenceCheck | Finds parts that are referenced by assemblies and where the referenced part version is not the latest version.
Top

See Also

IEdmRevisionMgr3 Interface
EPDM.Interop.epdm Namespace


VerUpgrade_BumpRevisions Method (IEdmRevisionMgr3)

VerUpgrade_BumpRevisions Method (IEdmRevisionMgr3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr3 Interface : VerUpgrade_BumpRevisions Method (IEdmRevisionMgr3)

poFiles
Array of EdmSelItem structures; one structure for each file on which to bump the revision number (see Remarks)
Moves all revisions set on the second-to-latest version to the latest version.

Syntax

Visual Basic
Sub VerUpgrade_BumpRevisions( _
   ByVal poFiles() As EdmSelItem _
)
C#
void VerUpgrade_BumpRevisions(
   EdmSelItem[] poFiles
)
C++/CLI
void VerUpgrade_BumpRevisions(
&   array<EdmSelItem>^ poFiles
)

Parameters

poFiles
Array of EdmSelItem structures; one structure for each file on which to bump the revision number (see Remarks)

Remarks

You need to be logged in as a user that has permission to update revision numbers (EdmSysRightFlags.EdmSysRight_ModifyRevisionNumbers) in order to use this method. The reason you need this high level of permission is that this method overrides other permission settings on the file and changes the content of file history.

poFiles contains the array of files on which to bump revision numbers. Files lacking revisions on the second-to-latest version are ignored.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr3 Interface
IEdmRevisionMgr3 Members

Availability

SOLIDWORKS PDM Professional 2009


VerUpgrade_ReferenceCheck Method (IEdmRevisionMgr3)

VerUpgrade_ReferenceCheck Method (IEdmRevisionMgr3)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevisionMgr3 Interface : VerUpgrade_ReferenceCheck Method (IEdmRevisionMgr3)

poFiles
Array of EdmSelItem structures; one structure for each assembly file for which to find references
ppoWrongRefs
Array of EdmCheckRef structures; one structure for each part that is referenced in an earlier version than the lastest version
Finds parts that are referenced by assemblies and where the referenced part version is not the latest version.

Syntax

Visual Basic
Sub VerUpgrade_ReferenceCheck( _
   ByVal poFiles() As EdmSelItem, _
   ByRef ppoWrongRefs() As EdmCheckRef _
)
C#
void VerUpgrade_ReferenceCheck(
   EdmSelItem[] poFiles,
   out EdmCheckRef[] ppoWrongRefs
)
C++/CLI
void VerUpgrade_ReferenceCheck(
&   array<EdmSelItem>^ poFiles,
&   [Out] array<EdmCheckRef>^ ppoWrongRefs
)

Parameters

poFiles
Array of EdmSelItem structures; one structure for each assembly file for which to find references
ppoWrongRefs
Array of EdmCheckRef structures; one structure for each part that is referenced in an earlier version than the lastest version

Remarks

You need to be logged in as a user that has permission to update revision numbers (EdmSysRightFlags.EdmSysRight_ModifyRevisionNumbers) in order to use this method. The reason you need this high level of permission is that this method overrides read permission on the files and returns files that the logged-in user lacks permission to see.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmRevisionMgr3 Interface
IEdmRevisionMgr3 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmSearch10 Interface

IEdmSearch10 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSearch10 Interface

Allows you to quickly find files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearch10
   Inherits IEdmSearch5, IEdmSearch6, IEdmSearch7, IEdmSearch8, IEdmSearch9
C#
public interface IEdmSearch10 : IEdmSearch5, IEdmSearch6, IEdmSearch7, IEdmSearch8, IEdmSearch9
C++/CLI
public interface class IEdmSearch10 : public IEdmSearch5, IEdmSearch6, IEdmSearch7, IEdmSearch8, IEdmSearch9

Example

Favorite Search (VB.NET)
Favorite Search (C#)

Remarks

This interface extends IEdmSearch9 by providing the ability to perform favorite searches.

Accessors

IEdmVault5::CreateSearch

IEdmVault7::CreateUtility

See Also

IEdmSearch10 Members
EPDM.Interop.epdm Namespace


IEdmSearch10 Interface Members

IEdmSearch10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSearch10 Interface

The following tables list the members exposed by IEdmSearch10.

Public Methods

 | Name | Description
Method | GetFirstFavoriteResult | Gets the first file or folder that matches the favorite search criteria.
Top

See Also

IEdmSearch10 Interface
EPDM.Interop.epdm Namespace


IEdmSearch10 Interface Methods

IEdmSearch10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearch10 Interface

For a list of all members of this type, see IEdmSearch10 members.

Public Methods

 | Name | Description
Method | GetFirstFavoriteResult | Gets the first file or folder that matches the favorite search criteria.
Top

See Also

IEdmSearch10 Interface
EPDM.Interop.epdm Namespace


GetFirstFavoriteResult Method (IEdmSearch10)

GetFirstFavoriteResult Method (IEdmSearch10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch10 Interface : GetFirstFavoriteResult Method (IEdmSearch10)

bsFavName
Name of a favorite search
bGetCustomColumns
True to retrieve custom column information, false to not
Gets the first file or folder that matches the favorite search criteria.

Syntax

Visual Basic
Function GetFirstFavoriteResult( _
   ByVal bsFavName As System.String, _
   Optional ByVal bGetCustomColumns As System.Boolean _
) As IEdmSearchResult5
C#
IEdmSearchResult5 GetFirstFavoriteResult(
   System.string bsFavName,
   System.bool bGetCustomColumns
)
C++/CLI
IEdmSearchResult5^ GetFirstFavoriteResult(
&   System.String^ bsFavName,
&   System.bool bGetCustomColumns
)

Parameters

bsFavName
Name of a favorite search
bGetCustomColumns
True to retrieve custom column information, false to not

Return Value

IEdmSearchResult5

Example

See the IEdmSearch10 examples.

Remarks

If bGetCustomColumns is set to true and custom columns exist in the search results of bsFavName, then use IEdmSearchResult6::GetCustomColumnsInfo and IEdmSearchResult6::GetCustomColumnValues to see the custom column information.

After calling this method, call IEdmSearch5::GetNextResult repeatedly to retrieve the rest of the search results.

See Also

IEdmSearch10 Interface
IEdmSearch10 Members

Availability

SOLIDWORKS PDM Professional 2021


IEdmSearch5 Interface

IEdmSearch5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSearch5 Interface

Allows you to quickly find files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearch5
C#
public interface IEdmSearch5
C++/CLI
public interface class IEdmSearch5

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmSearch6.

There is a bit of overhead involved in creating an IEdmSearch5 object, so if you intend to perform several searches, call IEdmSearch5::Clear to clear and re-use the current search object instead of calling IEdmVault5::CreateSearch to create new search objects.

Accessors

IEdmVault5::CreateSearch

IEdmVault7::CreateUtility

See Also

IEdmSearch5 Members
EPDM.Interop.epdm Namespace


IEdmSearch5 Interface Members

IEdmSearch5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmSearch5 Interface

The following tables list the members exposed by IEdmSearch5.

Public Properties

 | Name | Description
Property | FileName | Gets or sets the name of the file or folder for which to search.
Property | FindFiles | Gets or sets whether to return files in the search.
Property | FindFolders | Gets or sets whether to return folders in the search.
Property | FindHistoricStates | Gets or sets whether to find all files that have ever been in the state specified by IEdmSearch5::State.
Property | FindLockedFiles | Gets or sets whether to include checked-out files in the search result.
Property | FindUnlockedFiles | Gets or sets whether to include checked-in files in the search result.
Property | Recursive | Gets or sets whether to search recursively in subfolders.
Property | StartFolderID | Gets or sets the ID of the folder in which to search.
Property | State | Gets or sets the ID or name of the workflow state in which to search.
Property | VersionComment | Gets or sets the version comment substring for which to search.
Top

Public Methods

 | Name | Description
Method | AddVariable | Obsolete. Superseded by IEdmSearch8::AddVariable2 .
Method | Clear | Resets all search properties to their default values
Method | GetFirstResult | Gets the first file or folder that matches the search criteria.
Method | GetNextResult | Gets the next file or folder that matches the search criteria.
Top

See Also

IEdmSearch5 Interface
EPDM.Interop.epdm Namespace


IEdmSearch5 Interface Methods

IEdmSearch5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearch5 Interface

For a list of all members of this type, see IEdmSearch5 members.

Public Methods

 | Name | Description
Method | AddVariable | Obsolete. Superseded by IEdmSearch8::AddVariable2 .
Method | Clear | Resets all search properties to their default values
Method | GetFirstResult | Gets the first file or folder that matches the search criteria.
Method | GetNextResult | Gets the next file or folder that matches the search criteria.
Top

See Also

IEdmSearch5 Interface
EPDM.Interop.epdm Namespace


Clear Method (IEdmSearch5)

Clear Method (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : Clear Method (IEdmSearch5)

Resets all search properties to their default values

Syntax

Visual Basic
Sub Clear()
C#
void Clear()
C++/CLI
void Clear();

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstResult Method (IEdmSearch5)

GetFirstResult Method (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : GetFirstResult Method (IEdmSearch5)

Gets the first file or folder that matches the search criteria.

Syntax

Visual Basic
Function GetFirstResult() As IEdmSearchResult5
C#
IEdmSearchResult5 GetFirstResult()
C++/CLI
IEdmSearchResult5^ GetFirstResult();

Return Value

IEdmSearchResult5; Nothing or null if no files or folders match the search criteria or there are syntax errors in search conditions (see Remarks)

Example

See the IEdmSearch5 and IEdmSearch9 examples.

Remarks

If the search object was obtained using IEdmVault21::CreateSearch2 (IEdmSearch9) then this method's return of Nothing or null can mean either:

  • the search found no documents,

- or -

  • there are one or more search condition syntax errrors. Call IEdmSearch9::GetSyntaxErrors to determine whether there are syntax errors. If IEdmSearch9::GetSyntaxErrors returns Nothing or null, then you can assume that this method returned Nothing or null because the search found no documents. See Search Syntax.

After calling this method, call IEdmSearch5::GetNextResult to retrieve the rest of the files and folders that match the search criteria.

C++ users must release the returned interface, IEdmSearchResult5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The method successfully executed, but no files or folders match the search criteria.

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextResult Method (IEdmSearch5)

GetNextResult Method (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : GetNextResult Method (IEdmSearch5)

Gets the next file or folder that matches the search criteria.

Syntax

Visual Basic
Function GetNextResult() As IEdmSearchResult5
C#
IEdmSearchResult5 GetNextResult()
C++/CLI
IEdmSearchResult5^ GetNextResult();

Return Value

IEdmSearchResult5; Nothing or null if no more files or folders match the search criteria

Example

See the examples for IEdmSearch5 and IEdmSearch10.

Remarks

Before calling this method, call IEdmSearch5::GetFirstResult or IEdmSearch10::GetFirstFavoriteResult to retrieve the first file or folder that matches the search criteria.

C++ users must release the returned interface, IEdmSearchResult5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The method successfully executed, but no files or folders match the search criteria.

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmSearch5 Interface Properties

IEdmSearch5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmSearch5 Interface

For a list of all members of this type, see IEdmSearch5 members.

Public Properties

 | Name | Description
Property | FileName | Gets or sets the name of the file or folder for which to search.
Property | FindFiles | Gets or sets whether to return files in the search.
Property | FindFolders | Gets or sets whether to return folders in the search.
Property | FindHistoricStates | Gets or sets whether to find all files that have ever been in the state specified by IEdmSearch5::State.
Property | FindLockedFiles | Gets or sets whether to include checked-out files in the search result.
Property | FindUnlockedFiles | Gets or sets whether to include checked-in files in the search result.
Property | Recursive | Gets or sets whether to search recursively in subfolders.
Property | StartFolderID | Gets or sets the ID of the folder in which to search.
Property | State | Gets or sets the ID or name of the workflow state in which to search.
Property | VersionComment | Gets or sets the version comment substring for which to search.
Top

See Also

IEdmSearch5 Interface
EPDM.Interop.epdm Namespace


FileName Property (IEdmSearch5)

FileName Property (IEdmSearch5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : FileName Property (IEdmSearch5)

Gets or sets the name of the file or folder for which to search.

Syntax

Visual Basic
Property FileName As System.String
C#
System.string FileName {get; set;}
C++/CLI
property System.String^ FileName {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Name of file or folder for which to search (see Remarks)

Example

See the IEdmSearch9 examples.

Example

Batch Update Card Variables (VB.NET)
Batch Update Card Variables (C#)

Remarks

If the search object was obtained using:

  • IEdmVault21::CreateSearch2 (IEdmSearch9), then the name may require extended search syntax. (See Search Syntax.)
  • IEdmVault5::CreateSearch, then the name may contain a % wildcard character. For example, %.txt searches for all text files.

% indicates any sequence of characters of any length. You can also use underscore (_) as a wildcard for exactly one arbitrary character.

To search for strings containing the actual characters '%' and '_', enclose them in brackets [...]:

my[_]text[%]file.txt

You can also enclose the entire string in brackets, if no wildcards exist in it:

[my_text%file.txt]

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FindFiles Property (IEdmSearch5)

FindFiles Property (IEdmSearch5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : FindFiles Property (IEdmSearch5)

Gets or sets whether to return files in the search.

Syntax

Visual Basic
Property FindFiles As System.Boolean
C#
System.bool FindFiles {get; set;}
C++/CLI
property System.bool FindFiles {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to return files, false to not

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FindFolders Property (IEdmSearch5)

FindFolders Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : FindFolders Property (IEdmSearch5)

Gets or sets whether to return folders in the search.

Syntax

Visual Basic
Property FindFolders As System.Boolean
C#
System.bool FindFolders {get; set;}
C++/CLI
property System.bool FindFolders {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to return folders, false to not

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FindHistoricStates Property (IEdmSearch5)

FindHistoricStates Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : FindHistoricStates Property (IEdmSearch5)

Gets or sets whether to find all files that have ever been in the state specified by IEdmSearch5::State.

Syntax

Visual Basic
Property FindHistoricStates As System.Boolean
C#
System.bool FindHistoricStates {get; set;}
C++/CLI
property System.bool FindHistoricStates {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to find all files that have ever been in IEdmSearch5::State, false to return only files that are currently in IEdmSearch5::State

Remarks

This property is only valid if IEdmSearch5::State is set.

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FindLockedFiles Property (IEdmSearch5)

FindLockedFiles Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : FindLockedFiles Property (IEdmSearch5)

Gets or sets whether to include checked-out files in the search result.

Syntax

Visual Basic
Property FindLockedFiles As System.Boolean
C#
System.bool FindLockedFiles {get; set;}
C++/CLI
property System.bool FindLockedFiles {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to include checked-out files, false to not

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FindUnlockedFiles Property (IEdmSearch5)

FindUnlockedFiles Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : FindUnlockedFiles Property (IEdmSearch5)

Gets or sets whether to include checked-in files in the search result.

Syntax

Visual Basic
Property FindUnlockedFiles As System.Boolean
C#
System.bool FindUnlockedFiles {get; set;}
C++/CLI
property System.bool FindUnlockedFiles {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to include checked-in files, false to not

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Recursive Property (IEdmSearch5)

Recursive Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : Recursive Property (IEdmSearch5)

Gets or sets whether to search recursively in subfolders.

Syntax

Visual Basic
Property Recursive As System.Boolean
C#
System.bool Recursive {get; set;}
C++/CLI
property System.bool Recursive {
   System.bool get();
   void set ( &   System.bool value);
}

Property Value

True to search recursively in subfolders, false to search only in the folder specified by IEdmSearch5::StartFolderID

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


StartFolderID Property (IEdmSearch5)

StartFolderID Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : StartFolderID Property (IEdmSearch5)

Gets or sets the ID of the folder in which to search.

Syntax

Visual Basic
Property StartFolderID As System.Integer
C#
System.int StartFolderID {get; set;}
C++/CLI
property System.int StartFolderID {
   System.int get();
   void set ( &   System.int value);
}

Property Value

ID of folder in which to search; default is the root folder

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


State Property (IEdmSearch5)

State Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : State Property (IEdmSearch5)

Gets or sets the ID or name of the workflow state in which to search.

Syntax

Visual Basic
Property State As System.Object
C#
System.object State {get; set;}
C++/CLI
property System.Object^ State {
   System.Object^ get();
   void set ( &   System.Object^ value);
}

Property Value

ID or name of the workflow state in which to search

Remarks

If the search object was obtained using:

  • IEdmVault21::CreateSearch2 (IEdmSearch9), then the workflow state name may require extended search syntax. (See Search Syntax.)
  • IEdmVault5::CreateSearch, then the workflow state name for which to search may contain a % wildcard character. For example, test searches for all files that have a workflow state that contains the word, test.

    % indicates any sequence of characters of any length. You can also use underscore (_) as a wildcard for exactly one arbitrary character.

    To search for strings containing the actual characters '%' and '_', enclose them in brackets [...]:

    my[_]text[%]file.txt

    You can also enclose the entire string in brackets, because no wildcards occur in it:

    [my_text%file.txt]

See Also

IEdmSearch5 Interface
IEdmSearch5 Members
IEdmSearch5::FindHistoricStates Property ()

Availability

SOLIDWORKS PDM Professional Version 5.2


VersionComment Property (IEdmSearch5)

VersionComment Property (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : VersionComment Property (IEdmSearch5)

Gets or sets the version comment substring for which to search.

Syntax

Visual Basic
Property VersionComment As System.String
C#
System.string VersionComment {get; set;}
C++/CLI
property System.String^ VersionComment {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Substring of version comment for which to search (see Remarks)

Remarks

If the search object was obtained using:

  • IEdmVault21::CreateSearch2 (IEdmSearch9), then the version comment may require extended search syntax. (See Search Syntax.)
  • IEdmVault5::CreateSearch, then the substring for which to search may contain a % wildcard character. For example, test searches for all files that have a version comment that contains the word, test.

% indicates any sequence of characters of any length. You can also use underscore (_) as a wildcard for exactly one arbitrary character.

To search for strings containing the actual characters '%' and '_', enclose them in brackets [...]:

my[_]text[%]file.txt

You can also enclose the entire string in brackets, because no wildcards occur in it:

[my_text%file.txt]

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmSearch6 Interface

IEdmSearch6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSearch6 Interface

Allows you to quickly find files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearch6
   Inherits IEdmSearch5
C#
public interface IEdmSearch6 : IEdmSearch5
C++/CLI
public interface class IEdmSearch6 : public IEdmSearch5

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface:

  • extends IEdmSearch5.
  • is extended by IEdmSearch7.

See Also

IEdmSearch6 Members
EPDM.Interop.epdm Namespace


IEdmSearch6 Interface Members

IEdmSearch6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSearch6 Interface

The following tables list the members exposed by IEdmSearch6.

Public Methods

 | Name | Description
Method | GetToken | Gets the value of a search token.
Method | SetToken | Sets the specified token with the specified value.
Top

See Also

IEdmSearch6 Interface
EPDM.Interop.epdm Namespace


IEdmSearch6 Interface Methods

IEdmSearch6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearch6 Interface

For a list of all members of this type, see IEdmSearch6 members.

Public Methods

 | Name | Description
Method | GetToken | Gets the value of a search token.
Method | SetToken | Sets the specified token with the specified value.
Top

See Also

IEdmSearch6 Interface
EPDM.Interop.epdm Namespace


GetToken Method (IEdmSearch6)

GetToken Method (IEdmSearch6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch6 Interface : GetToken Method (IEdmSearch6)

eTok
Type of token for which to get a value as defined in EdmSearchToken
Gets the value of a search token.

Syntax

Visual Basic
Function GetToken( _
   ByVal eTok As EdmSearchToken _
) As System.Object
C#
System.object GetToken(
   EdmSearchToken eTok
)
C++/CLI
System.Object^ GetToken(
&   EdmSearchToken eTok
)

Parameters

eTok
Type of token for which to get a value as defined in EdmSearchToken

Return Value

Value of token

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSearch6 Interface
IEdmSearch6 Members
IEdmSearch6::SetToken Method ()

Availability

SOLIDWORKS PDM Professional 2007


SetToken Method (IEdmSearch6)

SetToken Method (IEdmSearch6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch6 Interface : SetToken Method (IEdmSearch6)

eTok
Search token for which to set a value as defined in EdmSearchToken (see Remarks)
oValue
New value for token
Sets the specified token with the specified value.

Syntax

Visual Basic
Sub SetToken( _
   ByVal eTok As EdmSearchToken, _
   ByVal oValue As System.Object _
)
C#
void SetToken(
   EdmSearchToken eTok,
   System.object oValue
)
C++/CLI
void SetToken(
&   EdmSearchToken eTok,
&   System.Object^ oValue
)

Parameters

eTok
Search token for which to set a value as defined in EdmSearchToken (see Remarks)
oValue
New value for token

Example

See the IEdmSearch6 and IEdmSearch9 examples.

Remarks

For every search you must explicitly set EdmSearchToken.Edmstok_AllVersions to either true or false. If you leave it unset, unexpected search results can occur.

If the search object was obtained using IEdmVault21::CreateSearch2 (IEdmSearch9), then oValue may contain extended search syntax. (See Search Syntax.)

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSearch6 Interface
IEdmSearch6 Members

Availability

SOLIDWORKS PDM Professional 2007


IEdmSearch7 Interface

IEdmSearch7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSearch7 Interface

Allows you to quickly find files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearch7
   Inherits IEdmSearch5, IEdmSearch6
C#
public interface IEdmSearch7 : IEdmSearch5, IEdmSearch6
C++/CLI
public interface class IEdmSearch7 : public IEdmSearch5, IEdmSearch6

Remarks

This interface:

  • extends IEdmSearch6.
  • is extended by IEdmSearch8.

See Also

IEdmSearch7 Members
EPDM.Interop.epdm Namespace


IEdmSearch7 Interface Members

IEdmSearch7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSearch7 Interface

The following tables list the members exposed by IEdmSearch7.

Public Methods

 | Name | Description
Method | GetMenuInfo | Gets information that can be used to display a quick launch menu from which the user can start the search tool and activate one of his search forms or favorites.
Method | LaunchApp | Starts the search tool application.
Top

See Also

IEdmSearch7 Interface
EPDM.Interop.epdm Namespace


IEdmSearch7 Interface Methods

IEdmSearch7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearch7 Interface

For a list of all members of this type, see IEdmSearch7 members.

Public Methods

 | Name | Description
Method | GetMenuInfo | Gets information that can be used to display a quick launch menu from which the user can start the search tool and activate one of his search forms or favorites.
Method | LaunchApp | Starts the search tool application.
Top

See Also

IEdmSearch7 Interface
EPDM.Interop.epdm Namespace


GetMenuInfo Method (IEdmSearch7)

GetMenuInfo Method (IEdmSearch7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch7 Interface : GetMenuInfo Method (IEdmSearch7)

ppoForms
Array of search forms
ppoFavorites
Array of favorite searches
plSysPerm
Combination of EdmSysRightFlags bits for the logged-in user
plEdmGetMenuInfoFlags
Combination of EdmGetMenuInfoFlags bits
Gets information that can be used to display a quick launch menu from which the user can start the search tool and activate one of his search forms or favorites.

Syntax

Visual Basic
Sub GetMenuInfo( _
   ByRef ppoForms() As System.String, _
   ByRef ppoFavorites() As System.String, _
   ByRef plSysPerm As System.Integer, _
   ByRef plEdmGetMenuInfoFlags As System.Integer _
)
C#
void GetMenuInfo(
   out System.string[] ppoForms,
   out System.string[] ppoFavorites,
   out System.int plSysPerm,
   out System.int plEdmGetMenuInfoFlags
)
C++/CLI
void GetMenuInfo(
&   [Out] System.array<String^>^ ppoForms,
&   [Out] System.array<String^>^ ppoFavorites,
&   [Out] System.int plSysPerm,
&   [Out] System.int plEdmGetMenuInfoFlags
)

Parameters

ppoForms
Array of search forms
ppoFavorites
Array of favorite searches
plSysPerm
Combination of EdmSysRightFlags bits for the logged-in user
plEdmGetMenuInfoFlags
Combination of EdmGetMenuInfoFlags bits

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSearch7 Interface
IEdmSearch7 Members

Availability

SOLIDWORKS PDM Professional 2009


LaunchApp Method (IEdmSearch7)

LaunchApp Method (IEdmSearch7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch7 Interface : LaunchApp Method (IEdmSearch7)

hParentWnd
Parent window handle
bsDefault
Name of a search form; name of a search favorite if lEdmLaunchSearchFlags contains EdmLaunchSearchFlags.Elsf_DefaultIsAFavorite
oStartFolderPathOrID
Path or ID of the folder in which the search tool should start looking
lEdmLaunchSearchFlags
Combination of EdmLaunchSearchFlags bits
Starts the search tool application.

Syntax

Visual Basic
Sub LaunchApp( _
   ByVal hParentWnd As System.Integer, _
   Optional ByVal bsDefault As System.String, _
   Optional ByVal oStartFolderPathOrID As System.Object, _
   Optional ByVal lEdmLaunchSearchFlags As System.Integer _
)
C#
void LaunchApp(
   System.int hParentWnd,
   System.string bsDefault,
   System.object oStartFolderPathOrID,
   System.int lEdmLaunchSearchFlags
)
C++/CLI
void LaunchApp(
&   System.int hParentWnd,
&   System.String^ bsDefault,
&   System.Object^ oStartFolderPathOrID,
&   System.int lEdmLaunchSearchFlags
)

Parameters

hParentWnd
Parent window handle
bsDefault
Name of a search form; name of a search favorite if lEdmLaunchSearchFlags contains EdmLaunchSearchFlags.Elsf_DefaultIsAFavorite
oStartFolderPathOrID
Path or ID of the folder in which the search tool should start looking
lEdmLaunchSearchFlags
Combination of EdmLaunchSearchFlags bits

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSearch7 Interface
IEdmSearch7 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmSearch8 Interface

IEdmSearch8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSearch8 Interface

Allows you to quickly find files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearch8
   Inherits IEdmSearch5, IEdmSearch6, IEdmSearch7
C#
public interface IEdmSearch8 : IEdmSearch5, IEdmSearch6, IEdmSearch7
C++/CLI
public interface class IEdmSearch8 : public IEdmSearch5, IEdmSearch6, IEdmSearch7

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)

Remarks

This interface:

  • extends IEdmSearch7 by providing the ability to construct more complicated search criteria using:
    • Comparison operators
    • Boolean OR and AND
  • is extended by IEdmSearch9.

See Also

IEdmSearch8 Members
EPDM.Interop.epdm Namespace


IEdmSearch8 Interface Members

IEdmSearch8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSearch8 Interface

The following tables list the members exposed by IEdmSearch8.

Public Methods

 | Name | Description
Method | AddVariable2 | Adds a file or folder data card variable to this search.
Method | BeginAND | Begins boolean AND operation.
Method | BeginOR | Begins boolean OR operation.
Method | EndAND | Ends boolean AND operation.
Method | EndOR | Ends boolean OR operation.
Top

See Also

IEdmSearch8 Interface
EPDM.Interop.epdm Namespace


IEdmSearch8 Interface Methods

IEdmSearch8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearch8 Interface

For a list of all members of this type, see IEdmSearch8 members.

Public Methods

 | Name | Description
Method | AddVariable2 | Adds a file or folder data card variable to this search.
Method | BeginAND | Begins boolean AND operation.
Method | BeginOR | Begins boolean OR operation.
Method | EndAND | Ends boolean AND operation.
Method | EndOR | Ends boolean OR operation.
Top

See Also

IEdmSearch8 Interface
EPDM.Interop.epdm Namespace


AddVariable2 Method (IEdmSearch8)

AddVariable2 Method (IEdmSearch8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch8 Interface : AddVariable2 Method (IEdmSearch8)

poIdOrName
ID or name of variable for which to search
poValue
Value or regular expression for which to search (see Remarks)
lEdmVarOp
Operator to apply to poValue as defined in EdmVarOp (see Remarks)
Adds a file or folder data card variable to this search.

Syntax

Visual Basic
Sub AddVariable2( _
   ByRef poIdOrName As System.Object, _
   ByRef poValue As System.Object, _
   Optional ByVal lEdmVarOp As System.Integer _
)
C#
void AddVariable2(
   ref System.object poIdOrName,
   ref System.object poValue,
   System.int lEdmVarOp
)
C++/CLI
void AddVariable2(
&   System.Object^% poIdOrName,
&   System.Object^% poValue,
&   System.int lEdmVarOp
)

Parameters

poIdOrName
ID or name of variable for which to search
poValue
Value or regular expression for which to search (see Remarks)
lEdmVarOp
Operator to apply to poValue as defined in EdmVarOp (see Remarks)

Example

See the IEdmSearch8 and IEdmSearch9 examples.

Remarks

If the search object:

  • is IEdmSearch5, then:
    • before calling this method, call IEdmSearch8::BeginAND or IEdmSearch8::BeginOR to construct more complicated search criteria.
    • poValue may contain wildcards:
  • % - any number of arbitrary characters
  • _ - exactly one arbitrary character
  • is created using IEdmVault21::CreateSearch2 (IEdmSearch9), then poValue follows basic syntax (single-value search logic rules. See Search Syntax.) lEdmVarOp must be Nothing or null.

The number of times you could call this method was limited to 4 in SOLIDWORKS PDM Professional Version 6.0 and earlier. This restriction was removed in Version 6.1.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_KEY_NOT_FOUND: The variable name was not recognized.

See Also

IEdmSearch8 Interface
IEdmSearch8 Members

Availability

SOLIDWORKS PDM Professional 2018


BeginAND Method (IEdmSearch8)

BeginAND Method (IEdmSearch8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch8 Interface : BeginAND Method (IEdmSearch8)

Begins boolean AND operation.

Syntax

Visual Basic
Sub BeginAND()
C#
void BeginAND()
C++/CLI
void BeginAND();

Example

See the IEdmSearch8 examples.

Remarks

After calling this method, call IEdmSearch8::AddVariable2 multiple times to further constrain the search.

Use IEdmSearch8::EndAND to end the AND operation.

See Also

IEdmSearch8 Interface
IEdmSearch8 Members

Availability

SOLIDWORKS PDM Professional 2018


BeginOR Method (IEdmSearch8)

BeginOR Method (IEdmSearch8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch8 Interface : BeginOR Method (IEdmSearch8)

Begins boolean OR operation.

Syntax

Visual Basic
Sub BeginOR()
C#
void BeginOR()
C++/CLI
void BeginOR();

Remarks

After calling this method, call IEdmSearch8::AddVariable2 multiple times to further constrain the search.

Use IEdmSearch8::EndOR to end the OR operation.

See Also

IEdmSearch8 Interface
IEdmSearch8 Members

Availability

SOLIDWORKS PDM Professional 2018


EndAND Method (IEdmSearch8)

EndAND Method (IEdmSearch8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch8 Interface : EndAND Method (IEdmSearch8)

Ends boolean AND operation.

Syntax

Visual Basic
Sub EndAND()
C#
void EndAND()
C++/CLI
void EndAND();

Example

See the IEdmSearch8 examples.

Remarks

Use IEdmSearch8::BeginAND to begin the AND operation.

See Also

IEdmSearch8 Interface
IEdmSearch8 Members

Availability

SOLIDWORKS PDM Professional 2018


EndOR Method (IEdmSearch8)

EndOR Method (IEdmSearch8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch8 Interface : EndOR Method (IEdmSearch8)

Ends boolean OR operation.

Syntax

Visual Basic
Sub EndOR()
C#
void EndOR()
C++/CLI
void EndOR();

Remarks

Use IEdmSearch8::BeginOR to begin the OR operation.

See Also

IEdmSearch8 Interface
IEdmSearch8 Members

Availability

SOLIDWORKS PDM Professional 2018


IEdmSearch9 Interface

IEdmSearch9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSearch9 Interface

Allows you to quickly find files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearch9
   Inherits IEdmSearch5, IEdmSearch6, IEdmSearch7, IEdmSearch8
C#
public interface IEdmSearch9 : IEdmSearch5, IEdmSearch6, IEdmSearch7, IEdmSearch8
C++/CLI
public interface class IEdmSearch9 : public IEdmSearch5, IEdmSearch6, IEdmSearch7, IEdmSearch8

Example

Using Basic Search Syntax (VB.NET)
Using Basic Search Syntax (C#)

Remarks

This interface:

  • Extends IEdmSearch8 by providing the ability to peform a search for files and folders using logical operators, multi-variable conditions, and new search syntax. See Search Syntax.
  • Is extended by IEdmSearch10.

In extended searches:

  • All IEdmSearch* properties and method parameters support the new search syntax.
  • IEdmSearch9::AddMultiVariableCondition can be used to specify new search syntax for two or more file or folder data card variables.
  • If IEdmSearch5::GetFirstResult returns Nothing or null, it means that either:
    • no documents were found

- or -

  • there was a syntax error in one of the search syntax expressions.

After calling IEdmSearch5::GetFirstResult, you must call IEdmSearch9::GetSyntaxErrors to see if there are any syntax errors. If not, then you can deduce that no documents were found.

Accessors

IEdmVault21::CreateSearch2

See Also

IEdmSearch9 Members
EPDM.Interop.epdm Namespace


IEdmSearch9 Interface Members

IEdmSearch9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSearch9 Interface

The following tables list the members exposed by IEdmSearch9.

Public Methods

 | Name | Description
Method | AddMultiVariableCondition | Adds a multi-variable condition to this search.
Method | GetSyntaxErrors | Gets syntax errors resulting from this search.
Top

See Also

IEdmSearch9 Interface
EPDM.Interop.epdm Namespace


IEdmSearch9 Interface Methods

IEdmSearch9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearch9 Interface

For a list of all members of this type, see IEdmSearch9 members.

Public Methods

 | Name | Description
Method | AddMultiVariableCondition | Adds a multi-variable condition to this search.
Method | GetSyntaxErrors | Gets syntax errors resulting from this search.
Top

See Also

IEdmSearch9 Interface
EPDM.Interop.epdm Namespace


AddMultiVariableCondition Method (IEdmSearch9)

AddMultiVariableCondition Method (IEdmSearch9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch9 Interface : AddMultiVariableCondition Method (IEdmSearch9)

poVariableNames
Array of file or folder data card variable names (see Remarks)
bsCondition
Condition to apply to poVariableNames (see Remarks)
Adds a multi-variable condition to this search.

Syntax

Visual Basic
Sub AddMultiVariableCondition( _
   ByVal poVariableNames() As System.String, _
   ByVal bsCondition As System.String _
)
C#
void AddMultiVariableCondition(
   System.string[] poVariableNames,
   System.string bsCondition
)
C++/CLI
void AddMultiVariableCondition(
&   System.array<String^>^ poVariableNames,
&   System.String^ bsCondition
)

Parameters

poVariableNames
Array of file or folder data card variable names (see Remarks)
bsCondition
Condition to apply to poVariableNames (see Remarks)

Example

See the IEdmSearch9 examples.

Remarks

Call this method before calling IEdmSearch5::GetFirstResult.

Specify poVariableNames and bsCondition using the basic syntax (single-value search logic rules) as defined in Search Syntax.

poVariableNames requires:

  • \" to replace each " inside the variable name
  • \\ to replace each \ inside the variable name
  • " on both the left and right side of the variable name

poVariableNames supports:

  • IDs in place of names
  • 0 or "" to represent "any variable
  • _Name to represent file/folder name

Syntactically incorrect elements in poVariableNames will generate an exception.

See Also

IEdmSearch9 Interface
IEdmSearch9 Members

Availability

SOLIDWORKS PDM Professional 2020


GetSyntaxErrors Method (IEdmSearch9)

GetSyntaxErrors Method (IEdmSearch9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch9 Interface : GetSyntaxErrors Method (IEdmSearch9)

Gets syntax errors resulting from this search.

Syntax

Visual Basic
Function GetSyntaxErrors() As System.String()
C#
System.string[] GetSyntaxErrors()
C++/CLI
System.array<String^>^ GetSyntaxErrors();

Return Value

Array of localized syntax errors; Nothing or null if no errors

Example

See the IEdmSearch9 examples.

Remarks

This method returns errors only if the advanced specifier (@:) is specified at the beginning of search syntax conditions.

If IEdmSearch5::GetFirstResult returns Nothing or null it can mean either:

  • the search found no documents

- or -

  • there were one or more search syntax errrors.

Call this method after IEdmSearch5::GetFirstResult to determine whether there are syntax errors. If this method returns Nothing or null, then you can assume that IEdmSearch5::GetFirstResult found no documents.

See Search Syntax.

See Also

IEdmSearch9 Interface
IEdmSearch9 Members

Availability

SOLIDWORKS PDM Professional 2020


IEdmSearchResult5 Interface

IEdmSearchResult5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSearchResult5 Interface

Allows you to access a search result.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearchResult5
   Inherits IEdmObject5
C#
public interface IEdmSearchResult5 : IEdmObject5
C++/CLI
public interface class IEdmSearchResult5 : public IEdmObject5

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmSearchResult6 which provides the ability to perform favorite searches and get accurate sizes of very large files.

To use this interface:

  1. Obtain an object for this interface by calling IEdmSearch5::GetFirstResult or IEdmSearch10::GetFirstFavoriteResult.
  2. Determine the type of the result object by calling one of the inherited properties on the IEdmSearchResult5 object, ID or Name.
  3. If the type of this search result is a:
    1. file, cast this interface's object to IEdmFile5.
    2. folder, cast this interface's object to IEdmFolder5.

Accessors

IEdmSearch5::GetFirstResult

IEdmSearch5::GetNextResult

IEdmSearch10::GetFirstFavoriteResult

See Also

IEdmSearchResult5 Members
EPDM.Interop.epdm Namespace


IEdmSearchResult5 Interface Members

IEdmSearchResult5 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmSearchResult5 Interface

The following tables list the members exposed by IEdmSearchResult5.

Public Properties

 | Name | Description
Property | FileDate | Gets the modification date of this search result.
Property | FileSize | Gets the size of this search result.
Property | LockedByUserID | Gets the ID of the user who has the file checked out.
Property | LockedByUserName | Gets the name of the user who has the file checked out.
Property | LockedOnComputer | Gets the name of the computer to which the file is checked out.
Property | LockPath | Gets the full path where the file is checked out.
Property | ParentFolderID | Gets the ID of the folder where the file or folder is found.
Property | Path | Gets the full path to the file or folder.
Property | StateName | Gets the name of the file's workflow state.
Property | Version | Gets the file's current version number.
Top

See Also

IEdmSearchResult5 Interface
EPDM.Interop.epdm Namespace


IEdmSearchResult5 Interface Properties

IEdmSearchResult5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmSearchResult5 Interface

For a list of all members of this type, see IEdmSearchResult5 members.

Public Properties

 | Name | Description
Property | FileDate | Gets the modification date of this search result.
Property | FileSize | Gets the size of this search result.
Property | LockedByUserID | Gets the ID of the user who has the file checked out.
Property | LockedByUserName | Gets the name of the user who has the file checked out.
Property | LockedOnComputer | Gets the name of the computer to which the file is checked out.
Property | LockPath | Gets the full path where the file is checked out.
Property | ParentFolderID | Gets the ID of the folder where the file or folder is found.
Property | Path | Gets the full path to the file or folder.
Property | StateName | Gets the name of the file's workflow state.
Property | Version | Gets the file's current version number.
Top

See Also

IEdmSearchResult5 Interface
EPDM.Interop.epdm Namespace


FileDate Property (IEdmSearchResult5)

FileDate Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : FileDate Property (IEdmSearchResult5)

Gets the modification date of this search result.

Syntax

Visual Basic
ReadOnly Property FileDate As System.Object
C#
System.object FileDate {get;}
C++/CLI
property System.Object^ FileDate {
   System.Object^ get();
}

Property Value

Date of file; 0 for folders

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FileSize Property (IEdmSearchResult5)

FileSize Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : FileSize Property (IEdmSearchResult5)

Gets the size of this search result.

Syntax

Visual Basic
ReadOnly Property FileSize As System.Integer
C#
System.int FileSize {get;}
C++/CLI
property System.int FileSize {
   System.int get();
}

Property Value

Size of the file; -1 for folders

Remarks

For very large file size search results, use IEdmSearchResult6::FileSize2.

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LockedByUserID Property (IEdmSearchResult5)

LockedByUserID Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : LockedByUserID Property (IEdmSearchResult5)

Gets the ID of the user who has the file checked out.

Syntax

Visual Basic
ReadOnly Property LockedByUserID As System.Integer
C#
System.int LockedByUserID {get;}
C++/CLI
property System.int LockedByUserID {
   System.int get();
}

Property Value

ID of user who has file checked out; 1 if the file is not checked out

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


LockedByUserName Property (IEdmSearchResult5)

LockedByUserName Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : LockedByUserName Property (IEdmSearchResult5)

Gets the name of the user who has the file checked out.

Syntax

Visual Basic
ReadOnly Property LockedByUserName As System.String
C#
System.string LockedByUserName {get;}
C++/CLI
property System.String^ LockedByUserName {
   System.String^ get();
}

Property Value

Name of user who has the file checked out

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


LockedOnComputer Property (IEdmSearchResult5)

LockedOnComputer Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : LockedOnComputer Property (IEdmSearchResult5)

Gets the name of the computer to which the file is checked out.

Syntax

Visual Basic
ReadOnly Property LockedOnComputer As System.String
C#
System.string LockedOnComputer {get;}
C++/CLI
property System.String^ LockedOnComputer {
   System.String^ get();
}

Property Value

Name of computer to which the file is checked out

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


LockPath Property (IEdmSearchResult5)

LockPath Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : LockPath Property (IEdmSearchResult5)

Gets the full path where the file is checked out.

Syntax

Visual Basic
ReadOnly Property LockPath As System.String
C#
System.string LockPath {get;}
C++/CLI
property System.String^ LockPath {
   System.String^ get();
}

Property Value

Full path where the file is checked out; "" for folders or if the file is not checked out

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


ParentFolderID Property (IEdmSearchResult5)

ParentFolderID Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : ParentFolderID Property (IEdmSearchResult5)

Gets the ID of the folder where the file or folder is found.

Syntax

Visual Basic
ReadOnly Property ParentFolderID As System.Integer
C#
System.int ParentFolderID {get;}
C++/CLI
property System.int ParentFolderID {
   System.int get();
}

Property Value

ID of the folder where the file or folder is found; 0 for the vault root folder

Example

See the examples in IEdmSearchResult5.

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


Path Property (IEdmSearchResult5)

Path Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : Path Property (IEdmSearchResult5)

Gets the full path to the file or folder.

Syntax

Visual Basic
ReadOnly Property Path As System.String
C#
System.string Path {get;}
C++/CLI
property System.String^ Path {
   System.String^ get();
}

Property Value

Full path the file or folder

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


StateName Property (IEdmSearchResult5)

StateName Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : StateName Property (IEdmSearchResult5)

Gets the name of the file's workflow state.

Syntax

Visual Basic
ReadOnly Property StateName As System.String
C#
System.string StateName {get;}
C++/CLI
property System.String^ StateName {
   System.String^ get();
}

Property Value

Name of the file's workflow state

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


Version Property (IEdmSearchResult5)

Version Property (IEdmSearchResult5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult5 Interface : Version Property (IEdmSearchResult5)

Gets the file's current version number.

Syntax

Visual Basic
ReadOnly Property Version As System.Integer
C#
System.int Version {get;}
C++/CLI
property System.int Version {
   System.int get();
}

Property Value

File's current version number

Example

See the examples in IEdmSearchResult5.

See Also

IEdmSearchResult5 Interface
IEdmSearchResult5 Members


IEdmSearchResult6 Interface

IEdmSearchResult6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSearchResult6 Interface

Allows you to access a search result.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSearchResult6
   Inherits IEdmObject5, IEdmSearchResult5
C#
public interface IEdmSearchResult6 : IEdmObject5, IEdmSearchResult5
C++/CLI
public interface class IEdmSearchResult6 : public IEdmObject5, IEdmSearchResult5

Example

See the IEdmSearch10 examples.

Remarks

This interface extends IEdmSearchResult5.

To use this interface:

  1. Call IEdmSearch10::GetFirstFavoriteResult, specifying a favorite search name and whether to get search result custom column information.
  2. Determine the type of the search result returned in step 1 by inspecting ObjectType. (Becaue IEdmSearchResult5 inherits from IEdmObject5, you can simply call IEdmSearchResult5::ObjectType.)
  3. If the type of this search result is an:
    1. EdmObjectType.EdmObject_File, cast the search result object to IEdmFile5.
    2. EdmObjectType.EdmObject_Folder, cast the search result object to IEdmFolder5.
  4. Cast the search result object obtained in step 1 to an IEdmSearchResult6 object. Call IEdmSearchResult6::GetCustomColumnsInfo and IEdmSearchResult6::GetCustomColumnValues to obtain custom column information for the search result listing.

See Also

IEdmSearchResult6 Members
EPDM.Interop.epdm Namespace


IEdmSearchResult6 Interface Members

IEdmSearchResult6 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmSearchResult6 Interface

The following tables list the members exposed by IEdmSearchResult6.

Public Properties

 | Name | Description
Property | FileSize2 | Gets the size of this very large search result file.
Top

Public Methods

 | Name | Description
Method | GetCustomColumnsInfo | Gets the custom column headers for this favorite search result.
Method | GetCustomColumnValues | Gets the custom column values returned in this favorite search result.
Top

See Also

IEdmSearchResult6 Interface
EPDM.Interop.epdm Namespace


IEdmSearchResult6 Interface Methods

IEdmSearchResult6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSearchResult6 Interface

For a list of all members of this type, see IEdmSearchResult6 members.

Public Methods

 | Name | Description
Method | GetCustomColumnsInfo | Gets the custom column headers for this favorite search result.
Method | GetCustomColumnValues | Gets the custom column values returned in this favorite search result.
Top

See Also

IEdmSearchResult6 Interface
EPDM.Interop.epdm Namespace


GetCustomColumnsInfo Method (IEdmSearchResult6)

GetCustomColumnsInfo Method (IEdmSearchResult6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult6 Interface : GetCustomColumnsInfo Method (IEdmSearchResult6)

ppoRetColsInfo
Array of EdmListCol structures (see Remarks)
Gets the custom column headers for this favorite search result.

Syntax

Visual Basic
Sub GetCustomColumnsInfo( _
   ByRef ppoRetColsInfo() As EdmListCol _
)
C#
void GetCustomColumnsInfo(
   out EdmListCol[] ppoRetColsInfo
)
C++/CLI
void GetCustomColumnsInfo(
&   [Out] array<EdmListCol>^ ppoRetColsInfo
)

Parameters

ppoRetColsInfo
Array of EdmListCol structures (see Remarks)

Example

See the IEdmSearch10 examples.

Remarks

ppoRetColsInfo is not null only for favorite search results that show custom columns.

If the favorite search result:

  • Does not have custom columns,
  • ISearch10::GetFirstFavoriteResult is called with bGetCustomColumns set to false, or
  • IEdmSearch5::GetFirstResult is called,

then ppoRetColsInfo is null.

The six fields in each structure returned in the ppoRetColsInfo array map to the elements in the array (ppoRetColValues) returned by IEdmSearchResult6::GetCustomColumnValues as follows:

size_of_ppoRetColValues = (size_of_ppoRetColsInfo) * (6 EdmListCol fields)

See Also

IEdmSearchResult6 Interface
IEdmSearchResult6 Members

Availability

SOLIDWORKS PDM Professional 2021


GetCustomColumnValues Method (IEdmSearchResult6)

GetCustomColumnValues Method (IEdmSearchResult6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult6 Interface : GetCustomColumnValues Method (IEdmSearchResult6)

ppoRetColValues
Array of string values (see Remarks)
Gets the custom column values returned in this favorite search result.

Syntax

Visual Basic
Sub GetCustomColumnValues( _
   ByRef ppoRetColValues() As System.String _
)
C#
void GetCustomColumnValues(
   out System.string[] ppoRetColValues
)
C++/CLI
void GetCustomColumnValues(
&   [Out] System.array<String^>^ ppoRetColValues
)

Parameters

ppoRetColValues
Array of string values (see Remarks)

Example

See the IEdmSearch10 examples.

Remarks

ppoRetColValues is not null only for favorite search results that show custom columns.

If the favorite search result:

  • Does not have custom columns,
  • ISearch10::GetFirstFavoriteResult is called with bGetCustomColumns set to false, or
  • IEdmSearch5::GetFirstResult is called,

then ppoRetColValues is null.

The ppoRetColValues array elements map to the fields in the EdmListCol structures in the array (ppoRetColsInfo) that is returned by IEdmSearchResult6::GetCustomColumnsInfo as follows:

size_of_ppoRetColValues = (size_of_ppoRetColsInfo) * (6 EdmListCol fields)

See Also

IEdmSearchResult6 Interface
IEdmSearchResult6 Members

Availability

SOLIDWORKS PDM Professional 2021


IEdmSearchResult6 Interface Properties

IEdmSearchResult6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmSearchResult6 Interface

For a list of all members of this type, see IEdmSearchResult6 members.

Public Properties

 | Name | Description
Property | FileSize2 | Gets the size of this very large search result file.
Top

See Also

IEdmSearchResult6 Interface
EPDM.Interop.epdm Namespace


FileSize2 Property (IEdmSearchResult6)

FileSize2 Property (IEdmSearchResult6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearchResult6 Interface : FileSize2 Property (IEdmSearchResult6)

Gets the size of this very large search result file.

Syntax

Visual Basic
ReadOnly Property FileSize2 As System.Long
C#
System.long FileSize2 {get;}
C++/CLI
property System.int64 FileSize2 {
   System.int64 get();
}

Property Value

64-bit file size

See Also

IEdmSearchResult6 Interface
IEdmSearchResult6 Members
IEdmSearchResult5::FileSize Property ()

Availability

SOLIDWORKS PDM Professional 2021


IEdmSelectionList5 Interface

IEdmSelectionList5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSelectionList5 Interface

Allows you to access a list of files or folders.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSelectionList5
C#
public interface IEdmSelectionList5
C++/CLI
public interface class IEdmSelectionList5

Example

Batch Change States of Files (VB.NET)
Batch Change States of Files (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmSelectionList6 which provides the ability to access lists of objects of any EdmObjectType.

Accessors

IEdmMenu5::OnMenuItem

See Also

IEdmSelectionList5 Members
EPDM.Interop.epdm Namespace


IEdmSelectionList5 Interface Members

IEdmSelectionList5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmSelectionList5 Interface

The following tables list the members exposed by IEdmSelectionList5.

Public Properties

 | Name | Description
Property | AllInSameFolder | Gets whether all of the items in this list are located in the same parent folder.
Property | Count | Gets the number of items in this list.
Property | IsEmpty | Gets whether this list is empty.
Top

Public Methods

 | Name | Description
Method | AddTail | Obsolete. Superseded by IEdmSelectionList6::AddTail2 .
Method | GetHeadPosition | Starts an enumeration of the items in this list.
Method | GetNext | Obsolete. Superseded by IEdmSelectionList6::GetNext2 .
Top

See Also

IEdmSelectionList5 Interface
EPDM.Interop.epdm Namespace


IEdmSelectionList5 Interface Methods

IEdmSelectionList5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSelectionList5 Interface

For a list of all members of this type, see IEdmSelectionList5 members.

Public Methods

 | Name | Description
Method | AddTail | Obsolete. Superseded by IEdmSelectionList6::AddTail2 .
Method | GetHeadPosition | Starts an enumeration of the items in this list.
Method | GetNext | Obsolete. Superseded by IEdmSelectionList6::GetNext2 .
Top

See Also

IEdmSelectionList5 Interface
EPDM.Interop.epdm Namespace


GetHeadPosition Method (IEdmSelectionList5)

GetHeadPosition Method (IEdmSelectionList5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList5 Interface : GetHeadPosition Method (IEdmSelectionList5)

Starts an enumeration of the items in this list.

Syntax

Visual Basic
Function GetHeadPosition() As IEdmPos5
C#
IEdmPos5 GetHeadPosition()
C++/CLI
IEdmPos5^ GetHeadPosition();

Return Value

IEdmPos5; position of first element in this list

Example

See the IEdmSelectionList5 examples.

Remarks

After calling this method, pass the position of the first item to IEdmSelectionList5::GetNext to get the first item in this list. Then call IEdmSelectionList5::GetNext repeatedly to get the rest of the items in this list.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSelectionList5 Interface
IEdmSelectionList5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmSelectionList5 Interface Properties

IEdmSelectionList5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmSelectionList5 Interface

For a list of all members of this type, see IEdmSelectionList5 members.

Public Properties

 | Name | Description
Property | AllInSameFolder | Gets whether all of the items in this list are located in the same parent folder.
Property | Count | Gets the number of items in this list.
Property | IsEmpty | Gets whether this list is empty.
Top

See Also

IEdmSelectionList5 Interface
EPDM.Interop.epdm Namespace


AllInSameFolder Property (IEdmSelectionList5)

AllInSameFolder Property (IEdmSelectionList5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList5 Interface : AllInSameFolder Property (IEdmSelectionList5)

Gets whether all of the items in this list are located in the same parent folder.

Syntax

Visual Basic
ReadOnly Property AllInSameFolder As System.Boolean
C#
System.bool AllInSameFolder {get;}
C++/CLI
property System.bool AllInSameFolder {
   System.bool get();
}

Property Value

True if all items in this list are located in the same parent folder, false if not

See Also

IEdmSelectionList5 Interface
IEdmSelectionList5 Members


Count Property (IEdmSelectionList5)

Count Property (IEdmSelectionList5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList5 Interface : Count Property (IEdmSelectionList5)

Gets the number of items in this list.

Syntax

Visual Basic
ReadOnly Property Count As System.Integer
C#
System.int Count {get;}
C++/CLI
property System.int Count {
   System.int get();
}

Property Value

Number of items in this list

Example

See the IEdmSelectionList5 examples.

See Also

IEdmSelectionList5 Interface
IEdmSelectionList5 Members


IsEmpty Property (IEdmSelectionList5)

IsEmpty Property (IEdmSelectionList5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList5 Interface : IsEmpty Property (IEdmSelectionList5)

Gets whether this list is empty.

Syntax

Visual Basic
ReadOnly Property IsEmpty As System.Boolean
C#
System.bool IsEmpty {get;}
C++/CLI
property System.bool IsEmpty {
   System.bool get();
}

Property Value

True if this list is empty, false if not

See Also

IEdmSelectionList5 Interface
IEdmSelectionList5 Members


IEdmSelectionList6 Interface

IEdmSelectionList6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSelectionList6 Interface

Allows you to access a list of objects of any EdmObjectType.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSelectionList6
   Inherits IEdmSelectionList5
C#
public interface IEdmSelectionList6 : IEdmSelectionList5
C++/CLI
public interface class IEdmSelectionList6 : public IEdmSelectionList5

Example

Display Menu of Commands (VB.NET)

Remarks

This interface extends IEdmSelectionList5.

See Also

IEdmSelectionList6 Members
EPDM.Interop.epdm Namespace


IEdmSelectionList6 Interface Members

IEdmSelectionList6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSelectionList6 Interface

The following tables list the members exposed by IEdmSelectionList6.

Public Methods

 | Name | Description
Method | AddTail2 | Adds an item to the end of this list.
Method | GetNext2 | Gets the next item in this list.
Top

See Also

IEdmSelectionList6 Interface
EPDM.Interop.epdm Namespace


IEdmSelectionList6 Interface Methods

IEdmSelectionList6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSelectionList6 Interface

For a list of all members of this type, see IEdmSelectionList6 members.

Public Methods

 | Name | Description
Method | AddTail2 | Adds an item to the end of this list.
Method | GetNext2 | Gets the next item in this list.
Top

See Also

IEdmSelectionList6 Interface
EPDM.Interop.epdm Namespace


AddTail2 Method (IEdmSelectionList6)

AddTail2 Method (IEdmSelectionList6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList6 Interface : AddTail2 Method (IEdmSelectionList6)

poObject
EdmSelectionObject structure; describes the object to add to the end of the list
Adds an item to the end of this list.

Syntax

Visual Basic
Sub AddTail2( _
   ByRef poObject As EdmSelectionObject _
)
C#
void AddTail2(
   ref EdmSelectionObject poObject
)
C++/CLI
void AddTail2(
&   EdmSelectionObject% poObject
)

Parameters

poObject
EdmSelectionObject structure; describes the object to add to the end of the list

Example

Display Menu of Commands (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSelectionList6 Interface
IEdmSelectionList6 Members

Availability

SOLIDWORKS PDM Professional 2010


GetNext2 Method (IEdmSelectionList6)

GetNext2 Method (IEdmSelectionList6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList6 Interface : GetNext2 Method (IEdmSelectionList6)

poPos
IEdmPos5; position of the item to get (see Remarks)
poSel
EdmSelectionObject structure
Gets the next item in this list.

Syntax

Visual Basic
Sub GetNext2( _
   ByVal poPos As IEdmPos5, _
   ByRef poSel As EdmSelectionObject _
)
C#
void GetNext2(
   IEdmPos5 poPos,
   out EdmSelectionObject poSel
)
C++/CLI
void GetNext2(
&   IEdmPos5^ poPos,
&   [Out] EdmSelectionObject poSel
)

Parameters

poPos
IEdmPos5; position of the item to get (see Remarks)
poSel
EdmSelectionObject structure

Example

See the IEdmSelectionList5 examples.

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first item, IEdmPos5. Call IEdmSelectionList5::GetHeadPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the items.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers must free the object returned in poSel.

Note: Objects added with the now obsolete IEdmSelectionList5::AddTail are not completely defined. If you added an object using IEdmSelectionList5::AddTail, the EdmSelectionObject structure returned by this method contains the following:

  • The meType member is always EdmObjectType.EdmObject_File.
  • The mbsPath member contains only the file name provided as argument to IEdmSelectionList5::AddTail, not the entire path.
  • The members mlGetVersion, mlLocalVersion, and mlLatestVersion are all -1.

To add completely defined objects to this list, call IEdmSelectionList6.AddTail2.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmSelectionList6 Interface
IEdmSelectionList6 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmSerNoGen7 Interface

IEdmSerNoGen7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSerNoGen7 Interface

Allows you to manage serial numbers.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSerNoGen7
   Inherits IEdmSerNoGen6
C#
public interface IEdmSerNoGen7 : IEdmSerNoGen6
C++/CLI
public interface class IEdmSerNoGen7 : public IEdmSerNoGen6

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

This interface:

  • supersedes IEdmSerNoGen6.
  • is extended by IEdmSerNoGen8.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmSerNoGen7 Members
EPDM.Interop.epdm Namespace


IEdmSerNoGen7 Interface Members

IEdmSerNoGen7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSerNoGen7 Interface

The following tables list the members exposed by IEdmSerNoGen7.

Public Methods

 | Name | Description
Method | AllocSerNoValue | Generates a new serial number for the specified file, data card, or card control using the specified serial number generator.
Method | GetSerialNumberNames | Gets the names of all of the serial number generators installed in the vault.
Top

See Also

IEdmSerNoGen7 Interface
EPDM.Interop.epdm Namespace


IEdmSerNoGen7 Interface Methods

IEdmSerNoGen7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSerNoGen7 Interface

For a list of all members of this type, see IEdmSerNoGen7 members.

Public Methods

 | Name | Description
Method | AllocSerNoValue | Generates a new serial number for the specified file, data card, or card control using the specified serial number generator.
Method | GetSerialNumberNames | Gets the names of all of the serial number generators installed in the vault.
Top

See Also

IEdmSerNoGen7 Interface
EPDM.Interop.epdm Namespace


AllocSerNoValue Method (IEdmSerNoGen7)

AllocSerNoValue Method (IEdmSerNoGen7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmSerNoGen7 Interface : AllocSerNoValue Method (IEdmSerNoGen7)

bsSerNoName
Name of the serial number generator to use to generate a new serial number (see Remarks)
lParentWnd
Parent window handle; passed to a serial number add-in, if it exists
bsFilePath
Path to the file for which to generate a serial number
lFolderID
ID of the file's parent folder
lFileID
ID of the file for which to generate a serial number
lCardID
ID of the data card for which to generate a serial number
lCardControlID
ID of the control for which to generate a serial number
Generates a new serial number for the specified file, data card, or card control using the specified serial number generator.

Syntax

Visual Basic
Function AllocSerNoValue( _
   ByVal bsSerNoName As System.String, _
   Optional ByVal lParentWnd As System.Integer, _
   Optional ByVal bsFilePath As System.String, _
   Optional ByVal lFolderID As System.Integer, _
   Optional ByVal lFileID As System.Integer, _
   Optional ByVal lCardID As System.Integer, _
   Optional ByVal lCardControlID As System.Integer _
) As IEdmSerNoValue
C#
IEdmSerNoValue AllocSerNoValue(
   System.string bsSerNoName,
   System.int lParentWnd,
   System.string bsFilePath,
   System.int lFolderID,
   System.int lFileID,
   System.int lCardID,
   System.int lCardControlID
)
C++/CLI
IEdmSerNoValue^ AllocSerNoValue(
&   System.String^ bsSerNoName,
&   System.int lParentWnd,
&   System.String^ bsFilePath,
&   System.int lFolderID,
&   System.int lFileID,
&   System.int lCardID,
&   System.int lCardControlID
)

Parameters

bsSerNoName
Name of the serial number generator to use to generate a new serial number (see Remarks)
lParentWnd
Parent window handle; passed to a serial number add-in, if it exists
bsFilePath
Path to the file for which to generate a serial number
lFolderID
ID of the file's parent folder
lFileID
ID of the file for which to generate a serial number
lCardID
ID of the data card for which to generate a serial number
lCardControlID
ID of the control for which to generate a serial number

Return Value

IEdmSerNoValue

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

The difference between this method and the now obsolete IEdmSerNoGen6::GenerateSerNo method is that this method returns an IEdmSerNoValue interface instead of a string. IEdmSerNoValue::Rollback allows you to return generated numbers that you can not use. This helps to avoid gaps between serial numbers.

bsSerNoName is the name you specify in the SOLIDWORKS PDM Professional Administration tool when you create a serial number generator.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_SERIAL_NUMBER_NAME: The bsSerNoName argument is invalid.

See Also

IEdmSerNoGen7 Interface
IEdmSerNoGen7 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


GetSerialNumberNames Method (IEdmSerNoGen7)

GetSerialNumberNames Method (IEdmSerNoGen7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmSerNoGen7 Interface : GetSerialNumberNames Method (IEdmSerNoGen7)

ppoRetNames
Array of serial number generator names
Gets the names of all of the serial number generators installed in the vault.

Syntax

Visual Basic
Sub GetSerialNumberNames( _
   ByRef ppoRetNames() As System.String _
)
C#
void GetSerialNumberNames(
   out System.string[] ppoRetNames
)
C++/CLI
void GetSerialNumberNames(
&   [Out] System.array<String^>^ ppoRetNames
)

Parameters

ppoRetNames
Array of serial number generator names

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

See Also

IEdmSerNoGen7 Interface
IEdmSerNoGen7 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmSerNoGen8 Interface

IEdmSerNoGen8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSerNoGen8 Interface

Allows you to manage serial numbers.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSerNoGen8
   Inherits IEdmSerNoGen6, IEdmSerNoGen7
C#
public interface IEdmSerNoGen8 : IEdmSerNoGen6, IEdmSerNoGen7
C++/CLI
public interface class IEdmSerNoGen8 : public IEdmSerNoGen6, IEdmSerNoGen7

Remarks

This interface extends IEdmSerNoGen7 by providing the ability to set the next counter value for serial numbers.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmSerNoGen8 Members
EPDM.Interop.epdm Namespace


IEdmSerNoGen8 Interface Members

IEdmSerNoGen8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSerNoGen8 Interface

The following tables list the members exposed by IEdmSerNoGen8.

Public Methods

 | Name | Description
Method | SetSerNoNextCounterVal | Sets the next counter value for the specified serial number generator.
Top

See Also

IEdmSerNoGen8 Interface
EPDM.Interop.epdm Namespace


IEdmSerNoGen8 Interface Methods

IEdmSerNoGen8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSerNoGen8 Interface

For a list of all members of this type, see IEdmSerNoGen8 members.

Public Methods

 | Name | Description
Method | SetSerNoNextCounterVal | Sets the next counter value for the specified serial number generator.
Top

See Also

IEdmSerNoGen8 Interface
EPDM.Interop.epdm Namespace


SetSerNoNextCounterVal Method (IEdmSerNoGen8)

SetSerNoNextCounterVal Method (IEdmSerNoGen8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSerNoGen8 Interface : SetSerNoNextCounterVal Method (IEdmSerNoGen8)

bsSerNoName
Name of serial number generator
lNextCounterValue
Next value
Sets the next counter value for the specified serial number generator.

Syntax

Visual Basic
Sub SetSerNoNextCounterVal( _
   ByVal bsSerNoName As System.String, _
   ByVal lNextCounterValue As System.Integer _
)
C#
void SetSerNoNextCounterVal(
   System.string bsSerNoName,
   System.int lNextCounterValue
)
C++/CLI
void SetSerNoNextCounterVal(
&   System.String^ bsSerNoName,
&   System.int lNextCounterValue
)

Parameters

bsSerNoName
Name of serial number generator
lNextCounterValue
Next value

Example

//Preconditions:

//1. Create a C# console application in Visual Studio.

//2. Add references EPDM.Interop.epdm and EPDM.Interop.EPDMResultCode to the project.

//3. Copy the code below to Program.cs.

//4. Change the namespace to match your project name.

//5. Add a serial number generator called “NSN” using the Admin tool.

//6. Ensure that parameters of Login match your vault.

//

//Postconditions:

//1. Open the Admin Tool.

//2. Observe that the next counter value for the NSN serial number generator is 9.

//Program.cs:

using System;

using System.Linq;

using System.Text;

using EPDM.Interop.epdm;

using EPDM.Interop.EPDMResultCode;

namespace project_name

{

  class Program

  {

    static string userName = "Admin";

    static string vaultName = "JEB12";

    static string serNoGenName = "NSN";

    static int newCounterValue = 9;

    static void Main(string[] args)

    {

      StringBuilder sb = new StringBuilder();

      try

      {

        sb.AppendFormat("UserName: {0}", userName).AppendLine();

        sb.AppendFormat("VaultName: {0}", vaultName).AppendLine();

        IEdmVault11 vault = (IEdmVault11)(new EdmVault5());

        if (!vault.IsLoggedIn)

          vault.Login(userName, "password", vaultName);

        IEdmSerNoGen7 serNoGen7 = (IEdmSerNoGen7)vault.CreateUtility(EdmUtility.EdmUtil_SerNoGen);

        string[] names = { };

        serNoGen7.GetSerialNumberNames(out names);

        sb.AppendFormat("Serial number generators present in vault: {0}", String.Join(",", names)).AppendLine();

        if (names.Contains(serNoGenName))

        {

          IEdmSerNoGen8 serNoGen8 = (IEdmSerNoGen8)serNoGen7;

          serNoGen8.SetSerNoNextCounterVal(serNoGenName, newCounterValue);

          sb.AppendFormat("Serial number generator's {0} next counter value set to {1}", serNoGenName, newCounterValue).AppendLine();

        }

        else

        {

          sb.AppendFormat("There is no {0} serial number generator present in vault", serNoGenName).AppendLine();

        }

      }

      catch (System.Runtime.InteropServices.COMException ex)

      {

        var errorType = typeof(EdmResultErrorCodes_e);

        if (Enum.IsDefined(errorType, ex.ErrorCode))

          sb.AppendFormat("Edm error occurred: {0}", Enum.GetName(errorType, ex.ErrorCode)).AppendLine();

        else

          sb.AppendLine("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);

      }

      catch (Exception ex)

      {

        sb.AppendFormat("Error occurred: {0}", ex.Message).AppendLine();

      }

      Console.WriteLine(sb.ToString());

      Console.WriteLine("Please press any key to exit");

      Console.ReadKey();

    }

  }

}

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_SERIAL_NUMBER_NAME is returned if bsSerNoName is incorrect.
  • E_EDM_PERMISSION_DENIED is returned if user does not have "Can update serial numbers" permission.

See Also

IEdmSerNoGen8 Interface
IEdmSerNoGen8 Members

Availability

SOLIDWORKS PDM Professional 2022


IEdmSerNoValue Interface

IEdmSerNoValue Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmSerNoValue Interface

Allows you to access the serial number generated by IEdmSerNoGen7::AllocSerNoValue.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSerNoValue
C#
public interface IEdmSerNoValue
C++/CLI
public interface class IEdmSerNoValue

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmSerNoGen7::AllocSerNoValue

See Also

IEdmSerNoValue Members
EPDM.Interop.epdm Namespace


IEdmSerNoValue Interface Members

IEdmSerNoValue Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmSerNoValue Interface

The following tables list the members exposed by IEdmSerNoValue.

Public Properties

 | Name | Description
Property | Value | Gets the allocated serial number value.
Top

Public Methods

 | Name | Description
Method | Rollback | Returns the allocated serial number to the serial number generator, so it can be allocated in the future.
Top

See Also

IEdmSerNoValue Interface
EPDM.Interop.epdm Namespace


IEdmSerNoValue Interface Methods

IEdmSerNoValue Interface Methods
EPDM.Interop.epdm Namespace : IEdmSerNoValue Interface

For a list of all members of this type, see IEdmSerNoValue members.

Public Methods

 | Name | Description
Method | Rollback | Returns the allocated serial number to the serial number generator, so it can be allocated in the future.
Top

See Also

IEdmSerNoValue Interface
EPDM.Interop.epdm Namespace


Rollback Method (IEdmSerNoValue)

Rollback Method (IEdmSerNoValue)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSerNoValue Interface : Rollback Method (IEdmSerNoValue)

Returns the allocated serial number to the serial number generator, so it can be allocated in the future.

Syntax

Visual Basic
Sub Rollback()
C#
void Rollback()
C++/CLI
void Rollback();

Remarks

This method allows you to return generated numbers that you can not use. This helps to avoid gaps between serial numbers.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSerNoValue Interface
IEdmSerNoValue Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmSerNoValue Interface Properties

IEdmSerNoValue Interface Properties
EPDM.Interop.epdm Namespace : IEdmSerNoValue Interface

For a list of all members of this type, see IEdmSerNoValue members.

Public Properties

 | Name | Description
Property | Value | Gets the allocated serial number value.
Top

See Also

IEdmSerNoValue Interface
EPDM.Interop.epdm Namespace


Value Property (IEdmSerNoValue)

Value Property (IEdmSerNoValue)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmSerNoValue Interface : Value Property (IEdmSerNoValue)

Gets the allocated serial number value.

Syntax

Visual Basic
ReadOnly Property Value As System.String
C#
System.string Value {get;}
C++/CLI
property System.String^ Value {
   System.String^ get();
}

Property Value

Serial number value

Example

Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

See Also

IEdmSerNoValue Interface
IEdmSerNoValue Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmState5 Interface

IEdmState5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmState5 Interface

Allows you to access a workflow state.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmState5
   Inherits IEdmObject5
C#
public interface IEdmState5 : IEdmObject5
C++/CLI
public interface class IEdmState5 : public IEdmObject5

Example

Get File's State Transitions (C#)
Get File's State Transitions (VB.NET)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmState6.

Accessors

IEdmFile5::CurrentState

IEdmTransition5::FromState

IEdmTransition5::ToState

IEdmVault5::GetObject

IEdmWorkflow5::GetNextState

IEdmWorkflow5::GetState

IEdmWorkflow5::InitialState

See Also

IEdmState5 Members
EPDM.Interop.epdm Namespace
IEdmTransition5 Interface


IEdmState5 Interface Members

IEdmState5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmState5 Interface

The following tables list the members exposed by IEdmState5.

Public Properties

 | Name | Description
Property | IconName | Gets the name of the icon used in the workflow graph.
Top

Public Methods

 | Name | Description
Method | GetFirstFilePosition | Starts an enumeration of all the files in this workflow state.
Method | GetFirstTransitionPosition | Starts an enumeration of the transitions to and from this workflow state.
Method | GetNextFile | Gets the next file in this workflow state.
Method | GetNextTransition | Gets the next transition to or from this workflow state.
Method | GetTransition | Obsolete. Gets a transition from this workflow state by name.
Top

See Also

IEdmState5 Interface
EPDM.Interop.epdm Namespace
IEdmTransition5 Interface


IEdmState5 Interface Methods

IEdmState5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmState5 Interface

For a list of all members of this type, see IEdmState5 members.

Public Methods

 | Name | Description
Method | GetFirstFilePosition | Starts an enumeration of all the files in this workflow state.
Method | GetFirstTransitionPosition | Starts an enumeration of the transitions to and from this workflow state.
Method | GetNextFile | Gets the next file in this workflow state.
Method | GetNextTransition | Gets the next transition to or from this workflow state.
Method | GetTransition | Obsolete. Gets a transition from this workflow state by name.
Top

See Also

IEdmState5 Interface
EPDM.Interop.epdm Namespace
IEdmTransition5 Interface


GetFirstFilePosition Method (IEdmState5)

GetFirstFilePosition Method (IEdmState5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmState5 Interface : GetFirstFilePosition Method (IEdmState5)

Starts an enumeration of all the files in this workflow state.

Syntax

Visual Basic
Function GetFirstFilePosition() As IEdmPos5
C#
IEdmPos5 GetFirstFilePosition()
C++/CLI
IEdmPos5^ GetFirstFilePosition();

Return Value

IEdmPos5; position in the list of the first file in this workflow state (see Remarks)

Example

Get Files in Workflow State (VB.NET)
Get Files in Workflow State (C#)

Remarks

After calling this method, pass the returned position of the first file in this workflow state to IEdmState5::GetNextFile to get the first file in this workflow state. Then call IEdmState5::GetNextFile repeatedly to get the rest of the files in this workflow state.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Use IEdmSearch5 to perform more elaborate searches.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmState5 Interface
IEdmState5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstTransitionPosition Method (IEdmState5)

GetFirstTransitionPosition Method (IEdmState5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmState5 Interface : GetFirstTransitionPosition Method (IEdmState5)

bExitTransitions
Optionally true to enumerate the transitions from this workflow state, false to enumerate the transition to this workflow state; default is true
Starts an enumeration of the transitions to and from this workflow state.

Syntax

Visual Basic
Function GetFirstTransitionPosition( _
   Optional ByVal bExitTransitions As System.Boolean _
) As IEdmPos5
C#
IEdmPos5 GetFirstTransitionPosition(
   System.bool bExitTransitions
)
C++/CLI
IEdmPos5^ GetFirstTransitionPosition(
&   System.bool bExitTransitions
)

Parameters

bExitTransitions
Optionally true to enumerate the transitions from this workflow state, false to enumerate the transition to this workflow state; default is true

Return Value

IEdmPos5; position in the list of the first transition to or from this workflow state (see Remarks)

Example

Get File's State Transitions (C#)
Get File's State Transitions (VB.NET)

Remarks

After calling this method, pass the returned position of the first transition to or from this workflow state to IEdmState5::GetNextTransition to get the first transition to or from this workflow state. Then call IEdmState5::GetNextTransition repeatedly to get the rest of the transitions to and from this workflow state.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmState5 Interface
IEdmState5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextFile Method (IEdmState5)

GetNextFile Method (IEdmState5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmState5 Interface : GetNextFile Method (IEdmState5)

poPosition
IEdmPos5; position of the next file in this workflow state (see Remarks)
Gets the next file in this workflow state.

Syntax

Visual Basic
Function GetNextFile( _
   ByVal poPosition As IEdmPos5 _
) As IEdmFile5
C#
IEdmFile5 GetNextFile(
   IEdmPos5 poPosition
)
C++/CLI
IEdmFile5^ GetNextFile(
&   IEdmPos5^ poPosition
)

Parameters

poPosition
IEdmPos5; position of the next file in this workflow state (see Remarks)

Return Value

IEdmFile5

Example

Get Files in Workflow State (VB.NET)
Get Files in Workflow State (C#)

Remarks

Before calling this method the first time, you must populate poPosition with the interface to the position of the first file, IEdmPos5. Call IEdmState5::GetFirstFilePosition to start an enumeration and obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the files.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers must free the interface returned, IEdmFile5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmState5 Interface
IEdmState5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextTransition Method (IEdmState5)

GetNextTransition Method (IEdmState5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmState5 Interface : GetNextTransition Method (IEdmState5)

poPosition
IEdmPos5; position of the next transition to or from this workflow state (see Remarks)
Gets the next transition to or from this workflow state.

Syntax

Visual Basic
Function GetNextTransition( _
   ByVal poPosition As IEdmPos5 _
) As IEdmTransition5
C#
IEdmTransition5 GetNextTransition(
   IEdmPos5 poPosition
)
C++/CLI
IEdmTransition5^ GetNextTransition(
&   IEdmPos5^ poPosition
)

Parameters

poPosition
IEdmPos5; position of the next transition to or from this workflow state (see Remarks)

Return Value

IEdmTransition5

Example

Get File's State Transitions (C#)
Get File's State Transitions (VB.NET)

Remarks

Before calling this method the first time, you must populate poPosition with the interface to the position of the first transition to this workflow state, IEdmPos5. Call IEdmState5::GetFirstTransitionPosition to start an enumeration and obtain IEdmPos5, the position of the first transition.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the transitions to this workflow state.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers must free the interface returned, IEdmFile5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmState5 Interface
IEdmState5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetTransition Method (IEdmState5)

GetTransition Method (IEdmState5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmState5 Interface : GetTransition Method (IEdmState5)

bsName
Name of transition from this workflow state
Obsolete. Gets a transition from this workflow state by name.

Syntax

Visual Basic
Function GetTransition( _
   ByVal bsName As System.String _
) As IEdmTransition5
C#
IEdmTransition5 GetTransition(
   System.string bsName
)
C++/CLI
IEdmTransition5^ GetTransition(
&   System.String^ bsName
)

Parameters

bsName
Name of transition from this workflow state

Return Value

IEdmTransition5; Null if no transition for bsName is found

Remarks

This method is not supported in SOLIDWORKS PDM Professional Version 6.0 and later, because workflows in SOLIDWORKS PDM Professional 6.0 may contain several transitions with the same name. In SOLIDWORKS PDM Professional Version 5.3, the user was forced to create transitions with unique names in the workflow editor. It is, therefore, no longer possible to uniquely identify transitions by name.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmTransition5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The transition is not found.
  • E_NOTIMPL: This method is obsolete as of SOLIDWORKS PDM Professional Version 6.0.

See Also

IEdmState5 Interface
IEdmState5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmState5 Interface Properties

IEdmState5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmState5 Interface

For a list of all members of this type, see IEdmState5 members.

Public Properties

 | Name | Description
Property | IconName | Gets the name of the icon used in the workflow graph.
Top

See Also

IEdmState5 Interface
EPDM.Interop.epdm Namespace
IEdmTransition5 Interface


IconName Property (IEdmState5)

IconName Property (IEdmState5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmState5 Interface : IconName Property (IEdmState5)

Gets the name of the icon used in the workflow graph.

Syntax

Visual Basic
ReadOnly Property IconName As System.String
C#
System.string IconName {get;}
C++/CLI
property System.String^ IconName {
   System.String^ get();
}

Property Value

Name of the icon

Remarks

You can extract the icon from the WfIcons.dll, where the resource ID is the name stored in this property appended by "_SML".

See Also

IEdmState5 Interface
IEdmState5 Members


IEdmState6 Interface

IEdmState6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmState6 Interface

Allows you to access a workflow state.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmState6
   Inherits IEdmObject5, IEdmState5
C#
public interface IEdmState6 : IEdmObject5, IEdmState5
C++/CLI
public interface class IEdmState6 : public IEdmObject5, IEdmState5

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface:

  • inherits from IEdmState5.
  • is extended by IEdmState7.

See Also

IEdmState6 Members
EPDM.Interop.epdm Namespace


IEdmState6 Interface Members

IEdmState6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmState6 Interface

The following tables list the members exposed by IEdmState6.

Public Properties

 | Name | Description
Property | WorkflowID | Gets the ID of the workflow to which this state belongs.
Top

See Also

IEdmState6 Interface
EPDM.Interop.epdm Namespace


IEdmState6 Interface Properties

IEdmState6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmState6 Interface

For a list of all members of this type, see IEdmState6 members.

Public Properties

 | Name | Description
Property | WorkflowID | Gets the ID of the workflow to which this state belongs.
Top

See Also

IEdmState6 Interface
EPDM.Interop.epdm Namespace


WorkflowID Property (IEdmState6)

WorkflowID Property (IEdmState6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmState6 Interface : WorkflowID Property (IEdmState6)

Gets the ID of the workflow to which this state belongs.

Syntax

Visual Basic
ReadOnly Property WorkflowID As System.Integer
C#
System.int WorkflowID {get;}
C++/CLI
property System.int WorkflowID {
   System.int get();
}

Property Value

ID of the IEdmWorkflow6 to which this state belongs

See Also

IEdmState6 Interface
IEdmState6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmState7 Interface

IEdmState7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmState7 Interface

Allows you to access a workflow state.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmState7
   Inherits IEdmObject5, IEdmState5, IEdmState6
C#
public interface IEdmState7 : IEdmObject5, IEdmState5, IEdmState6
C++/CLI
public interface class IEdmState7 : public IEdmObject5, IEdmState5, IEdmState6

Example

Graph a Workflow (VB.NET)
Graph a Workflow (C#)

Remarks

This interface extends IEdmState6 by providing access to the size and position of the state box in the workflow graph.

See Also

IEdmState7 Members
EPDM.Interop.epdm Namespace


IEdmState7 Interface Members

IEdmState7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmState7 Interface

The following tables list the members exposed by IEdmState7.

Public Methods

 | Name | Description
Method | GetRect | Gets the bounding rectangle of the state box displayed in the workflow editor.
Top

See Also

IEdmState7 Interface
EPDM.Interop.epdm Namespace


IEdmState7 Interface Methods

IEdmState7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmState7 Interface

For a list of all members of this type, see IEdmState7 members.

Public Methods

 | Name | Description
Method | GetRect | Gets the bounding rectangle of the state box displayed in the workflow editor.
Top

See Also

IEdmState7 Interface
EPDM.Interop.epdm Namespace


GetRect Method (IEdmState7)

GetRect Method (IEdmState7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmState7 Interface : GetRect Method (IEdmState7)

poRect
EdmRect structure; bounding rectangle of the state box displayed in the workflow editor
Gets the bounding rectangle of the state box displayed in the workflow editor.

Syntax

Visual Basic
Sub GetRect( _
   ByRef poRect As EdmRect _
)
C#
void GetRect(
   out EdmRect poRect
)
C++/CLI
void GetRect(
&   [Out] EdmRect poRect
)

Parameters

poRect
EdmRect structure; bounding rectangle of the state box displayed in the workflow editor

Example

See the IEdmState7 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmState7 Interface
IEdmState7 Members
IEdmTransition7::GetRect Method ()
IEdmTransition7::GetArrowVertices Method ()

Availability

SOLIDWORKS PDM Professional 2011


IEdmStrLst5 Interface

IEdmStrLst5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmStrLst5 Interface

Allows you to access a list of arbitrary strings.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmStrLst5
C#
public interface IEdmStrLst5
C++/CLI
public interface class IEdmStrLst5

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Set Initial Revision (VB.NET)
Set Initial Revision (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Access Check-in Flags in Check out Dialog (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmFile5::GetConfigurations

IEdmVault5:BrowseForFile

See Also

IEdmStrLst5 Members
EPDM.Interop.epdm Namespace


IEdmStrLst5 Interface Members

IEdmStrLst5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmStrLst5 Interface

The following tables list the members exposed by IEdmStrLst5.

Public Properties

 | Name | Description
Property | Count | Gets the number of strings in this list.
Property | IsEmpty | Gets whether this list is empty.
Top

Public Methods

 | Name | Description
Method | AddTail | Adds a string to the end of this list.
Method | GetHeadPosition | Starts an enumeration of the strings in this list.
Method | GetNext | Gets the next string in this list.
Top

See Also

IEdmStrLst5 Interface
EPDM.Interop.epdm Namespace


IEdmStrLst5 Interface Methods

IEdmStrLst5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmStrLst5 Interface

For a list of all members of this type, see IEdmStrLst5 members.

Public Methods

 | Name | Description
Method | AddTail | Adds a string to the end of this list.
Method | GetHeadPosition | Starts an enumeration of the strings in this list.
Method | GetNext | Gets the next string in this list.
Top

See Also

IEdmStrLst5 Interface
EPDM.Interop.epdm Namespace


AddTail Method (IEdmStrLst5)

AddTail Method (IEdmStrLst5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmStrLst5 Interface : AddTail Method (IEdmStrLst5)

bsString
String to add to the end of this list
Adds a string to the end of this list.

Syntax

Visual Basic
Sub AddTail( _
   ByVal bsString As System.String _
)
C#
void AddTail(
   System.string bsString
)
C++/CLI
void AddTail(
&   System.String^ bsString
)

Parameters

bsString
String to add to the end of this list

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmStrLst5 Interface
IEdmStrLst5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetHeadPosition Method (IEdmStrLst5)

GetHeadPosition Method (IEdmStrLst5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmStrLst5 Interface : GetHeadPosition Method (IEdmStrLst5)

Starts an enumeration of the strings in this list.

Syntax

Visual Basic
Function GetHeadPosition() As IEdmPos5
C#
IEdmPos5 GetHeadPosition()
C++/CLI
IEdmPos5^ GetHeadPosition();

Return Value

IEdmPos5; position in the list of the first string (see Remarks)

Example

See the IEdmStrLst5 examples.

Remarks

After calling this method, pass the returned position of the first string to IEdmStrLst5::GetNext to get the first string in this list. Then call IEdmStrLst5::GetNext repeatedly to get the rest of the strings in this list.

C++ programmers not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmStrLst5 Interface
IEdmStrLst5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNext Method (IEdmStrLst5)

GetNext Method (IEdmStrLst5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmStrLst5 Interface : GetNext Method (IEdmStrLst5)

poPos
IEdmPos5; position of the next string in this list (see Remarks)
Gets the next string in this list.

Syntax

Visual Basic
Function GetNext( _
   ByVal poPos As IEdmPos5 _
) As System.String
C#
System.string GetNext(
   IEdmPos5 poPos
)
C++/CLI
System.String^ GetNext(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next string in this list (see Remarks)

Return Value

Next string in this list

Example

See the IEdmStrLst5 examples.

Remarks

Before calling this method the first time, you must populate poPosition with the interface to the position of the first string, IEdmPos5. Call IEdmStrLst5::GetHeadPosition to start an enumeration and obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the strings.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers must free the returned pointer with a call to SysFreeString.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmStrLst5 Interface
IEdmStrLst5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmStrLst5 Interface Properties

IEdmStrLst5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmStrLst5 Interface

For a list of all members of this type, see IEdmStrLst5 members.

Public Properties

 | Name | Description
Property | Count | Gets the number of strings in this list.
Property | IsEmpty | Gets whether this list is empty.
Top

See Also

IEdmStrLst5 Interface
EPDM.Interop.epdm Namespace


Count Property (IEdmStrLst5)

Count Property (IEdmStrLst5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmStrLst5 Interface : Count Property (IEdmStrLst5)

Gets the number of strings in this list.

Syntax

Visual Basic
ReadOnly Property Count As System.Integer
C#
System.int Count {get;}
C++/CLI
property System.int Count {
   System.int get();
}

Property Value

Number of strings in this list

See Also

IEdmStrLst5 Interface
IEdmStrLst5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IsEmpty Property (IEdmStrLst5)

IsEmpty Property (IEdmStrLst5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmStrLst5 Interface : IsEmpty Property (IEdmStrLst5)

Gets whether this list is empty.

Syntax

Visual Basic
ReadOnly Property IsEmpty As System.Boolean
C#
System.bool IsEmpty {get;}
C++/CLI
property System.bool IsEmpty {
   System.bool get();
}

Property Value

True if this list is empty, false if not

See Also

IEdmStrLst5 Interface
IEdmStrLst5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmSWBom Interface

IEdmSWBom Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSWBom Interface

Allows you to access a SOLIDWORKS BOM.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSWBom
C#
public interface IEdmSWBom
C++/CLI
public interface class IEdmSWBom

Example

See the IEdmBomMgr3 examples.

Accessors

IEdmBomMgr3::CreateEmptySWBom

See Also

IEdmSWBom Members
EPDM.Interop.epdm Namespace


IEdmSWBom Interface Members

IEdmSWBom Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmSWBom Interface

The following tables list the members exposed by IEdmSWBom.

Public Properties

 | Name | Description
Property | IncrementNumber | Gets or sets the increment for numbering items in this BOM.
Property | Name | Gets or sets the name of this BOM.
Property | RefCfgs | Gets or sets the configurations of the document on which this BOM is based.
Property | RefDocID | Gets or sets the ID of the document on which this BOM is based.
Property | SheetName | Gets or sets the name of the sheet on which this BOM is located.
Property | StartNumber | Gets or sets the starting number of items in this BOM.
Property | TableType | Gets or sets the type of this BOM.
Top

Public Methods

 | Name | Description
Method | DeleteColumn | Deletes the specified column from this BOM.
Method | DeleteRow | Deletes the specified row from this BOM.
Method | GetCell | Gets the specified cell in this BOM.
Method | GetColumn | Gets the specified column in this BOM.
Method | GetColumnsCount | Gets the number of columns in this BOM.
Method | GetRow | Gets the specified row in this BOM.
Method | GetRowsCount | Gets the number of rows in this BOM.
Method | InsertColumn | Inserts a column at the specified column index.
Method | InsertRow | Inserts a row at the specified index.
Top

See Also

IEdmSWBom Interface
EPDM.Interop.epdm Namespace


IEdmSWBom Interface Methods

IEdmSWBom Interface Methods
EPDM.Interop.epdm Namespace : IEdmSWBom Interface

For a list of all members of this type, see IEdmSWBom members.

Public Methods

 | Name | Description
Method | DeleteColumn | Deletes the specified column from this BOM.
Method | DeleteRow | Deletes the specified row from this BOM.
Method | GetCell | Gets the specified cell in this BOM.
Method | GetColumn | Gets the specified column in this BOM.
Method | GetColumnsCount | Gets the number of columns in this BOM.
Method | GetRow | Gets the specified row in this BOM.
Method | GetRowsCount | Gets the number of rows in this BOM.
Method | InsertColumn | Inserts a column at the specified column index.
Method | InsertRow | Inserts a row at the specified index.
Top

See Also

IEdmSWBom Interface
EPDM.Interop.epdm Namespace


DeleteColumn Method (IEdmSWBom)

DeleteColumn Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : DeleteColumn Method (IEdmSWBom)

lNr
0-based index of column to delete
Deletes the specified column from this BOM.

Syntax

Visual Basic
Sub DeleteColumn( _
   ByVal lNr As System.Integer _
)
C#
void DeleteColumn(
   System.int lNr
)
C++/CLI
void DeleteColumn(
&   System.int lNr
)

Parameters

lNr
0-based index of column to delete

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


DeleteRow Method (IEdmSWBom)

DeleteRow Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : DeleteRow Method (IEdmSWBom)

lNr
0-based index of row to delete
Deletes the specified row from this BOM.

Syntax

Visual Basic
Sub DeleteRow( _
   ByVal lNr As System.Integer _
)
C#
void DeleteRow(
   System.int lNr
)
C++/CLI
void DeleteRow(
&   System.int lNr
)

Parameters

lNr
0-based index of row to delete

See Also

IEdmSWBom Interface
IEdmSWBom Members


GetCell Method (IEdmSWBom)

GetCell Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : GetCell Method (IEdmSWBom)

lRowNr
0-based index of cell row
lColumnNr
0-based index of cell column
Gets the specified cell in this BOM.

Syntax

Visual Basic
Function GetCell( _
   ByVal lRowNr As System.Integer, _
   ByVal lColumnNr As System.Integer _
) As EdmSWBomCell
C#
EdmSWBomCell GetCell(
   System.int lRowNr,
   System.int lColumnNr
)
C++/CLI
EdmSWBomCell^ GetCell(
&   System.int lRowNr,
&   System.int lColumnNr
)

Parameters

lRowNr
0-based index of cell row
lColumnNr
0-based index of cell column

Return Value

IEdmSWBomCell

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


GetColumn Method (IEdmSWBom)

GetColumn Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : GetColumn Method (IEdmSWBom)

lNr
0-based index of column to retrieve
Gets the specified column in this BOM.

Syntax

Visual Basic
Function GetColumn( _
   ByVal lNr As System.Integer _
) As EdmSWBomColumn
C#
EdmSWBomColumn GetColumn(
   System.int lNr
)
C++/CLI
EdmSWBomColumn^ GetColumn(
&   System.int lNr
)

Parameters

lNr
0-based index of column to retrieve

Return Value

IEdmSWBomColumn

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


GetColumnsCount Method (IEdmSWBom)

GetColumnsCount Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : GetColumnsCount Method (IEdmSWBom)

Gets the number of columns in this BOM.

Syntax

Visual Basic
Function GetColumnsCount() As System.Integer
C#
System.int GetColumnsCount()
C++/CLI
System.int GetColumnsCount();

Return Value

Number of columns

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


GetRow Method (IEdmSWBom)

GetRow Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : GetRow Method (IEdmSWBom)

lNr
0-based index of row to retrieve
Gets the specified row in this BOM.

Syntax

Visual Basic
Function GetRow( _
   ByVal lNr As System.Integer _
) As EdmSWBomRow
C#
EdmSWBomRow GetRow(
   System.int lNr
)
C++/CLI
EdmSWBomRow^ GetRow(
&   System.int lNr
)

Parameters

lNr
0-based index of row to retrieve

Return Value

IEdmSWBomRow

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


GetRowsCount Method (IEdmSWBom)

GetRowsCount Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : GetRowsCount Method (IEdmSWBom)

Gets the number of rows in this BOM.

Syntax

Visual Basic
Function GetRowsCount() As System.Integer
C#
System.int GetRowsCount()
C++/CLI
System.int GetRowsCount();

Return Value

Number of rows

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


InsertColumn Method (IEdmSWBom)

InsertColumn Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : InsertColumn Method (IEdmSWBom)

lNr
0-based index where to insert the column; 0 to insert column in first position, -1 to insert column in last position
pbsName
Name of column
Inserts a column at the specified column index.

Syntax

Visual Basic
Function InsertColumn( _
   ByVal lNr As System.Integer, _
   ByVal pbsName As System.String _
) As EdmSWBomColumn
C#
EdmSWBomColumn InsertColumn(
   System.int lNr,
   System.string pbsName
)
C++/CLI
EdmSWBomColumn^ InsertColumn(
&   System.int lNr,
&   System.String^ pbsName
)

Parameters

lNr
0-based index where to insert the column; 0 to insert column in first position, -1 to insert column in last position
pbsName
Name of column

Return Value

IEdmSWBomColumn

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


InsertRow Method (IEdmSWBom)

InsertRow Method (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : InsertRow Method (IEdmSWBom)

lNr
0-based index where to insert the row; 0 to insert in first position, -1 to insert at last position
Inserts a row at the specified index.

Syntax

Visual Basic
Function InsertRow( _
   ByVal lNr As System.Integer _
) As EdmSWBomRow
C#
EdmSWBomRow InsertRow(
   System.int lNr
)
C++/CLI
EdmSWBomRow^ InsertRow(
&   System.int lNr
)

Parameters

lNr
0-based index where to insert the row; 0 to insert in first position, -1 to insert at last position

Return Value

IEdmSWBomRow

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


IEdmSWBom Interface Properties

IEdmSWBom Interface Properties
EPDM.Interop.epdm Namespace : IEdmSWBom Interface

For a list of all members of this type, see IEdmSWBom members.

Public Properties

 | Name | Description
Property | IncrementNumber | Gets or sets the increment for numbering items in this BOM.
Property | Name | Gets or sets the name of this BOM.
Property | RefCfgs | Gets or sets the configurations of the document on which this BOM is based.
Property | RefDocID | Gets or sets the ID of the document on which this BOM is based.
Property | SheetName | Gets or sets the name of the sheet on which this BOM is located.
Property | StartNumber | Gets or sets the starting number of items in this BOM.
Property | TableType | Gets or sets the type of this BOM.
Top

See Also

IEdmSWBom Interface
EPDM.Interop.epdm Namespace


IncrementNumber Property (IEdmSWBom)

IncrementNumber Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : IncrementNumber Property (IEdmSWBom)

Gets or sets the increment for numbering items in this BOM.

Syntax

Visual Basic
Property IncrementNumber As System.Integer
C#
System.int IncrementNumber {get; set;}
C++/CLI
property System.int IncrementNumber {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Increment number

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Name Property (IEdmSWBom)

Name Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : Name Property (IEdmSWBom)

Gets or sets the name of this BOM.

Syntax

Visual Basic
Property Name As System.String
C#
System.string Name {get; set;}
C++/CLI
property System.String^ Name {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

BOM name

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


RefCfgs Property (IEdmSWBom)

RefCfgs Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : RefCfgs Property (IEdmSWBom)

Gets or sets the configurations of the document on which this BOM is based.

Syntax

Visual Basic
Property RefCfgs As System.String
C#
System.string RefCfgs {get; set;}
C++/CLI
property System.String^ RefCfgs {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Reference configurations

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


RefDocID Property (IEdmSWBom)

RefDocID Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : RefDocID Property (IEdmSWBom)

Gets or sets the ID of the document on which this BOM is based.

Syntax

Visual Basic
Property RefDocID As System.Integer
C#
System.int RefDocID {get; set;}
C++/CLI
property System.int RefDocID {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Reference document ID

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


SheetName Property (IEdmSWBom)

SheetName Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : SheetName Property (IEdmSWBom)

Gets or sets the name of the sheet on which this BOM is located.

Syntax

Visual Basic
Property SheetName As System.String
C#
System.string SheetName {get; set;}
C++/CLI
property System.String^ SheetName {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Sheet name

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


StartNumber Property (IEdmSWBom)

StartNumber Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : StartNumber Property (IEdmSWBom)

Gets or sets the starting number of items in this BOM.

Syntax

Visual Basic
Property StartNumber As System.Integer
C#
System.int StartNumber {get; set;}
C++/CLI
property System.int StartNumber {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Starting number

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


TableType Property (IEdmSWBom)

TableType Property (IEdmSWBom)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBom Interface : TableType Property (IEdmSWBom)

Gets or sets the type of this BOM.

Syntax

Visual Basic
Property TableType As System.Integer
C#
System.int TableType {get; set;}
C++/CLI
property System.int TableType {
   System.int get();
   void set ( &   System.int value);
}

Property Value

0 = Parts only

1 = Top-level only

2 = Indented

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBom Interface
IEdmSWBom Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


IEdmSWBomCell Interface

IEdmSWBomCell Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSWBomCell Interface

Allows you to access a cell in a custom SOLIDWORKS BOM table.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSWBomCell
C#
public interface IEdmSWBomCell
C++/CLI
public interface class IEdmSWBomCell

Example

See the IEdmBomMgr3 examples.

Accessors

IEdmSWBom::GetCell

See Also

IEdmSWBomCell Members
EPDM.Interop.epdm Namespace


IEdmSWBomCell Interface Members

IEdmSWBomCell Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmSWBomCell Interface

The following tables list the members exposed by IEdmSWBomCell.

Public Properties

 | Name | Description
Property | ColNr | Gets the column index of this BOM cell.
Property | RowNr | Gets the row index of this BOM cell.
Property | Text | Gets or sets the content of this BOM cell.
Top

See Also

IEdmSWBomCell Interface
EPDM.Interop.epdm Namespace


IEdmSWBomCell Interface Properties

IEdmSWBomCell Interface Properties
EPDM.Interop.epdm Namespace : IEdmSWBomCell Interface

For a list of all members of this type, see IEdmSWBomCell members.

Public Properties

 | Name | Description
Property | ColNr | Gets the column index of this BOM cell.
Property | RowNr | Gets the row index of this BOM cell.
Property | Text | Gets or sets the content of this BOM cell.
Top

See Also

IEdmSWBomCell Interface
EPDM.Interop.epdm Namespace


ColNr Property (IEdmSWBomCell)

ColNr Property (IEdmSWBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomCell Interface : ColNr Property (IEdmSWBomCell)

Gets the column index of this BOM cell.

Syntax

Visual Basic
ReadOnly Property ColNr As System.Integer
C#
System.int ColNr {get;}
C++/CLI
property System.int ColNr {
   System.int get();
}

Property Value

Column index

See Also

IEdmSWBomCell Interface
IEdmSWBomCell Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


RowNr Property (IEdmSWBomCell)

RowNr Property (IEdmSWBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomCell Interface : RowNr Property (IEdmSWBomCell)

Gets the row index of this BOM cell.

Syntax

Visual Basic
ReadOnly Property RowNr As System.Integer
C#
System.int RowNr {get;}
C++/CLI
property System.int RowNr {
   System.int get();
}

Property Value

Row index

See Also

IEdmSWBomCell Interface
IEdmSWBomCell Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Text Property (IEdmSWBomCell)

Text Property (IEdmSWBomCell)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomCell Interface : Text Property (IEdmSWBomCell)

Gets or sets the content of this BOM cell.

Syntax

Visual Basic
Property Text As System.String
C#
System.string Text {get; set;}
C++/CLI
property System.String^ Text {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Text string

See Also

IEdmSWBomCell Interface
IEdmSWBomCell Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


IEdmSWBomColumn Interface

IEdmSWBomColumn Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSWBomColumn Interface

Allows you to access a column in a custom SOLIDWORKS BOM table.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSWBomColumn
C#
public interface IEdmSWBomColumn
C++/CLI
public interface class IEdmSWBomColumn

Example

See the IEdmBomMgr3 examples.

Accessors

IEdmSWBom::GetColumn

IEdmSWBom::InsertColumn

See Also

IEdmSWBomColumn Members
EPDM.Interop.epdm Namespace


IEdmSWBomColumn Interface Members

IEdmSWBomColumn Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmSWBomColumn Interface

The following tables list the members exposed by IEdmSWBomColumn.

Public Properties

 | Name | Description
Property | ColNr | Gets the index of this BOM column.
Property | CustomPropName | Gets or sets the custom property to which this BOM column is associated.
Property | Flags | Gets or sets the alignment of this BOM column.
Property | Name | Gets or sets the name of this BOM column.
Property | Type | Gets or sets the type of this BOM column.
Property | Width | Gets or sets the width of this BOM column.
Top

See Also

IEdmSWBomColumn Interface
EPDM.Interop.epdm Namespace


IEdmSWBomColumn Interface Properties

IEdmSWBomColumn Interface Properties
EPDM.Interop.epdm Namespace : IEdmSWBomColumn Interface

For a list of all members of this type, see IEdmSWBomColumn members.

Public Properties

 | Name | Description
Property | ColNr | Gets the index of this BOM column.
Property | CustomPropName | Gets or sets the custom property to which this BOM column is associated.
Property | Flags | Gets or sets the alignment of this BOM column.
Property | Name | Gets or sets the name of this BOM column.
Property | Type | Gets or sets the type of this BOM column.
Property | Width | Gets or sets the width of this BOM column.
Top

See Also

IEdmSWBomColumn Interface
EPDM.Interop.epdm Namespace


ColNr Property (IEdmSWBomColumn)

ColNr Property (IEdmSWBomColumn)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomColumn Interface : ColNr Property (IEdmSWBomColumn)

Gets the index of this BOM column.

Syntax

Visual Basic
ReadOnly Property ColNr As System.Integer
C#
System.int ColNr {get;}
C++/CLI
property System.int ColNr {
   System.int get();
}

Property Value

Column index

See Also

IEdmSWBomColumn Interface
IEdmSWBomColumn Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


CustomPropName Property (IEdmSWBomColumn)

CustomPropName Property (IEdmSWBomColumn)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomColumn Interface : CustomPropName Property (IEdmSWBomColumn)

Gets or sets the custom property to which this BOM column is associated.

Syntax

Visual Basic
Property CustomPropName As System.String
C#
System.string CustomPropName {get; set;}
C++/CLI
property System.String^ CustomPropName {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Custom property name

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomColumn Interface
IEdmSWBomColumn Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Flags Property (IEdmSWBomColumn)

Flags Property (IEdmSWBomColumn)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomColumn Interface : Flags Property (IEdmSWBomColumn)

Gets or sets the alignment of this BOM column.

Syntax

Visual Basic
Property Flags As System.Integer
C#
System.int Flags {get; set;}
C++/CLI
property System.int Flags {
   System.int get();
   void set ( &   System.int value);
}

Property Value

0 = left

1 = right

2 = center

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomColumn Interface
IEdmSWBomColumn Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Name Property (IEdmSWBomColumn)

Name Property (IEdmSWBomColumn)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomColumn Interface : Name Property (IEdmSWBomColumn)

Gets or sets the name of this BOM column.

Syntax

Visual Basic
Property Name As System.String
C#
System.string Name {get; set;}
C++/CLI
property System.String^ Name {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Column name

See Also

IEdmSWBomColumn Interface
IEdmSWBomColumn Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Type Property (IEdmSWBomColumn)

Type Property (IEdmSWBomColumn)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomColumn Interface : Type Property (IEdmSWBomColumn)

Gets or sets the type of this BOM column.

Syntax

Visual Basic
Property Type As System.Integer
C#
System.int Type {get; set;}
C++/CLI
property System.int Type {
   System.int get();
   void set ( &   System.int value);
}

Property Value

0 = Zone

1 = Revision

2 = Description

3 = Date

4 = Approved

5 = User

6 = Configuration quantity

7 = Item number

8 = Part number

-1 = Type not found

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomColumn Interface
IEdmSWBomColumn Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Width Property (IEdmSWBomColumn)

Width Property (IEdmSWBomColumn)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomColumn Interface : Width Property (IEdmSWBomColumn)

Gets or sets the width of this BOM column.

Syntax

Visual Basic
Property Width As System.Integer
C#
System.int Width {get; set;}
C++/CLI
property System.int Width {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Column width in characters

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomColumn Interface
IEdmSWBomColumn Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


IEdmSWBomRow Interface

IEdmSWBomRow Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSWBomRow Interface

Allows you to access a row in a custom SOLIDWORKS BOM table.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSWBomRow
C#
public interface IEdmSWBomRow
C++/CLI
public interface class IEdmSWBomRow

Example

See the IEdmBomMgr3 examples.

Accessors

IEdmSWBom::GetRow

IEdmSWBom::InsertRow

See Also

IEdmSWBomRow Members
EPDM.Interop.epdm Namespace


IEdmSWBomRow Interface Members

IEdmSWBomRow Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmSWBomRow Interface

The following tables list the members exposed by IEdmSWBomRow.

Public Properties

 | Name | Description
Property | ComponentRep | Gets or sets the component representation to which this BOM row is associated.
Property | Configuration | Gets or sets the configuration of the document to which this BOM row is associated.
Property | DocID | Gets or sets the ID of the document to which this BOM row is associated.
Property | ProjectID | ts or sets the ID of the project where this BOM row's document resides.
Property | RowNr | Gets the index of this BOM row.
Property | Version | Gets or sets the version of the document to which this BOM row is associated.
Top

See Also

IEdmSWBomRow Interface
EPDM.Interop.epdm Namespace


IEdmSWBomRow Interface Properties

IEdmSWBomRow Interface Properties
EPDM.Interop.epdm Namespace : IEdmSWBomRow Interface

For a list of all members of this type, see IEdmSWBomRow members.

Public Properties

 | Name | Description
Property | ComponentRep | Gets or sets the component representation to which this BOM row is associated.
Property | Configuration | Gets or sets the configuration of the document to which this BOM row is associated.
Property | DocID | Gets or sets the ID of the document to which this BOM row is associated.
Property | ProjectID | ts or sets the ID of the project where this BOM row's document resides.
Property | RowNr | Gets the index of this BOM row.
Property | Version | Gets or sets the version of the document to which this BOM row is associated.
Top

See Also

IEdmSWBomRow Interface
EPDM.Interop.epdm Namespace


ComponentRep Property (IEdmSWBomRow)

ComponentRep Property (IEdmSWBomRow)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomRow Interface : ComponentRep Property (IEdmSWBomRow)

Gets or sets the component representation to which this BOM row is associated.

Syntax

Visual Basic
Property ComponentRep As System.String
C#
System.string ComponentRep {get; set;}
C++/CLI
property System.String^ ComponentRep {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Component representation

See Also

IEdmSWBomRow Interface
IEdmSWBomRow Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Configuration Property (IEdmSWBomRow)

Configuration Property (IEdmSWBomRow)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomRow Interface : Configuration Property (IEdmSWBomRow)

Gets or sets the configuration of the document to which this BOM row is associated.

Syntax

Visual Basic
Property Configuration As System.String
C#
System.string Configuration {get; set;}
C++/CLI
property System.String^ Configuration {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Configuration of associated document

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomRow Interface
IEdmSWBomRow Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


DocID Property (IEdmSWBomRow)

DocID Property (IEdmSWBomRow)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomRow Interface : DocID Property (IEdmSWBomRow)

Gets or sets the ID of the document to which this BOM row is associated.

Syntax

Visual Basic
Property DocID As System.Integer
C#
System.int DocID {get; set;}
C++/CLI
property System.int DocID {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Document ID

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomRow Interface
IEdmSWBomRow Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


ProjectID Property (IEdmSWBomRow)

ProjectID Property (IEdmSWBomRow)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomRow Interface : ProjectID Property (IEdmSWBomRow)

ts or sets the ID of the project where this BOM row's document resides.

Syntax

Visual Basic
Property ProjectID As System.Integer
C#
System.int ProjectID {get; set;}
C++/CLI
property System.int ProjectID {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Project ID

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomRow Interface
IEdmSWBomRow Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


RowNr Property (IEdmSWBomRow)

RowNr Property (IEdmSWBomRow)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomRow Interface : RowNr Property (IEdmSWBomRow)

Gets the index of this BOM row.

Syntax

Visual Basic
ReadOnly Property RowNr As System.Integer
C#
System.int RowNr {get;}
C++/CLI
property System.int RowNr {
   System.int get();
}

Property Value

Row index

See Also

IEdmSWBomRow Interface
IEdmSWBomRow Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


Version Property (IEdmSWBomRow)

Version Property (IEdmSWBomRow)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSWBomRow Interface : Version Property (IEdmSWBomRow)

Gets or sets the version of the document to which this BOM row is associated.

Syntax

Visual Basic
Property Version As System.Integer
C#
System.int Version {get; set;}
C++/CLI
property System.int Version {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Document version

Example

See the IEdmBomMgr3 examples.

See Also

IEdmSWBomRow Interface
IEdmSWBomRow Members

Availability

SOLIDWORKS PDM Professional 2021 SP03


IEdmTaskInstance Interface

IEdmTaskInstance Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTaskInstance Interface

Allows you to access the task instance of an add-in.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTaskInstance
C#
public interface IEdmTaskInstance
C++/CLI
public interface class IEdmTaskInstance

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

An instance of the task is created when the task is launched. This interface is created in EdmCmd::mpoExtra when an add-in calls IEdmAddIn5::OnCmd and has previously registered the hooks, EdmCmdType.EdmCmd_TaskRun, EdmCmdType.EdmCmd_TaskLaunch, EdmCmdType.EdmCmd_TaskDetails, using IEdmCmdMgr5::AddHook. After the task launches, IEdmTaskInstance can be used to prompt the user for user-defined variable values, display a data card for editing data card variables, or update the task list messages and progress bar as the task runs.

Programming tasks are add-ins that allow you to specify when and where to perform specific tasks.

The definition of the task can be used to modify the task setup page.

See Also

IEdmTaskInstance Members
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


IEdmTaskInstance Interface Members

IEdmTaskInstance Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmTaskInstance Interface

The following tables list the members exposed by IEdmTaskInstance.

Public Properties

 | Name | Description
Property | ID | Gets the database ID of this task instance.
Property | InstanceGUID | Gets the task instance GUID.
Property | TaskGUID | Gets the task definition GUID.
Property | TaskName | Gets the name of this task.
Top

Public Methods

 | Name | Description
Method | GetStatus | Gets the current status of this task instance.
Method | GetValEx | Gets the value of the specified user-defined variable.
Method | GetVar | Gets the value of a card variable created in the administration tool.
Method | SetProgressPos | Updates the task list progress bar during execution of this task instance.
Method | SetProgressRange | Sets the range of the progress bar for the execution of this task instance.
Method | SetStatus | Sets the specified status of this task instance.
Method | SetValEx | Sets a value for the specified user-defined variable.
Method | SetVar | Sets the value of a card variable created in the administration tool.
Top

See Also

IEdmTaskInstance Interface
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


IEdmTaskInstance Interface Methods

IEdmTaskInstance Interface Methods
EPDM.Interop.epdm Namespace : IEdmTaskInstance Interface

For a list of all members of this type, see IEdmTaskInstance members.

Public Methods

 | Name | Description
Method | GetStatus | Gets the current status of this task instance.
Method | GetValEx | Gets the value of the specified user-defined variable.
Method | GetVar | Gets the value of a card variable created in the administration tool.
Method | SetProgressPos | Updates the task list progress bar during execution of this task instance.
Method | SetProgressRange | Sets the range of the progress bar for the execution of this task instance.
Method | SetStatus | Sets the specified status of this task instance.
Method | SetValEx | Sets a value for the specified user-defined variable.
Method | SetVar | Sets the value of a card variable created in the administration tool.
Top

See Also

IEdmTaskInstance Interface
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


GetStatus Method (IEdmTaskInstance)

GetStatus Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : GetStatus Method (IEdmTaskInstance)

Gets the current status of this task instance.

Syntax

Visual Basic
Function GetStatus() As EdmTaskStatus
C#
EdmTaskStatus GetStatus()
C++/CLI
EdmTaskStatus GetStatus();

Return Value

Status as defined in EdmTaskStatus

Remarks

The add-in calls this method regularly during the processing of EdmCmdType.EdmCmd_TaskRun to see if the task has been canceled or suspended in the task list user interface.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members
IEdmTaskInstance::SetStatus Method ()
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


GetValEx Method (IEdmTaskInstance)

GetValEx Method (IEdmTaskInstance)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : GetValEx Method (IEdmTaskInstance)

bsValName
Name of a user-defined variable
Gets the value of the specified user-defined variable.

Syntax

Visual Basic
Function GetValEx( _
   ByVal bsValName As System.String _
) As System.Object
C#
System.object GetValEx(
   System.string bsValName
)
C++/CLI
System.Object^ GetValEx(
&   System.String^ bsValName
)

Parameters

bsValName
Name of a user-defined variable

Return Value

Value of user-defined variable (see Remarks)

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This method gets the value of a user-defined variable that is created by IEdmTaskInstance::SetValEx or IEdmTaskProperties::SetValEx. User-defined variables are usually created during the processing of the EdmCmdType.EdmCmd_TaskLaunch or the EdmCmdType.EdmCmd_TaskSetup hook and are usually read during the processing of the EdmCmdType.EdmCmd_TaskRun hook.

Custom data types and objects must have been serialized to a string, numeric type, or date before calling IEdmTaskInstance::SetValEx or IEdmTaskProperites::SetValEx. For example:

  1. Serialize the object data to XML or JSON using StringBuilder, XmlWriter, XmlSerializer, etc.
  2. Call IEdmTaskInstance::SetValEx or IEdmTaskProperties::SetValEx to store the resulting string.
  3. Call IEdmTaskInstance::GetValEx to retrieve the stored string.
  4. Initialize the new instance of the object from XML/JSON using StringReader, XmlReader, XmlSerializer, etc.

NOTE: User-defined variables are not related to the card variables created using the administration tool. To access card variables, call IEdmTaskInstance::GetVar and IEdmTaskInstance::SetVar.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


GetVar Method (IEdmTaskInstance)

GetVar Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : GetVar Method (IEdmTaskInstance)

oVarIDorName
ID or name of the card variable for which to get a value
Gets the value of a card variable created in the administration tool.

Syntax

Visual Basic
Function GetVar( _
   ByVal oVarIDorName As System.Object _
) As System.Object
C#
System.object GetVar(
   System.object oVarIDorName
)
C++/CLI
System.Object^ GetVar(
&   System.Object^ oVarIDorName
)

Parameters

oVarIDorName
ID or name of the card variable for which to get a value

Return Value

Value of a card variable

Remarks

The task add-in calls this method while the task is running on the server (EdmCmdType.EdmCmd_TaskRun) to retrieve a variable value set by the add-in when it calls:

  • IEdmTaskInstance::SetVar during the processing of the EdmCmdType.EdmCmd_TaskLaunch hook when the user enters values on the data card displayed when the task is launched on the client computer.
  • IEdmTaskProperties.SetVar during the processing of the EdmCmdType.EdmCmd_TaskSetup hook when the user enters data card variable values on the task setup page.

Card variables accessible by this method must be created using the administration tool card editor and are not related to the user-defined variables accessed by IEdmTaskInstance::GetValEx and IEdmTaskInstance::SetValEx.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members
IEdmTaskInstance::SetVar Method ()
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


SetProgressPos Method (IEdmTaskInstance)

SetProgressPos Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : SetProgressPos Method (IEdmTaskInstance)

lPos
Current position of the progress bar
bsDocStr
Description of what the add-in is currently doing
Updates the task list progress bar during execution of this task instance.

Syntax

Visual Basic
Sub SetProgressPos( _
   ByVal lPos As System.Integer, _
   ByVal bsDocStr As System.String _
)
C#
void SetProgressPos(
   System.int lPos,
   System.string bsDocStr
)
C++/CLI
void SetProgressPos(
&   System.int lPos,
&   System.String^ bsDocStr
)

Parameters

lPos
Current position of the progress bar
bsDocStr
Description of what the add-in is currently doing

Example

See the examples in IEdmTaskInstance.

Remarks

The task add-in calls this method periodically during processing of the hook, EdmCmdType.EdmCmd.TaskRun, to update the progress bar in the task list window of the PDM Administration tool.

Initialize the task list progress bar by calling IEdmTaskinstance::SetProgressRange at the start of processing of the hook, EdmCmdType.EdmCmd.TaskRun.

lPos is between 0 and lMax of IEdmTaskinstance::SetProgressRange.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


SetProgressRange Method (IEdmTaskInstance)

SetProgressRange Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : SetProgressRange Method (IEdmTaskInstance)

lMax
Maximum position in the progress bar
lPos
0 <= Current position in the progress bar <= lMax
bsDocStr
Description of what the add-in is currently doing
Sets the range of the progress bar for the execution of this task instance.

Syntax

Visual Basic
Sub SetProgressRange( _
   ByVal lMax As System.Integer, _
   ByVal lPos As System.Integer, _
   ByVal bsDocStr As System.String _
)
C#
void SetProgressRange(
   System.int lMax,
   System.int lPos,
   System.string bsDocStr
)
C++/CLI
void SetProgressRange(
&   System.int lMax,
&   System.int lPos,
&   System.String^ bsDocStr
)

Parameters

lMax
Maximum position in the progress bar
lPos
0 <= Current position in the progress bar <= lMax
bsDocStr
Description of what the add-in is currently doing

Example

See the examples in IEdmTaskInstance.

Remarks

The task add-in calls this method at the start of processing of the hook, EdmCmdType.EdmCmd.TaskRun, to initialize the task list progress bar in the task list window of the PDM Administration tool.

The task add-in calls IEdmTaskInstance::SetProgressPos periodically during processing of the hook, EdmCmdType.EdmCmd.TaskRun, to update the progress bar.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


SetStatus Method (IEdmTaskInstance)

SetStatus Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : SetStatus Method (IEdmTaskInstance)

eStatus
Status of this task as defined in EdmTaskStatus
lHRESULT
Optional error code to display in the properties window when terminating the task; valid only if eStatus is EdmTaskStatus.EdmTaskStat_DoneFailed
bsCustomMsg
Optional error message to display when terminating the task; valid only if eStatus is EdmTaskStatus.EdmTaskStat_DoneFailed
oNotificationAttachments
Optional array of EdmSelItem2 structures; one structure for each file link to add to the notification message that is sent when the task completes
bsExtraNotificationMsg
Optional message to append to the notification message that is sent when the task completes
Sets the specified status of this task instance.

Syntax

Visual Basic
Sub SetStatus( _
   ByVal eStatus As EdmTaskStatus, _
   Optional ByVal lHRESULT As System.Integer, _
   Optional ByVal bsCustomMsg As System.String, _
   Optional ByVal oNotificationAttachments As System.Object, _
   Optional ByVal bsExtraNotificationMsg As System.String _
)
C#
void SetStatus(
   EdmTaskStatus eStatus,
   System.int lHRESULT,
   System.string bsCustomMsg,
   System.object oNotificationAttachments,
   System.string bsExtraNotificationMsg
)
C++/CLI
void SetStatus(
&   EdmTaskStatus eStatus,
&   System.int lHRESULT,
&   System.String^ bsCustomMsg,
&   System.Object^ oNotificationAttachments,
&   System.String^ bsExtraNotificationMsg
)

Parameters

eStatus
Status of this task as defined in EdmTaskStatus
lHRESULT
Optional error code to display in the properties window when terminating the task; valid only if eStatus is EdmTaskStatus.EdmTaskStat_DoneFailed
bsCustomMsg
Optional error message to display when terminating the task; valid only if eStatus is EdmTaskStatus.EdmTaskStat_DoneFailed
oNotificationAttachments
Optional array of EdmSelItem2 structures; one structure for each file link to add to the notification message that is sent when the task completes
bsExtraNotificationMsg
Optional message to append to the notification message that is sent when the task completes

Example

See the examples in IEdmTaskInstance.

Remarks

The task add-in calls this method to inform the framework about the current status of the task.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members
IEdmTaskInstance::GetStatus Method ()

Availability

SOLIDWORKS PDM Professional 2010


SetValEx Method (IEdmTaskInstance)

SetValEx Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : SetValEx Method (IEdmTaskInstance)

bsValName
User-defined variable name
oValue
Value of user-defined variable (see Remarks)
Sets a value for the specified user-defined variable.

Syntax

Visual Basic
Sub SetValEx( _
   ByVal bsValName As System.String, _
   ByVal oValue As System.Object _
)
C#
void SetValEx(
   System.string bsValName,
   System.object oValue
)
C++/CLI
void SetValEx(
&   System.String^ bsValName,
&   System.Object^ oValue
)

Parameters

bsValName
User-defined variable name
oValue
Value of user-defined variable (see Remarks)

Remarks

This method can be called to set the value when the task is launched on the client computer (EdmCmdType.EdmCmd_TaskLaunch) and IEdmTaskInstance::GetValEx can be called to get the value when the task is executed on the server (EdmCmdType.EdmCmd_TaskRun).

Custom data types and objects must be serialized to a string, numeric type, or date before calling IEdmTaskInstance::SetValEx. For example:

  1. Serialize the object data to XML or JSON using StringBuilder, XmlWriter, XmlSerializer, etc.
  2. Call IEdmTaskInstance::SetValEx to store the resulting string.
  3. Call IEdmTaskInstance::GetValEx to retrieve the stored string.
  4. Initialize the new instance of the object from XML/JSON using StringReader, XmlReader, XmlSerializer, etc.

NOTE: The difference between this method and IEdmTaskInstance::SetVar is that the latter requires a pre-defined card variable in the vault, whereas this method does not.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


SetVar Method (IEdmTaskInstance)

SetVar Method (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : SetVar Method (IEdmTaskInstance)

oVarIDorName
Database ID or name of the variable for which to set a value (see Remarks)
oValue
Value to set
Sets the value of a card variable created in the administration tool.

Syntax

Visual Basic
Sub SetVar( _
   ByVal oVarIDorName As System.Object, _
   ByVal oValue As System.Object _
)
C#
void SetVar(
   System.object oVarIDorName,
   System.object oValue
)
C++/CLI
void SetVar(
&   System.Object^ oVarIDorName,
&   System.Object^ oValue
)

Parameters

oVarIDorName
Database ID or name of the variable for which to set a value (see Remarks)
oValue
Value to set

Remarks

The task add-in can display a data card with variable values that the user can modify when the task is launched on the client computer (EdmCmdType.EdmCmd_TaskLaunch). The add-in can call this method to store the variable values entered by the user.

The task add-in can call IEdmTaskInstance::GetVar during the processing of the EdmCmdType.EdmCmd_TaskRun hook to retrieve a card variable value from the server where the task is running.

Card variables are created using the administration tool card editor and are not related to the user-defined variables accessed by IEdmTaskInstance::GetValEx and IEdmTaskInstance::SetValEx.

The difference between this method and IEdmTaskInstance::SetValEx is that the latter does not require a pre-defined card variable in the vault, whereas this method does.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


IEdmTaskInstance Interface Properties

IEdmTaskInstance Interface Properties
EPDM.Interop.epdm Namespace : IEdmTaskInstance Interface

For a list of all members of this type, see IEdmTaskInstance members.

Public Properties

 | Name | Description
Property | ID | Gets the database ID of this task instance.
Property | InstanceGUID | Gets the task instance GUID.
Property | TaskGUID | Gets the task definition GUID.
Property | TaskName | Gets the name of this task.
Top

See Also

IEdmTaskInstance Interface
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


ID Property (IEdmTaskInstance)

ID Property (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : ID Property (IEdmTaskInstance)

Gets the database ID of this task instance.

Syntax

Visual Basic
ReadOnly Property ID As System.Long
C#
System.long ID {get;}
C++/CLI
property System.int64 ID {
   System.int64 get();
}

Property Value

Database ID

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


InstanceGUID Property (IEdmTaskInstance)

InstanceGUID Property (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : InstanceGUID Property (IEdmTaskInstance)

Gets the task instance GUID.

Syntax

Visual Basic
ReadOnly Property InstanceGUID As System.String
C#
System.string InstanceGUID {get;}
C++/CLI
property System.String^ InstanceGUID {
   System.String^ get();
}

Property Value

Task instance GUID

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


TaskGUID Property (IEdmTaskInstance)

TaskGUID Property (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : TaskGUID Property (IEdmTaskInstance)

Gets the task definition GUID.

Syntax

Visual Basic
ReadOnly Property TaskGUID As System.String
C#
System.string TaskGUID {get;}
C++/CLI
property System.String^ TaskGUID {
   System.String^ get();
}

Property Value

Task definition GUID.

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


TaskName Property (IEdmTaskInstance)

TaskName Property (IEdmTaskInstance)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskInstance Interface : TaskName Property (IEdmTaskInstance)

Gets the name of this task.

Syntax

Visual Basic
ReadOnly Property TaskName As System.String
C#
System.string TaskName {get;}
C++/CLI
property System.String^ TaskName {
   System.String^ get();
}

Property Value

Task name

See Also

IEdmTaskInstance Interface
IEdmTaskInstance Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmTaskMgr Interface

IEdmTaskMgr Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTaskMgr Interface

Allows you to manage task add-ins.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTaskMgr
C#
public interface IEdmTaskMgr
C++/CLI
public interface class IEdmTaskMgr

Example

Get and Run a Task Add-in (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmVault7::CreateUtility

See Also

IEdmTaskMgr Members
EPDM.Interop.epdm Namespace
IEdmTaskInstance Interface
IEdmTaskProperties Interface


IEdmTaskMgr Interface Members

IEdmTaskMgr Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTaskMgr Interface

The following tables list the members exposed by IEdmTaskMgr.

Public Methods

 | Name | Description
Method | GetTasks | Gets the task add-ins installed in the vault.
Method | RunTask | Runs the specified task add-in.
Top

See Also

IEdmTaskMgr Interface
EPDM.Interop.epdm Namespace
IEdmTaskInstance Interface
IEdmTaskProperties Interface


IEdmTaskMgr Interface Methods

IEdmTaskMgr Interface Methods
EPDM.Interop.epdm Namespace : IEdmTaskMgr Interface

For a list of all members of this type, see IEdmTaskMgr members.

Public Methods

 | Name | Description
Method | GetTasks | Gets the task add-ins installed in the vault.
Method | RunTask | Runs the specified task add-in.
Top

See Also

IEdmTaskMgr Interface
EPDM.Interop.epdm Namespace
IEdmTaskInstance Interface
IEdmTaskProperties Interface


GetTasks Method (IEdmTaskMgr)

GetTasks Method (IEdmTaskMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskMgr Interface : GetTasks Method (IEdmTaskMgr)

Gets the task add-ins installed in the vault.

Syntax

Visual Basic
Function GetTasks() As EdmTaskInfo()
C#
EdmTaskInfo[] GetTasks()
C++/CLI
array<EdmTaskInfo>^ GetTasks();

Return Value

Array of EdmTaskInfo

Example

See the IEdmTaskMgr example.

See Also

IEdmTaskMgr Interface
IEdmTaskMgr Members

Availability

SOLIDWORKS PDM Professional 2018 SP04


RunTask Method (IEdmTaskMgr)

RunTask Method (IEdmTaskMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskMgr Interface : RunTask Method (IEdmTaskMgr)

oTask
Task add-in to run as defined by EdmTaskInfo
poSelections
Array of EdmSelItem2
lParentWnd
Parent window
Runs the specified task add-in.

Syntax

Visual Basic
Sub RunTask( _
   ByVal oTask As EdmTaskInfo, _
   ByVal poSelections() As EdmSelItem2, _
   ByVal lParentWnd As System.Integer _
)
C#
void RunTask(
   EdmTaskInfo oTask,
   EdmSelItem2[] poSelections,
   System.int lParentWnd
)
C++/CLI
void RunTask(
&   EdmTaskInfo oTask,
&   array<EdmSelItem2>^ poSelections,
&   System.int lParentWnd
)

Parameters

oTask
Task add-in to run as defined by EdmTaskInfo
poSelections
Array of EdmSelItem2
lParentWnd
Parent window

Example

See the IEdmTaskMgr example.

See Also

IEdmTaskMgr Interface
IEdmTaskMgr Members

Availability

SOLIDWORKS PDM Professional 2018 SP04


IEdmTaskProperties Interface

IEdmTaskProperties Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTaskProperties Interface

Allows you to access the task definition of an add-in.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTaskProperties
C#
public interface IEdmTaskProperties
C++/CLI
public interface class IEdmTaskProperties

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

This interface provides the definition of a task and can be used to extend the task setup page. This interface is created in EdmCmd::mpoExtra when an add-in calls IEdmAddIn5::OnCmd and has previously registered the hook, EdmCmdType.EdmCmd_TaskSetup, using IEdmCmdMgr5::AddHook. Use this interface in the processing of the EdmCmdType.EdmCmd_TaskSetup hook to load or store user-defined variables, load or store card variables, or set menu commands for the task setup page.

Programming tasks are add-ins that allow you to specify when and where to perform specific tasks.

An instance of the task is created when the task is launched.

See Also

IEdmTaskProperties Members
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


IEdmTaskProperties Interface Members

IEdmTaskProperties Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmTaskProperties Interface

The following tables list the members exposed by IEdmTaskProperties.

Public Properties

 | Name | Description
Property | AddInName | Gets the name of the add-in that is used to execute this task.
Property | FormName | Gets the name of the data card to show when the task is launched.
Property | IsScheduled | Gets whether this task is scheduled.
Property | RetryCount | Gets the number of times to retry the task on failure.
Property | TaskFlags | Gets or sets task-specific options.
Property | TaskGUID | Gets the unique ID of this task definition.
Property | TaskID | Gets the database ID of this task definition.
Property | TaskName | Gets the name of this task.
Property | TimeoutInSeconds | Gets the number of seconds to wait until failing the task.
Property | UserName | Gets the name of the user as whom to execute this task.
Top

Public Methods

 | Name | Description
Method | GetMenuCmds | Gets the menu commands set with IEdmTaskProperties::SetMenuCmds.
Method | GetSel | Gets the selection of objects on which to execute this task.
Method | GetSetupPages | Gets the setup pages added to the task property dialog box using IEdmTaskProperties::SetSetupPages.
Method | GetValEx | Gets the value of a user-defined variable created with IEdmTaskProperties::SetValEx.
Method | GetVar | Gets the value of a card variable created in the administration tool and set by IEdmTaskProperties::SetVar.
Method | SetMenuCmds | Adds the specified menu commands to File Explorer context menus.
Method | SetSel | Sets the selection of objects on which to execute this task.
Method | SetSetupPages | Adds setup pages to the task property dialog box for this task definition.
Method | SetValEx | Sets a value for the specified user-defined variable.
Method | SetVar | Sets the value of a card variable created in the administration tool.
Top

See Also

IEdmTaskProperties Interface
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


IEdmTaskProperties Interface Methods

IEdmTaskProperties Interface Methods
EPDM.Interop.epdm Namespace : IEdmTaskProperties Interface

For a list of all members of this type, see IEdmTaskProperties members.

Public Methods

 | Name | Description
Method | GetMenuCmds | Gets the menu commands set with IEdmTaskProperties::SetMenuCmds.
Method | GetSel | Gets the selection of objects on which to execute this task.
Method | GetSetupPages | Gets the setup pages added to the task property dialog box using IEdmTaskProperties::SetSetupPages.
Method | GetValEx | Gets the value of a user-defined variable created with IEdmTaskProperties::SetValEx.
Method | GetVar | Gets the value of a card variable created in the administration tool and set by IEdmTaskProperties::SetVar.
Method | SetMenuCmds | Adds the specified menu commands to File Explorer context menus.
Method | SetSel | Sets the selection of objects on which to execute this task.
Method | SetSetupPages | Adds setup pages to the task property dialog box for this task definition.
Method | SetValEx | Sets a value for the specified user-defined variable.
Method | SetVar | Sets the value of a card variable created in the administration tool.
Top

See Also

IEdmTaskProperties Interface
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


GetMenuCmds Method (IEdmTaskProperties)

GetMenuCmds Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : GetMenuCmds Method (IEdmTaskProperties)

ppoCmds
Array of EdmTaskMenuCmd structures; one structure for each menu command
Gets the menu commands set with IEdmTaskProperties::SetMenuCmds.

Syntax

Visual Basic
Sub GetMenuCmds( _
   ByRef ppoCmds() As EdmTaskMenuCmd _
)
C#
void GetMenuCmds(
   out EdmTaskMenuCmd[] ppoCmds
)
C++/CLI
void GetMenuCmds(
&   [Out] array<EdmTaskMenuCmd>^ ppoCmds
)

Parameters

ppoCmds
Array of EdmTaskMenuCmd structures; one structure for each menu command

Remarks

The menu commands display in a File Explorer context menu.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


GetSel Method (IEdmTaskProperties)

GetSel Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : GetSel Method (IEdmTaskProperties)

ppoSel
Array of EdmTaskSel structures; one structure for each selected object
Gets the selection of objects on which to execute this task.

Syntax

Visual Basic
Sub GetSel( _
   ByRef ppoSel() As EdmTaskSel _
)
C#
void GetSel(
   out EdmTaskSel[] ppoSel
)
C++/CLI
void GetSel(
&   [Out] array<EdmTaskSel>^ ppoSel
)

Parameters

ppoSel
Array of EdmTaskSel structures; one structure for each selected object

Remarks

The user can select the objects on which the task performs from a dialog box that is displayed when the task add-in calls IEdmAddIn5::OnCmd. The hook, EdmCmdType.EdmCmd_TaskLaunch, must be previously registered by calling IEdmCmdMgr5::AddHook in your implementation of IEdmAddIn5::GetAddInInfo. The add-in returns the user's selections in the EdmCmdData structures that are returned by IEdmAddIn5::OnCmd.

You can set a selection of objects directly in this task definition by calling IEdmTaskProperties::SetSel.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


GetSetupPages Method (IEdmTaskProperties)

GetSetupPages Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : GetSetupPages Method (IEdmTaskProperties)

ppoPages
Array of EdmTaskSetupPage structures; one structure for each setup page
Gets the setup pages added to the task property dialog box using IEdmTaskProperties::SetSetupPages.

Syntax

Visual Basic
Sub GetSetupPages( _
   ByRef ppoPages() As EdmTaskSetupPage _
)
C#
void GetSetupPages(
   out EdmTaskSetupPage[] ppoPages
)
C++/CLI
void GetSetupPages(
&   [Out] array<EdmTaskSetupPage>^ ppoPages
)

Parameters

ppoPages
Array of EdmTaskSetupPage structures; one structure for each setup page

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


GetValEx Method (IEdmTaskProperties)

GetValEx Method (IEdmTaskProperties)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : GetValEx Method (IEdmTaskProperties)

bsValName
Name of variable for which to get a value
Gets the value of a user-defined variable created with IEdmTaskProperties::SetValEx.

Syntax

Visual Basic
Function GetValEx( _
   ByVal bsValName As System.String _
) As System.Object
C#
System.object GetValEx(
   System.string bsValName
)
C++/CLI
System.Object^ GetValEx(
&   System.String^ bsValName
)

Parameters

bsValName
Name of variable for which to get a value

Return Value

Value of variable (see Remarks)

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

Call IEdmTaskProperties::SetValEx to store variable data entered by the user in the task definition setup page on the client machine. The task definition setup page displays during the processing of the EdmCmdType.EdmCmd_TaskSetup hook when the task add-in calls IEdmAddIn5::OnCmd.

Custom data types and objects must have been serialized to a string, numeric type, or date before calling IEdmTaskProperites::SetValEx. For example:

  1. Serialize the object data to XML or JSON using StringBuilder, XmlWriter, XmlSerializer, etc.
  2. Call IEdmTaskProperites::SetValEx to store the resulting string.
  3. Call IEdmTaskProperites::GetValEx to retrieve the stored string.
  4. Initialize the new instance of the object from XML/JSON using StringReader, XmlReader, XmlSerializer, etc.

To get the values when the task is executing on the server, call IEdmTaskInstance::GetValEx during the processing of the EdmCmdType.EdmCmd_TaskRun hook.

NOTE: User-defined variables are not related to the card variables created using the administration tool. To access card variables for this task definition, call IEdmTaskProperties::GetVar and IEdmTaskProperties::SetVar.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


GetVar Method (IEdmTaskProperties)

GetVar Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : GetVar Method (IEdmTaskProperties)

lVarID
ID of variable for which to get a value
Gets the value of a card variable created in the administration tool and set by IEdmTaskProperties::SetVar.

Syntax

Visual Basic
Function GetVar( _
   ByVal lVarID As System.Integer _
) As System.Object
C#
System.object GetVar(
   System.int lVarID
)
C++/CLI
System.Object^ GetVar(
&   System.int lVarID
)

Parameters

lVarID
ID of variable for which to get a value

Return Value

Value of a card variable

Remarks

The task add-in calls this method to retrieve a data card variable value that is set by the user on the task details page on the client computer. To save and retrieve the variable, the add-in calls IEdmTaskProperties::SetVar and this method, respectively, during the processing of the EdmCmdType.EdmCmd_TaskSetup hook.

These data card variable values can also be retrieved when the task is executed on the server by calling IEdmTaskInstance::GetVar.

Card variables accessible by this method must be created using the administration tool card editor and are not related to the user-defined variables accessed by IEdmTaskProperties::GetValEx and IEdmTaskProperties::SetValEx.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


SetMenuCmds Method (IEdmTaskProperties)

SetMenuCmds Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : SetMenuCmds Method (IEdmTaskProperties)

poCmds
Array of EdmTaskMenuCmd structures; one structure for each menu command to add to the context menus
Adds the specified menu commands to File Explorer context menus.

Syntax

Visual Basic
Sub SetMenuCmds( _
   ByVal poCmds() As EdmTaskMenuCmd _
)
C#
void SetMenuCmds(
   EdmTaskMenuCmd[] poCmds
)
C++/CLI
void SetMenuCmds(
&   array<EdmTaskMenuCmd>^ poCmds
)

Parameters

poCmds
Array of EdmTaskMenuCmd structures; one structure for each menu command to add to the context menus

Example

See the examples in IEdmTaskProperties.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
IEdmTaskProperties::GetMenuCmds Method ()

Availability

SOLIDWORKS PDM Professional 2010


SetSel Method (IEdmTaskProperties)

SetSel Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : SetSel Method (IEdmTaskProperties)

poSel
Array of EdmTaskSel structures; one structure for each selected object
Sets the selection of objects on which to execute this task.

Syntax

Visual Basic
Sub SetSel( _
   ByVal poSel() As EdmTaskSel _
)
C#
void SetSel(
   EdmTaskSel[] poSel
)
C++/CLI
void SetSel(
&   array<EdmTaskSel>^ poSel
)

Parameters

poSel
Array of EdmTaskSel structures; one structure for each selected object

Remarks

The user can select the objects on which the task performs from a dialog box that is displayed when the task add-in calls IEdmAddIn5::OnCmd. The hook, EdmCmdType.EdmCmd_TaskLaunch, must be previously registered by calling IEdmCmdMgr5::AddHook in your implementation of IEdmAddIn5::GetAddInInfo. The add-in returns the user's selections in the EdmCmdData structures that are returned by IEdmAddIn5::OnCmd.

You can set a selection of objects that should always be passed to the task instances by calling this method.

Call IEdmTaskProperties::GetSel to get the objects set by this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


SetSetupPages Method (IEdmTaskProperties)

SetSetupPages Method (IEdmTaskProperties)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : SetSetupPages Method (IEdmTaskProperties)

poPages
Array of EdmTaskSetupPage structures; one structure for each setup page
Adds setup pages to the task property dialog box for this task definition.

Syntax

Visual Basic
Sub SetSetupPages( _
   ByVal poPages() As EdmTaskSetupPage _
)
C#
void SetSetupPages(
   EdmTaskSetupPage[] poPages
)
C++/CLI
void SetSetupPages(
&   array<EdmTaskSetupPage>^ poPages
)

Parameters

poPages
Array of EdmTaskSetupPage structures; one structure for each setup page

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

Call this method during the processing of the EdmCmdData.EdmCmd_TaskSetup hook. The setup pages display when the task is double-clicked in the administration tool.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


SetValEx Method (IEdmTaskProperties)

SetValEx Method (IEdmTaskProperties)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : SetValEx Method (IEdmTaskProperties)

bsValName
Name of the user-defined variable for which to set a value
oValue
Value of user-defined variable (see Remarks)
Sets a value for the specified user-defined variable.

Syntax

Visual Basic
Sub SetValEx( _
   ByVal bsValName As System.String, _
   ByVal oValue As System.Object _
)
C#
void SetValEx(
   System.string bsValName,
   System.object oValue
)
C++/CLI
void SetValEx(
&   System.String^ bsValName,
&   System.Object^ oValue
)

Parameters

bsValName
Name of the user-defined variable for which to set a value
oValue
Value of user-defined variable (see Remarks)

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

Call this method:

  • to store variable data entered by the user in the task definition setup page on the client machine.
  • during the processing of the EdmCmdType.EdmCmd_TaskSetup hook.

Custom data types and objects must be serialized to a string, numeric type, or date before calling this method. For example:

  1. Serialize the object data to XML or JSON using StringBuilder, XmlWriter, XmlSerializer, etc.
  2. Call IEdmTaskProperites::SetValEx to store the resulting string.
  3. Call IEdmTaskProperties::GetValEx to retrieve the stored string.
  4. Initialize the new instance of the object from XML/JSON using StringReader, XmlReader, XmlSerializer, etc.

To get the user-defined values when the task is executing on the server, call IEdmTaskInstance::GetValEx during the processing of the EdmCmdType.EdmCmd_TaskRun hook.

NOTE: The difference between this method and IEdmTaskProperties::SetVar is that the latter requires a pre-defined card variable in the vault, whereas this method does not.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


SetVar Method (IEdmTaskProperties)

SetVar Method (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : SetVar Method (IEdmTaskProperties)

lVarID
ID of the variable for which to set a value (see Remarks)
oValue
Value to set
Sets the value of a card variable created in the administration tool.

Syntax

Visual Basic
Sub SetVar( _
   ByVal lVarID As System.Integer, _
   ByVal oValue As System.Object _
)
C#
void SetVar(
   System.int lVarID,
   System.object oValue
)
C++/CLI
void SetVar(
&   System.int lVarID,
&   System.Object^ oValue
)

Parameters

lVarID
ID of the variable for which to set a value (see Remarks)
oValue
Value to set

Remarks

The task add-in can display a data card with variable values that the user can modify when the task is launched on the client computer (EdmCmdType.EdmCmd_TaskLaunch). The add-in can call this method to store the variable values entered by the user.

The card variable value set by this method can be retrieved by calling:

  • IEdmTaskProperties::GetVar.
  • IEdmTaskInstance::GetVar during the processing of the EdmCmdType.EdmCmd_TaskRun hook on the server where the task instance is running.

Card variables are created using the administration tool card editor and are not related to the user-defined variables accessed by IEdmTaskInstance::GetValEx and IEdmTaskInstance::SetValEx.

The difference between this method and IEdmTaskInstance::SetValEx is that the latter does not require a pre-defined card variable in the vault, whereas this method does.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members
Task Add-in Sample

Availability

SOLIDWORKS PDM Professional 2010


IEdmTaskProperties Interface Properties

IEdmTaskProperties Interface Properties
EPDM.Interop.epdm Namespace : IEdmTaskProperties Interface

For a list of all members of this type, see IEdmTaskProperties members.

Public Properties

 | Name | Description
Property | AddInName | Gets the name of the add-in that is used to execute this task.
Property | FormName | Gets the name of the data card to show when the task is launched.
Property | IsScheduled | Gets whether this task is scheduled.
Property | RetryCount | Gets the number of times to retry the task on failure.
Property | TaskFlags | Gets or sets task-specific options.
Property | TaskGUID | Gets the unique ID of this task definition.
Property | TaskID | Gets the database ID of this task definition.
Property | TaskName | Gets the name of this task.
Property | TimeoutInSeconds | Gets the number of seconds to wait until failing the task.
Property | UserName | Gets the name of the user as whom to execute this task.
Top

See Also

IEdmTaskProperties Interface
EPDM.Interop.epdm Namespace
Task Add-in Sample
Standard Task Add-in
IEdmTaskMgr Interface


AddInName Property (IEdmTaskProperties)

AddInName Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : AddInName Property (IEdmTaskProperties)

Gets the name of the add-in that is used to execute this task.

Syntax

Visual Basic
ReadOnly Property AddInName As System.String
C#
System.string AddInName {get;}
C++/CLI
property System.String^ AddInName {
   System.String^ get();
}

Property Value

Name of an add-in

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


FormName Property (IEdmTaskProperties)

FormName Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : FormName Property (IEdmTaskProperties)

Gets the name of the data card to show when the task is launched.

Syntax

Visual Basic
ReadOnly Property FormName As System.String
C#
System.string FormName {get;}
C++/CLI
property System.String^ FormName {
   System.String^ get();
}

Property Value

Name of a data card

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


IsScheduled Property (IEdmTaskProperties)

IsScheduled Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : IsScheduled Property (IEdmTaskProperties)

Gets whether this task is scheduled.

Syntax

Visual Basic
ReadOnly Property IsScheduled As System.Boolean
C#
System.bool IsScheduled {get;}
C++/CLI
property System.bool IsScheduled {
   System.bool get();
}

Property Value

True if the task is scheduled, false if not

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


RetryCount Property (IEdmTaskProperties)

RetryCount Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : RetryCount Property (IEdmTaskProperties)

Gets the number of times to retry the task on failure.

Syntax

Visual Basic
ReadOnly Property RetryCount As System.Integer
C#
System.int RetryCount {get;}
C++/CLI
property System.int RetryCount {
   System.int get();
}

Property Value

Number of time to retry the task on failure

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


TaskFlags Property (IEdmTaskProperties)

TaskFlags Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : TaskFlags Property (IEdmTaskProperties)

Gets or sets task-specific options.

Syntax

Visual Basic
Property TaskFlags As System.Integer
C#
System.int TaskFlags {get; set;}
C++/CLI
property System.int TaskFlags {
   System.int get();
   void set ( &   System.int value);
}

Property Value

Combination of EdmTaskFlag bits

Example

See the examples in IEdmTaskProperties.

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


TaskGUID Property (IEdmTaskProperties)

TaskGUID Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : TaskGUID Property (IEdmTaskProperties)

Gets the unique ID of this task definition.

Syntax

Visual Basic
ReadOnly Property TaskGUID As System.String
C#
System.string TaskGUID {get;}
C++/CLI
property System.String^ TaskGUID {
   System.String^ get();
}

Property Value

Unique ID of this task definition

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


TaskID Property (IEdmTaskProperties)

TaskID Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : TaskID Property (IEdmTaskProperties)

Gets the database ID of this task definition.

Syntax

Visual Basic
ReadOnly Property TaskID As System.Integer
C#
System.int TaskID {get;}
C++/CLI
property System.int TaskID {
   System.int get();
}

Property Value

Database ID of this task definition

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


TaskName Property (IEdmTaskProperties)

TaskName Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : TaskName Property (IEdmTaskProperties)

Gets the name of this task.

Syntax

Visual Basic
ReadOnly Property TaskName As System.String
C#
System.string TaskName {get;}
C++/CLI
property System.String^ TaskName {
   System.String^ get();
}

Property Value

Name of this task

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


TimeoutInSeconds Property (IEdmTaskProperties)

TimeoutInSeconds Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : TimeoutInSeconds Property (IEdmTaskProperties)

Gets the number of seconds to wait until failing the task.

Syntax

Visual Basic
ReadOnly Property TimeoutInSeconds As System.Integer
C#
System.int TimeoutInSeconds {get;}
C++/CLI
property System.int TimeoutInSeconds {
   System.int get();
}

Property Value

Number of seconds to wait until failing the task; 0 to wait forever

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


UserName Property (IEdmTaskProperties)

UserName Property (IEdmTaskProperties)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTaskProperties Interface : UserName Property (IEdmTaskProperties)

Gets the name of the user as whom to execute this task.

Syntax

Visual Basic
ReadOnly Property UserName As System.String
C#
System.string UserName {get;}
C++/CLI
property System.String^ UserName {
   System.String^ get();
}

Property Value

Name of a user

See Also

IEdmTaskProperties Interface
IEdmTaskProperties Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmTemplate5 Interface

IEdmTemplate5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTemplate5 Interface

Allows you to access a single template.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTemplate5
C#
public interface IEdmTemplate5
C++/CLI
public interface class IEdmTemplate5

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmTemplate53 which provides information about all of the files and folders created by the template.

Accessors

IEdmTemplateMgr5::GetNextTemplate

See Also

IEdmTemplate5 Members
EPDM.Interop.epdm Namespace


IEdmTemplate5 Interface Members

IEdmTemplate5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTemplate5 Interface

The following tables list the members exposed by IEdmTemplate5.

Public Methods

 | Name | Description
Method | GetIconExtension | Gets the file extension for the icon registered with this template.
Method | GetMenuString | Gets the string displayed in the SOLIDWORKS PDM Professional menu for this template.
Method | Run | Executes this template in the specified folder.
Top

See Also

IEdmTemplate5 Interface
EPDM.Interop.epdm Namespace


IEdmTemplate5 Interface Methods

IEdmTemplate5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTemplate5 Interface

For a list of all members of this type, see IEdmTemplate5 members.

Public Methods

 | Name | Description
Method | GetIconExtension | Gets the file extension for the icon registered with this template.
Method | GetMenuString | Gets the string displayed in the SOLIDWORKS PDM Professional menu for this template.
Method | Run | Executes this template in the specified folder.
Top

See Also

IEdmTemplate5 Interface
EPDM.Interop.epdm Namespace


GetIconExtension Method (IEdmTemplate5)

GetIconExtension Method (IEdmTemplate5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTemplate5 Interface : GetIconExtension Method (IEdmTemplate5)

Gets the file extension for the icon registered with this template.

Syntax

Visual Basic
Function GetIconExtension() As System.String
C#
System.string GetIconExtension()
C++/CLI
System.String^ GetIconExtension();

Return Value

File extension of the icon registered with this template

Remarks

Templates are listed with a menu string and, optionally, an icon in SOLIDWORKS PDM Professional's menus and list controls. The file extension retrieved maps to the registered icon for the Windows file type of this template.

C++ programmers not using bstr_t wrapper functions must free the returned string with a call to SysFreeString.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTemplate5 Interface
IEdmTemplate5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetMenuString Method (IEdmTemplate5)

GetMenuString Method (IEdmTemplate5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTemplate5 Interface : GetMenuString Method (IEdmTemplate5)

Gets the string displayed in the SOLIDWORKS PDM Professional menu for this template.

Syntax

Visual Basic
Function GetMenuString() As System.String
C#
System.string GetMenuString()
C++/CLI
System.String^ GetMenuString();

Return Value

Menu string

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

C++ programmers not using bstr_t wrapper functions must free the returned string with a call to SysFreeString.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTemplate5 Interface
IEdmTemplate5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Run Method (IEdmTemplate5)

Run Method (IEdmTemplate5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTemplate5 Interface : Run Method (IEdmTemplate5)

hParentWnd
Parent window handle
lCurrentFolderID
ID of folder in which to run this template
Executes this template in the specified folder.

Syntax

Visual Basic
Function Run( _
   ByVal hParentWnd As System.Integer, _
   ByVal lCurrentFolderID As System.Integer _
) As System.Integer
C#
System.int Run(
   System.int hParentWnd,
   System.int lCurrentFolderID
)
C++/CLI
System.int Run(
&   System.int hParentWnd,
&   System.int lCurrentFolderID
)

Parameters

hParentWnd
Parent window handle
lCurrentFolderID
ID of folder in which to run this template

Return Value

User-interface refresh flags as defined in EdmRefreshFlag

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

This method is extended by IEdmTemplate53::RunEx which returns information about all of the files and folders created by the template.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTemplate5 Interface
IEdmTemplate5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmTemplate53 Interface

IEdmTemplate53 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTemplate53 Interface

Allows you to access a single template.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTemplate53
   Inherits IEdmTemplate5
C#
public interface IEdmTemplate53 : IEdmTemplate5
C++/CLI
public interface class IEdmTemplate53 : public IEdmTemplate5

Example

Execute Template and Return Data (VB.NET)
Execute Template and Return Data (C#)

Remarks

This interface:

  • extends IEdmTemplate5 by providing the ability to execute a template in a specified folder.
  • is extended by IEdmTemplate6.

See Also

IEdmTemplate53 Members
EPDM.Interop.epdm Namespace


IEdmTemplate53 Interface Members

IEdmTemplate53 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTemplate53 Interface

The following tables list the members exposed by IEdmTemplate53.

Public Methods

 | Name | Description
Method | RunEx | Executes this template in the specified folder.
Top

See Also

IEdmTemplate53 Interface
EPDM.Interop.epdm Namespace


IEdmTemplate53 Interface Methods

IEdmTemplate53 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTemplate53 Interface

For a list of all members of this type, see IEdmTemplate53 members.

Public Methods

 | Name | Description
Method | RunEx | Executes this template in the specified folder.
Top

See Also

IEdmTemplate53 Interface
EPDM.Interop.epdm Namespace


RunEx Method (IEdmTemplate53)

RunEx Method (IEdmTemplate53)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTemplate53 Interface : RunEx Method (IEdmTemplate53)

hParentWnd
Parent window handle
lCurrentFolderID
ID of the folder in which to execute this template
ppoRetData
Array of IEdmData interfaces; one interface for each object created by this template
Executes this template in the specified folder.

Syntax

Visual Basic
Function RunEx( _
   ByVal hParentWnd As System.Integer, _
   ByVal lCurrentFolderID As System.Integer, _
   ByRef ppoRetData() As System.Object _
) As System.Integer
C#
System.int RunEx(
   System.int hParentWnd,
   System.int lCurrentFolderID,
   out System.object[] ppoRetData
)
C++/CLI
System.int RunEx(
&   System.int hParentWnd,
&   System.int lCurrentFolderID,
&   [Out] System.array<Object^>^ ppoRetData
)

Parameters

hParentWnd
Parent window handle
lCurrentFolderID
ID of the folder in which to execute this template
ppoRetData
Array of IEdmData interfaces; one interface for each object created by this template

Return Value

User-interface refresh flags as defined in EdmRefleshFlag

Example

See the IEdmTemplate53 examples.

Remarks

This method executes this template like IEdmTemplate5::Run does, but it also returns information about all of the files, folders, and variables created by this template.

If your application needs to be backward compatible with SOLIDWORKS PDM Professional 5.2, use IEdmTemplate5::Run instead of this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTemplate53 Interface
IEdmTemplate53 Members

Availability

SOLIDWORKS PDM Professional Version 5.3


IEdmTemplate6 Interface

IEdmTemplate6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmTemplate6 Interface

Allows you to access a single template.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTemplate6
   Inherits IEdmTemplate5, IEdmTemplate53
C#
public interface IEdmTemplate6 : IEdmTemplate5, IEdmTemplate53
C++/CLI
public interface class IEdmTemplate6 : public IEdmTemplate5, IEdmTemplate53

Remarks

This interface extends IEdmTemplate53 by providing the ability to get the fixed folder ID in the template.

See Also

IEdmTemplate6 Members
EPDM.Interop.epdm Namespace


IEdmTemplate6 Interface Members

IEdmTemplate6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTemplate6 Interface

The following tables list the members exposed by IEdmTemplate6.

Public Methods

 | Name | Description
Method | GetTemplateFixedFolder | Gets the fixed folder ID in the template.
Top

See Also

IEdmTemplate6 Interface
EPDM.Interop.epdm Namespace


IEdmTemplate6 Interface Methods

IEdmTemplate6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTemplate6 Interface

For a list of all members of this type, see IEdmTemplate6 members.

Public Methods

 | Name | Description
Method | GetTemplateFixedFolder | Gets the fixed folder ID in the template.
Top

See Also

IEdmTemplate6 Interface
EPDM.Interop.epdm Namespace


GetTemplateFixedFolder Method (IEdmTemplate6)

GetTemplateFixedFolder Method (IEdmTemplate6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTemplate6 Interface : GetTemplateFixedFolder Method (IEdmTemplate6)

Gets the fixed folder ID in the template.

Syntax

Visual Basic
Function GetTemplateFixedFolder() As System.Integer
C#
System.int GetTemplateFixedFolder()
C++/CLI
System.int GetTemplateFixedFolder();

Return Value

Fixed folder ID

See Also

IEdmTemplate6 Interface
IEdmTemplate6 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmTemplateMgr5 Interface

IEdmTemplateMgr5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTemplateMgr5 Interface

Allows you to access the templates installed in the file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTemplateMgr5
C#
public interface IEdmTemplateMgr5
C++/CLI
public interface class IEdmTemplateMgr5

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Templates are sequences of commands that you set up using the Template Manager command in the File Explorer Tools menu. See the SOLIDWORKS PDM Professional help for more information.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmTemplateMgr5 Members
EPDM.Interop.epdm Namespace


IEdmTemplateMgr5 Interface Members

IEdmTemplateMgr5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTemplateMgr5 Interface

The following tables list the members exposed by IEdmTemplateMgr5.

Public Methods

 | Name | Description
Method | GetFirstTemplatePosition | Starts an enumeration of the templates installed in the vault.
Method | GetNextTemplate | Gets the next template in this list.
Top

See Also

IEdmTemplateMgr5 Interface
EPDM.Interop.epdm Namespace


IEdmTemplateMgr5 Interface Methods

IEdmTemplateMgr5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTemplateMgr5 Interface

For a list of all members of this type, see IEdmTemplateMgr5 members.

Public Methods

 | Name | Description
Method | GetFirstTemplatePosition | Starts an enumeration of the templates installed in the vault.
Method | GetNextTemplate | Gets the next template in this list.
Top

See Also

IEdmTemplateMgr5 Interface
EPDM.Interop.epdm Namespace


GetFirstTemplatePosition Method (IEdmTemplateMgr5)

GetFirstTemplatePosition Method (IEdmTemplateMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTemplateMgr5 Interface : GetFirstTemplatePosition Method (IEdmTemplateMgr5)

Starts an enumeration of the templates installed in the vault.

Syntax

Visual Basic
Function GetFirstTemplatePosition() As IEdmPos5
C#
IEdmPos5 GetFirstTemplatePosition()
C++/CLI
IEdmPos5^ GetFirstTemplatePosition();

Return Value

IEdmPos5; position of the first installed template

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

After calling this method, pass the position of the first template to IEdmTemplateMgr5::GetNextTemplate to get the first template in this list. Then call IEdmTemplateMgr5::GetNextTemplate repeatedly to get the rest of the templates in this list.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTemplateMgr5 Interface
IEdmTemplateMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextTemplate Method (IEdmTemplateMgr5)

GetNextTemplate Method (IEdmTemplateMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmTemplateMgr5 Interface : GetNextTemplate Method (IEdmTemplateMgr5)

poPos
IEdmPos5; position of the next template
Gets the next template in this list.

Syntax

Visual Basic
Function GetNextTemplate( _
   ByVal poPos As IEdmPos5 _
) As IEdmTemplate5
C#
IEdmTemplate5 GetNextTemplate(
   IEdmPos5 poPos
)
C++/CLI
IEdmTemplate5^ GetNextTemplate(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next template

Return Value

IEdmTemplate5

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first template, IEdmPos5. Call IEdmTemplateMgr5::GetFirstTemplatePosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the templates.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmTemplate5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTemplateMgr5 Interface
IEdmTemplateMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmTransition10 Interface

IEdmTransition10 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTransition10 Interface

Allows you to access a workflow transition.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTransition10
   Inherits IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7, IEdmTransition8, IEdmTransition9
C#
public interface IEdmTransition10 : IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7, IEdmTransition8, IEdmTransition9
C++/CLI
public interface class IEdmTransition10 : public IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7, IEdmTransition8, IEdmTransition9

Example

Get File's State Transitions (VB.NET)
Get File's State Transitions (C#)

Remarks

This interface extends IEdmTransition9 by providing password protection.

See Also

IEdmTransition10 Members
EPDM.Interop.epdm Namespace


IEdmTransition10 Interface Members

IEdmTransition10 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmTransition10 Interface

The following tables list the members exposed by IEdmTransition10.

Public Properties

 | Name | Description
Property | Authentication | Gets whether this workflow transition requires a password.
Top

See Also

IEdmTransition10 Interface
EPDM.Interop.epdm Namespace


IEdmTransition10 Interface Properties

IEdmTransition10 Interface Properties
EPDM.Interop.epdm Namespace : IEdmTransition10 Interface

For a list of all members of this type, see IEdmTransition10 members.

Public Properties

 | Name | Description
Property | Authentication | Gets whether this workflow transition requires a password.
Top

See Also

IEdmTransition10 Interface
EPDM.Interop.epdm Namespace


Authentication Property (IEdmTransition10)

Authentication Property (IEdmTransition10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition10 Interface : Authentication Property (IEdmTransition10)

Gets whether this workflow transition requires a password.

Syntax

Visual Basic
ReadOnly Property Authentication As System.Boolean
C#
System.bool Authentication {get;}
C++/CLI
property System.bool Authentication {
   System.bool get();
}

Property Value

True if this workflow transition requires a password, false if not

Example

See the IEdmTransition10 examples.

Remarks

This property corresponds to the Authentication check box in the Properties dialog of a transition.

See Also

IEdmTransition10 Interface
IEdmTransition10 Members
IEdmBatchChangeState4::ChangeState2 Method ()
IEdmFile10::ChangeState2 Method ()

Availability

SOLIDWORKS PDM Professional 2015 SP02


IEdmTransition5 Interface

IEdmTransition5 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmTransition5 Interface

Allows you to access a workflow transition.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTransition5
   Inherits IEdmObject5
C#
public interface IEdmTransition5 : IEdmObject5
C++/CLI
public interface class IEdmTransition5 : public IEdmObject5

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmTransition6.

Accessors

IEdmState5::GetNextTransition

IEdmState5::GetTransition

IEdmVault5::GetObject

IEdmWorkflow5::GetNextTransition

IEdmWorkflow5::GetTransition

See Also

IEdmTransition5 Members
EPDM.Interop.epdm Namespace


IEdmTransition5 Interface Members

IEdmTransition5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmTransition5 Interface

The following tables list the members exposed by IEdmTransition5.

Public Properties

 | Name | Description
Property | FromState | Gets the source state of this transition.
Property | FromStateID | Gets the ID of the source state of this transition.
Property | ToState | Gets the destination state of this transition.
Property | ToStateID | Gets the ID of the destination state of this transition.
Top

Public Methods

 | Name | Description
Method | CheckPermission | Gets whether the logged-in user has permission to perform this transition.
Top

See Also

IEdmTransition5 Interface
EPDM.Interop.epdm Namespace


IEdmTransition5 Interface Methods

IEdmTransition5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTransition5 Interface

For a list of all members of this type, see IEdmTransition5 members.

Public Methods

 | Name | Description
Method | CheckPermission | Gets whether the logged-in user has permission to perform this transition.
Top

See Also

IEdmTransition5 Interface
EPDM.Interop.epdm Namespace


CheckPermission Method (IEdmTransition5)

CheckPermission Method (IEdmTransition5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition5 Interface : CheckPermission Method (IEdmTransition5)

Gets whether the logged-in user has permission to perform this transition.

Syntax

Visual Basic
Function CheckPermission() As System.Boolean
C#
System.bool CheckPermission()
C++/CLI
System.bool CheckPermission();

Return Value

True if the user can make this transition, false if not

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The user lacks permission.

See Also

IEdmTransition5 Interface
IEdmTransition5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmTransition5 Interface Properties

IEdmTransition5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmTransition5 Interface

For a list of all members of this type, see IEdmTransition5 members.

Public Properties

 | Name | Description
Property | FromState | Gets the source state of this transition.
Property | FromStateID | Gets the ID of the source state of this transition.
Property | ToState | Gets the destination state of this transition.
Property | ToStateID | Gets the ID of the destination state of this transition.
Top

See Also

IEdmTransition5 Interface
EPDM.Interop.epdm Namespace


FromState Property (IEdmTransition5)

FromState Property (IEdmTransition5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition5 Interface : FromState Property (IEdmTransition5)

Gets the source state of this transition.

Syntax

Visual Basic
ReadOnly Property FromState As IEdmState5
C#
IEdmState5 FromState {get;}
C++/CLI
property IEdmState5^ FromState {
   IEdmState5^ get();
}

Property Value

IEdmState5; Null if no source state exists (see Remarks)

Remarks

A SOLIDWORKS PDM Professional workflow contains one transition, called AddedToFileVault, without a source state. In SOLIDWORKS PDM Professional 5.2, trying to access the FromState property of the AddedToFileVault transition results in an exception with the error code E_EDM_STATE_NOT_FOUND. In SOLIDWORKS PDM Professional 5.3 and later, the FromState property can be read without exception from the AddedToFileVault transition.

See Also

IEdmTransition5 Interface
IEdmTransition5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FromStateID Property (IEdmTransition5)

FromStateID Property (IEdmTransition5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition5 Interface : FromStateID Property (IEdmTransition5)

Gets the ID of the source state of this transition.

Syntax

Visual Basic
ReadOnly Property FromStateID As System.Integer
C#
System.int FromStateID {get;}
C++/CLI
property System.int FromStateID {
   System.int get();
}

Property Value

ID of the source state of this transition; 1 if there is no source state

See Also

IEdmTransition5 Interface
IEdmTransition5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


ToState Property (IEdmTransition5)

ToState Property (IEdmTransition5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition5 Interface : ToState Property (IEdmTransition5)

Gets the destination state of this transition.

Syntax

Visual Basic
ReadOnly Property ToState As IEdmState5
C#
IEdmState5 ToState {get;}
C++/CLI
property IEdmState5^ ToState {
   IEdmState5^ get();
}

Property Value

IEdmState5

See Also

IEdmTransition5 Interface
IEdmTransition5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


ToStateID Property (IEdmTransition5)

ToStateID Property (IEdmTransition5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition5 Interface : ToStateID Property (IEdmTransition5)

Gets the ID of the destination state of this transition.

Syntax

Visual Basic
ReadOnly Property ToStateID As System.Integer
C#
System.int ToStateID {get;}
C++/CLI
property System.int ToStateID {
   System.int get();
}

Property Value

ID of the destination state of this transition

See Also

IEdmTransition5 Interface
IEdmTransition5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmTransition6 Interface

IEdmTransition6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmTransition6 Interface

Allows you to access a workflow transition.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTransition6
   Inherits IEdmObject5, IEdmTransition5
C#
public interface IEdmTransition6 : IEdmObject5, IEdmTransition5
C++/CLI
public interface class IEdmTransition6 : public IEdmObject5, IEdmTransition5

Remarks

This interface:

  • inherits from IEdmTransition5.
  • is extended by IEdmTransition7.

See Also

IEdmTransition6 Members
EPDM.Interop.epdm Namespace


IEdmTransition6 Interface Members

IEdmTransition6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmTransition6 Interface

The following tables list the members exposed by IEdmTransition6.

Public Properties

 | Name | Description
Property | WorkflowID | Gets the ID of the workflow to which this transition belongs.
Top

See Also

IEdmTransition6 Interface
EPDM.Interop.epdm Namespace


IEdmTransition6 Interface Properties

IEdmTransition6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmTransition6 Interface

For a list of all members of this type, see IEdmTransition6 members.

Public Properties

 | Name | Description
Property | WorkflowID | Gets the ID of the workflow to which this transition belongs.
Top

See Also

IEdmTransition6 Interface
EPDM.Interop.epdm Namespace


WorkflowID Property (IEdmTransition6)

WorkflowID Property (IEdmTransition6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition6 Interface : WorkflowID Property (IEdmTransition6)

Gets the ID of the workflow to which this transition belongs.

Syntax

Visual Basic
ReadOnly Property WorkflowID As System.Integer
C#
System.int WorkflowID {get;}
C++/CLI
property System.int WorkflowID {
   System.int get();
}

Property Value

ID of IEdmWorkflow6

Remarks

To obtain IEdmWorkflow6, call IEdmVault5::GetObject with lObjectID set to this property.

See Also

IEdmTransition6 Interface
IEdmTransition6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmTransition7 Interface

IEdmTransition7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmTransition7 Interface

Allows you to access a workflow transition.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTransition7
   Inherits IEdmObject5, IEdmTransition5, IEdmTransition6
C#
public interface IEdmTransition7 : IEdmObject5, IEdmTransition5, IEdmTransition6
C++/CLI
public interface class IEdmTransition7 : public IEdmObject5, IEdmTransition5, IEdmTransition6

Example

Graph a Workflow (VB.NET)
Graph a Workflow (C#)

Accessors

This interface:

  • inherits from IEdmTransition6.
  • is extended by IEdmTransition8.

See Also

IEdmTransition7 Members
EPDM.Interop.epdm Namespace


IEdmTransition7 Interface Members

IEdmTransition7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTransition7 Interface

The following tables list the members exposed by IEdmTransition7.

Public Methods

 | Name | Description
Method | GetArrowVertices | Gets the points that make up the transition arrow in the workflow graph.
Method | GetRect | Gets the bounding rectangle of the transition box in the workflow editor.
Top

See Also

IEdmTransition7 Interface
EPDM.Interop.epdm Namespace


IEdmTransition7 Interface Methods

IEdmTransition7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTransition7 Interface

For a list of all members of this type, see IEdmTransition7 members.

Public Methods

 | Name | Description
Method | GetArrowVertices | Gets the points that make up the transition arrow in the workflow graph.
Method | GetRect | Gets the bounding rectangle of the transition box in the workflow editor.
Top

See Also

IEdmTransition7 Interface
EPDM.Interop.epdm Namespace


GetArrowVertices Method (IEdmTransition7)

GetArrowVertices Method (IEdmTransition7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition7 Interface : GetArrowVertices Method (IEdmTransition7)

ppoVertices
Array of EdmPoint structures; one structure for each point that makes up the transition arrow
Gets the points that make up the transition arrow in the workflow graph.

Syntax

Visual Basic
Sub GetArrowVertices( _
   ByRef ppoVertices() As EdmPoint _
)
C#
void GetArrowVertices(
   out EdmPoint[] ppoVertices
)
C++/CLI
void GetArrowVertices(
&   [Out] array<EdmPoint>^ ppoVertices
)

Parameters

ppoVertices
Array of EdmPoint structures; one structure for each point that makes up the transition arrow

Example

See the IEdmTransition7 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTransition7 Interface
IEdmTransition7 Members
IEdmTransition7::GetRect Method ()

Availability

SOLIDWORKS PDM Professional 2011


GetRect Method (IEdmTransition7)

GetRect Method (IEdmTransition7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition7 Interface : GetRect Method (IEdmTransition7)

poRect
EdmRect structure; bounding rectangle
Gets the bounding rectangle of the transition box in the workflow editor.

Syntax

Visual Basic
Sub GetRect( _
   ByRef poRect As EdmRect _
)
C#
void GetRect(
   out EdmRect poRect
)
C++/CLI
void GetRect(
&   [Out] EdmRect poRect
)

Parameters

poRect
EdmRect structure; bounding rectangle

Example

See the IEdmTransition7 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmTransition7 Interface
IEdmTransition7 Members
IEdmTransition7::GetArrowVertices Method ()

Availability

SOLIDWORKS PDM Professional 2011


IEdmTransition8 Interface

IEdmTransition8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmTransition8 Interface

Allows you to access a workflow transition.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTransition8
   Inherits IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7
C#
public interface IEdmTransition8 : IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7
C++/CLI
public interface class IEdmTransition8 : public IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7

Remarks

This interface:

  • extends IEdmTransition7.
  • is extended by IEdmTransition9.

See Also

IEdmTransition8 Members
EPDM.Interop.epdm Namespace


IEdmTransition8 Interface Members

IEdmTransition8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmTransition8 Interface

The following tables list the members exposed by IEdmTransition8.

Public Methods

 | Name | Description
Method | CheckProjectPermission | Checks whether the user has permission to perform this transition for the specified project.
Top

See Also

IEdmTransition8 Interface
EPDM.Interop.epdm Namespace


IEdmTransition8 Interface Methods

IEdmTransition8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTransition8 Interface

For a list of all members of this type, see IEdmTransition8 members.

Public Methods

 | Name | Description
Method | CheckProjectPermission | Checks whether the user has permission to perform this transition for the specified project.
Top

See Also

IEdmTransition8 Interface
EPDM.Interop.epdm Namespace


CheckProjectPermission Method (IEdmTransition8)

CheckProjectPermission Method (IEdmTransition8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition8 Interface : CheckProjectPermission Method (IEdmTransition8)

lProjectID
Project ID
Checks whether the user has permission to perform this transition for the specified project.

Syntax

Visual Basic
Function CheckProjectPermission( _
   ByVal lProjectID As System.Integer _
) As System.Boolean
C#
System.bool CheckProjectPermission(
   System.int lProjectID
)
C++/CLI
System.bool CheckProjectPermission(
&   System.int lProjectID
)

Parameters

lProjectID
Project ID

Return Value

True if the user has permission to perform the transition, false if not

See Also

IEdmTransition8 Interface
IEdmTransition8 Members


IEdmTransition9 Interface

IEdmTransition9 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmTransition9 Interface

Allows you to access a workflow transition.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmTransition9
   Inherits IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7, IEdmTransition8
C#
public interface IEdmTransition9 : IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7, IEdmTransition8
C++/CLI
public interface class IEdmTransition9 : public IEdmObject5, IEdmTransition5, IEdmTransition6, IEdmTransition7, IEdmTransition8

Remarks

This interface:

  • extends IEdmTransition8.
  • is extended by IEdmTransition10.

See Also

IEdmTransition9 Members
EPDM.Interop.epdm Namespace


IEdmTransition9 Interface Members

IEdmTransition9 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmTransition9 Interface

The following tables list the members exposed by IEdmTransition9.

Public Properties

 | Name | Description
Property | HideIfParallelSiblingTransitionUsed | Gets whether to hide this transition when a sibling parallel transition occurs.
Property | TransitionType | Gets the type of transition.
Property | UserPartOfTransitionRoles | Gets whether the logged-in user has a role in this parallel transition.
Top

Public Methods

 | Name | Description
Method | GetParallelTransitionInfo | Gets the required information for the parallel transition of the specified document and project.
Top

See Also

IEdmTransition9 Interface
EPDM.Interop.epdm Namespace


IEdmTransition9 Interface Methods

IEdmTransition9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmTransition9 Interface

For a list of all members of this type, see IEdmTransition9 members.

Public Methods

 | Name | Description
Method | GetParallelTransitionInfo | Gets the required information for the parallel transition of the specified document and project.
Top

See Also

IEdmTransition9 Interface
EPDM.Interop.epdm Namespace


GetParallelTransitionInfo Method (IEdmTransition9)

GetParallelTransitionInfo Method (IEdmTransition9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition9 Interface : GetParallelTransitionInfo Method (IEdmTransition9)

lDocumentID
Document ID
lProjectID
Project ID
plReqNum
Number of this parallel transition
plCommitNum
Number of committed users
pbRevoke
True to revoke, false to not
Gets the required information for the parallel transition of the specified document and project.

Syntax

Visual Basic
Sub GetParallelTransitionInfo( _
   ByVal lDocumentID As System.Integer, _
   ByVal lProjectID As System.Integer, _
   ByRef plReqNum As System.Integer, _
   ByRef plCommitNum As System.Integer, _
   ByRef pbRevoke As System.Boolean _
)
C#
void GetParallelTransitionInfo(
   System.int lDocumentID,
   System.int lProjectID,
   out System.int plReqNum,
   out System.int plCommitNum,
   out System.bool pbRevoke
)
C++/CLI
void GetParallelTransitionInfo(
&   System.int lDocumentID,
&   System.int lProjectID,
&   [Out] System.int plReqNum,
&   [Out] System.int plCommitNum,
&   [Out] System.bool pbRevoke
)

Parameters

lDocumentID
Document ID
lProjectID
Project ID
plReqNum
Number of this parallel transition
plCommitNum
Number of committed users
pbRevoke
True to revoke, false to not

See Also

IEdmTransition9 Interface
IEdmTransition9 Members


IEdmTransition9 Interface Properties

IEdmTransition9 Interface Properties
EPDM.Interop.epdm Namespace : IEdmTransition9 Interface

For a list of all members of this type, see IEdmTransition9 members.

Public Properties

 | Name | Description
Property | HideIfParallelSiblingTransitionUsed | Gets whether to hide this transition when a sibling parallel transition occurs.
Property | TransitionType | Gets the type of transition.
Property | UserPartOfTransitionRoles | Gets whether the logged-in user has a role in this parallel transition.
Top

See Also

IEdmTransition9 Interface
EPDM.Interop.epdm Namespace


HideIfParallelSiblingTransitionUsed Property (IEdmTransition9)

HideIfParallelSiblingTransitionUsed Property (IEdmTransition9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition9 Interface : HideIfParallelSiblingTransitionUsed Property (IEdmTransition9)

Gets whether to hide this transition when a sibling parallel transition occurs.

Syntax

Visual Basic
ReadOnly Property HideIfParallelSiblingTransitionUsed As System.Boolean
C#
System.bool HideIfParallelSiblingTransitionUsed {get;}
C++/CLI
property System.bool HideIfParallelSiblingTransitionUsed {
   System.bool get();
}

Property Value

True to hide this transition when a sibling parallel transition occurs, false to not

See Also

IEdmTransition9 Interface
IEdmTransition9 Members


TransitionType Property (IEdmTransition9)

TransitionType Property (IEdmTransition9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition9 Interface : TransitionType Property (IEdmTransition9)

Gets the type of transition.

Syntax

Visual Basic
ReadOnly Property TransitionType As EdmTransitionType
C#
EdmTransitionType TransitionType {get;}
C++/CLI
property EdmTransitionType TransitionType {
   EdmTransitionType get();
}

Property Value

Type of transition as defined in EdmTransitionType

See Also

IEdmTransition9 Interface
IEdmTransition9 Members


UserPartOfTransitionRoles Property (IEdmTransition9)

UserPartOfTransitionRoles Property (IEdmTransition9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmTransition9 Interface : UserPartOfTransitionRoles Property (IEdmTransition9)

lProjectID
Project ID
Gets whether the logged-in user has a role in this parallel transition.

Syntax

Visual Basic
ReadOnly Property UserPartOfTransitionRoles( _
   ByVal lProjectID As System.Integer _
) As System.Boolean
C#
System.bool UserPartOfTransitionRoles(
   System.int lProjectID
) {get;}
C++/CLI
property System.bool UserPartOfTransitionRoles {
   System.bool get(System.int lProjectID);
}

Parameters

lProjectID
Project ID

Property Value

True if the logged-in user has a role in this parallel transition, false if not

See Also

IEdmTransition9 Interface
IEdmTransition9 Members


IEdmUnlockOpCallback Interface

IEdmUnlockOpCallback Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUnlockOpCallback Interface

Allows you to access information and gain control of IEdmBatchUnlock operations.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUnlockOpCallback
C#
public interface IEdmUnlockOpCallback
C++/CLI
public interface class IEdmUnlockOpCallback

Example

Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

This interface inherits from IUnknown. See Using and Implementing IUnknown (COM).

To use this callback interface:

  1. Create a new class.
  2. Implement all of the methods of this interface in the new class.
  3. Call IEdmBatchUnlock::CreateTree or IEdmBatchUnlock::UnlockFiles, setting poCallback to a pointer to the new class.

See Also

IEdmUnlockOpCallback Members
EPDM.Interop.epdm Namespace


IEdmUnlockOpCallback Interface Members

IEdmUnlockOpCallback Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUnlockOpCallback Interface

The following tables list the members exposed by IEdmUnlockOpCallback.

Public Methods

 | Name | Description
Method | MsgBox | Called by the check-in operation to display a message box with information or options that the user can choose.
Method | ProgressBegin | Called by the check-in operation when it starts.
Method | ProgressEnd | Called by the check-in operation when it finishes.
Method | ProgressStep | Called to advance a progress bar.
Method | ProgressStepEvent | Called to advance a progress bar.
Top

See Also

IEdmUnlockOpCallback Interface
EPDM.Interop.epdm Namespace


IEdmUnlockOpCallback Interface Methods

IEdmUnlockOpCallback Interface Methods
EPDM.Interop.epdm Namespace : IEdmUnlockOpCallback Interface

For a list of all members of this type, see IEdmUnlockOpCallback members.

Public Methods

 | Name | Description
Method | MsgBox | Called by the check-in operation to display a message box with information or options that the user can choose.
Method | ProgressBegin | Called by the check-in operation when it starts.
Method | ProgressEnd | Called by the check-in operation when it finishes.
Method | ProgressStep | Called to advance a progress bar.
Method | ProgressStepEvent | Called to advance a progress bar.
Top

See Also

IEdmUnlockOpCallback Interface
EPDM.Interop.epdm Namespace


MsgBox Method (IEdmUnlockOpCallback)

MsgBox Method (IEdmUnlockOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUnlockOpCallback Interface : MsgBox Method (IEdmUnlockOpCallback)

eMsg
Message to display as defined in EdmUnlockOpMsg
lDocID
ID of the file that caused the message
lProjID
ID of the file's parent folder
bsPath
Full path to the file that caused the message
poError
EdmUnlockErrInfo structure containing extended information about the error
Called by the check-in operation to display a message box with information or options that the user can choose.

Syntax

Visual Basic
Function MsgBox( _
   ByVal eMsg As EdmUnlockOpMsg, _
   ByVal lDocID As System.Integer, _
   ByVal lProjID As System.Integer, _
   ByVal bsPath As System.String, _
   ByRef poError As EdmUnlockErrInfo _
) As EdmUnlockOpReply
C#
EdmUnlockOpReply MsgBox(
   EdmUnlockOpMsg eMsg,
   System.int lDocID,
   System.int lProjID,
   System.string bsPath,
   ref EdmUnlockErrInfo poError
)
C++/CLI
EdmUnlockOpReply MsgBox(
&   EdmUnlockOpMsg eMsg,
&   System.int lDocID,
&   System.int lProjID,
&   System.String^ bsPath,
&   EdmUnlockErrInfo% poError
)

Parameters

eMsg
Message to display as defined in EdmUnlockOpMsg
lDocID
ID of the file that caused the message
lProjID
ID of the file's parent folder
bsPath
Full path to the file that caused the message
poError
EdmUnlockErrInfo structure containing extended information about the error

Return Value

Reply to SOLIDWORKS PDM Professional as defined in EdmUnlockOpReply

Example

See the IEdmUnlockOpCallback examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUnlockOpCallback Interface
IEdmUnlockOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressBegin Method (IEdmUnlockOpCallback)

ProgressBegin Method (IEdmUnlockOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUnlockOpCallback Interface : ProgressBegin Method (IEdmUnlockOpCallback)

eType
Type of progress bar to start as defined in EdmProgressType
eEvent
Type of operation as defined in EdmUnlockEvent
lSteps
Number of steps in the operation (see Remarks)
Called by the check-in operation when it starts.

Syntax

Visual Basic
Sub ProgressBegin( _
   ByVal eType As EdmProgressType, _
   ByVal eEvent As EdmUnlockEvent, _
   ByVal lSteps As System.Integer _
)
C#
void ProgressBegin(
   EdmProgressType eType,
   EdmUnlockEvent eEvent,
   System.int lSteps
)
C++/CLI
void ProgressBegin(
&   EdmProgressType eType,
&   EdmUnlockEvent eEvent,
&   System.int lSteps
)

Parameters

eType
Type of progress bar to start as defined in EdmProgressType
eEvent
Type of operation as defined in EdmUnlockEvent
lSteps
Number of steps in the operation (see Remarks)

Example

See the IEdmUnlockOpCallback examples.

Remarks

IEdmUnlockOpCallback::ProgressStep and IEdmUnlockOpCallback::ProgressStepEvent are each called lStep times. IEdmUnlockOpCallback::ProgressEnd is called when the operation completes.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUnlockOpCallback Interface
IEdmUnlockOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressEnd Method (IEdmUnlockOpCallback)

ProgressEnd Method (IEdmUnlockOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUnlockOpCallback Interface : ProgressEnd Method (IEdmUnlockOpCallback)

eType
Type of progress bar to end as defined in EdmProgressType
Called by the check-in operation when it finishes.

Syntax

Visual Basic
Sub ProgressEnd( _
   ByVal eType As EdmProgressType _
)
C#
void ProgressEnd(
   EdmProgressType eType
)
C++/CLI
void ProgressEnd(
&   EdmProgressType eType
)

Parameters

eType
Type of progress bar to end as defined in EdmProgressType

Example

See the IEdmUnlockOpCallback examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUnlockOpCallback Interface
IEdmUnlockOpCallback Members
IEdmUnlockOpCallback::ProgressBegin Method ()

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressStep Method (IEdmUnlockOpCallback)

ProgressStep Method (IEdmUnlockOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUnlockOpCallback Interface : ProgressStep Method (IEdmUnlockOpCallback)

eType
Type of progress bar to advance as defined in EdmProgressType
bsText
Message that indicates what the operation is doing
lProgressPos
New position in the progress bar
Called to advance a progress bar.

Syntax

Visual Basic
Function ProgressStep( _
   ByVal eType As EdmProgressType, _
   ByVal bsText As System.String, _
   ByVal lProgressPos As System.Integer _
) As System.Boolean
C#
System.bool ProgressStep(
   EdmProgressType eType,
   System.string bsText,
   System.int lProgressPos
)
C++/CLI
System.bool ProgressStep(
&   EdmProgressType eType,
&   System.String^ bsText,
&   System.int lProgressPos
)

Parameters

eType
Type of progress bar to advance as defined in EdmProgressType
bsText
Message that indicates what the operation is doing
lProgressPos
New position in the progress bar

Return Value

True to continue the operation, false to cancel it

Example

See the IEdmUnlockOpCallback examples.

Remarks

This method or IEdmUnlockOpCallback::ProgressStepEvent is called for each step in an operation that begins with IEdmUnlockOpCallback::ProgressBegin.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUnlockOpCallback Interface
IEdmUnlockOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


ProgressStepEvent Method (IEdmUnlockOpCallback)

ProgressStepEvent Method (IEdmUnlockOpCallback)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUnlockOpCallback Interface : ProgressStepEvent Method (IEdmUnlockOpCallback)

eType
Type of progress bar to advance as defined in EdmProgressType
eText
Type of current operation as defined in EdmUnlockEventMsg
lProgressPos
New position in the progress bar
Called to advance a progress bar.

Syntax

Visual Basic
Function ProgressStepEvent( _
   ByVal eType As EdmProgressType, _
   ByVal eText As EdmUnlockEventMsg, _
   ByVal lProgressPos As System.Integer _
) As System.Boolean
C#
System.bool ProgressStepEvent(
   EdmProgressType eType,
   EdmUnlockEventMsg eText,
   System.int lProgressPos
)
C++/CLI
System.bool ProgressStepEvent(
&   EdmProgressType eType,
&   EdmUnlockEventMsg eText,
&   System.int lProgressPos
)

Parameters

eType
Type of progress bar to advance as defined in EdmProgressType
eText
Type of current operation as defined in EdmUnlockEventMsg
lProgressPos
New position in the progress bar

Return Value

True to continue the operation, false to cancel it

Example

See the IEdmUnlockOpCallback examples.

Remarks

This method or IEdmUnlockOpCallback::ProgressStep is called for each step in an operation that begins with IEdmUnlockOpCallback::ProgressBegin.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUnlockOpCallback Interface
IEdmUnlockOpCallback Members

Availability

SOLIDWORKS PDM Professional Version 6.3


IEdmUpdateReferences Interface

IEdmUpdateReferences Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUpdateReferences Interface

Allows you to mend broken file references.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUpdateReferences
C#
public interface IEdmUpdateReferences
C++/CLI
public interface class IEdmUpdateReferences

Example

Update References (C#)
Update References (VB.NET)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

To mend broken file references from the user interface:

  1. Select a SOLIDWORKS file.
  2. Select Tools > Update References in the SOLIWORKS PDM Professional menu bar.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmUpdateReferences Members
EPDM.Interop.epdm Namespace


IEdmUpdateReferences Interface Members

IEdmUpdateReferences Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUpdateReferences Interface

The following tables list the members exposed by IEdmUpdateReferences.

Public Methods

 | Name | Description
Method | AddFile | Adds an assembly or drawing to the batch of files for which to update file references.
Method | ShowDlg | Displays the command dialog box for all of the files added to the batch with IEdmUpdateReferences::AddFile.
Top

See Also

IEdmUpdateReferences Interface
EPDM.Interop.epdm Namespace


IEdmUpdateReferences Interface Methods

IEdmUpdateReferences Interface Methods
EPDM.Interop.epdm Namespace : IEdmUpdateReferences Interface

For a list of all members of this type, see IEdmUpdateReferences members.

Public Methods

 | Name | Description
Method | AddFile | Adds an assembly or drawing to the batch of files for which to update file references.
Method | ShowDlg | Displays the command dialog box for all of the files added to the batch with IEdmUpdateReferences::AddFile.
Top

See Also

IEdmUpdateReferences Interface
EPDM.Interop.epdm Namespace


AddFile Method (IEdmUpdateReferences)

AddFile Method (IEdmUpdateReferences)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUpdateReferences Interface : AddFile Method (IEdmUpdateReferences)

oPath
Full path to the file for which to update file references
Adds an assembly or drawing to the batch of files for which to update file references.

Syntax

Visual Basic
Sub AddFile( _
   ByVal oPath As System.Object _
)
C#
void AddFile(
   System.object oPath
)
C++/CLI
void AddFile(
&   System.Object^ oPath
)

Parameters

oPath
Full path to the file for which to update file references

Example

Update References (C#)
Update References (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUpdateReferences Interface
IEdmUpdateReferences Members

Availability

SOLIDWORKS PDM Professional 2011


ShowDlg Method (IEdmUpdateReferences)

ShowDlg Method (IEdmUpdateReferences)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUpdateReferences Interface : ShowDlg Method (IEdmUpdateReferences)

lParentWnd
Parent window handle
lFlags
Must be 0; reserved for future use
lFolderID
ID of the active folder; 0 to ignore
Displays the command dialog box for all of the files added to the batch with IEdmUpdateReferences::AddFile.

Syntax

Visual Basic
Sub ShowDlg( _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal lFlags As System.Integer, _
   Optional ByVal lFolderID As System.Integer _
)
C#
void ShowDlg(
   System.int lParentWnd,
   System.int lFlags,
   System.int lFolderID
)
C++/CLI
void ShowDlg(
&   System.int lParentWnd,
&   System.int lFlags,
&   System.int lFolderID
)

Parameters

lParentWnd
Parent window handle
lFlags
Must be 0; reserved for future use
lFolderID
ID of the active folder; 0 to ignore

Example

Update References (C#)
Update References (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUpdateReferences Interface
IEdmUpdateReferences Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmUser10 Interface

IEdmUser10 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUser10 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser10
   Inherits IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8, IEdmUser9
C#
public interface IEdmUser10 : IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8, IEdmUser9
C++/CLI
public interface class IEdmUser10 : public IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8, IEdmUser9

Example

Find Users (VB.NET)
Find Users (C#)

Remarks

This interface:

  • extends IEdmUser9.
  • is extended by IEdmUser11.

See Also

IEdmUser10 Members
EPDM.Interop.epdm Namespace


IEdmUser10 Interface Members

IEdmUser10 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmUser10 Interface

The following tables list the members exposed by IEdmUser10.

Public Properties

 | Name | Description
Property | Email | Gets this user's e-mail address.
Top

Public Methods

 | Name | Description
Method | GetUserDataEx | Gets information about this user.
Method | SetUserDataEx | Sets information about this user.
Top

See Also

IEdmUser10 Interface
EPDM.Interop.epdm Namespace


IEdmUser10 Interface Methods

IEdmUser10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUser10 Interface

For a list of all members of this type, see IEdmUser10 members.

Public Methods

 | Name | Description
Method | GetUserDataEx | Gets information about this user.
Method | SetUserDataEx | Sets information about this user.
Top

See Also

IEdmUser10 Interface
EPDM.Interop.epdm Namespace


GetUserDataEx Method (IEdmUser10)

GetUserDataEx Method (IEdmUser10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser10 Interface : GetUserDataEx Method (IEdmUser10)

poUserData
EdmUserDataEx (see Remarks)
Gets information about this user.

Syntax

Visual Basic
Sub GetUserDataEx( _
   ByRef poUserData As EdmUserDataEx _
)
C#
void GetUserDataEx(
   out EdmUserDataEx poUserData
)
C++/CLI
void GetUserDataEx(
&   [Out] EdmUserDataEx poUserData
)

Parameters

poUserData
EdmUserDataEx (see Remarks)

Example

See the IEdmUser10 examples.

Remarks

The properties and picture associated with this user can be returned. EdmUserDataEx::mlEdmUserDataExFlags indicates which properties to return.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUser10 Interface
IEdmUser10 Members
IEdmuser10::SetUserDataEx Method ()

Availability

SOLIDWORKS PDM Professional 2013


SetUserDataEx Method (IEdmUser10)

SetUserDataEx Method (IEdmUser10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser10 Interface : SetUserDataEx Method (IEdmUser10)

poUserData
EdmUserDataEx structure (see Remarks)
Sets information about this user.

Syntax

Visual Basic
Sub SetUserDataEx( _
   ByRef poUserData As EdmUserDataEx _
)
C#
void SetUserDataEx(
   ref EdmUserDataEx poUserData
)
C++/CLI
void SetUserDataEx(
&   EdmUserDataEx% poUserData
)

Parameters

poUserData
EdmUserDataEx structure (see Remarks)

Example

See the IEdmUser10 examples.

Remarks

The properties and picture associated with this user can be updated using this method. EdmUserDataEx::mlEdmUserDataExFlags indicates which properties to update. EdmUserDataEx::mlUserID is ignored.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user doesn't have user administration privileges.
  • E_EDM_FILE_NOT_FOUND: A new user picture path was specified, but the file wasn't found.
  • E_EDM_INVALID_FILE: A new user picture path was specified, but the file format isn't supported.

See Also

IEdmUser10 Interface
IEdmUser10 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmUser10 Interface Properties

IEdmUser10 Interface Properties
EPDM.Interop.epdm Namespace : IEdmUser10 Interface

For a list of all members of this type, see IEdmUser10 members.

Public Properties

 | Name | Description
Property | Email | Gets this user's e-mail address.
Top

See Also

IEdmUser10 Interface
EPDM.Interop.epdm Namespace


Email Property (IEdmUser10)

Email Property (IEdmUser10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser10 Interface : Email Property (IEdmUser10)

Gets this user's e-mail address.

Syntax

Visual Basic
ReadOnly Property Email As System.String
C#
System.string Email {get;}
C++/CLI
property System.String^ Email {
   System.String^ get();
}

Property Value

E-mail address

See Also

IEdmUser10 Interface
IEdmUser10 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmUser11 Interface

IEdmUser11 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmUser11 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser11
   Inherits IEdmObject5, IEdmUser10, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8, IEdmUser9
C#
public interface IEdmUser11 : IEdmObject5, IEdmUser10, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8, IEdmUser9
C++/CLI
public interface class IEdmUser11 : public IEdmObject5, IEdmUser10, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8, IEdmUser9

Remarks

This interface extends IEdmUser10 by providing the ability to specify these user settings:

  • Automatically delete local read-only files in File Explorer that are not part of the file vault.
  • Always work with the latest version of files.
  • Auto-select reference files to get latest when checking out.

Accessors

See the IEdmUser5 accessors.

See Also

IEdmUser11 Members
EPDM.Interop.epdm Namespace


IEdmUser11 Interface Members

IEdmUser11 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUser11 Interface

The following tables list the members exposed by IEdmUser11.

Public Methods

 | Name | Description
Method | SetSettingsVar | Sets the specified user setting.
Top

See Also

IEdmUser11 Interface
EPDM.Interop.epdm Namespace


IEdmUser11 Interface Methods

IEdmUser11 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUser11 Interface

For a list of all members of this type, see IEdmUser11 members.

Public Methods

 | Name | Description
Method | SetSettingsVar | Sets the specified user setting.
Top

See Also

IEdmUser11 Interface
EPDM.Interop.epdm Namespace


SetSettingsVar Method (IEdmUser11)

SetSettingsVar Method (IEdmUser11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser11 Interface : SetSettingsVar Method (IEdmUser11)

eVar
User setting as defined by EdmUserSetting
pbsVal
Value of eVar
Sets the specified user setting.

Syntax

Visual Basic
Sub SetSettingsVar( _
   ByVal eVar As EdmUserSetting, _
   ByVal pbsVal As System.String _
)
C#
void SetSettingsVar(
   EdmUserSetting eVar,
   System.string pbsVal
)
C++/CLI
void SetSettingsVar(
&   EdmUserSetting eVar,
&   System.String^ pbsVal
)

Parameters

eVar
User setting as defined by EdmUserSetting
pbsVal
Value of eVar

Example

//Preconditions:

//1. Create a C# console application in Visual Studio.

//2. Add references EPDM.Interop.epdm and EPDM.Interop.EPDMResultCode to the project.

//3. Copy the code below to Program.cs.

//4. Change the namespace to match your project name.

//5. Open the Admin Tool and add a user “A” and a user group “NewGroup”. Add a user to NewGroup.

//6. Ensure that parameters of Login match your vault.

//

//Postconditions:

//1. Open the Admin Tool.

//2. Inspect the settings of user “A” to verify that reference files are not auto-selected to get latest when user A checks out a file.

//3. Inspect the settings of user group “NewGroup” to verify that reference files are auto-selected to get latest when a user in user group NewGroup checks out a file.

//Program.cs:

using System;

using System.Text;

using EPDM.Interop.epdm;

using EPDM.Interop.EPDMResultCode;

namespace project_name

{

  class Program

  {

    static string userName = "Admin";

    static string vaultName = "JEB12";

    static string updUser = "A";

    static string updGroup = "NewGroup";

    static void Main(string[] args)

    {

      StringBuilder sb = new StringBuilder();

      try

      {

        sb.AppendFormat("UserName: {0}", userName).AppendLine();

        sb.AppendFormat("VaultName: {0}", vaultName).AppendLine();

        IEdmVault11 vault = (IEdmVault11)(new EdmVault5());

        if (!vault.IsLoggedIn)

          vault.Login(userName, "password", vaultName);

        IEdmUserMgr9 userMgr = (IEdmUserMgr9)vault.CreateUtility(EdmUtility.EdmUtil_UserMgr);

        var userPos = userMgr.GetFirstUserPosition();

        while (!userPos.IsNull)

        {

          IEdmUser11 user = (IEdmUser11)userMgr.GetNextUser(userPos);

          if (user.Name == updUser)

          {

            //user.SetSettingsVar(EdmUserSetting.EdmSv_AutoGetLatest, "1");

            //user.SetSettingsVar(EdmUserSetting.EdmSv_AutoDelete, "1");

            user.SetSettingsVar(EdmUserSetting.EdmUSv_AutoGetLatestRefs, "0");

            sb.AppendFormat("Settings successfully updated for user {0}", updUser).AppendLine();

            break;

          }

        }

        var groupPos = userMgr.GetFirstUserGroupPosition();

        while (!groupPos.IsNull)

        {

          IEdmUserGroup9 group = (IEdmUserGroup9)userMgr.GetNextUserGroup(groupPos);

          if (group.Name == updGroup)

          {

            group.SetSettingsVar(EdmGroupSetting.EdmGSv_AutoGetLatestRefs, "1");

            sb.AppendFormat("Settings successfully updated for group {0}", updGroup);

            break;

          }

        }

      }

      catch (System.Runtime.InteropServices.COMException ex)

      {

        var errorType = typeof(EdmResultErrorCodes_e);

        if (Enum.IsDefined(errorType, ex.ErrorCode))

          sb.AppendFormat("Edm error occurred: {0}", Enum.GetName(errorType, ex.ErrorCode)).AppendLine();

        else

          sb.AppendLine("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);

      }

      catch (Exception ex)

      {

        sb.AppendFormat("Error occurred: {0}", ex.Message).AppendLine();

      }

      Console.WriteLine(sb.ToString());

      Console.WriteLine("Please press any key to exit");

      Console.ReadKey();

    }

  }

}

See Also

IEdmUser11 Interface
IEdmUser11 Members

Availability

SOLIDWORKS PDM Professional 2022


IEdmUser5 Interface

IEdmUser5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUser5 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser5
   Inherits IEdmObject5
C#
public interface IEdmUser5 : IEdmObject5
C++/CLI
public interface class IEdmUser5 : public IEdmObject5

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmUser6.

To enumerate:

  • the users in a file vault, use IEdmUserMgr5.
  • the messages sent to a user, cast this interface to an IEdmInbox5 pointer.

Accessors

IEdmFile5::LockedByUser

IEdmLabel5::User

IEdmReference5::LockedByUser

IEdmRevision5::User

IEdmUserGroup5::GetNextUser

IEdmUserMgr5::GetLoggedInUser

IEdmUserMgr5::GetNextUser

IEdmUserMgr5::GetUser

IEdmVault5::GetObject

See Also

IEdmUser5 Members
EPDM.Interop.epdm Namespace


IEdmUser5 Interface Members

IEdmUser5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmUser5 Interface

The following tables list the members exposed by IEdmUser5.

Public Properties

 | Name | Description
Property | IsLoggedIn | Gets whether this user is logged in.
Top

Public Methods

 | Name | Description
Method | HasSysRight | Obsolete. Superseded by IEdmUser7::HasSysRightEx .
Method | SendMsg | Sends email to this user.
Top

See Also

IEdmUser5 Interface
EPDM.Interop.epdm Namespace


IEdmUser5 Interface Methods

IEdmUser5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUser5 Interface

For a list of all members of this type, see IEdmUser5 members.

Public Methods

 | Name | Description
Method | HasSysRight | Obsolete. Superseded by IEdmUser7::HasSysRightEx .
Method | SendMsg | Sends email to this user.
Top

See Also

IEdmUser5 Interface
EPDM.Interop.epdm Namespace


SendMsg Method (IEdmUser5)

SendMsg Method (IEdmUser5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUser5 Interface : SendMsg Method (IEdmUser5)

bsSubject
Subject of the email
bsMessageText
Message detail (see Remarks)
Sends email to this user.

Syntax

Visual Basic
Sub SendMsg( _
   ByVal bsSubject As System.String, _
   ByVal bsMessageText As System.String _
)
C#
void SendMsg(
   System.string bsSubject,
   System.string bsMessageText
)
C++/CLI
void SendMsg(
&   System.String^ bsSubject,
&   System.String^ bsMessageText
)

Parameters

bsSubject
Subject of the email
bsMessageText
Message detail (see Remarks)

Example

Send Message to Users (C#)
Send Message to Users (VB.NET)
Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

It is possible to send HTML-formatted mail, if the recipient uses a mail system that supports HTML. In so, add HTML tags to the text in bsMessageText.

For example, bsMessageText might contain:

<html><body><h1>Hello!</h1>How are you?</body></html>

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUser5 Interface
IEdmUser5 Members
IEdmUserGroup5::SendMsg Method ()
IEdmInbox5::SendMsg Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmUser5 Interface Properties

IEdmUser5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmUser5 Interface

For a list of all members of this type, see IEdmUser5 members.

Public Properties

 | Name | Description
Property | IsLoggedIn | Gets whether this user is logged in.
Top

See Also

IEdmUser5 Interface
EPDM.Interop.epdm Namespace


IsLoggedIn Property (IEdmUser5)

IsLoggedIn Property (IEdmUser5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUser5 Interface : IsLoggedIn Property (IEdmUser5)

Gets whether this user is logged in.

Syntax

Visual Basic
ReadOnly Property IsLoggedIn As System.Boolean
C#
System.bool IsLoggedIn {get;}
C++/CLI
property System.bool IsLoggedIn {
   System.bool get();
}

Property Value

True if this user is logged in, false if not

Example

Send Message to Users (C#)
Send Message to Users (VB.NET)
Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

See Also

IEdmUser5 Interface
IEdmUser5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmUser6 Interface

IEdmUser6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUser6 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser6
   Inherits IEdmObject5, IEdmUser5
C#
public interface IEdmUser6 : IEdmObject5, IEdmUser5
C++/CLI
public interface class IEdmUser6 : public IEdmObject5, IEdmUser5

Example

Add Users (C#)
Add Users (VB.NET)

Remarks

This interface:

  • inherits from IEdmUser5.
  • is extended by IEdmUser7.

See Also

IEdmUser6 Members
EPDM.Interop.epdm Namespace


IEdmUser6 Interface Members

IEdmUser6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmUser6 Interface

The following tables list the members exposed by IEdmUser6.

Public Properties

 | Name | Description
Property | FullName | Gets this user's full name.
Property | Initials | Gets this user's initials.
Property | UserData | Gets and sets arbitrary text data associated with this user.
Top

See Also

IEdmUser6 Interface
EPDM.Interop.epdm Namespace


IEdmUser6 Interface Properties

IEdmUser6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmUser6 Interface

For a list of all members of this type, see IEdmUser6 members.

Public Properties

 | Name | Description
Property | FullName | Gets this user's full name.
Property | Initials | Gets this user's initials.
Property | UserData | Gets and sets arbitrary text data associated with this user.
Top

See Also

IEdmUser6 Interface
EPDM.Interop.epdm Namespace


FullName Property (IEdmUser6)

FullName Property (IEdmUser6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser6 Interface : FullName Property (IEdmUser6)

Gets this user's full name.

Syntax

Visual Basic
ReadOnly Property FullName As System.String
C#
System.string FullName {get;}
C++/CLI
property System.String^ FullName {
   System.String^ get();
}

Property Value

User's full name

See Also

IEdmUser6 Interface
IEdmUser6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


Initials Property (IEdmUser6)

Initials Property (IEdmUser6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser6 Interface : Initials Property (IEdmUser6)

Gets this user's initials.

Syntax

Visual Basic
ReadOnly Property Initials As System.String
C#
System.string Initials {get;}
C++/CLI
property System.String^ Initials {
   System.String^ get();
}

Property Value

User's initials

See Also

IEdmUser6 Interface
IEdmUser6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


UserData Property (IEdmUser6)

UserData Property (IEdmUser6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser6 Interface : UserData Property (IEdmUser6)

Gets and sets arbitrary text data associated with this user.

Syntax

Visual Basic
Property UserData As System.String
C#
System.string UserData {get; set;}
C++/CLI
property System.String^ UserData {
   System.String^ get();
   void set ( &   System.String^ value);
}

Property Value

Arbitrary text data associated with this user

See Also

IEdmUser6 Interface
IEdmUser6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmUser7 Interface

IEdmUser7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUser7 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser7
   Inherits IEdmObject5, IEdmUser5, IEdmUser6
C#
public interface IEdmUser7 : IEdmObject5, IEdmUser5, IEdmUser6
C++/CLI
public interface class IEdmUser7 : public IEdmObject5, IEdmUser5, IEdmUser6

Example

Send Message to Users (C#)
Send Message to Users (VB.NET)

Remarks

This interface:

  • inherits from IEdmUser6.
  • is extended by IEdmUser8.

See Also

IEdmUser7 Members
EPDM.Interop.epdm Namespace


IEdmUser7 Interface Members

IEdmUser7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUser7 Interface

The following tables list the members exposed by IEdmUser7.

Public Methods

 | Name | Description
Method | HasSysRightEx | Gets whether this user has the specified permission.
Top

See Also

IEdmUser7 Interface
EPDM.Interop.epdm Namespace


IEdmUser7 Interface Methods

IEdmUser7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUser7 Interface

For a list of all members of this type, see IEdmUser7 members.

Public Methods

 | Name | Description
Method | HasSysRightEx | Gets whether this user has the specified permission.
Top

See Also

IEdmUser7 Interface
EPDM.Interop.epdm Namespace


HasSysRightEx Method (IEdmUser7)

HasSysRightEx Method (IEdmUser7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUser7 Interface : HasSysRightEx Method (IEdmUser7)

eRight
Permission as defined in EdmSysPerm
Gets whether this user has the specified permission.

Syntax

Visual Basic
Function HasSysRightEx( _
   ByVal eRight As EdmSysPerm _
) As System.Boolean
C#
System.bool HasSysRightEx(
   EdmSysPerm eRight
)
C++/CLI
System.bool HasSysRightEx(
&   EdmSysPerm eRight
)

Parameters

eRight
Permission as defined in EdmSysPerm

Return Value

True if the user has the permission, false if not

Example

Send Message to Users (C#)
Send Message to Users (VB.NET)
Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

This method supersedes IEdmUser5::HasSysRight, which checked system permissions represented as bit flags that could be ORed together. As of SOLIDWORKS PDM Professional 2010, new permissions are represented as sequentially numbered constants that cannot be ORed together. You must call this method once for each permission you want to check.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUser7 Interface
IEdmUser7 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmUser8 Interface

IEdmUser8 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmUser8 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser8
   Inherits IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7
C#
public interface IEdmUser8 : IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7
C++/CLI
public interface class IEdmUser8 : public IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7

Remarks

This interface:

  • inherits from IEdmUser7.
  • is extended by IEdmUser9.

See Also

IEdmUser8 Members
EPDM.Interop.epdm Namespace


IEdmUser8 Interface Members

IEdmUser8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUser8 Interface

The following tables list the members exposed by IEdmUser8.

Public Methods

 | Name | Description
Method | GetGroupMemberships | Gets all of the groups to which this user belongs.
Top

See Also

IEdmUser8 Interface
EPDM.Interop.epdm Namespace


IEdmUser8 Interface Methods

IEdmUser8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUser8 Interface

For a list of all members of this type, see IEdmUser8 members.

Public Methods

 | Name | Description
Method | GetGroupMemberships | Gets all of the groups to which this user belongs.
Top

See Also

IEdmUser8 Interface
EPDM.Interop.epdm Namespace


GetGroupMemberships Method (IEdmUser8)

GetGroupMemberships Method (IEdmUser8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser8 Interface : GetGroupMemberships Method (IEdmUser8)

poGroups
Array of IEdmUserGroup6 interfaces
Gets all of the groups to which this user belongs.

Syntax

Visual Basic
Sub GetGroupMemberships( _
   ByRef poGroups() As System.Object _
)
C#
void GetGroupMemberships(
   out System.object[] poGroups
)
C++/CLI
void GetGroupMemberships(
&   [Out] System.array<Object^>^ poGroups
)

Parameters

poGroups
Array of IEdmUserGroup6 interfaces

Example

The following sample code displays a message box with the names of all the groups to which a user, John, belongs:

Private Sub GetJohnsGroups(ByVal vault As IEdmVault12)

  'Get the user interface of user 'John'
  Dim userMgr As IEdmUserMgr7
  userMgr = vault.CreateUtility(EdmUtility.EdmUtil_UserMgr)
  Dim john As IEdmUser8
  john = userMgr.GetUser("John")

  'Get the groups to which he belongs
  Dim groups() As Object
  groups = Nothing
  john.GetGroupMemberships(groups)

  'Display a message box with the group names
  Dim message As String
  message = "John's groups:" + vbLf
  Dim i As Integer
  i = LBound(groups)
  While (i <= UBound(groups))
    Dim group As IEdmUserGroup7
    group = groups(i)
    message = message + group.Name + vbLf
    i = i + 1
  End While

  MsgBox(message)

End Sub

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUser8 Interface
IEdmUser8 Members
IEdmUser9::GetGroupMembershipsInFolder Method ()

Availability

SOLIDWORKS PDM Professional 2011


IEdmUser9 Interface

IEdmUser9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUser9 Interface

Allows you to access a user in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUser9
   Inherits IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8
C#
public interface IEdmUser9 : IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8
C++/CLI
public interface class IEdmUser9 : public IEdmObject5, IEdmUser5, IEdmUser6, IEdmUser7, IEdmUser8

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

This interface:

  • inherits from IEdmUser8.
  • is extended by IEdmUser10.

See Also

IEdmUser9 Members
EPDM.Interop.epdm Namespace


IEdmUser9 Interface Members

IEdmUser9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUser9 Interface

The following tables list the members exposed by IEdmUser9.

Public Methods

 | Name | Description
Method | GetGroupMembershipsInFolder | Gets all of the groups to which this user belongs and for the specified folder.
Top

See Also

IEdmUser9 Interface
EPDM.Interop.epdm Namespace


IEdmUser9 Interface Methods

IEdmUser9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUser9 Interface

For a list of all members of this type, see IEdmUser9 members.

Public Methods

 | Name | Description
Method | GetGroupMembershipsInFolder | Gets all of the groups to which this user belongs and for the specified folder.
Top

See Also

IEdmUser9 Interface
EPDM.Interop.epdm Namespace


GetGroupMembershipsInFolder Method (IEdmUser9)

GetGroupMembershipsInFolder Method (IEdmUser9)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUser9 Interface : GetGroupMembershipsInFolder Method (IEdmUser9)

lFolderID
ID of folder for which to get memberships
Gets all of the groups to which this user belongs and for the specified folder.

Syntax

Visual Basic
Function GetGroupMembershipsInFolder( _
   ByVal lFolderID As System.Integer _
) As System.Object()
C#
System.object[] GetGroupMembershipsInFolder(
   System.int lFolderID
)
C++/CLI
System.array<Object^>^ GetGroupMembershipsInFolder(
&   System.int lFolderID
)

Parameters

lFolderID
ID of folder for which to get memberships

Return Value

Array of IEdmUserGroup8 interfaces

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

This method extends IEdmUser8::GetGroupMemberships, which only gets global group memberships. As of SOLIDWORKS PDM Professional 2011, it is possible to assign group memberships to a specific folder. This method gets folder-specific group memberships.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUser9 Interface
IEdmUser9 Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmUserGroup5 Interface

IEdmUserGroup5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserGroup5 Interface

Allows you to access a user group in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserGroup5
   Inherits IEdmObject5
C#
public interface IEdmUserGroup5 : IEdmObject5
C++/CLI
public interface class IEdmUserGroup5 : public IEdmObject5

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

This interface:

  • inherits from IEdmObject5.
  • is extended by IEdmUserGroup6.

User groups are set up using SOLIDWORKS PDM Professional's User Manager.

Use IEdmUserMgr5 to enumerate the user groups in the vault.

Accessors

IEdmUserMgr5::GetNextUserGroup

IEdmUserMgr5::GetUserGroup

IEdmVault5::GetObject

See Also

IEdmUserGroup5 Members
EPDM.Interop.epdm Namespace
IEdmUser5 Interface


IEdmUserGroup5 Interface Members

IEdmUserGroup5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup5 Interface

The following tables list the members exposed by IEdmUserGroup5.

Public Methods

 | Name | Description
Method | GetFirstUserPosition | Starts an enumeration of the users in this group.
Method | GetNextUser | Gets the next user in the enumeration.
Method | HasSysRight | Obsolete. Superseded by IEdmUserGroup6::HasSysRightEx .
Method | SendMsg | Sends email to all members of this user group.
Top

See Also

IEdmUserGroup5 Interface
EPDM.Interop.epdm Namespace
IEdmUser5 Interface


IEdmUserGroup5 Interface Methods

IEdmUserGroup5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup5 Interface

For a list of all members of this type, see IEdmUserGroup5 members.

Public Methods

 | Name | Description
Method | GetFirstUserPosition | Starts an enumeration of the users in this group.
Method | GetNextUser | Gets the next user in the enumeration.
Method | HasSysRight | Obsolete. Superseded by IEdmUserGroup6::HasSysRightEx .
Method | SendMsg | Sends email to all members of this user group.
Top

See Also

IEdmUserGroup5 Interface
EPDM.Interop.epdm Namespace
IEdmUser5 Interface


GetFirstUserPosition Method (IEdmUserGroup5)

GetFirstUserPosition Method (IEdmUserGroup5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup5 Interface : GetFirstUserPosition Method (IEdmUserGroup5)

Starts an enumeration of the users in this group.

Syntax

Visual Basic
Function GetFirstUserPosition() As IEdmPos5
C#
IEdmPos5 GetFirstUserPosition()
C++/CLI
IEdmPos5^ GetFirstUserPosition();

Return Value

IEdmPos5; position of the first user in the list

Example

Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

After calling this method, pass the returned position of the first user to IEdmUserGroup5::GetNextUser to get the first user in this list. Then call IEdmUserGroup5::GetNextUser repeatedly to get the rest of the users in this list.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup5 Interface
IEdmUserGroup5 Members

Availability

SOLIDWORKS PDM Professional version 5.2


GetNextUser Method (IEdmUserGroup5)

GetNextUser Method (IEdmUserGroup5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup5 Interface : GetNextUser Method (IEdmUserGroup5)

poPos
IEdmPos5; position of the next user (see Remarks)
Gets the next user in the enumeration.

Syntax

Visual Basic
Function GetNextUser( _
   ByVal poPos As IEdmPos5 _
) As IEdmUser5
C#
IEdmUser5 GetNextUser(
   IEdmPos5 poPos
)
C++/CLI
IEdmUser5^ GetNextUser(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next user (see Remarks)

Return Value

IEdmUser5

Example

Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first user in the list, IEdmPos5. Call IEdmUserGroup5::GetFirstUserPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the users in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmUser5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup5 Interface
IEdmUserGroup5 Members

Availability

SOLIDWORKS PDM Professional version 5.2


SendMsg Method (IEdmUserGroup5)

SendMsg Method (IEdmUserGroup5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup5 Interface : SendMsg Method (IEdmUserGroup5)

bsSubject
Email subject
bsMessageText
Message detail (see Remarks)
bExcludeCurrentUser
True to not send email to the logged-in user even if he is a member of this group, false to send email to the logged-in user
Sends email to all members of this user group.

Syntax

Visual Basic
Sub SendMsg( _
   ByVal bsSubject As System.String, _
   ByVal bsMessageText As System.String, _
   ByVal bExcludeCurrentUser As System.Boolean _
)
C#
void SendMsg(
   System.string bsSubject,
   System.string bsMessageText,
   System.bool bExcludeCurrentUser
)
C++/CLI
void SendMsg(
&   System.String^ bsSubject,
&   System.String^ bsMessageText,
&   System.bool bExcludeCurrentUser
)

Parameters

bsSubject
Email subject
bsMessageText
Message detail (see Remarks)
bExcludeCurrentUser
True to not send email to the logged-in user even if he is a member of this group, false to send email to the logged-in user

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

It is possible to send HTML-formatted mail, if the recipients use a mail system that supports HTML. In so, add HTML tags to the text in bsMessageText:

<html><body><h1>Hello!</h1>How are you?</body></html>

Call IEdmUser5::SendMsg to send email to an individual user.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup5 Interface
IEdmUserGroup5 Members

Availability

SOLIDWORKS PDM Professional version 5.2


IEdmUserGroup6 Interface

IEdmUserGroup6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmUserGroup6 Interface

Allows you to access a user group in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserGroup6
   Inherits IEdmObject5, IEdmUserGroup5
C#
public interface IEdmUserGroup6 : IEdmObject5, IEdmUserGroup5
C++/CLI
public interface class IEdmUserGroup6 : public IEdmObject5, IEdmUserGroup5

Remarks

This interface:

  • inherits from IEdmUserGroup5.
  • provides the ability to add members to this user group.
  • is extended by IEdmUserGroup7.

See Also

IEdmUserGroup6 Members
EPDM.Interop.epdm Namespace


IEdmUserGroup6 Interface Members

IEdmUserGroup6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup6 Interface

The following tables list the members exposed by IEdmUserGroup6.

Public Methods

 | Name | Description
Method | AddMembers | Adds the specified users to this user group.
Method | HasSysRightEx | Gets whether this user group has the specified permission.
Top

See Also

IEdmUserGroup6 Interface
EPDM.Interop.epdm Namespace


IEdmUserGroup6 Interface Methods

IEdmUserGroup6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup6 Interface

For a list of all members of this type, see IEdmUserGroup6 members.

Public Methods

 | Name | Description
Method | AddMembers | Adds the specified users to this user group.
Method | HasSysRightEx | Gets whether this user group has the specified permission.
Top

See Also

IEdmUserGroup6 Interface
EPDM.Interop.epdm Namespace


AddMembers Method (IEdmUserGroup6)

AddMembers Method (IEdmUserGroup6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup6 Interface : AddMembers Method (IEdmUserGroup6)

poUserIDs
Array of database IDs of users to add to this user group (see Remarks)
Adds the specified users to this user group.

Syntax

Visual Basic
Sub AddMembers( _
   ByVal poUserIDs() As System.Integer _
)
C#
void AddMembers(
   System.int[] poUserIDs
)
C++/CLI
void AddMembers(
&   System.array<int>^ poUserIDs
)

Parameters

poUserIDs
Array of database IDs of users to add to this user group (see Remarks)

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

Call IEdmUser5::ID to populate the array of poUserIDs.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup6 Interface
IEdmUserGroup6 Members

Availability

SOLIDWORKS PDM Professional 2010


HasSysRightEx Method (IEdmUserGroup6)

HasSysRightEx Method (IEdmUserGroup6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup6 Interface : HasSysRightEx Method (IEdmUserGroup6)

eRight
Permission to check as defined in EdmSysPerm
Gets whether this user group has the specified permission.

Syntax

Visual Basic
Function HasSysRightEx( _
   ByVal eRight As EdmSysPerm _
) As System.Boolean
C#
System.bool HasSysRightEx(
   EdmSysPerm eRight
)
C++/CLI
System.bool HasSysRightEx(
&   EdmSysPerm eRight
)

Parameters

eRight
Permission to check as defined in EdmSysPerm

Return Value

True if the user group has the specified permission, false if not

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

This method supersedes IEdmUserGroup5::HasSysRight, which checked system permissions represented as bit flags that could be ORed together. As of SOLIDWORKS PDM Professional 2010, new permissions are represented as sequentially numbered constants that cannot be ORed together. You must call this method once for each permission you want to check.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup6 Interface
IEdmUserGroup6 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmUserGroup7 Interface

IEdmUserGroup7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmUserGroup7 Interface

Allows you to access a user group in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserGroup7
   Inherits IEdmObject5, IEdmUserGroup5, IEdmUserGroup6
C#
public interface IEdmUserGroup7 : IEdmObject5, IEdmUserGroup5, IEdmUserGroup6
C++/CLI
public interface class IEdmUserGroup7 : public IEdmObject5, IEdmUserGroup5, IEdmUserGroup6

Remarks

This interface:

  • inherits from IEdmUserGroup6.
  • provides the ability to add group memberships in specific folders.
  • is extended by IEdmUserGroup8.

See Also

IEdmUserGroup7 Members
EPDM.Interop.epdm Namespace


IEdmUserGroup7 Interface Members

IEdmUserGroup7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup7 Interface

The following tables list the members exposed by IEdmUserGroup7.

Public Methods

 | Name | Description
Method | AddMembersWithFolders | Adds the specified members of this user group to the specified folders.
Top

See Also

IEdmUserGroup7 Interface
EPDM.Interop.epdm Namespace


IEdmUserGroup7 Interface Methods

IEdmUserGroup7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup7 Interface

For a list of all members of this type, see IEdmUserGroup7 members.

Public Methods

 | Name | Description
Method | AddMembersWithFolders | Adds the specified members of this user group to the specified folders.
Top

See Also

IEdmUserGroup7 Interface
EPDM.Interop.epdm Namespace


AddMembersWithFolders Method (IEdmUserGroup7)

AddMembersWithFolders Method (IEdmUserGroup7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup7 Interface : AddMembersWithFolders Method (IEdmUserGroup7)

poMemberFolders
Array of EdmMemberFolder structures; one structure for each member folder to add to this user group
Adds the specified members of this user group to the specified folders.

Syntax

Visual Basic
Sub AddMembersWithFolders( _
   ByVal poMemberFolders() As EdmMemberFolder _
)
C#
void AddMembersWithFolders(
   EdmMemberFolder[] poMemberFolders
)
C++/CLI
void AddMembersWithFolders(
&   array<EdmMemberFolder>^ poMemberFolders
)

Parameters

poMemberFolders
Array of EdmMemberFolder structures; one structure for each member folder to add to this user group

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup7 Interface
IEdmUserGroup7 Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmUserGroup8 Interface

IEdmUserGroup8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserGroup8 Interface

Allows you to access a user group in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserGroup8
   Inherits IEdmObject5, IEdmUserGroup5, IEdmUserGroup6, IEdmUserGroup7
C#
public interface IEdmUserGroup8 : IEdmObject5, IEdmUserGroup5, IEdmUserGroup6, IEdmUserGroup7
C++/CLI
public interface class IEdmUserGroup8 : public IEdmObject5, IEdmUserGroup5, IEdmUserGroup6, IEdmUserGroup7

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

This interface:

  • extends IEdmUserGroup7.
  • is extended by IEdmUserGroup9.

See Also

IEdmUserGroup8 Members
EPDM.Interop.epdm Namespace


IEdmUserGroup8 Interface Members

IEdmUserGroup8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup8 Interface

The following tables list the members exposed by IEdmUserGroup8.

Public Methods

 | Name | Description
Method | RemoveMembers | Removes the specified members from this user group.
Top

See Also

IEdmUserGroup8 Interface
EPDM.Interop.epdm Namespace


IEdmUserGroup8 Interface Methods

IEdmUserGroup8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup8 Interface

For a list of all members of this type, see IEdmUserGroup8 members.

Public Methods

 | Name | Description
Method | RemoveMembers | Removes the specified members from this user group.
Top

See Also

IEdmUserGroup8 Interface
EPDM.Interop.epdm Namespace


RemoveMembers Method (IEdmUserGroup8)

RemoveMembers Method (IEdmUserGroup8)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup8 Interface : RemoveMembers Method (IEdmUserGroup8)

poMemberFolders
Array of EdmMemberFolder structures; one structure for each member to remove from this user group
Removes the specified members from this user group.

Syntax

Visual Basic
Sub RemoveMembers( _
   ByVal poMemberFolders() As EdmMemberFolder _
)
C#
void RemoveMembers(
   EdmMemberFolder[] poMemberFolders
)
C++/CLI
void RemoveMembers(
&   array<EdmMemberFolder>^ poMemberFolders
)

Parameters

poMemberFolders
Array of EdmMemberFolder structures; one structure for each member to remove from this user group

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserGroup8 Interface
IEdmUserGroup8 Members

Availability

SOLIDWORKS PDM Professional 2012


IEdmUserGroup9 Interface

IEdmUserGroup9 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmUserGroup9 Interface

Allows you to access a user group in SOLIDWORKS PDM Professional.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserGroup9
   Inherits IEdmObject5, IEdmUserGroup5, IEdmUserGroup6, IEdmUserGroup7, IEdmUserGroup8
C#
public interface IEdmUserGroup9 : IEdmObject5, IEdmUserGroup5, IEdmUserGroup6, IEdmUserGroup7, IEdmUserGroup8
C++/CLI
public interface class IEdmUserGroup9 : public IEdmObject5, IEdmUserGroup5, IEdmUserGroup6, IEdmUserGroup7, IEdmUserGroup8

Remarks

This interface extends IEdmUserGroup8 by providing the ability to specify these user group settings:

  • Automatically delete local read-only files that are not part of the file vault.
  • Always work with the latest version of files.
  • Auto-select reference files to get latest when checking out.

Accessors

See the IEdmUserGroup5 accessors.

See Also

IEdmUserGroup9 Members
EPDM.Interop.epdm Namespace


IEdmUserGroup9 Interface Members

IEdmUserGroup9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup9 Interface

The following tables list the members exposed by IEdmUserGroup9.

Public Methods

 | Name | Description
Method | SetSettingsVar | Sets the specified user group setting.
Top

See Also

IEdmUserGroup9 Interface
EPDM.Interop.epdm Namespace


IEdmUserGroup9 Interface Methods

IEdmUserGroup9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserGroup9 Interface

For a list of all members of this type, see IEdmUserGroup9 members.

Public Methods

 | Name | Description
Method | SetSettingsVar | Sets the specified user group setting.
Top

See Also

IEdmUserGroup9 Interface
EPDM.Interop.epdm Namespace


SetSettingsVar Method (IEdmUserGroup9)

SetSettingsVar Method (IEdmUserGroup9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup9 Interface : SetSettingsVar Method (IEdmUserGroup9)

eVar
User group setting as defined by EdmGroupSetting
pbsVal
Value of eVar
Sets the specified user group setting.

Syntax

Visual Basic
Sub SetSettingsVar( _
   ByVal eVar As EdmGroupSetting, _
   ByVal pbsVal As System.String _
)
C#
void SetSettingsVar(
   EdmGroupSetting eVar,
   System.string pbsVal
)
C++/CLI
void SetSettingsVar(
&   EdmGroupSetting eVar,
&   System.String^ pbsVal
)

Parameters

eVar
User group setting as defined by EdmGroupSetting
pbsVal
Value of eVar

Example

See the IEdmUser11::SetSettingsVar example.

See Also

IEdmUserGroup9 Interface
IEdmUserGroup9 Members

Availability

SOLIDWORKS PDM Professional 2022


IEdmUserMgr10 Interface

IEdmUserMgr10 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserMgr10 Interface

Allows you to access the users and user groups in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserMgr10
   Inherits IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7, IEdmUserMgr8, IEdmUserMgr9
C#
public interface IEdmUserMgr10 : IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7, IEdmUserMgr8, IEdmUserMgr9
C++/CLI
public interface class IEdmUserMgr10 : public IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7, IEdmUserMgr8, IEdmUserMgr9

Example

Add and Remove User and Group from Folder (VB.NET)
Add and Remove User and Group from Folder (C#)

Remarks

This interface extends IEdmUserMgr9 by providing the ability to add users by type.

See Also

IEdmUserMgr10 Members
EPDM.Interop.epdm Namespace


IEdmUserMgr10 Interface Members

IEdmUserMgr10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr10 Interface

The following tables list the members exposed by IEdmUserMgr10.

Public Methods

 | Name | Description
Method | AddUsers3 | Adds the specified users of the specified login type to the vault.
Top

See Also

IEdmUserMgr10 Interface
EPDM.Interop.epdm Namespace


IEdmUserMgr10 Interface Methods

IEdmUserMgr10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr10 Interface

For a list of all members of this type, see IEdmUserMgr10 members.

Public Methods

 | Name | Description
Method | AddUsers3 | Adds the specified users of the specified login type to the vault.
Top

See Also

IEdmUserMgr10 Interface
EPDM.Interop.epdm Namespace


AddUsers3 Method (IEdmUserMgr10)

AddUsers3 Method (IEdmUserMgr10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr10 Interface : AddUsers3 Method (IEdmUserMgr10)

ppoUserData
Array of EdmUserData2 structures; one structure for each user
UserType
Login type of users as defined in EdmUserType
Adds the specified users of the specified login type to the vault.

Syntax

Visual Basic
Sub AddUsers3( _
   ByRef ppoUserData() As EdmUserData2, _
   ByVal UserType As EdmUserType _
)
C#
void AddUsers3(
   out EdmUserData2[] ppoUserData,
   EdmUserType UserType
)
C++/CLI
void AddUsers3(
&   [Out] array<EdmUserData2>^ ppoUserData,
&   EdmUserType UserType
)

Parameters

ppoUserData
Array of EdmUserData2 structures; one structure for each user
UserType
Login type of users as defined in EdmUserType

Example

See the IEdmUserMgr10 examples.

Remarks

This method supersedes IEdmUserMgr7::AddUsers2 by providing the ability to add users by type to the vault.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr10 Interface
IEdmUserMgr10 Members

Availability

SOLIDWORKS PDM Professional 2019


IEdmUserMgr5 Interface

IEdmUserMgr5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserMgr5 Interface

Allows you to access the users and user groups in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserMgr5
C#
public interface IEdmUserMgr5
C++/CLI
public interface class IEdmUserMgr5

Example

Send Message to Users (C#)
Send Message to Users (VB.NET)
Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmUserMgr6.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmUserMgr5 Members
EPDM.Interop.epdm Namespace
IEdmUser5 Interface
IEdmUserGroup5 Interface


IEdmUserMgr5 Interface Members

IEdmUserMgr5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr5 Interface

The following tables list the members exposed by IEdmUserMgr5.

Public Methods

 | Name | Description
Method | GetFirstLoggedInUserPosition | Starts an enumeration of the users that are logged in to the specified vaults.
Method | GetFirstUserGroupPosition | Starts an enumeration of the user groups in the vault.
Method | GetFirstUserPosition | Starts an enumeration of the users in the vault.
Method | GetLoggedInUser | Gets the user currently running this program in the vault.
Method | GetNextLoggedInUser | Gets information about the next logged-in user in an enumeration of all logged-in users in the vault.
Method | GetNextUser | Gets the next user in an enumeration of all users in the vault.
Method | GetNextUserGroup | Gets the next user group in an enumeration of all user groups in the vault.
Method | GetUser | Gets a user with the specified name or ID.
Method | GetUserGroup | Gets a user group with the specified name or ID.
Top

See Also

IEdmUserMgr5 Interface
EPDM.Interop.epdm Namespace
IEdmUser5 Interface
IEdmUserGroup5 Interface


IEdmUserMgr5 Interface Methods

IEdmUserMgr5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr5 Interface

For a list of all members of this type, see IEdmUserMgr5 members.

Public Methods

 | Name | Description
Method | GetFirstLoggedInUserPosition | Starts an enumeration of the users that are logged in to the specified vaults.
Method | GetFirstUserGroupPosition | Starts an enumeration of the user groups in the vault.
Method | GetFirstUserPosition | Starts an enumeration of the users in the vault.
Method | GetLoggedInUser | Gets the user currently running this program in the vault.
Method | GetNextLoggedInUser | Gets information about the next logged-in user in an enumeration of all logged-in users in the vault.
Method | GetNextUser | Gets the next user in an enumeration of all users in the vault.
Method | GetNextUserGroup | Gets the next user group in an enumeration of all user groups in the vault.
Method | GetUser | Gets a user with the specified name or ID.
Method | GetUserGroup | Gets a user group with the specified name or ID.
Top

See Also

IEdmUserMgr5 Interface
EPDM.Interop.epdm Namespace
IEdmUser5 Interface
IEdmUserGroup5 Interface


GetFirstLoggedInUserPosition Method (IEdmUserMgr5)

GetFirstLoggedInUserPosition Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetFirstLoggedInUserPosition Method (IEdmUserMgr5)

bsVaultNames
Optional newline-separated list of the names of the vaults for which to enumerate logged-in users; "" to enumerate users that are logged in to the current vault only
Starts an enumeration of the users that are logged in to the specified vaults.

Syntax

Visual Basic
Function GetFirstLoggedInUserPosition( _
   ByVal bsVaultNames As System.String _
) As IEdmPos5
C#
IEdmPos5 GetFirstLoggedInUserPosition(
   System.string bsVaultNames
)
C++/CLI
IEdmPos5^ GetFirstLoggedInUserPosition(
&   System.String^ bsVaultNames
)

Parameters

bsVaultNames
Optional newline-separated list of the names of the vaults for which to enumerate logged-in users; "" to enumerate users that are logged in to the current vault only

Return Value

IEdmPos5; position of the first logged-in user in the enumeration

Example

Create New Vault (VB.NET)
Create New Vault (C#)

Remarks

After calling this method, pass the returned position of the first logged-in user to IEdmUserMgr5::GetNextLoggedInUser to get the first logged-in user in this list. Then call IEdmUserMgr5::GetNextLoggedInUser repeatedly to get the rest of the users that are logged in to the vault.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Call IEdmUserMgr5::GetLoggedInUser to only get the user who is currently running this program in the vault.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstUserGroupPosition Method (IEdmUserMgr5)

GetFirstUserGroupPosition Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetFirstUserGroupPosition Method (IEdmUserMgr5)

Starts an enumeration of the user groups in the vault.

Syntax

Visual Basic
Function GetFirstUserGroupPosition() As IEdmPos5
C#
IEdmPos5 GetFirstUserGroupPosition()
C++/CLI
IEdmPos5^ GetFirstUserGroupPosition();

Return Value

IEdmPos5; position of the first user group in the enumeration

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

After calling this method, pass the returned position of the first user group to IEdmUserMgr5::GetNextUserGroup to get the first user group in this list. Then call IEdmUserMgr5::GetNextUserGroup repeatedly to get the rest of the user groups.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstUserPosition Method (IEdmUserMgr5)

GetFirstUserPosition Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetFirstUserPosition Method (IEdmUserMgr5)

Starts an enumeration of the users in the vault.

Syntax

Visual Basic
Function GetFirstUserPosition() As IEdmPos5
C#
IEdmPos5 GetFirstUserPosition()
C++/CLI
IEdmPos5^ GetFirstUserPosition();

Return Value

IEdmPos5; position of the first user in the enumeration

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Send Message to Users (C#)
Send Message to Users (VB.NET)

Remarks

After calling this method, pass the returned position of the first user to IEdmUserMgr5::GetNextUser to get the first user in this list. Then call IEdmUserMgr5::GetNextUser repeatedly to get the rest of the users.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetLoggedInUser Method (IEdmUserMgr5)

GetLoggedInUser Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetLoggedInUser Method (IEdmUserMgr5)

Gets the user currently running this program in the vault.

Syntax

Visual Basic
Function GetLoggedInUser() As IEdmUser5
C#
IEdmUser5 GetLoggedInUser()
C++/CLI
IEdmUser5^ GetLoggedInUser();

Return Value

IEdmUser5; current user

Example

Get Messages (C#)
Get Messages (VB.NET)

Remarks

This method returns the IEdmUser5 interface of the user currently logged in on the IEdmVault5 object from which this IEdmUserMgr5 interface is retrieved. IEdmUserMgr5::GetFirstLoggedInUserPosition and IEdmUserMgr5::GetNextLoggedInUser return information about all users currently logged in to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NOT_LOGGED_IN: Neither IEdmVault5::Login nor IEdmVault5::LoginAuto has been called.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextLoggedInUser Method (IEdmUserMgr5)

GetNextLoggedInUser Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetNextLoggedInUser Method (IEdmUserMgr5)

poPos
IEdmPos5; position in the enumeration of the next logged-in user
pbsUserName
Name of the logged-in user (see Remarks)
pbsComputerName
Name of the computer in which the user is logged (see Remarks)
pbsVaultName
Name of the vault in which the user is logged (see Remarks)
poLoginTime
Date and time of the moment when the user logged in to the vault (see Remarks)
Gets information about the next logged-in user in an enumeration of all logged-in users in the vault.

Syntax

Visual Basic
Sub GetNextLoggedInUser( _
   ByVal poPos As IEdmPos5, _
   ByRef pbsUserName As System.String, _
   ByRef pbsComputerName As System.String, _
   ByRef pbsVaultName As System.String, _
   ByRef poLoginTime As System.Object _
)
C#
void GetNextLoggedInUser(
   IEdmPos5 poPos,
   out System.string pbsUserName,
   out System.string pbsComputerName,
   out System.string pbsVaultName,
   out System.object poLoginTime
)
C++/CLI
void GetNextLoggedInUser(
&   IEdmPos5^ poPos,
&   [Out] System.String^ pbsUserName,
&   [Out] System.String^ pbsComputerName,
&   [Out] System.String^ pbsVaultName,
&   [Out] System.Object^ poLoginTime
)

Parameters

poPos
IEdmPos5; position in the enumeration of the next logged-in user
pbsUserName
Name of the logged-in user (see Remarks)
pbsComputerName
Name of the computer in which the user is logged (see Remarks)
pbsVaultName
Name of the vault in which the user is logged (see Remarks)
poLoginTime
Date and time of the moment when the user logged in to the vault (see Remarks)

Example

Create New Vault (VB.NET)
Create New Vault (C#)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first logged-in user in the list, IEdmPos5. Call IEdmUserMgr5::GetFirstLoggedInUserPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the logged-in users in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users must free the strings returned in pbsUserName, pbsComputerName, and pbsVaultName with a call to SysFreeString. C++ users must initialize the VARIANT struct in poLoginTime with a call to VariantInit before calling this method. After the method has returned, the contents of the VARIANT struct must be freed by calling VariantClear.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextUser Method (IEdmUserMgr5)

GetNextUser Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetNextUser Method (IEdmUserMgr5)

poPos
IEdmPos5; position in the enumeration of the next user
Gets the next user in an enumeration of all users in the vault.

Syntax

Visual Basic
Function GetNextUser( _
   ByVal poPos As IEdmPos5 _
) As IEdmUser5
C#
IEdmUser5 GetNextUser(
   IEdmPos5 poPos
)
C++/CLI
IEdmUser5^ GetNextUser(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position in the enumeration of the next user

Return Value

IEdmUser5

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Send Message to Users (C#)
Send Message to Users (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first user in the list, IEdmPos5. Call IEdmUserMgr5::GetFirstUserPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the users in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextUserGroup Method (IEdmUserMgr5)

GetNextUserGroup Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetNextUserGroup Method (IEdmUserMgr5)

poPos
IEdmPos5; position in the enumeration of the next user group
Gets the next user group in an enumeration of all user groups in the vault.

Syntax

Visual Basic
Function GetNextUserGroup( _
   ByVal poPos As IEdmPos5 _
) As IEdmUserGroup5
C#
IEdmUserGroup5 GetNextUserGroup(
   IEdmPos5 poPos
)
C++/CLI
IEdmUserGroup5^ GetNextUserGroup(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position in the enumeration of the next user group

Return Value

IEdmUserGroup5

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first user group in the list, IEdmPos5. Call IEdmUserMgr5::GetFirstUserGroupPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the user groups in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetUser Method (IEdmUserMgr5)

GetUser Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetUser Method (IEdmUserMgr5)

poIdOrName
Id or name of user to get
Gets a user with the specified name or ID.

Syntax

Visual Basic
Function GetUser( _
   ByRef poIdOrName As System.Object _
) As IEdmUser5
C#
IEdmUser5 GetUser(
   ref System.object poIdOrName
)
C++/CLI
IEdmUser5^ GetUser(
&   System.Object^% poIdOrName
)

Parameters

poIdOrName
Id or name of user to get

Return Value

IEdmUser5

Example

Add Folder (VB.NET)
Add Folder (C#)

Remarks

C++ users must release the returned interface, IEdmUser5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The poIdOrName argument contains an unknown user name. ppoRetUser contains null when this happens in C++.
  • E_EDM_INVALID_ID: The poIdOrName argument contains an invalid ID.
  • E_EDM_DATABASE_ACCESS: Returned only for invalid IDs in SOLIDWORKS PDM Professional 5.2.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetUserGroup Method (IEdmUserMgr5)

GetUserGroup Method (IEdmUserMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr5 Interface : GetUserGroup Method (IEdmUserMgr5)

poIdOrName
ID or name of the user group to get
Gets a user group with the specified name or ID.

Syntax

Visual Basic
Function GetUserGroup( _
   ByRef poIdOrName As System.Object _
) As IEdmUserGroup5
C#
IEdmUserGroup5 GetUserGroup(
   ref System.object poIdOrName
)
C++/CLI
IEdmUserGroup5^ GetUserGroup(
&   System.Object^% poIdOrName
)

Parameters

poIdOrName
ID or name of the user group to get

Return Value

IEdmUserGroup5

Example

Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)
Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

C++ users must release the returned interface, IEdmUserGroup5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The poIdOrName argument contains an unknown user group name. The return value contains null when this happens in C++.
  • E_EDM_INVALID_ID: The poIdOrName argument contains an invalid ID.
  • E_EDM_DATABASE_ACCESS: Returned only for invalid IDs in SOLIDWORKS PDM Professional 5.2.

See Also

IEdmUserMgr5 Interface
IEdmUserMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmUserMgr7 Interface

IEdmUserMgr7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserMgr7 Interface

Allows you to access the users and user groups in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserMgr7
   Inherits IEdmUserMgr5, IEdmUserMgr6
C#
public interface IEdmUserMgr7 : IEdmUserMgr5, IEdmUserMgr6
C++/CLI
public interface class IEdmUserMgr7 : public IEdmUserMgr5, IEdmUserMgr6

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)

Remarks

This interface:

  • supersedes IEdmUserMgr6.
  • provides the ability to remove groups and users and manage folder permissions.
  • is extended by IEdmUserMgr8.

See Also

IEdmUserMgr7 Members
EPDM.Interop.epdm Namespace


IEdmUserMgr7 Interface Members

IEdmUserMgr7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr7 Interface

The following tables list the members exposed by IEdmUserMgr7.

Public Methods

 | Name | Description
Method | AddGroups2 | Adds the specified user groups to the vault.
Method | AddUsers2 | Obsolete. Superseded by IEdmUserMgr10::AddUsers3 .
Method | GetFolderPermissions | Gets the permissions set on the specified folder for the specified user or group.
Method | RemoveGroups | Removes the specified groups from the vault.
Method | RemoveUsers | Removes the specified users from the vault.
Method | SetFolderPermissions | Sets specified permissions on a specified folder for a specified user or group.
Top

See Also

IEdmUserMgr7 Interface
EPDM.Interop.epdm Namespace


IEdmUserMgr7 Interface Methods

IEdmUserMgr7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr7 Interface

For a list of all members of this type, see IEdmUserMgr7 members.

Public Methods

 | Name | Description
Method | AddGroups2 | Adds the specified user groups to the vault.
Method | AddUsers2 | Obsolete. Superseded by IEdmUserMgr10::AddUsers3 .
Method | GetFolderPermissions | Gets the permissions set on the specified folder for the specified user or group.
Method | RemoveGroups | Removes the specified groups from the vault.
Method | RemoveUsers | Removes the specified users from the vault.
Method | SetFolderPermissions | Sets specified permissions on a specified folder for a specified user or group.
Top

See Also

IEdmUserMgr7 Interface
EPDM.Interop.epdm Namespace


AddGroups2 Method (IEdmUserMgr7)

AddGroups2 Method (IEdmUserMgr7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr7 Interface : AddGroups2 Method (IEdmUserMgr7)

ppoGroupData
Array of EdmGroupData2 structures; one structure for each group
Adds the specified user groups to the vault.

Syntax

Visual Basic
Sub AddGroups2( _
   ByRef ppoGroupData() As EdmGroupData2 _
)
C#
void AddGroups2(
   out EdmGroupData2[] ppoGroupData
)
C++/CLI
void AddGroups2(
&   [Out] array<EdmGroupData2>^ ppoGroupData
)

Parameters

ppoGroupData
Array of EdmGroupData2 structures; one structure for each group

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

This method supersedes IEdmUserMgr6::AddGroups by providing the ability to specify permissions for added groups.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr7 Interface
IEdmUserMgr7 Members

Availability

SOLIDWORKS PDM Professional 2010


GetFolderPermissions Method (IEdmUserMgr7)

GetFolderPermissions Method (IEdmUserMgr7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr7 Interface : GetFolderPermissions Method (IEdmUserMgr7)

lOwnerID
ID of the user or group for which to get permissions; 0 to return permissions for all users and groups
meOwnerType
Type of lOwnerID as defined in EdmObjectType
lFolderID
ID of folder for which to get permissions
lEdmGetPermFlags
Combination of EdmGetPermFlag bits (see Remarks)
ppoPermissions
Array of EdmFolderPermission structures; one structure for each permission
Gets the permissions set on the specified folder for the specified user or group.

Syntax

Visual Basic
Sub GetFolderPermissions( _
   ByVal lOwnerID As System.Integer, _
   ByVal meOwnerType As EdmObjectType, _
   ByVal lFolderID As System.Integer, _
   ByVal lEdmGetPermFlags As System.Integer, _
   ByRef ppoPermissions() As EdmFolderPermission _
)
C#
void GetFolderPermissions(
   System.int lOwnerID,
   EdmObjectType meOwnerType,
   System.int lFolderID,
   System.int lEdmGetPermFlags,
   out EdmFolderPermission[] ppoPermissions
)
C++/CLI
void GetFolderPermissions(
&   System.int lOwnerID,
&   EdmObjectType meOwnerType,
&   System.int lFolderID,
&   System.int lEdmGetPermFlags,
&   [Out] array<EdmFolderPermission>^ ppoPermissions
)

Parameters

lOwnerID
ID of the user or group for which to get permissions; 0 to return permissions for all users and groups
meOwnerType
Type of lOwnerID as defined in EdmObjectType
lFolderID
ID of folder for which to get permissions
lEdmGetPermFlags
Combination of EdmGetPermFlag bits (see Remarks)
ppoPermissions
Array of EdmFolderPermission structures; one structure for each permission

Example

See the IEdmUserMgr7 examples.

Remarks

This method returns not only permissions explicitly set on a folder, but also permissions inherited from parent folders, depending on the combination of EdmGetPermFlag bits in lEdmGetPermFlags.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr7 Interface
IEdmUserMgr7 Members

Availability

SOLIDWORKS PDM Professional 2010


RemoveGroups Method (IEdmUserMgr7)

RemoveGroups Method (IEdmUserMgr7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr7 Interface : RemoveGroups Method (IEdmUserMgr7)

poGroupIDs
Array of IDs of the groups to remove (see Remarks)
Removes the specified groups from the vault.

Syntax

Visual Basic
Sub RemoveGroups( _
   ByVal poGroupIDs() As System.Integer _
)
C#
void RemoveGroups(
   System.int[] poGroupIDs
)
C++/CLI
void RemoveGroups(
&   System.array<int>^ poGroupIDs
)

Parameters

poGroupIDs
Array of IDs of the groups to remove (see Remarks)

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

If you specify an ID in poGroupIDs that does not exist, it is ignored.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks the EdmSysPerm.EdmSysPerm_EditUserMgr permission.

See Also

IEdmUserMgr7 Interface
IEdmUserMgr7 Members

Availability

SOLIDWORKS PDM Professional 2010


RemoveUsers Method (IEdmUserMgr7)

RemoveUsers Method (IEdmUserMgr7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr7 Interface : RemoveUsers Method (IEdmUserMgr7)

poUserIDs
Array of IDs of the users to remove (see Remarks)
Removes the specified users from the vault.

Syntax

Visual Basic
Sub RemoveUsers( _
   ByVal poUserIDs() As System.Integer _
)
C#
void RemoveUsers(
   System.int[] poUserIDs
)
C++/CLI
void RemoveUsers(
&   System.array<int>^ poUserIDs
)

Parameters

poUserIDs
Array of IDs of the users to remove (see Remarks)

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)
Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

If you specify an ID in poUserIDs that does not exist, it is ignored.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks the EdmSysPerm.EdmSysPerm_EditUserMgr permission.

See Also

IEdmUserMgr7 Interface
IEdmUserMgr7 Members

Availability

SOLIDWORKS PDM Professional 2010


SetFolderPermissions Method (IEdmUserMgr7)

SetFolderPermissions Method (IEdmUserMgr7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr7 Interface : SetFolderPermissions Method (IEdmUserMgr7)

poPermissions
Array of EdmFolderPermission structures; one structure for each permission assignment
Sets specified permissions on a specified folder for a specified user or group.

Syntax

Visual Basic
Sub SetFolderPermissions( _
   ByVal poPermissions() As EdmFolderPermission _
)
C#
void SetFolderPermissions(
   EdmFolderPermission[] poPermissions
)
C++/CLI
void SetFolderPermissions(
&   array<EdmFolderPermission>^ poPermissions
)

Parameters

poPermissions
Array of EdmFolderPermission structures; one structure for each permission assignment

Example

See the IEdmUserMgr7 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks the EdmSysPerm.EdmSysPerm_EditUserMgr permission.

See Also

IEdmUserMgr7 Interface
IEdmUserMgr7 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmUserMgr8 Interface

IEdmUserMgr8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserMgr8 Interface

Allows you to access the users and user groups in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserMgr8
   Inherits IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7
C#
public interface IEdmUserMgr8 : IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7
C++/CLI
public interface class IEdmUserMgr8 : public IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7

Example

Create User Picture (VB.NET)
Create User Picture (C#)

Remarks

This interface:

  • extends IEdmUserMgr7 by providing the ability to display a user's picture and a popup with picture information.
  • is extended by IEdmUserMgr9.

See Also

IEdmUserMgr8 Members
EPDM.Interop.epdm Namespace


IEdmUserMgr8 Interface Members

IEdmUserMgr8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr8 Interface

The following tables list the members exposed by IEdmUserMgr8.

Public Methods

 | Name | Description
Method | CreateUserPicture | Creates a picture of the user to display in a form.
Method | ShowUserPopup | Displays a popup window with information about the specified user when the mouse hovers over the specified area of the specified window.
Top

See Also

IEdmUserMgr8 Interface
EPDM.Interop.epdm Namespace


IEdmUserMgr8 Interface Methods

IEdmUserMgr8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr8 Interface

For a list of all members of this type, see IEdmUserMgr8 members.

Public Methods

 | Name | Description
Method | CreateUserPicture | Creates a picture of the user to display in a form.
Method | ShowUserPopup | Displays a popup window with information about the specified user when the mouse hovers over the specified area of the specified window.
Top

See Also

IEdmUserMgr8 Interface
EPDM.Interop.epdm Namespace


CreateUserPicture Method (IEdmUserMgr8)

CreateUserPicture Method (IEdmUserMgr8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr8 Interface : CreateUserPicture Method (IEdmUserMgr8)

hParent
Handle of parent window on which the picture should be drawn
poDestRect
EdmRect structure; bounding rectangle in which the picture should be drawn (see Remarks)
oUserID
ID or login name of the user for which to create a picture
poCallback
Optional pointer to a class that implements IEdmCallback to receive progress information if the picture needs to be downloaded from an archive server
lEdmUserPictureFlags
Combination of EdmUserPictureFlag bits
Creates a picture of the user to display in a form.

Syntax

Visual Basic
Function CreateUserPicture( _
   ByVal hParent As System.Integer, _
   ByRef poDestRect As EdmRect, _
   ByVal oUserID As System.Object, _
   Optional ByVal poCallback As EdmCallback, _
   Optional ByVal lEdmUserPictureFlags As System.Integer _
) As IEdmImage
C#
IEdmImage CreateUserPicture(
   System.int hParent,
   ref EdmRect poDestRect,
   System.object oUserID,
   EdmCallback poCallback,
   System.int lEdmUserPictureFlags
)
C++/CLI
IEdmImage^ CreateUserPicture(
&   System.int hParent,
&   EdmRect% poDestRect,
&   System.Object^ oUserID,
&   EdmCallback^ poCallback,
&   System.int lEdmUserPictureFlags
)

Parameters

hParent
Handle of parent window on which the picture should be drawn
poDestRect
EdmRect structure; bounding rectangle in which the picture should be drawn (see Remarks)
oUserID
ID or login name of the user for which to create a picture
poCallback
Optional pointer to a class that implements IEdmCallback to receive progress information if the picture needs to be downloaded from an archive server
lEdmUserPictureFlags
Combination of EdmUserPictureFlag bits

Return Value

IEdmImage

Example

See the IEdmUserMgr8 examples.

Remarks

Call IEdmUserMgr8::ShowUserPopup to display a popup window with user information.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr8 Interface
IEdmUserMgr8 Members

Availability

SOLIDWORKS PDM Professional 2013


ShowUserPopup Method (IEdmUserMgr8)

ShowUserPopup Method (IEdmUserMgr8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr8 Interface : ShowUserPopup Method (IEdmUserMgr8)

hParent
Handle of the parent window
poTrackRect
EdmRect structure; bounding rectangle of the area in the window that will trigger the mouse hover event
oUserID
ID, login name, or full name of the user for which to display information in the popup window (see Remarks)
Displays a popup window with information about the specified user when the mouse hovers over the specified area of the specified window.

Syntax

Visual Basic
Sub ShowUserPopup( _
   ByVal hParent As System.Integer, _
   ByRef poTrackRect As EdmRect, _
   ByVal oUserID As System.Object _
)
C#
void ShowUserPopup(
   System.int hParent,
   ref EdmRect poTrackRect,
   System.object oUserID
)
C++/CLI
void ShowUserPopup(
&   System.int hParent,
&   EdmRect% poTrackRect,
&   System.Object^ oUserID
)

Parameters

hParent
Handle of the parent window
poTrackRect
EdmRect structure; bounding rectangle of the area in the window that will trigger the mouse hover event
oUserID
ID, login name, or full name of the user for which to display information in the popup window (see Remarks)

Example

See the IEdmUserMgr8 examples.

Remarks

In the SOLIDWORKS PDM Professional user interface, whenever the mouse hovers over a user name, a popup window displays information about the user. The popup window displays until the mouse moves off the area containing the user name. Call this method to display a popup window when the mouse hovers over a user name in a Windows form.

If oUserID contains a full name that is not unique, the user to display is randomly selected by the system.

IEdmUser10::SetUserDataEx describes how to update the information displayed in the popup window.

Call IEdmUserMgr8::CreateUserPicture if you want to display the picture of a user in a Windows form.

Return codes:

  • S_OK: The method successfully executed.
  • E_INVALIDARG: One or more of the arguments are invalid.
  • E_EDM_NOT_LOGGED_IN: You must log in to the vault before calling this method.

See Also

IEdmUserMgr8 Interface
IEdmUserMgr8 Members

Availability

SOLIDWORKS PDM Professional 2013


IEdmUserMgr9 Interface

IEdmUserMgr9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmUserMgr9 Interface

Allows you to access the users and user groups in the vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserMgr9
   Inherits IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7, IEdmUserMgr8
C#
public interface IEdmUserMgr9 : IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7, IEdmUserMgr8
C++/CLI
public interface class IEdmUserMgr9 : public IEdmUserMgr5, IEdmUserMgr6, IEdmUserMgr7, IEdmUserMgr8

Example

Traverse Users and Groups in Vault (VB.NET)
Traverse Users and Groups in Vault (C#)

Remarks

This interface:

  • extends IEdmUserMgr8 by providing the ability to get and set the state and transition permissions for users and groups.
  • is extended by IEdmUserMgr10.

See Also

IEdmUserMgr9 Members
EPDM.Interop.epdm Namespace


IEdmUserMgr9 Interface Members

IEdmUserMgr9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr9 Interface

The following tables list the members exposed by IEdmUserMgr9.

Public Methods

 | Name | Description
Method | GetStatePermissions | Gets the state permissions for the specified owner and state.
Method | GetTransitionPermissions | Gets the transition permissions for the specified owner and transition.
Method | SetStatePermissions | Sets state permissions.
Method | SetTransitionPermissions | Sets transition permissions.
Top

See Also

IEdmUserMgr9 Interface
EPDM.Interop.epdm Namespace


IEdmUserMgr9 Interface Methods

IEdmUserMgr9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr9 Interface

For a list of all members of this type, see IEdmUserMgr9 members.

Public Methods

 | Name | Description
Method | GetStatePermissions | Gets the state permissions for the specified owner and state.
Method | GetTransitionPermissions | Gets the transition permissions for the specified owner and transition.
Method | SetStatePermissions | Sets state permissions.
Method | SetTransitionPermissions | Sets transition permissions.
Top

See Also

IEdmUserMgr9 Interface
EPDM.Interop.epdm Namespace


GetStatePermissions Method (IEdmUserMgr9)

GetStatePermissions Method (IEdmUserMgr9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr9 Interface : GetStatePermissions Method (IEdmUserMgr9)

lOwnerID
ID of the user or group for which to get permissions; 0 to return permissions for all users and groups
meOwnerType
Type of lOwnerID as defined in EdmObjectType; valid only if lOwnerID is not 0
lStateID
ID of state for which to get permissions; 0 to return permissions for all states
ppoPermissions
Array of EdmStatePermission structures; one structure for each permission assignment
Gets the state permissions for the specified owner and state.

Syntax

Visual Basic
Sub GetStatePermissions( _
   ByVal lOwnerID As System.Integer, _
   ByVal meOwnerType As EdmObjectType, _
   ByVal lStateID As System.Integer, _
   ByRef ppoPermissions() As EdmStatePermission _
)
C#
void GetStatePermissions(
   System.int lOwnerID,
   EdmObjectType meOwnerType,
   System.int lStateID,
   out EdmStatePermission[] ppoPermissions
)
C++/CLI
void GetStatePermissions(
&   System.int lOwnerID,
&   EdmObjectType meOwnerType,
&   System.int lStateID,
&   [Out] array<EdmStatePermission>^ ppoPermissions
)

Parameters

lOwnerID
ID of the user or group for which to get permissions; 0 to return permissions for all users and groups
meOwnerType
Type of lOwnerID as defined in EdmObjectType; valid only if lOwnerID is not 0
lStateID
ID of state for which to get permissions; 0 to return permissions for all states
ppoPermissions
Array of EdmStatePermission structures; one structure for each permission assignment

Example

See the IEdmUserMgr9 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr9 Interface
IEdmUserMgr9 Members
IEdmUserMgr9::SetStatePermissions Method ()

Availability

SOLIDWORKS PDM Professional 2017


GetTransitionPermissions Method (IEdmUserMgr9)

GetTransitionPermissions Method (IEdmUserMgr9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr9 Interface : GetTransitionPermissions Method (IEdmUserMgr9)

lOwnerID
ID of the user or group for which to get permissions; 0 to return permissions for all users and groups
meOwnerType
Type of lOwnerID as defined in EdmObjectType; valid only if lOwnerID is not 0
lTransitionID
ID of transition for which to get permissions; 0 to return permissions for all transitions
ppoPermissions
Array of EdmTransitionPermission structures; one structure for each permission assignment
Gets the transition permissions for the specified owner and transition.

Syntax

Visual Basic
Sub GetTransitionPermissions( _
   ByVal lOwnerID As System.Integer, _
   ByVal meOwnerType As EdmObjectType, _
   ByVal lTransitionID As System.Integer, _
   ByRef ppoPermissions() As EdmTransitionPermission _
)
C#
void GetTransitionPermissions(
   System.int lOwnerID,
   EdmObjectType meOwnerType,
   System.int lTransitionID,
   out EdmTransitionPermission[] ppoPermissions
)
C++/CLI
void GetTransitionPermissions(
&   System.int lOwnerID,
&   EdmObjectType meOwnerType,
&   System.int lTransitionID,
&   [Out] array<EdmTransitionPermission>^ ppoPermissions
)

Parameters

lOwnerID
ID of the user or group for which to get permissions; 0 to return permissions for all users and groups
meOwnerType
Type of lOwnerID as defined in EdmObjectType; valid only if lOwnerID is not 0
lTransitionID
ID of transition for which to get permissions; 0 to return permissions for all transitions
ppoPermissions
Array of EdmTransitionPermission structures; one structure for each permission assignment

Example

See the IEdmUserMgr9 examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr9 Interface
IEdmUserMgr9 Members
IEdmUserMgr9::SetTransitionPermissions Method ()

Availability

SOLIDWORKS PDM Professional 2017


SetStatePermissions Method (IEdmUserMgr9)

SetStatePermissions Method (IEdmUserMgr9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr9 Interface : SetStatePermissions Method (IEdmUserMgr9)

poPermissions
Array of EdmStatePermission structures; one structure for each permission assignment
Sets state permissions.

Syntax

Visual Basic
Sub SetStatePermissions( _
   ByVal poPermissions() As EdmStatePermission _
)
C#
void SetStatePermissions(
   EdmStatePermission[] poPermissions
)
C++/CLI
void SetStatePermissions(
&   array<EdmStatePermission>^ poPermissions
)

Parameters

poPermissions
Array of EdmStatePermission structures; one structure for each permission assignment

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks the EdmSysPerm.EdmSysPerm_EditUserMgr permission.

See Also

IEdmUserMgr9 Interface
IEdmUserMgr9 Members
IEdmUserMgr9::GetStatePermissions Method ()

Availability

SOLIDWORKS PDM Professional 2017


SetTransitionPermissions Method (IEdmUserMgr9)

SetTransitionPermissions Method (IEdmUserMgr9)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr9 Interface : SetTransitionPermissions Method (IEdmUserMgr9)

poPermissions
Array of EdmTransitionPermission structures; one structure for each permission assignment
Sets transition permissions.

Syntax

Visual Basic
Sub SetTransitionPermissions( _
   ByVal poPermissions() As EdmTransitionPermission _
)
C#
void SetTransitionPermissions(
   EdmTransitionPermission[] poPermissions
)
C++/CLI
void SetTransitionPermissions(
&   array<EdmTransitionPermission>^ poPermissions
)

Parameters

poPermissions
Array of EdmTransitionPermission structures; one structure for each permission assignment

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks the EdmSysPerm.EdmSysPerm_EditUserMgr permission.

See Also

IEdmUserMgr9 Interface
IEdmUserMgr9 Members
IEdmUserMgr9::GetTransitionPermissions Method ()

Availability

SOLIDWORKS PDM Professional 2017


IEdmVariable5 Interface

IEdmVariable5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVariable5 Interface

Allows you to access a variable on a file or folder data card.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVariable5
   Inherits IEdmObject5
C#
public interface IEdmVariable5 : IEdmObject5
C++/CLI
public interface class IEdmVariable5 : public IEdmObject5

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)

Remarks

This interface inherits from IEdmObject5.

Use IEdmVariableMgr5 to enumerate the variables created with the Card Editor.

Accessors

IEdmVariableMgr5::GetNextVariable

IEdmVariableMgr5::GetVariable

IEdmVault5::GetObject

See Also

IEdmVariable5 Members
EPDM.Interop.epdm Namespace
IEdmEnumeratorVariable5 Interface
IEdmAttribute5 Interface


IEdmVariable5 Interface Members

IEdmVariable5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmVariable5 Interface

The following tables list the members exposed by IEdmVariable5.

Public Properties

 | Name | Description
Property | Flags | Gets the style of this variable.
Property | VariableType | Gets the type of data that can be stored in this variable.
Top

Public Methods

 | Name | Description
Method | GetFirstAttributePosition | Starts an enumeration of the attributes to which this variable is mapped for the specified file type.
Method | GetNextAttribute | Gets the next attribute in an enumeration.
Top

See Also

IEdmVariable5 Interface
EPDM.Interop.epdm Namespace
IEdmEnumeratorVariable5 Interface
IEdmAttribute5 Interface


IEdmVariable5 Interface Methods

IEdmVariable5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVariable5 Interface

For a list of all members of this type, see IEdmVariable5 members.

Public Methods

 | Name | Description
Method | GetFirstAttributePosition | Starts an enumeration of the attributes to which this variable is mapped for the specified file type.
Method | GetNextAttribute | Gets the next attribute in an enumeration.
Top

See Also

IEdmVariable5 Interface
EPDM.Interop.epdm Namespace
IEdmEnumeratorVariable5 Interface
IEdmAttribute5 Interface


GetFirstAttributePosition Method (IEdmVariable5)

GetFirstAttributePosition Method (IEdmVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariable5 Interface : GetFirstAttributePosition Method (IEdmVariable5)

bsFileExtension
Extension of file for which to get attributes, e.g., "DWG" or "DOC"; "" to get all attributes for all file types
Starts an enumeration of the attributes to which this variable is mapped for the specified file type.

Syntax

Visual Basic
Function GetFirstAttributePosition( _
   ByVal bsFileExtension As System.String _
) As IEdmPos5
C#
IEdmPos5 GetFirstAttributePosition(
   System.string bsFileExtension
)
C++/CLI
IEdmPos5^ GetFirstAttributePosition(
&   System.String^ bsFileExtension
)

Parameters

bsFileExtension
Extension of file for which to get attributes, e.g., "DWG" or "DOC"; "" to get all attributes for all file types

Return Value

IEdmPos5; position of the first attribute in the enumeration

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)

Remarks

A variable in SOLIDWORKS PDM Professional can be mapped to zero or more block-attribute pairs. SOLIDWORKS PDM Professional uses the attributes when transferring data between the file data card and the file, itself. See the main SOLIDWORKS PDM Professional online help for more information.

After calling this method, pass the returned position of the first attribute to IEdmVariable5::GetNextAttribute to get the first attribute in this list. Then call IEdmVariable5::GetNextAttribute repeatedly to get the rest of the attributes.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariable5 Interface
IEdmVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextAttribute Method (IEdmVariable5)

GetNextAttribute Method (IEdmVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariable5 Interface : GetNextAttribute Method (IEdmVariable5)

poPos
IEdmPos5; position in the enumeration of the next attribute
Gets the next attribute in an enumeration.

Syntax

Visual Basic
Function GetNextAttribute( _
   ByVal poPos As IEdmPos5 _
) As IEdmAttribute5
C#
IEdmAttribute5 GetNextAttribute(
   IEdmPos5 poPos
)
C++/CLI
IEdmAttribute5^ GetNextAttribute(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position in the enumeration of the next attribute

Return Value

IEdmAttribute5

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first attribute in the list, IEdmPos5. Call IEdmVariable5::GetFirstAttributePosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the attributes in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmAttribute5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariable5 Interface
IEdmVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVariable5 Interface Properties

IEdmVariable5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVariable5 Interface

For a list of all members of this type, see IEdmVariable5 members.

Public Properties

 | Name | Description
Property | Flags | Gets the style of this variable.
Property | VariableType | Gets the type of data that can be stored in this variable.
Top

See Also

IEdmVariable5 Interface
EPDM.Interop.epdm Namespace
IEdmEnumeratorVariable5 Interface
IEdmAttribute5 Interface


Flags Property (IEdmVariable5)

Flags Property (IEdmVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariable5 Interface : Flags Property (IEdmVariable5)

Gets the style of this variable.

Syntax

Visual Basic
ReadOnly Property Flags As System.Integer
C#
System.int Flags {get;}
C++/CLI
property System.int Flags {
   System.int get();
}

Property Value

Combination of EdmVariableFlags bits

Example

Access File Card Variables (VB.NET)
Access File Card Variables (C#)

See Also

IEdmVariable5 Interface
IEdmVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


VariableType Property (IEdmVariable5)

VariableType Property (IEdmVariable5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariable5 Interface : VariableType Property (IEdmVariable5)

Gets the type of data that can be stored in this variable.

Syntax

Visual Basic
ReadOnly Property VariableType As EdmVariableType
C#
EdmVariableType VariableType {get;}
C++/CLI
property EdmVariableType VariableType {
   EdmVariableType get();
}

Property Value

Type of data that can be stored in this variable as defined in EdmVariableType

Example

Access File Card Variables (VB.NET)
Access File Card Variables (C#)

See Also

IEdmVariable5 Interface
IEdmVariable5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVariableMgr5 Interface

IEdmVariableMgr5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVariableMgr5 Interface

Allows you to manage the file and folder data card variables set up in the Card Editor.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVariableMgr5
C#
public interface IEdmVariableMgr5
C++/CLI
public interface class IEdmVariableMgr5

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmVariableMgr6.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmVariableMgr5 Members
EPDM.Interop.epdm Namespace
IEdmVariable5 Interface
IEdmEnumeratorVariable5 Interface


IEdmVariableMgr5 Interface Members

IEdmVariableMgr5 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVariableMgr5 Interface

The following tables list the members exposed by IEdmVariableMgr5.

Public Methods

 | Name | Description
Method | EditVariables | Displays the Edit Variables dialog box.
Method | GetFirstVariablePosition | Starts an enumeration of the variables in the vault.
Method | GetNextVariable | Gets the next variable in an enumeration.
Method | GetVariable | Gets a variable with the specified ID or name.
Top

See Also

IEdmVariableMgr5 Interface
EPDM.Interop.epdm Namespace
IEdmVariable5 Interface
IEdmEnumeratorVariable5 Interface


IEdmVariableMgr5 Interface Methods

IEdmVariableMgr5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVariableMgr5 Interface

For a list of all members of this type, see IEdmVariableMgr5 members.

Public Methods

 | Name | Description
Method | EditVariables | Displays the Edit Variables dialog box.
Method | GetFirstVariablePosition | Starts an enumeration of the variables in the vault.
Method | GetNextVariable | Gets the next variable in an enumeration.
Method | GetVariable | Gets a variable with the specified ID or name.
Top

See Also

IEdmVariableMgr5 Interface
EPDM.Interop.epdm Namespace
IEdmVariable5 Interface
IEdmEnumeratorVariable5 Interface


EditVariables Method (IEdmVariableMgr5)

EditVariables Method (IEdmVariableMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariableMgr5 Interface : EditVariables Method (IEdmVariableMgr5)

hParentWnd
Parent window handle
Displays the Edit Variables dialog box.

Syntax

Visual Basic
Function EditVariables( _
   ByVal hParentWnd As System.Integer _
) As System.Boolean
C#
System.bool EditVariables(
   System.int hParentWnd
)
C++/CLI
System.bool EditVariables(
&   System.int hParentWnd
)

Parameters

hParentWnd
Parent window handle

Return Value

True if one or more variables are updated; false if not

Example

Add Card Variables to Vault (VB.NET)
Add Card Variables to Vault (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to edit variables.

See Also

IEdmVariableMgr5 Interface
IEdmVariableMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstVariablePosition Method (IEdmVariableMgr5)

GetFirstVariablePosition Method (IEdmVariableMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariableMgr5 Interface : GetFirstVariablePosition Method (IEdmVariableMgr5)

Starts an enumeration of the variables in the vault.

Syntax

Visual Basic
Function GetFirstVariablePosition() As IEdmPos5
C#
IEdmPos5 GetFirstVariablePosition()
C++/CLI
IEdmPos5^ GetFirstVariablePosition();

Return Value

IEdmPos5; position of the first variable in the enumeration

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)

Remarks

After calling this method, pass the returned position of the first variable to IEdmVariableMgr5::GetNextVariable to get the first variable in this list. Then call IEdmVariableMgr5::GetNextVariable repeatedly to get the rest of the variables.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariableMgr5 Interface
IEdmVariableMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextVariable Method (IEdmVariableMgr5)

GetNextVariable Method (IEdmVariableMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariableMgr5 Interface : GetNextVariable Method (IEdmVariableMgr5)

poPos
IEdmPos5; position of the next variable in the list
Gets the next variable in an enumeration.

Syntax

Visual Basic
Function GetNextVariable( _
   ByVal poPos As IEdmPos5 _
) As IEdmVariable5
C#
IEdmVariable5 GetNextVariable(
   IEdmPos5 poPos
)
C++/CLI
IEdmVariable5^ GetNextVariable(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next variable in the list

Return Value

IEdmVariable5

Example

Find Data Cards with Description Variable (C#)
Find Data Cards with Description Variable (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first variable in the list, IEdmPos5. Call IEdmVariableMgr5::GetFirstVariablePosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the variables in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmVariable5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariableMgr5 Interface
IEdmVariableMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetVariable Method (IEdmVariableMgr5)

GetVariable Method (IEdmVariableMgr5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVariableMgr5 Interface : GetVariable Method (IEdmVariableMgr5)

poIdOrName
ID or name of variable to get
Gets a variable with the specified ID or name.

Syntax

Visual Basic
Function GetVariable( _
   ByRef poIdOrName As System.Object _
) As IEdmVariable5
C#
IEdmVariable5 GetVariable(
   ref System.object poIdOrName
)
C++/CLI
IEdmVariable5^ GetVariable(
&   System.Object^% poIdOrName
)

Parameters

poIdOrName
ID or name of variable to get

Return Value

IEdmVariable5; Null if poIdOrName is not valid

Example

Batch Update Card Variables (VB.NET)
Batch Update Card Variables (C#)

Remarks

C++ users not using smart-pointer wrapper functions must release the returned pointer, IEdmVariable5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The variable name or ID is not recognized.

See Also

IEdmVariableMgr5 Interface
IEdmVariableMgr5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVariableMgr6 Interface

IEdmVariableMgr6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVariableMgr6 Interface

Allows you to manage the file and folder data card variables set up in the Card Editor.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVariableMgr6
   Inherits IEdmVariableMgr5
C#
public interface IEdmVariableMgr6 : IEdmVariableMgr5
C++/CLI
public interface class IEdmVariableMgr6 : public IEdmVariableMgr5

Example

Add Card Variables to Vault (VB.NET)
Add Card Variables to Vault (C#)

Remarks

This interface:

  • extends IEdmVariableMgr5.
  • provides the ability to create new variables.
  • is extended by IEdmVariableMgr7.

See Also

IEdmVariableMgr6 Members
EPDM.Interop.epdm Namespace


IEdmVariableMgr6 Interface Members

IEdmVariableMgr6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVariableMgr6 Interface

The following tables list the members exposed by IEdmVariableMgr6.

Public Methods

 | Name | Description
Method | AddVariables | Adds the specified variables to the vault.
Top

See Also

IEdmVariableMgr6 Interface
EPDM.Interop.epdm Namespace


IEdmVariableMgr6 Interface Methods

IEdmVariableMgr6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVariableMgr6 Interface

For a list of all members of this type, see IEdmVariableMgr6 members.

Public Methods

 | Name | Description
Method | AddVariables | Adds the specified variables to the vault.
Top

See Also

IEdmVariableMgr6 Interface
EPDM.Interop.epdm Namespace


AddVariables Method (IEdmVariableMgr6)

AddVariables Method (IEdmVariableMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableMgr6 Interface : AddVariables Method (IEdmVariableMgr6)

ppoVariables
Array of EdmVariableData structures; one structure for each variable (see Remarks)
Adds the specified variables to the vault.

Syntax

Visual Basic
Sub AddVariables( _
   ByRef ppoVariables() As EdmVariableData _
)
C#
void AddVariables(
   out EdmVariableData[] ppoVariables
)
C++/CLI
void AddVariables(
&   [Out] array<EdmVariableData>^ ppoVariables
)

Parameters

ppoVariables
Array of EdmVariableData structures; one structure for each variable (see Remarks)

Example

See the IEdmVariableMgr6 examples.

Remarks

In the ppoVariables structure, set mlVariableID to 0 before calling this method. The ID of the new variable is returned in mlVariableID.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariableMgr6 Interface
IEdmVariableMgr6 Members

Availability

SOLIDWORKS PDM Professional 2007


IEdmVariableMgr7 Interface

IEdmVariableMgr7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVariableMgr7 Interface

Allows you to manage the file and folder data card variables set up in the Card Editor.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVariableMgr7
   Inherits IEdmVariableMgr5, IEdmVariableMgr6
C#
public interface IEdmVariableMgr7 : IEdmVariableMgr5, IEdmVariableMgr6
C++/CLI
public interface class IEdmVariableMgr7 : public IEdmVariableMgr5, IEdmVariableMgr6

Remarks

This interface extends IEdmVariableMgr6.

See Also

IEdmVariableMgr7 Members
EPDM.Interop.epdm Namespace


IEdmVariableMgr7 Interface Members

IEdmVariableMgr7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVariableMgr7 Interface

The following tables list the members exposed by IEdmVariableMgr7.

Public Methods

 | Name | Description
Method | GetDrawingPropSheetAttributes | Gets all of the SLDDRW-card attributes that are linked to the $PRPSHEET block for the specified folder.
Top

See Also

IEdmVariableMgr7 Interface
EPDM.Interop.epdm Namespace


IEdmVariableMgr7 Interface Methods

IEdmVariableMgr7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVariableMgr7 Interface

For a list of all members of this type, see IEdmVariableMgr7 members.

Public Methods

 | Name | Description
Method | GetDrawingPropSheetAttributes | Gets all of the SLDDRW-card attributes that are linked to the $PRPSHEET block for the specified folder.
Top

See Also

IEdmVariableMgr7 Interface
EPDM.Interop.epdm Namespace


GetDrawingPropSheetAttributes Method (IEdmVariableMgr7)

GetDrawingPropSheetAttributes Method (IEdmVariableMgr7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableMgr7 Interface : GetDrawingPropSheetAttributes Method (IEdmVariableMgr7)

lFolderID
ID of folder from which to get the values
ppoSrcAttribs
Array of attribute names used in the CustomProperty block
ppoDestAttribs
Array of attribute names used in the $PRPSheet block
Gets all of the SLDDRW-card attributes that are linked to the $PRPSHEET block for the specified folder.

Syntax

Visual Basic
Sub GetDrawingPropSheetAttributes( _
   ByVal lFolderID As System.Integer, _
   ByRef ppoSrcAttribs() As System.String, _
   ByRef ppoDestAttribs() As System.String _
)
C#
void GetDrawingPropSheetAttributes(
   System.int lFolderID,
   out System.string[] ppoSrcAttribs,
   out System.string[] ppoDestAttribs
)
C++/CLI
void GetDrawingPropSheetAttributes(
&   System.int lFolderID,
&   [Out] System.array<String^>^ ppoSrcAttribs,
&   [Out] System.array<String^>^ ppoDestAttribs
)

Parameters

lFolderID
ID of folder from which to get the values
ppoSrcAttribs
Array of attribute names used in the CustomProperty block
ppoDestAttribs
Array of attribute names used in the $PRPSheet block

Remarks

This method is used internally by SOLIDWORKS PDM Professional to copy attributes from the model's CustomProperty block to the $PRPSHEET block. ppoSrcAttribs and ppoDestAttribs both have the same number of elements.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariableMgr7 Interface
IEdmVariableMgr7 Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmVariableValue5 Interface

IEdmVariableValue5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVariableValue5 Interface

Allows you to access the values of file and folder data card variables.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVariableValue5
C#
public interface IEdmVariableValue5
C++/CLI
public interface class IEdmVariableValue5

Example

Access File Card Variables (VB.NET)
Access File Card Variables (C#)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmVariableValue6.

Accessors

IEdmEnumeratorVariable5::GetUpdateVars

See Also

IEdmVariableValue5 Members
EPDM.Interop.epdm Namespace


IEdmVariableValue5 Interface Members

IEdmVariableValue5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmVariableValue5 Interface

The following tables list the members exposed by IEdmVariableValue5.

Public Properties

 | Name | Description
Property | VariableID | Gets the ID of the variable to which this value belongs.
Top

Public Methods

 | Name | Description
Method | GetFirstAttributePosition | Starts an enumeration of the attributes mapped to this variable.
Method | GetNextAttribute | Gets the next attribute to which this variable is mapped in an enumeration.
Method | GetValue | Gets the value of this variable in the specified configuration.
Top

See Also

IEdmVariableValue5 Interface
EPDM.Interop.epdm Namespace


IEdmVariableValue5 Interface Methods

IEdmVariableValue5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVariableValue5 Interface

For a list of all members of this type, see IEdmVariableValue5 members.

Public Methods

 | Name | Description
Method | GetFirstAttributePosition | Starts an enumeration of the attributes mapped to this variable.
Method | GetNextAttribute | Gets the next attribute to which this variable is mapped in an enumeration.
Method | GetValue | Gets the value of this variable in the specified configuration.
Top

See Also

IEdmVariableValue5 Interface
EPDM.Interop.epdm Namespace


GetFirstAttributePosition Method (IEdmVariableValue5)

GetFirstAttributePosition Method (IEdmVariableValue5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue5 Interface : GetFirstAttributePosition Method (IEdmVariableValue5)

Starts an enumeration of the attributes mapped to this variable.

Syntax

Visual Basic
Function GetFirstAttributePosition() As IEdmPos5
C#
IEdmPos5 GetFirstAttributePosition()
C++/CLI
IEdmPos5^ GetFirstAttributePosition();

Return Value

IEdmPos5; position of the first attribute in the enumeration

Remarks

After calling this method, pass the returned position of the first attribute to IEdmVariableValue5::GetNextAttribute to get the first attribute in this list. Then call IEdmVariableValue5::GetNextAttribute repeatedly to get the rest of the variables.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariableValue5 Interface
IEdmVariableValue5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextAttribute Method (IEdmVariableValue5)

GetNextAttribute Method (IEdmVariableValue5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue5 Interface : GetNextAttribute Method (IEdmVariableValue5)

poPos
IEdmPos5; position of the next attribute in the list
Gets the next attribute to which this variable is mapped in an enumeration.

Syntax

Visual Basic
Function GetNextAttribute( _
   ByVal poPos As IEdmPos5 _
) As IEdmAttribute5
C#
IEdmAttribute5 GetNextAttribute(
   IEdmPos5 poPos
)
C++/CLI
IEdmAttribute5^ GetNextAttribute(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next attribute in the list

Return Value

IEdmAttribute5

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first attribute in the list, IEdmPos5. Call IEdmVariableValue5::GetFirstAttributePosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the attributes in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmVariable5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVariableValue5 Interface
IEdmVariableValue5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetValue Method (IEdmVariableValue5)

GetValue Method (IEdmVariableValue5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue5 Interface : GetValue Method (IEdmVariableValue5)

bsConfiguration
Name of configuration for which to get the value; "" for folders and file types that do not support multiple configurations
Gets the value of this variable in the specified configuration.

Syntax

Visual Basic
Function GetValue( _
   ByVal bsConfiguration As System.String _
) As System.Object
C#
System.object GetValue(
   System.string bsConfiguration
)
C++/CLI
System.Object^ GetValue(
&   System.String^ bsConfiguration
)

Parameters

bsConfiguration
Name of configuration for which to get the value; "" for folders and file types that do not support multiple configurations

Return Value

Value of the variable

Example

See the IEdmVariableValue5 examples.

Remarks

C++ users should use VariantInit and VariantClear to handle the VARIANT struct properly.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: No value exists for the specified configuration.

See Also

IEdmVariableValue5 Interface
IEdmVariableValue5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVariableValue5 Interface Properties

IEdmVariableValue5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVariableValue5 Interface

For a list of all members of this type, see IEdmVariableValue5 members.

Public Properties

 | Name | Description
Property | VariableID | Gets the ID of the variable to which this value belongs.
Top

See Also

IEdmVariableValue5 Interface
EPDM.Interop.epdm Namespace


VariableID Property (IEdmVariableValue5)

VariableID Property (IEdmVariableValue5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue5 Interface : VariableID Property (IEdmVariableValue5)

Gets the ID of the variable to which this value belongs.

Syntax

Visual Basic
ReadOnly Property VariableID As System.Integer
C#
System.int VariableID {get;}
C++/CLI
property System.int VariableID {
   System.int get();
}

Property Value

ID of the variable to which this value belongs

Example

See the IEdmVariableValue5 examples.

See Also

IEdmVariableValue5 Interface
IEdmVariableValue5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVariableValue6 Interface

IEdmVariableValue6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVariableValue6 Interface

Allows you to access the values of file and folder data card variables.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVariableValue6
   Inherits IEdmVariableValue5
C#
public interface IEdmVariableValue6 : IEdmVariableValue5
C++/CLI
public interface class IEdmVariableValue6 : public IEdmVariableValue5

Example

Access File Card Variables (VB.NET)
Access File Card Variables (C#)

Remarks

This interface extends IEdmVariableValue5.

See Also

IEdmVariableValue6 Members
EPDM.Interop.epdm Namespace


IEdmVariableValue6 Interface Members

IEdmVariableValue6 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmVariableValue6 Interface

The following tables list the members exposed by IEdmVariableValue6.

Public Properties

 | Name | Description
Property | VariableFlags | Gets the flags set for this variable.
Property | VariableName | Gets the name of this variable.
Property | VariableType | Gets the type of this variable.
Top

See Also

IEdmVariableValue6 Interface
EPDM.Interop.epdm Namespace


IEdmVariableValue6 Interface Properties

IEdmVariableValue6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVariableValue6 Interface

For a list of all members of this type, see IEdmVariableValue6 members.

Public Properties

 | Name | Description
Property | VariableFlags | Gets the flags set for this variable.
Property | VariableName | Gets the name of this variable.
Property | VariableType | Gets the type of this variable.
Top

See Also

IEdmVariableValue6 Interface
EPDM.Interop.epdm Namespace


VariableFlags Property (IEdmVariableValue6)

VariableFlags Property (IEdmVariableValue6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue6 Interface : VariableFlags Property (IEdmVariableValue6)

Gets the flags set for this variable.

Syntax

Visual Basic
ReadOnly Property VariableFlags As System.Integer
C#
System.int VariableFlags {get;}
C++/CLI
property System.int VariableFlags {
   System.int get();
}

Property Value

Combination of EdmVariableFlags bits

Example

See the IEdmVariableValue6 examples.

See Also

IEdmVariableValue6 Interface
IEdmVariableValue6 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


VariableName Property (IEdmVariableValue6)

VariableName Property (IEdmVariableValue6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue6 Interface : VariableName Property (IEdmVariableValue6)

Gets the name of this variable.

Syntax

Visual Basic
ReadOnly Property VariableName As System.String
C#
System.string VariableName {get;}
C++/CLI
property System.String^ VariableName {
   System.String^ get();
}

Property Value

Variable name

Example

See the IEdmVariableValue6 examples.

See Also

IEdmVariableValue6 Interface
IEdmVariableValue6 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


VariableType Property (IEdmVariableValue6)

VariableType Property (IEdmVariableValue6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVariableValue6 Interface : VariableType Property (IEdmVariableValue6)

Gets the type of this variable.

Syntax

Visual Basic
ReadOnly Property VariableType As EdmVariableType
C#
EdmVariableType VariableType {get;}
C++/CLI
property EdmVariableType VariableType {
   EdmVariableType get();
}

Property Value

Type of variable as defined in EdmVariableType

Example

See the IEdmVariableValue6 examples.

See Also

IEdmVariableValue6 Interface
IEdmVariableValue6 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmVault10 Interface

IEdmVault10 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVault10 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault10
   Inherits IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault10 : IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault10 : public IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Remarks

This interface:

  • extends IEdmVault9.
  • is extended by IEdmVault11.

See Also

IEdmVault10 Members
EPDM.Interop.epdm Namespace


IEdmVault10 Interface Members

IEdmVault10 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault10 Interface

The following tables list the members exposed by IEdmVault10.

Public Methods

 | Name | Description
Method | CreateCardViewEx2 | Displays a file or folder data card.
Top

See Also

IEdmVault10 Interface
EPDM.Interop.epdm Namespace


IEdmVault10 Interface Methods

IEdmVault10 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault10 Interface

For a list of all members of this type, see IEdmVault10 members.

Public Methods

 | Name | Description
Method | CreateCardViewEx2 | Displays a file or folder data card.
Top

See Also

IEdmVault10 Interface
EPDM.Interop.epdm Namespace


CreateCardViewEx2 Method (IEdmVault10)

CreateCardViewEx2 Method (IEdmVault10)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault10 Interface : CreateCardViewEx2 Method (IEdmVault10)

poArgs
EdmCardViewParams structure containing various members that control the creation of the view
poCallback
Pointer to a class that implements IEdmCardViewCallback6
Displays a file or folder data card.

Syntax

Visual Basic
Function CreateCardViewEx2( _
   ByRef poArgs As EdmCardViewParams, _
   ByVal poCallback As System.Object _
) As IEdmCardView63
C#
IEdmCardView63 CreateCardViewEx2(
   ref EdmCardViewParams poArgs,
   System.object poCallback
)
C++/CLI
IEdmCardView63^ CreateCardViewEx2(
&   EdmCardViewParams% poArgs,
&   System.Object^ poCallback
)

Parameters

poArgs
EdmCardViewParams structure containing various members that control the creation of the view
poCallback
Pointer to a class that implements IEdmCardViewCallback6

Return Value

IEdmCardView63

Example

Create Custom Card View (VB.NET)
Create Custom Card View (C#)

Remarks

Use this method if you want complete control of the loading and saving of data to and from a custom file or folder data card. Use IEdmFolder5::CreateCardView if you want SOLIDWORKS PDM Professional to handle the loading and saving of data to and from a simple file or folder data card.

This method supersedes IEdmVault6::CreateCardViewEx by allowing you to pass a structure instead of individual parameters.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault10 Interface
IEdmVault10 Members

Availability

SOLIDWORKS PDM Professional 2009


IEdmVault11 Interface

IEdmVault11 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault11 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault11
   Inherits IEdmVault10, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault11 : IEdmVault10, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault11 : public IEdmVault10, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Add Items (C#)
Add Items (VB.NET)
Add Users (C#)
Add Users (VB.NET)

Remarks

This interface:

  • extends IEdmVault10 by providing the ability to create vaults and access items.
  • is extended by IEdmVault12.

See Also

IEdmVault11 Members
EPDM.Interop.epdm Namespace


IEdmVault11 Interface Members

IEdmVault11 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmVault11 Interface

The following tables list the members exposed by IEdmVault11.

Public Properties

 | Name | Description
Property | ItemRootFolder | Gets the interface to the invisible root folder of all items and item folders.
Property | ItemRootFolderID | Gets the ID of the invisible root folder of all items and item folders.
Top

Public Methods

 | Name | Description
Method | BrowseForFolder2 | Displays a Browse for Folder dialog box in which the user can click a file or item folder.
Method | CreateNewVault | Creates a new vault.
Method | CreateNewVaultView | Creates a local view of a file vault in File Explorer.
Method | GetErrorMessage | Gets a description for the specified error code.
Method | GetErrorName | Gets an internal error code name for the specified error code.
Method | GetLicense | Gets all of the SOLIDWORKS PDM Professional licenses installed in this vault.
Method | GetLoggedInWindowsUserID | Gets the ID of the user who is currently logged in through the SOLIDWORKS PDM Professional client software on this machine.
Method | InstallLicense | Obsolete. Replaced by IEdmVault14::InstallLicense2.
Method | LogInWindowsUser | Logs into SOLIDWORKS PDM Professional as the specified user.
Top

See Also

IEdmVault11 Interface
EPDM.Interop.epdm Namespace


IEdmVault11 Interface Methods

IEdmVault11 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault11 Interface

For a list of all members of this type, see IEdmVault11 members.

Public Methods

 | Name | Description
Method | BrowseForFolder2 | Displays a Browse for Folder dialog box in which the user can click a file or item folder.
Method | CreateNewVault | Creates a new vault.
Method | CreateNewVaultView | Creates a local view of a file vault in File Explorer.
Method | GetErrorMessage | Gets a description for the specified error code.
Method | GetErrorName | Gets an internal error code name for the specified error code.
Method | GetLicense | Gets all of the SOLIDWORKS PDM Professional licenses installed in this vault.
Method | GetLoggedInWindowsUserID | Gets the ID of the user who is currently logged in through the SOLIDWORKS PDM Professional client software on this machine.
Method | InstallLicense | Obsolete. Replaced by IEdmVault14::InstallLicense2.
Method | LogInWindowsUser | Logs into SOLIDWORKS PDM Professional as the specified user.
Top

See Also

IEdmVault11 Interface
EPDM.Interop.epdm Namespace


BrowseForFolder2 Method (IEdmVault11)

BrowseForFolder2 Method (IEdmVault11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : BrowseForFolder2 Method (IEdmVault11)

hParentWnd
Parent window handle
bsMessage
Message to display in the dialog box
poDefaultFolder
IEdmFolder5; default folder to browse
lFlags
Combination of EdmBrowseForFolderFlag bits
Displays a Browse for Folder dialog box in which the user can click a file or item folder.

Syntax

Visual Basic
Function BrowseForFolder2( _
   ByVal hParentWnd As System.Integer, _
   ByVal bsMessage As System.String, _
   ByVal poDefaultFolder As IEdmFolder5, _
   ByVal lFlags As System.Integer _
) As IEdmFolder5
C#
IEdmFolder5 BrowseForFolder2(
   System.int hParentWnd,
   System.string bsMessage,
   IEdmFolder5 poDefaultFolder,
   System.int lFlags
)
C++/CLI
IEdmFolder5^ BrowseForFolder2(
&   System.int hParentWnd,
&   System.String^ bsMessage,
&   IEdmFolder5^ poDefaultFolder,
&   System.int lFlags
)

Parameters

hParentWnd
Parent window handle
bsMessage
Message to display in the dialog box
poDefaultFolder
IEdmFolder5; default folder to browse
lFlags
Combination of EdmBrowseForFolderFlag bits

Return Value

IEdmFolder5; Null if the user clicks Cancel (see Remarks)

Example

Get and Set Item References (VB.NET)
Get and Set Item References (C#)

Remarks

This method supersedes IEdmVault5::BrowseForFolder by providing the ability to select items.

C++ users must release the returned interface, IEdmFolder5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The user pressed Cancel.
  • E_EDM_NOT_LOGGED_IN: You must call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


CreateNewVault Method (IEdmVault11)

CreateNewVault Method (IEdmVault11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : CreateNewVault Method (IEdmVault11)

bsArchiveServer
Name or IP number of the archive server computer; "" if the local comuter is the archive server
bsArchiveServerUserName
Name of the Windows user who logs in to the archive server
bsArchiveServerPassword
Password for the Windows user who logs in to the archive server
bsVaultName
Name of the vault to create
bsDescription
Description of the vault; appears in the vault properties window in the administration tool
bsArchiveRootFolder
Archive server vault folder; "" to use the default folder
bsSQLServer
Name or IP number of the SQL Server computer
bsSQLUserName
Name of the user who logs in to the SQL Server computer
bsSQLPassword
Password for the user who logs in to the SQL Server computer
bsSQLDatabaseName
Name of the SQL database for the new vault
lDateFmt
SQL Server date format code for the new vault (see Remarks)
bsAdminUserPassword
Password for the Admin user
lEdmCreateVaultFlag
Combination of EdmCreateVaultFlag bits
poCallback
Optional pointer to a class that implements IEdmCallback to obtain progress information
oExtra
(see Remarks)
Creates a new vault.

Syntax

Visual Basic
Sub CreateNewVault( _
   ByVal bsArchiveServer As System.String, _
   ByVal bsArchiveServerUserName As System.String, _
   ByVal bsArchiveServerPassword As System.String, _
   ByVal bsVaultName As System.String, _
   ByVal bsDescription As System.String, _
   ByVal bsArchiveRootFolder As System.String, _
   ByVal bsSQLServer As System.String, _
   ByVal bsSQLUserName As System.String, _
   ByVal bsSQLPassword As System.String, _
   ByVal bsSQLDatabaseName As System.String, _
   ByVal lDateFmt As System.Integer, _
   ByVal bsAdminUserPassword As System.String, _
   ByVal lEdmCreateVaultFlag As System.Integer, _
   ByVal poCallback As EdmCallback, _
   Optional ByVal oExtra As System.Object _
)
C#
void CreateNewVault(
   System.string bsArchiveServer,
   System.string bsArchiveServerUserName,
   System.string bsArchiveServerPassword,
   System.string bsVaultName,
   System.string bsDescription,
   System.string bsArchiveRootFolder,
   System.string bsSQLServer,
   System.string bsSQLUserName,
   System.string bsSQLPassword,
   System.string bsSQLDatabaseName,
   System.int lDateFmt,
   System.string bsAdminUserPassword,
   System.int lEdmCreateVaultFlag,
   EdmCallback poCallback,
   System.object oExtra
)
C++/CLI
void CreateNewVault(
&   System.String^ bsArchiveServer,
&   System.String^ bsArchiveServerUserName,
&   System.String^ bsArchiveServerPassword,
&   System.String^ bsVaultName,
&   System.String^ bsDescription,
&   System.String^ bsArchiveRootFolder,
&   System.String^ bsSQLServer,
&   System.String^ bsSQLUserName,
&   System.String^ bsSQLPassword,
&   System.String^ bsSQLDatabaseName,
&   System.int lDateFmt,
&   System.String^ bsAdminUserPassword,
&   System.int lEdmCreateVaultFlag,
&   EdmCallback^ poCallback,
&   System.Object^ oExtra
)

Parameters

bsArchiveServer
Name or IP number of the archive server computer; "" if the local comuter is the archive server
bsArchiveServerUserName
Name of the Windows user who logs in to the archive server
bsArchiveServerPassword
Password for the Windows user who logs in to the archive server
bsVaultName
Name of the vault to create
bsDescription
Description of the vault; appears in the vault properties window in the administration tool
bsArchiveRootFolder
Archive server vault folder; "" to use the default folder
bsSQLServer
Name or IP number of the SQL Server computer
bsSQLUserName
Name of the user who logs in to the SQL Server computer
bsSQLPassword
Password for the user who logs in to the SQL Server computer
bsSQLDatabaseName
Name of the SQL database for the new vault
lDateFmt
SQL Server date format code for the new vault (see Remarks)
bsAdminUserPassword
Password for the Admin user
lEdmCreateVaultFlag
Combination of EdmCreateVaultFlag bits
poCallback
Optional pointer to a class that implements IEdmCallback to obtain progress information
oExtra
(see Remarks)

Example

Create New Vault (VB.NET)
Create New Vault (C#)

Remarks

See the CAST/CONVERT documentation in the SQL Server online help to learn more about the date format codes for lDateFmt. The following table lists the valid values for lDateFmt:

Date Codes | Date Format
1 | 12/31/99
2 | 99.12.31
3 | 31/12/99
4 | 31.12.99
5 | 31-12-99
6 | 31 Dec 99
7 | Dec 31, 99
10 | 12-31-99
11 | 99/12/31
12 | 991231
102 | 1999.12.31
103 | 31/12/1999
104 | 31.12.1999
105 | 31-12-1999
106 | 31 Dec 1999
107 | Dec 31, 1999
110 | 12-31-1999
111 | 1999/12/31
112 | 19991231
120 | 1999-12-31

Specify oExtra with one of the following:

  • VT_BSTR containing either a CEX-file path to set up the vault with data from the export file or a valid vault configuration name like "Default", "Empty" or "SOLIDWORKS Quick Start"; for valid configuration names, see the Configure Vault step in the vault creation wizard of the administration tool
  • VT_EMPTY to use default configuration

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_VAULT_ALREADY_EXISTS: There is already a file vault with the specified name on the archive server.
  • E_EDM_INVALID_VAULT_NAME: The vault name contains invalid characters or is longer than 31 characters. See the SOLIDWORKS PDM Professional administrative help for restrictions on valid characters in vault names.
  • E_EDM_ARCHIVE_ROOT_FOLDER_DOES_NOT_EXIST: The root folder specified in bsArchiveRootFolder does not exist.
  • E_EDM_INVALID_DATABASE_NAME: The specified SQL database name is invalid. See the SOLIDWORKS PDM Professional administrative help or the Microsoft SQL Server help for restrictions regarding database names.
  • E_EDM_INSUFFICIENT_SQL_PERMISSION: The specified SQL user lacks permission to create a new database. (He or she must typically be a member of the sysadmin group.)
  • E_EDM_SQLSERVER_UNSUPPORTED_VERSION: The SQL server version is not supported. (SQL Server 2000 is not supported by SOLIDWORKS PDM Professional 2010.)
  • E_EDM_DATABASE_ALREADY_EXISTS: There is already an SQL database with the suggested name.
  • E_EDM_SQLSERVER_LOGIN_FAILED: The provided SQL credentials are not valid.
  • E_EDM_SQLSERVER_CANNOT_CONNECT: General failure connecting to the SQL-server machine. Maybe the name/IP contains a typo?
  • E_EDM_INVALID_DATE_FORMAT_CODE: The lDateFmt argument is invalid.

See Also

IEdmVault11 Interface
IEdmVault11 Members
IEdmVault11::CreateNewVaultView Method ()

Availability

SOLIDWORKS PDM Professional 2010


CreateNewVaultView Method (IEdmVault11)

CreateNewVaultView Method (IEdmVault11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : CreateNewVaultView Method (IEdmVault11)

bsArchiveServer
Name or IP number of the archive server computer; "" if the local comuter is the archive server
bsArchiveServerUserName
Name of the Windows user who logs in to the archive server
bsArchiveServerPassword
Password for the Windows user who logs in to the archive server
bsVaultName
Name of the vault for which to create a view
bsParentFolderPath
Full system path to the parent folder of the view; a subfolder with the same name as the vault is created in the parent folder
lEdmCreateVaultViewFlag
Combination of EdmCreateVaultViewFlag bits
Creates a local view of a file vault in File Explorer.

Syntax

Visual Basic
Sub CreateNewVaultView( _
   ByVal bsArchiveServer As System.String, _
   ByVal bsArchiveServerUserName As System.String, _
   ByVal bsArchiveServerPassword As System.String, _
   ByVal bsVaultName As System.String, _
   ByVal bsParentFolderPath As System.String, _
   ByVal lEdmCreateVaultViewFlag As System.Integer _
)
C#
void CreateNewVaultView(
   System.string bsArchiveServer,
   System.string bsArchiveServerUserName,
   System.string bsArchiveServerPassword,
   System.string bsVaultName,
   System.string bsParentFolderPath,
   System.int lEdmCreateVaultViewFlag
)
C++/CLI
void CreateNewVaultView(
&   System.String^ bsArchiveServer,
&   System.String^ bsArchiveServerUserName,
&   System.String^ bsArchiveServerPassword,
&   System.String^ bsVaultName,
&   System.String^ bsParentFolderPath,
&   System.int lEdmCreateVaultViewFlag
)

Parameters

bsArchiveServer
Name or IP number of the archive server computer; "" if the local comuter is the archive server
bsArchiveServerUserName
Name of the Windows user who logs in to the archive server
bsArchiveServerPassword
Password for the Windows user who logs in to the archive server
bsVaultName
Name of the vault for which to create a view
bsParentFolderPath
Full system path to the parent folder of the view; a subfolder with the same name as the vault is created in the parent folder
lEdmCreateVaultViewFlag
Combination of EdmCreateVaultViewFlag bits

Example

Create New Vault (VB.NET)
Create New Vault (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FOLDER_NOT_FOUND: The parent folder does not exist.
  • E_EDM_VERSION_MISMATCH: The client version and the archive server version do not match.
  • E_EDM_FVC_CANT_WRITE_TO_REGISTRY: Failed to write to the system registry. Possibly you are trying to create a shared view, and the logged-in Windows user lacks privileges to write to HKEY_LOCAL_MACHINE.

See Also

IEdmVault11 Interface
IEdmVault11 Members
IEdmVault11::CreateNewVault Method ()

Availability

SOLIDWORKS PDM Professional 2010


GetErrorMessage Method (IEdmVault11)

GetErrorMessage Method (IEdmVault11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : GetErrorMessage Method (IEdmVault11)

lHRESULT
Error code for which to get a description
Gets a description for the specified error code.

Syntax

Visual Basic
Function GetErrorMessage( _
   ByVal lHRESULT As System.Integer _
) As System.String
C#
System.string GetErrorMessage(
   System.int lHRESULT
)
C++/CLI
System.String^ GetErrorMessage(
&   System.int lHRESULT
)

Parameters

lHRESULT
Error code for which to get a description

Return Value

Description of the error code

Example

Add Items (C#)
Add Items (VB.NET)
Add Users (C#)
Add Users (VB.NET)

Remarks

This method returns a readable error message for HRESULT error codes. For example, if lHRESULT is 0x80040204, then this method returns "You have not logged in to the file vault."

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault11 Interface
IEdmVault11 Members
IEdmVault11::GetErrorName Method ()

Availability

SOLIDWORKS PDM Professional 2010


GetErrorName Method (IEdmVault11)

GetErrorName Method (IEdmVault11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : GetErrorName Method (IEdmVault11)

lHRESULT
Error code for which to get the internal name
Gets an internal error code name for the specified error code.

Syntax

Visual Basic
Function GetErrorName( _
   ByVal lHRESULT As System.Integer _
) As System.String
C#
System.string GetErrorName(
   System.int lHRESULT
)
C++/CLI
System.String^ GetErrorName(
&   System.int lHRESULT
)

Parameters

lHRESULT
Error code for which to get the internal name

Return Value

Internal error code name

Example

Get and Set Item References (C#)
Get and Set Item References (VB.NET)

Remarks

This method returns the internal error code name for an HRESULT error code. For example, if lHRESULT is 0x80040204, this method returns "E_EDM_NOT_LOGGED_IN".

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault11 Interface
IEdmVault11 Members
IEdmVault11::GetErrorMessage Method ()

Availability

SOLIDWORKS PDM Professional 2010


GetLicense Method (IEdmVault11)

GetLicense Method (IEdmVault11)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : GetLicense Method (IEdmVault11)

ppoRetLicense
Array of EdmLicense structures; one structure for each license that has one or more users (see Remarks)
Gets all of the SOLIDWORKS PDM Professional licenses installed in this vault.

Syntax

Visual Basic
Sub GetLicense( _
   ByRef ppoRetLicense() As EdmLicense _
)
C#
void GetLicense(
   out EdmLicense[] ppoRetLicense
)
C++/CLI
void GetLicense(
&   [Out] array<EdmLicense>^ ppoRetLicense
)

Parameters

ppoRetLicense
Array of EdmLicense structures; one structure for each license that has one or more users (see Remarks)

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

In SOLIDWORKS PDM Professional:

  • 2015 SP0 and later, licenses are shared among all vaults that use the same SolidNetwork License Server (SNL). See IEdmVault14::InstallLicense2.
  • 2014 and earlier, licenses were shared among all vaults that were in the same SQL Server instance.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


GetLoggedInWindowsUserID Method (IEdmVault11)

GetLoggedInWindowsUserID Method (IEdmVault11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : GetLoggedInWindowsUserID Method (IEdmVault11)

bsVault
Name of the vault for which to get the logged-in user
Gets the ID of the user who is currently logged in through the SOLIDWORKS PDM Professional client software on this machine.

Syntax

Visual Basic
Function GetLoggedInWindowsUserID( _
   ByVal bsVault As System.String _
) As System.Integer
C#
System.int GetLoggedInWindowsUserID(
   System.string bsVault
)
C++/CLI
System.int GetLoggedInWindowsUserID(
&   System.String^ bsVault
)

Parameters

bsVault
Name of the vault for which to get the logged-in user

Return Value

ID of the logged-in user; 0 if no one is logged in

Remarks

Any number of users can be logged into a vault at the same time by calling IEdmVault5::Login. However, only a single user can be logged into a machine either through the SOLIDWORKS PDM Professional client software or by calling IEdmVault5::LoginAuto. This is the user for whom this method returns an ID.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


LogInWindowsUser Method (IEdmVault11)

LogInWindowsUser Method (IEdmVault11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : LogInWindowsUser Method (IEdmVault11)

bsUserName
User name
bsPasswd
Password for bsUserName
bsVaultName
Name of vault to which to log in
Logs into SOLIDWORKS PDM Professional as the specified user.

Syntax

Visual Basic
Sub LogInWindowsUser( _
   ByVal bsUserName As System.String, _
   ByVal bsPasswd As System.String, _
   ByVal bsVaultName As System.String _
)
C#
void LogInWindowsUser(
   System.string bsUserName,
   System.string bsPasswd,
   System.string bsVaultName
)
C++/CLI
void LogInWindowsUser(
&   System.String^ bsUserName,
&   System.String^ bsPasswd,
&   System.String^ bsVaultName
)

Parameters

bsUserName
User name
bsPasswd
Password for bsUserName
bsVaultName
Name of vault to which to log in

Remarks

This method works like IEdmVault5::LoginAuto, except this method does not display a login dialog box.

Any number of users can log in through the API, as long as they use the IEdmVault5::Login method. However, only one user at a time can log in through the SOLIDWORKS PDM Professional client user interface. Both IEdmVault11::LoginAuto and IEdmVault11::LogInWindowsUser log in the single user of the client user interface.

Call IEdmVault11::GetLoggedInWindowsUserID to obtain the ID of the user who is currently logged in through the client user interface.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_LOGIN_FAILED: The specified user name or password is incorrect.
  • E_EDM_ALREADY_LOGGED_IN: Someone is already logged in from this client machine's user interface, or the IEdmVault object is already connected.

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmVault11 Interface Properties

IEdmVault11 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVault11 Interface

For a list of all members of this type, see IEdmVault11 members.

Public Properties

 | Name | Description
Property | ItemRootFolder | Gets the interface to the invisible root folder of all items and item folders.
Property | ItemRootFolderID | Gets the ID of the invisible root folder of all items and item folders.
Top

See Also

IEdmVault11 Interface
EPDM.Interop.epdm Namespace


ItemRootFolder Property (IEdmVault11)

ItemRootFolder Property (IEdmVault11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : ItemRootFolder Property (IEdmVault11)

Gets the interface to the invisible root folder of all items and item folders.

Syntax

Visual Basic
ReadOnly Property ItemRootFolder As IEdmFolder6
C#
IEdmFolder6 ItemRootFolder {get;}
C++/CLI
property IEdmFolder6^ ItemRootFolder {
   IEdmFolder6^ get();
}

Property Value

IEdmFolder6

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


ItemRootFolderID Property (IEdmVault11)

ItemRootFolderID Property (IEdmVault11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : ItemRootFolderID Property (IEdmVault11)

Gets the ID of the invisible root folder of all items and item folders.

Syntax

Visual Basic
ReadOnly Property ItemRootFolderID As System.Integer
C#
System.int ItemRootFolderID {get;}
C++/CLI
property System.int ItemRootFolderID {
   System.int get();
}

Property Value

ID of the root folder for all items and item folders

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmVault12 Interface

IEdmVault12 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault12 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault12
   Inherits IEdmVault10, IEdmVault11, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault12 : IEdmVault10, IEdmVault11, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault12 : public IEdmVault10, IEdmVault11, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Display Menu of Commands (VB.NET)

Remarks

This interface:

  • extends IEdmVault11 by providing the ability to import administrative export (*.CEX) or card (*.CRD) files into the vault.
  • is extended by IEdmVault13.

See Also

IEdmVault12 Members
EPDM.Interop.epdm Namespace


IEdmVault12 Interface Members

IEdmVault12 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault12 Interface

The following tables list the members exposed by IEdmVault12.

Public Methods

 | Name | Description
Method | CreatePluginMenu2 | Inserts into a menu with the specified handle all of the menu commands registered by the SOLIDWORKS PDM Professional add-ins.
Method | InstallFile | Installs administrative export files (*.CEX) and card files (*.CRD).
Top

See Also

IEdmVault12 Interface
EPDM.Interop.epdm Namespace


IEdmVault12 Interface Methods

IEdmVault12 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault12 Interface

For a list of all members of this type, see IEdmVault12 members.

Public Methods

 | Name | Description
Method | CreatePluginMenu2 | Inserts into a menu with the specified handle all of the menu commands registered by the SOLIDWORKS PDM Professional add-ins.
Method | InstallFile | Installs administrative export files (*.CEX) and card files (*.CRD).
Top

See Also

IEdmVault12 Interface
EPDM.Interop.epdm Namespace


CreatePluginMenu2 Method (IEdmVault12)

CreatePluginMenu2 Method (IEdmVault12)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault12 Interface : CreatePluginMenu2 Method (IEdmVault12)

hMenu
Handle of menu in which to insert command items
lInsertPosition
Zero-based index of position in menu where new items are inserted; -1 to append new menu items to the bottom of the menu
plStartID
Menu command ID to assign new commands when this method is called; next available menu command ID after this method returns
poSelObjects
IEdmSelectionList6; selected objects for which to display the menu
lCreateMenuFlags
Combination of CreateMenuFlags bits
plItemCount
Number of menu command items added
Inserts into a menu with the specified handle all of the menu commands registered by the SOLIDWORKS PDM Professional add-ins.

Syntax

Visual Basic
Function CreatePluginMenu2( _
   ByVal hMenu As System.Integer, _
   ByVal lInsertPosition As System.Integer, _
   ByRef plStartID As System.Integer, _
   ByVal poSelObjects As IEdmSelectionList6, _
   ByVal lCreateMenuFlags As System.Integer, _
   ByRef plItemCount As System.Integer _
) As IEdmMenu7
C#
IEdmMenu7 CreatePluginMenu2(
   System.int hMenu,
   System.int lInsertPosition,
   out System.int plStartID,
   IEdmSelectionList6 poSelObjects,
   System.int lCreateMenuFlags,
   out System.int plItemCount
)
C++/CLI
IEdmMenu7^ CreatePluginMenu2(
&   System.int hMenu,
&   System.int lInsertPosition,
&   [Out] System.int plStartID,
&   IEdmSelectionList6^ poSelObjects,
&   System.int lCreateMenuFlags,
&   [Out] System.int plItemCount
)

Parameters

hMenu
Handle of menu in which to insert command items
lInsertPosition
Zero-based index of position in menu where new items are inserted; -1 to append new menu items to the bottom of the menu
plStartID
Menu command ID to assign new commands when this method is called; next available menu command ID after this method returns
poSelObjects
IEdmSelectionList6; selected objects for which to display the menu
lCreateMenuFlags
Combination of CreateMenuFlags bits
plItemCount
Number of menu command items added

Return Value

IEdmMenu7 (see Remarks)

Example

Display Menu of Commands (VB.NET)

Remarks

This method supersedes IEdmVault5::CreatePluginMenu by adding the ability to insert a menu for object types other than files and folders (e.g., items).

Use the returned interface to call IEdmMenu7::OnMenuItem2 when the user selects one of the command items added by this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault12 Interface
IEdmVault12 Members

Availability

SOLIDWORKS PDM Professional 2011


InstallFile Method (IEdmVault12)

InstallFile Method (IEdmVault12)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault12 Interface : InstallFile Method (IEdmVault12)

bsPath
Path to the file to install
lEdmInstallFileFlags
Combination of EdmInstallFileFlags bits
oInstallArg
ID of folder where to install the file; valid only if bsPath contains the path to a card file
Installs administrative export files (*.CEX) and card files (*.CRD).

Syntax

Visual Basic
Sub InstallFile( _
   ByVal bsPath As System.String, _
   ByVal lEdmInstallFileFlags As System.Integer, _
   ByVal oInstallArg As System.Object _
)
C#
void InstallFile(
   System.string bsPath,
   System.int lEdmInstallFileFlags,
   System.object oInstallArg
)
C++/CLI
void InstallFile(
&   System.String^ bsPath,
&   System.int lEdmInstallFileFlags,
&   System.Object^ oInstallArg
)

Parameters

bsPath
Path to the file to install
lEdmInstallFileFlags
Combination of EdmInstallFileFlags bits
oInstallArg
ID of folder where to install the file; valid only if bsPath contains the path to a card file

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault12 Interface
IEdmVault12 Members

Availability

SOLIDWORKS PDM Professional 2011


IEdmVault13 Interface

IEdmVault13 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVault13 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault13
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault13 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault13 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Remarks

This interface:

  • extends IEdmVault12.
  • is extended by IEdmVault14.

See Also

IEdmVault13 Members
EPDM.Interop.epdm Namespace


IEdmVault13 Interface Members

IEdmVault13 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault13 Interface

The following tables list the members exposed by IEdmVault13.

Public Methods

Name Description
Method LoginEx

Allows an application that is not supplied and supported by SOLIDWORKS Corporation to:

  • log into SOLIDWORKS PDM Professional
    - or -
  • log into a vault view
    - or -
  • directly access the vault database

when the same user is not already logged into a local view.

Top

See Also

IEdmVault13 Interface
EPDM.Interop.epdm Namespace


IEdmVault13 Interface Methods

IEdmVault13 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault13 Interface

For a list of all members of this type, see IEdmVault13 members.

Public Methods

Name Description
Method LoginEx

Allows an application that is not supplied and supported by SOLIDWORKS Corporation to:

  • log into SOLIDWORKS PDM Professional
    - or -
  • log into a vault view
    - or -
  • directly access the vault database

when the same user is not already logged into a local view.

Top

See Also

IEdmVault13 Interface
EPDM.Interop.epdm Namespace


LoginEx Method (IEdmVault13)

LoginEx Method (IEdmVault13)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault13 Interface : LoginEx Method (IEdmVault13)

bsUserName
User name of user created in the SOLIDWORKS PDM Professional User Manager
bsPasswd
User password for bsUserName
bsVaultName
Name of vault
lEdmLoginFlags

Login flags:

  • 0 = Nothing
  • 1 = Web client

Allows an application that is not supplied and supported by SOLIDWORKS Corporation to:

  • log into SOLIDWORKS PDM Professional
    - or -
  • log into a vault view
    - or -
  • directly access the vault database

when the same user is not already logged into a local view.

Syntax

Visual Basic
Sub LoginEx( _
   ByVal bsUserName As System.String, _
   ByVal bsPasswd As System.String, _
   ByVal bsVaultName As System.String, _
   Optional ByVal lEdmLoginFlags As System.Integer _
)
C#
void LoginEx(
   System.string bsUserName,
   System.string bsPasswd,
   System.string bsVaultName,
   System.int lEdmLoginFlags
)
C++/CLI
void LoginEx(
&   System.String^ bsUserName,
&   System.String^ bsPasswd,
&   System.String^ bsVaultName,
&   System.int lEdmLoginFlags
)

Parameters

bsUserName
User name of user created in the SOLIDWORKS PDM Professional User Manager
bsPasswd
User password for bsUserName
bsVaultName
Name of vault
lEdmLoginFlags

Login flags:

  • 0 = Nothing
  • 1 = Web client

Remarks

To make it easier to program and to comply with the SOLIDWORKS End User License Agreement (EULA), this method ensures that licenses are properly consumed by your application.

See Also

IEdmVault13 Interface
IEdmVault13 Members
IEdmVault5::Login Method()
IEdmVault5::LoginAuto Method ()

Availability

SOLIDWORKS PDM Professional 2014


IEdmVault14 Interface

IEdmVault14 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVault14 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault14
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault14 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault14 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Remarks

This interface:

  • extends IEdmVault13.
  • is extended by IEdmVault15.

See Also

IEdmVault14 Members
EPDM.Interop.epdm Namespace


IEdmVault14 Interface Members

IEdmVault14 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault14 Interface

The following tables list the members exposed by IEdmVault14.

Public Methods

 | Name | Description
Method | InstallLicense2 | Installs a SOLIDWORKS PDM Professional license for this vault.
Top

See Also

IEdmVault14 Interface
EPDM.Interop.epdm Namespace


IEdmVault14 Interface Methods

IEdmVault14 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault14 Interface

For a list of all members of this type, see IEdmVault14 members.

Public Methods

 | Name | Description
Method | InstallLicense2 | Installs a SOLIDWORKS PDM Professional license for this vault.
Top

See Also

IEdmVault14 Interface
EPDM.Interop.epdm Namespace


InstallLicense2 Method (IEdmVault14)

InstallLicense2 Method (IEdmVault14)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault14 Interface : InstallLicense2 Method (IEdmVault14)

brUserName
Name of a SOLIDWORKS PDM Professional user
bsPasswd
Password for bsUserName
bsVaultName
Name of vault for which to install a license
bsSNLServers
Names of the port and server of the SolidNetwork License (SNL) server; for example, 25734@myserver
Installs a SOLIDWORKS PDM Professional license for this vault.

Syntax

Visual Basic
Sub InstallLicense2( _
   ByVal brUserName As System.String, _
   ByVal bsPasswd As System.String, _
   ByVal bsVaultName As System.String, _
   ByVal bsSNLServers As System.String _
)
C#
void InstallLicense2(
   System.string brUserName,
   System.string bsPasswd,
   System.string bsVaultName,
   System.string bsSNLServers
)
C++/CLI
void InstallLicense2(
&   System.String^ brUserName,
&   System.String^ bsPasswd,
&   System.String^ bsVaultName,
&   System.String^ bsSNLServers
)

Parameters

brUserName
Name of a SOLIDWORKS PDM Professional user
bsPasswd
Password for bsUserName
bsVaultName
Name of vault for which to install a license
bsSNLServers
Names of the port and server of the SolidNetwork License (SNL) server; for example, 25734@myserver

Remarks

In SOLIDWORKS PDM Professional:
  • 2015 SP0 and later, licenses are shared among all vaults that use the same SolidNetwork License Server (SNL).
  • 2014 and earlier, licenses were shared among all vaults that were in the same SQL Server instance.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault14 Interface
IEdmVault14 Members
IEdmVault11::GetLicense Method ()

Availability

SOLIDWORKS PDM Professional 2015


IEdmVault15 Interface

IEdmVault15 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault15 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault15
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault15 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault15 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Traverse Folders and Files in Vault (VB.NET)
Traverse Folders and Files in Vault (C#)

Remarks

This interface:

  • extends IEdmVault14 by providing the ability to get the current user's log.
  • is extended by IEdmVault16.

See Also

IEdmVault15 Members
EPDM.Interop.epdm Namespace


IEdmVault15 Interface Members

IEdmVault15 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault15 Interface

The following tables list the members exposed by IEdmVault15.

Public Methods

 | Name | Description
Method | GetClientLog | Gets the contents of the current user's log.
Top

See Also

IEdmVault15 Interface
EPDM.Interop.epdm Namespace


IEdmVault15 Interface Methods

IEdmVault15 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault15 Interface

For a list of all members of this type, see IEdmVault15 members.

Public Methods

 | Name | Description
Method | GetClientLog | Gets the contents of the current user's log.
Top

See Also

IEdmVault15 Interface
EPDM.Interop.epdm Namespace


GetClientLog Method (IEdmVault15)

GetClientLog Method (IEdmVault15)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault15 Interface : GetClientLog Method (IEdmVault15)

pbsRetLogs
Contents of the current user's log
Gets the contents of the current user's log.

Syntax

Visual Basic
Sub GetClientLog( _
   ByRef pbsRetLogs As System.String _
)
C#
void GetClientLog(
   out System.string pbsRetLogs
)
C++/CLI
void GetClientLog(
&   [Out] System.String^ pbsRetLogs
)

Parameters

pbsRetLogs
Contents of the current user's log

Example

Traverse Folders and Files in Vault (VB.NET)
Traverse Folders and Files in Vault (C#)

Remarks

The current user's log appears when you click SOLIDWORKS PDM Administration > Local Settings > Log File in the SOLIDWORKS PDM Administration Tool. This method returns the full log.

See Also

IEdmVault15 Interface
IEdmVault15 Members

Availability

SOLIDWORKS PDM Professional 2015 SP03


IEdmVault16 Interface

IEdmVault16 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault16 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault16
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault16 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault16 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Traverse Folders and Files in Vault (VB.NET)
Traverse Folders and Files in Vault (C#)

Remarks

This interface:

  • extends IEdmVault15 by providing the ability to get the type of vault.
  • is extended by IEdmVault17.

See Also

IEdmVault16 Members
EPDM.Interop.epdm Namespace


IEdmVault16 Interface Members

IEdmVault16 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault16 Interface

The following tables list the members exposed by IEdmVault16.

Public Methods

 | Name | Description
Method | GetVaultType | Gets the type of this vault.
Top

See Also

IEdmVault16 Interface
EPDM.Interop.epdm Namespace


IEdmVault16 Interface Methods

IEdmVault16 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault16 Interface

For a list of all members of this type, see IEdmVault16 members.

Public Methods

 | Name | Description
Method | GetVaultType | Gets the type of this vault.
Top

See Also

IEdmVault16 Interface
EPDM.Interop.epdm Namespace


GetVaultType Method (IEdmVault16)

GetVaultType Method (IEdmVault16)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault16 Interface : GetVaultType Method (IEdmVault16)

Gets the type of this vault.

Syntax

Visual Basic
Function GetVaultType() As EdmVaultType
C#
EdmVaultType GetVaultType()
C++/CLI
EdmVaultType GetVaultType();

Return Value

Type of client installation as defined in EdmVaultType

Example

Traverse Folders and Files in Vault (VB.NET)
Traverse Folders and Files in Vault (C#)

See Also

IEdmVault16 Interface
IEdmVault16 Members

Availability

SOLIDWORKS PDM Professional 2016


IEdmVault17 Interface

IEdmVault17 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVault17 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault17
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault17 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault17 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Remarks

This interface:

  • extends IEdmVault16 by providing the ability to specify whether to ignore a secondary database that is configured for the logged-in user.
  • is extended by IEdmVault18.

See Also

IEdmVault17 Members
EPDM.Interop.epdm Namespace


IEdmVault17 Interface Members

IEdmVault17 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault17 Interface

The following tables list the members exposed by IEdmVault17.

Public Methods

 | Name | Description
Method | IgnoreSecondaryDatabaseConnection | Sets whether to ignore a secondary database that is configured for the logged-in user.
Top

See Also

IEdmVault17 Interface
EPDM.Interop.epdm Namespace


IEdmVault17 Interface Methods

IEdmVault17 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault17 Interface

For a list of all members of this type, see IEdmVault17 members.

Public Methods

 | Name | Description
Method | IgnoreSecondaryDatabaseConnection | Sets whether to ignore a secondary database that is configured for the logged-in user.
Top

See Also

IEdmVault17 Interface
EPDM.Interop.epdm Namespace


IgnoreSecondaryDatabaseConnection Method (IEdmVault17)

IgnoreSecondaryDatabaseConnection Method (IEdmVault17)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault17 Interface : IgnoreSecondaryDatabaseConnection Method (IEdmVault17)

vbIgnore
True to ignore a secondary database, false to use a secondary database
Sets whether to ignore a secondary database that is configured for the logged-in user.

Syntax

Visual Basic
Sub IgnoreSecondaryDatabaseConnection( _
   ByVal vbIgnore As System.Boolean _
)
C#
void IgnoreSecondaryDatabaseConnection(
   System.bool vbIgnore
)
C++/CLI
void IgnoreSecondaryDatabaseConnection(
&   System.bool vbIgnore
)

Parameters

vbIgnore
True to ignore a secondary database, false to use a secondary database

See Also

IEdmVault17 Interface
IEdmVault17 Members

Availability

SOLIDWORKS PDM Professional 2017


IEdmVault18 Interface

IEdmVault18 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVault18 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault18
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault18 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault18 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Remarks

This interface:

  • extends IEdmVault17 by supporting minor version client/server mismatches.
  • is extended by IEdmVault19.

See Also

IEdmVault18 Members
EPDM.Interop.epdm Namespace


IEdmVault18 Interface Members

IEdmVault18 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmVault18 Interface

The following tables list the members exposed by IEdmVault18.

Public Properties

 | Name | Description
Property | MinimumSupportedClientSP | Gets the minimum client service pack supported by this vault's views.
Top

See Also

IEdmVault18 Interface
EPDM.Interop.epdm Namespace


IEdmVault18 Interface Properties

IEdmVault18 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVault18 Interface

For a list of all members of this type, see IEdmVault18 members.

Public Properties

 | Name | Description
Property | MinimumSupportedClientSP | Gets the minimum client service pack supported by this vault's views.
Top

See Also

IEdmVault18 Interface
EPDM.Interop.epdm Namespace


MinimumSupportedClientSP Property (IEdmVault18)

MinimumSupportedClientSP Property (IEdmVault18)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault18 Interface : MinimumSupportedClientSP Property (IEdmVault18)

Gets the minimum client service pack supported by this vault's views.

Syntax

Visual Basic
ReadOnly Property MinimumSupportedClientSP As System.Integer
C#
System.int MinimumSupportedClientSP {get;}
C++/CLI
property System.int MinimumSupportedClientSP {
   System.int get();
}

Property Value

Minimum supported client service pack (e.g., 0, 1, 2, 3, 4, 5)

Remarks

As of SOLIDWORKS PDM Professional 2017 SP01, client/server minor version mismatches are supported. For example, if this method returns "0", then for the current major version (e.g., 2017), an SP0 client machine works with vault views created with other service packs.

See Also

IEdmVault18 Interface
IEdmVault18 Members

Availability

SOLIDWORKS PDM Professional 2017 SP01


IEdmVault19 Interface

IEdmVault19 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault19 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault19
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault19 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault19 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Copy Assembly Tree of Files (VB.NET)
Copy Assembly Tree of Files (C#)

Remarks

This interface:

  • extends IEdmVault18 by providing the ability to:
    • Call the Set Revision command to update a revision table in a SOLIDWORKS drawing in this vault.
    • Copy an assembly tree of referenced parts and drawings to a destination folder.
  • is extended by IEdmVault20.

See Also

IEdmVault19 Members
EPDM.Interop.epdm Namespace


IEdmVault19 Interface Members

IEdmVault19 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault19 Interface

The following tables list the members exposed by IEdmVault19.

Public Methods

 | Name | Description
Method | CopyTree | Copies the specified assembly and its referenced parts and drawings to the specified destination folder.
Method | GetRevisionTableSettings | Gets the settings for revision tables of drawings in this vault.
Method | UpdateRevTableWithSetRevCmd | Gets whether to update revision tables of drawings in this vault.
Top

See Also

IEdmVault19 Interface
EPDM.Interop.epdm Namespace


IEdmVault19 Interface Methods

IEdmVault19 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault19 Interface

For a list of all members of this type, see IEdmVault19 members.

Public Methods

 | Name | Description
Method | CopyTree | Copies the specified assembly and its referenced parts and drawings to the specified destination folder.
Method | GetRevisionTableSettings | Gets the settings for revision tables of drawings in this vault.
Method | UpdateRevTableWithSetRevCmd | Gets whether to update revision tables of drawings in this vault.
Top

See Also

IEdmVault19 Interface
EPDM.Interop.epdm Namespace


CopyTree Method (IEdmVault19)

CopyTree Method (IEdmVault19)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault19 Interface : CopyTree Method (IEdmVault19)

lSrcFileID
ID of the assembly to copy
lSrcFileProjID
ID of the parent folder of lSrcFileID; only valid if lSrcFileID is not 0 or blank
lDestinationFolderPath
Full path name of destination folder
vbShowDlg
True to display the copy dialog, false to not
vbShowProgressBar
True to display a progress bar during the copy procedure, false to not
oCopyTreeOptions
Copy tree options as defined in EdmCopyTreeOptions
lHwnd
Parent window handle
Copies the specified assembly and its referenced parts and drawings to the specified destination folder.

Syntax

Visual Basic
Sub CopyTree( _
   ByVal lSrcFileID As System.Integer, _
   ByVal lSrcFileProjID As System.Integer, _
   ByVal lDestinationFolderPath As System.String, _
   ByVal vbShowDlg As System.Boolean, _
   ByVal vbShowProgressBar As System.Boolean, _
   ByVal oCopyTreeOptions As EdmCopyTreeOptions, _
   ByVal lHwnd As System.Integer _
)
C#
void CopyTree(
   System.int lSrcFileID,
   System.int lSrcFileProjID,
   System.string lDestinationFolderPath,
   System.bool vbShowDlg,
   System.bool vbShowProgressBar,
   EdmCopyTreeOptions oCopyTreeOptions,
   System.int lHwnd
)
C++/CLI
void CopyTree(
&   System.int lSrcFileID,
&   System.int lSrcFileProjID,
&   System.String^ lDestinationFolderPath,
&   System.bool vbShowDlg,
&   System.bool vbShowProgressBar,
&   EdmCopyTreeOptions oCopyTreeOptions,
&   System.int lHwnd
)

Parameters

lSrcFileID
ID of the assembly to copy
lSrcFileProjID
ID of the parent folder of lSrcFileID; only valid if lSrcFileID is not 0 or blank
lDestinationFolderPath
Full path name of destination folder
vbShowDlg
True to display the copy dialog, false to not
vbShowProgressBar
True to display a progress bar during the copy procedure, false to not
oCopyTreeOptions
Copy tree options as defined in EdmCopyTreeOptions
lHwnd
Parent window handle

Example

See the IEdmVault19 examples.

See Also

IEdmVault19 Interface
IEdmVault19 Members

Availability

SOLIDWORKS PDM Professional 2018


GetRevisionTableSettings Method (IEdmVault19)

GetRevisionTableSettings Method (IEdmVault19)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault19 Interface : GetRevisionTableSettings Method (IEdmVault19)

vbManagedInPDM
True if the revision table is managed by PDM Professional, false if managed by SOLIDWORKS
plNoOfRows
Number of visible rows in the revision table
vbRevTableOrder
True if the revision table order is ascending, false if descending
pbsRevPlaceholder
Revision table placeholder character
Gets the settings for revision tables of drawings in this vault.

Syntax

Visual Basic
Sub GetRevisionTableSettings( _
   ByRef vbManagedInPDM As System.Boolean, _
   ByRef plNoOfRows As System.Integer, _
   ByRef vbRevTableOrder As System.Boolean, _
   ByRef pbsRevPlaceholder As System.String _
)
C#
void GetRevisionTableSettings(
   out System.bool vbManagedInPDM,
   out System.int plNoOfRows,
   out System.bool vbRevTableOrder,
   out System.string pbsRevPlaceholder
)
C++/CLI
void GetRevisionTableSettings(
&   [Out] System.bool vbManagedInPDM,
&   [Out] System.int plNoOfRows,
&   [Out] System.bool vbRevTableOrder,
&   [Out] System.String^ pbsRevPlaceholder
)

Parameters

vbManagedInPDM
True if the revision table is managed by PDM Professional, false if managed by SOLIDWORKS
plNoOfRows
Number of visible rows in the revision table
vbRevTableOrder
True if the revision table order is ascending, false if descending
pbsRevPlaceholder
Revision table placeholder character

See Also

IEdmVault19 Interface
IEdmVault19 Members

Availability

SOLIDWORKS PDM Professional 2018


UpdateRevTableWithSetRevCmd Method (IEdmVault19)

UpdateRevTableWithSetRevCmd Method (IEdmVault19)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault19 Interface : UpdateRevTableWithSetRevCmd Method (IEdmVault19)

vbFlag
True to update revision tables of drawings, false to not
Gets whether to update revision tables of drawings in this vault.

Syntax

Visual Basic
Sub UpdateRevTableWithSetRevCmd( _
   ByRef vbFlag As System.Boolean _
)
C#
void UpdateRevTableWithSetRevCmd(
   out System.bool vbFlag
)
C++/CLI
void UpdateRevTableWithSetRevCmd(
&   [Out] System.bool vbFlag
)

Parameters

vbFlag
True to update revision tables of drawings, false to not

See Also

IEdmVault19 Interface
IEdmVault19 Members

Availability

SOLIDWORKS PDM Professional 2018


IEdmVault20 Interface

IEdmVault20 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault20 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault20
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault20 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault20 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Get a File's State Transitions (VB.NET)
Get a File's State Transitions (C#)

Remarks

This interface:

  • extends IEdmVault19 by providing the ability to get whether a specified user must add a comment when making specified workflow transitions for specified documents.
  • is extended by IEdmVault21.

See Also

IEdmVault20 Members
EPDM.Interop.epdm Namespace


IEdmVault20 Interface Members

IEdmVault20 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault20 Interface

The following tables list the members exposed by IEdmVault20.

Public Methods

 | Name | Description
Method | GetArchiveServerLog | Gets the archive server's log.
Method | GetFiles | Gets the specified files in this vault.
Method | GetTransitionCommentPermissions | Gets whether the specified user must add a state change comment for the specified workflow transitions for the specified documents.
Top

See Also

IEdmVault20 Interface
EPDM.Interop.epdm Namespace


IEdmVault20 Interface Methods

IEdmVault20 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault20 Interface

For a list of all members of this type, see IEdmVault20 members.

Public Methods

 | Name | Description
Method | GetArchiveServerLog | Gets the archive server's log.
Method | GetFiles | Gets the specified files in this vault.
Method | GetTransitionCommentPermissions | Gets whether the specified user must add a state change comment for the specified workflow transitions for the specified documents.
Top

See Also

IEdmVault20 Interface
EPDM.Interop.epdm Namespace


GetArchiveServerLog Method (IEdmVault20)

GetArchiveServerLog Method (IEdmVault20)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault20 Interface : GetArchiveServerLog Method (IEdmVault20)

pbsRetLogs
Text in the archive server's log
Gets the archive server's log.

Syntax

Visual Basic
Sub GetArchiveServerLog( _
   ByRef pbsRetLogs As System.String _
)
C#
void GetArchiveServerLog(
   out System.string pbsRetLogs
)
C++/CLI
void GetArchiveServerLog(
&   [Out] System.String^ pbsRetLogs
)

Parameters

pbsRetLogs
Text in the archive server's log

Example

See the IEdmVault20 examples.

See Also

IEdmVault20 Interface
IEdmVault20 Members

Availability

SOLIDWORKS PDM Professional 2019


GetFiles Method (IEdmVault20)

GetFiles Method (IEdmVault20)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault20 Interface : GetFiles Method (IEdmVault20)

poDocsIDs
Array of EdmDocIDs
Gets the specified files in this vault.

Syntax

Visual Basic
Function GetFiles( _
   ByVal poDocsIDs() As EdmDocIDs _
) As System.Object()
C#
System.object[] GetFiles(
   EdmDocIDs[] poDocsIDs
)
C++/CLI
System.array<Object^>^ GetFiles(
&   array<EdmDocIDs>^ poDocsIDs
)

Parameters

poDocsIDs
Array of EdmDocIDs

Return Value

Array of IEdmFile5s

See Also

IEdmVault20 Interface
IEdmVault20 Members

Availability

SOLIDWORKS PDM Professional 2019


GetTransitionCommentPermissions Method (IEdmVault20)

GetTransitionCommentPermissions Method (IEdmVault20)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault20 Interface : GetTransitionCommentPermissions Method (IEdmVault20)

lUserID
User ID (see Remarks)
poDocIds
Array of document IDs (see Remarks)
poTransNames
Array of workfow transition names (see Remarks)
Gets whether the specified user must add a state change comment for the specified workflow transitions for the specified documents.

Syntax

Visual Basic
Function GetTransitionCommentPermissions( _
   ByVal lUserID As System.Integer, _
   ByVal poDocIds() As System.Integer, _
   ByVal poTransNames() As System.String _
) As System.Boolean()
C#
System.bool[] GetTransitionCommentPermissions(
   System.int lUserID,
   System.int[] poDocIds,
   System.string[] poTransNames
)
C++/CLI
System.array<bool>^ GetTransitionCommentPermissions(
&   System.int lUserID,
&   System.array<int>^ poDocIds,
&   System.array<String^>^ poTransNames
)

Parameters

lUserID
User ID (see Remarks)
poDocIds
Array of document IDs (see Remarks)
poTransNames
Array of workfow transition names (see Remarks)

Return Value

Array of booleans (see Remarks)

Example

See the IEdmVault20 examples.

Remarks

The returned one-dimensional array contains (n * m) booleans indicating whether lUserID must add a state change comment on each workflow transition in poTransNames for each document in poDocIds.

For:

  • n = size of poDocIds
  • m = size of poTransNames
  • permbool_* = true or false

the returned array follows the order of elements in poDocIds and poTransNames as follows:

{

permbool_poDocIds(0)_poTransNames(0)

...

permbool_poDocIds(0)_poTransNames(m-1)

permbool_poDocIds(1)_poTransNames(0)

...

permbool_poDocIds(1)_poTransNames(m-1)

...

...

permbool_poDocIds(n-1)_poTransNames(0)

...

permbool_poDocIds(n-1)_poTransNames(m-1)

}

See Also

IEdmVault20 Interface
IEdmVault20 Members

Availability

SOLIDWORKS PDM Professional 2019


IEdmVault21 Interface

IEdmVault21 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault21 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault21
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault20, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault21 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault20, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault21 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault20, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Using Basic Search Syntax (VB.NET)
Using Basic Search Syntax (C#)

Remarks

This interface:

  • extends IEdmVault20 by providing enhanced search functionality that includes multi-variable conditions, logical operators, and regular expressions.
  • is extended by IEdmVault22.

See Also

IEdmVault21 Members
EPDM.Interop.epdm Namespace


IEdmVault21 Interface Members

IEdmVault21 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault21 Interface

The following tables list the members exposed by IEdmVault21.

Public Methods

 | Name | Description
Method | CreateSearch2 | Creates an interface to a search object.
Top

See Also

IEdmVault21 Interface
EPDM.Interop.epdm Namespace


IEdmVault21 Interface Methods

IEdmVault21 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault21 Interface

For a list of all members of this type, see IEdmVault21 members.

Public Methods

 | Name | Description
Method | CreateSearch2 | Creates an interface to a search object.
Top

See Also

IEdmVault21 Interface
EPDM.Interop.epdm Namespace


CreateSearch2 Method (IEdmVault21)

CreateSearch2 Method (IEdmVault21)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault21 Interface : CreateSearch2 Method (IEdmVault21)

Creates an interface to a search object.

Syntax

Visual Basic
Function CreateSearch2() As IEdmSearch5
C#
IEdmSearch5 CreateSearch2()
C++/CLI
IEdmSearch5^ CreateSearch2();

Return Value

IEdmSearch5

Example

See the IEdmVault21 examples.

Remarks

This method creates a search object that allows you to search files and folders using multi-variable conditions, logical operators, and special search syntax. Once this search object is instantiated, special search syntax is allowed in all IEdmSearch* properties and method parameters. (See Search Syntax.)

To perform a search:

  1. Cast the returned IEdmSearch5 to IEdmSearch9.

  2. Add a single variable search condition using IEdmSearch8::AddVariable2. The new search allows you to specify the poValue parameter using special search syntax and eliminates the need to specify the lEdmVarOp parameter.

  3. Add a multi-variable search condition using IEdmSearch9::AddMultiVariableCondition. Special search syntax applies.

  4. Use the special search syntax in IEdmSearch5::FileName, IEdmSearch5::VersionComment, IEdmSearch5::State, and IEdmSearch6::SetToken.

  5. Call IEdmSearch5::GetFirstResult. If no results are returned, either nothing was found or there were search syntax errors.

  6. If step 5 returns no results, then see if there are search syntax errors by calling IEdmSearch9::GetSyntaxErrors. (Note: no syntax errors are reported unless advanced specifiers were placed before each search syntax.)

  7. If step 5 returns results, call IEdmSearch5::GetNextResult repeatedly to get further results.

C++ users must release the returned pointer, IEdmSearch5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault21 Interface
IEdmVault21 Members

Availability

SOLIDWORKS PDM Professional 2020


IEdmVault22 Interface

IEdmVault22 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault22 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault22
   Inherits IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault20, IEdmVault21, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C#
public interface IEdmVault22 : IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault20, IEdmVault21, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9
C++/CLI
public interface class IEdmVault22 : public IEdmVault10, IEdmVault11, IEdmVault12, IEdmVault13, IEdmVault14, IEdmVault15, IEdmVault16, IEdmVault17, IEdmVault18, IEdmVault19, IEdmVault20, IEdmVault21, IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8, IEdmVault9

Example

Assign Columnset to Folder before Browsing Add-in (VB.NET)

Remarks

This interface extends IEdmVault21 by providing the ability to clear the Archive Server Get logs, synchronize the vault's archive servers with the active directory, get all column sets assigned to the logged-in user, get the current column set for the logged-in user, and set a column set ID in the user's registry.

With IEdmVault22, add-ins can assign customized column sets to vault folders before they are browsed by:

  1. Triggering a pre-browse-folder event (EdmCmdType.EdmCmd_PreBrowseFolder) when the logged-in user browses a folder.
  2. Handling the event by:
    1. Getting all the column set IDs assigned to the logged-in user.
    2. Specifying a column set ID for the folder to be browsed.
  3. Triggering and handling a post-browse-folder event (EdmCmdType.EdmCmd_PostBrowseFolder).

For more information about customized column sets, see the SOLIDWORKS PDM Help > SOLIDWORKS PDM Administration Tool > Columns topics.

See Also

IEdmVault22 Members
EPDM.Interop.epdm Namespace


IEdmVault22 Interface Members

IEdmVault22 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault22 Interface

The following tables list the members exposed by IEdmVault22.

Public Methods

 | Name | Description
Method | ADRunSync | Synchronizes the vault's archive servers with the Active Directory.
Method | ClearLogs | Deletes the Archive Server Get logs.
Method | GetColumnSets | Gets the column sets assigned to the currently logged-in user of this vault.
Method | GetCurrentColumnSet | Gets the current column set for the currently logged-in user of this vault.
Method | SetColumnSetID | Sets the specified column set ID in the user's registry.
Top

See Also

IEdmVault22 Interface
EPDM.Interop.epdm Namespace


IEdmVault22 Interface Methods

IEdmVault22 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault22 Interface

For a list of all members of this type, see IEdmVault22 members.

Public Methods

 | Name | Description
Method | ADRunSync | Synchronizes the vault's archive servers with the Active Directory.
Method | ClearLogs | Deletes the Archive Server Get logs.
Method | GetColumnSets | Gets the column sets assigned to the currently logged-in user of this vault.
Method | GetCurrentColumnSet | Gets the current column set for the currently logged-in user of this vault.
Method | SetColumnSetID | Sets the specified column set ID in the user's registry.
Top

See Also

IEdmVault22 Interface
EPDM.Interop.epdm Namespace


ADRunSync Method (IEdmVault22)

ADRunSync Method (IEdmVault22)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault22 Interface : ADRunSync Method (IEdmVault22)

bsArchiveName
Archive Server name
Synchronizes the vault's archive servers with the Active Directory.

Syntax

Visual Basic
Sub ADRunSync( _
   Optional ByVal bsArchiveName As System.String _
)
C#
void ADRunSync(
   System.string bsArchiveName
)
C++/CLI
void ADRunSync(
&   System.String^ bsArchiveName
)

Parameters

bsArchiveName
Archive Server name

See Also

IEdmVault22 Interface
IEdmVault22 Members

Availability

SOLIDWORKS PDM Professional 2024


ClearLogs Method (IEdmVault22)

ClearLogs Method (IEdmVault22)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault22 Interface : ClearLogs Method (IEdmVault22)

Deletes the Archive Server Get logs.

Syntax

Visual Basic
Sub ClearLogs()
C#
void ClearLogs()
C++/CLI
void ClearLogs();

Remarks

This method is valid only when the user has EdmSysPerm.EdmSysRight_MaySeeAdminTool permission.

See Also

IEdmVault22 Interface
IEdmVault22 Members

Availability

SOLIDWORKS PDM Professional 2024


GetColumnSets Method (IEdmVault22)

GetColumnSets Method (IEdmVault22)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault22 Interface : GetColumnSets Method (IEdmVault22)

ppoCurrentColumns
Array of EdmColumnSets
Gets the column sets assigned to the currently logged-in user of this vault.

Syntax

Visual Basic
Sub GetColumnSets( _
   ByRef ppoCurrentColumns() As EdmColumnSet _
)
C#
void GetColumnSets(
   out EdmColumnSet[] ppoCurrentColumns
)
C++/CLI
void GetColumnSets(
&   [Out] array<EdmColumnSet>^ ppoCurrentColumns
)

Parameters

ppoCurrentColumns
Array of EdmColumnSets

Example

See the IEdmVault22 example.

See Also

IEdmVault22 Interface
IEdmVault22 Members
IEdmVault22::SetColumnSetID Method ()
IEdmVault22::GetCurrentColumnSet Method ()

Availability

SOLIDWORKS PDM Professional 2024


GetCurrentColumnSet Method (IEdmVault22)

GetCurrentColumnSet Method (IEdmVault22)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault22 Interface : GetCurrentColumnSet Method (IEdmVault22)

poCurrentColumn
EdmColumnSet
Gets the current column set for the currently logged-in user of this vault.

Syntax

Visual Basic
Sub GetCurrentColumnSet( _
   ByRef poCurrentColumn As EdmColumnSet _
)
C#
void GetCurrentColumnSet(
   out EdmColumnSet poCurrentColumn
)
C++/CLI
void GetCurrentColumnSet(
&   [Out] EdmColumnSet poCurrentColumn
)

Parameters

poCurrentColumn
EdmColumnSet

Example

See the IEdmVault22 example

See Also

IEdmVault22 Interface
IEdmVault22 Members
IEdmVault22::GetColumnSets Method ()
IEdmVault22::SetColumnSetID Method ()

Availability

SOLIDWORKS PDM Professional 2024


SetColumnSetID Method (IEdmVault22)

SetColumnSetID Method (IEdmVault22)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault22 Interface : SetColumnSetID Method (IEdmVault22)

mlColumnSetID
ID of column set to register
Sets the specified column set ID in the user's registry.

Syntax

Visual Basic
Sub SetColumnSetID( _
   ByVal mlColumnSetID As System.Integer _
)
C#
void SetColumnSetID(
   System.int mlColumnSetID
)
C++/CLI
void SetColumnSetID(
&   System.int mlColumnSetID
)

Parameters

mlColumnSetID
ID of column set to register

Example

See the IEdmVault22 example

Remarks

Before calling this method, use IEdmVault22::GetColumnSets to obtain all valid column set IDs for the currently logged-in user of this vault.

This method stores the column set ID at the following location in the registry:

User_Computer\HKEY_CURRENT_USER\SOFTWARE\SolidWorks\Applications\PDMWorks Enterprise\CTDMListView\ColumnSet\vault_name\user_name

After calling this method, call IEdmVault22::GetCurrentColumnSet to verify the current column set was changed.

See Also

IEdmVault22 Interface
IEdmVault22 Members

Availability

SOLIDWORKS PDM Professional 2024


IEdmVault5 Interface

IEdmVault5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault5 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault5
C#
public interface IEdmVault5
C++/CLI
public interface class IEdmVault5

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)
Get and Set Folder Permissions (C#)
Get and Set Folder Permissions (VB.NET)
Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface represents a SOLIDWORKS PDM Professional file vault. It is the highest-level interface within this API; most of the other interfaces in this API are retrieved from this interface either directly or indirectly.

Standalone programs using this API should first declare and create an instance of this interface. Because interfaces are abstract definitions and not implementations, they cannot be created directly using the New keyword.

The type library includes a creatable class called EdmVault5, which implements the IEdmVault5 interface.

You can create an instance of the EdmVault5 class with the New keyword, and because this class implements the IEdmVault5 interface, you can reference it with the variable declared as IEdmVault5 interface type. By convention, interface names begin with an uppercase letter I. Once the IEdmVault5 interface object is created, most of the other interface objects within this API are returned either directly or indirectly by methods and properties of the IEdmVault5 object or some other object that originated from it. Add-in programs are passed an IEdmVault5 object when the add-in is loaded and when needed.

To access this interface, stand-alone programs can:

  • Obtain an instance through one of the accessors.
  • Create an instance:
Dim vault as EdmVault5
vault = new EdmVault5

After obtaining an instance, programs must call IEdmVault5::Login or IEdmVault5::LoginAuto to establish a connection with the file vault.

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmVault6.

Accessors

IEdmAddIn5::GetAddInInfo

IEdmFile5::Vault

IEdmFolder5::Vault

IEdmObject5::Vault

See Also

IEdmVault5 Members
EPDM.Interop.epdm Namespace


IEdmVault5 Interface Members

IEdmVault5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmVault5 Interface

The following tables list the members exposed by IEdmVault5.

Public Properties

 | Name | Description
Property | CommandID | Gets the command ID count.
Property | IsLoggedIn | Gets whether you are logged in to this vault.
Property | Language | Gets the language used by the SOLIDWORKS PDM Professional client.
Property | Name | Gets the name of this vault.
Property | RootFolder | Gets the root folder of this vault.
Property | RootFolderID | Gets the database ID of the root folder of this vault.
Property | RootFolderPath | Gets the file system path to the root folder of this vault.
Property | SilentMode | Gets whether the add-in is running in silent mode.
Top

Public Methods

 | Name | Description
Method | BrowseForFile | Displays an Open or Save As dialog box in which the user can click one or more files.
Method | BrowseForFolder | Obsolete. Superseded by IEdmVault11::BrowseForFolder2 .
Method | CreatePluginMenu | Obsolete. Superseded by IEdmVault12::CreatePluginMenu2 .
Method | CreateSearch | Obsolete. Superseded by IEdmVault21::CreateSearch2 .
Method | GetDictionary | Gets or creates the specified dictionary.
Method | GetErrorString | Gets the name and description for the specified error code returned by one of SOLIDWORKS PDM Professional's API methods.
Method | GetFileFromPath | Gets an interface to the file with the specified file system path.
Method | GetFolderFromPath | Gets an interface to a folder on the specified file system path.
Method | GetObject | Gets an interface to a SOLIDWORKS PDM Professional object of the specified type and having the specified ID.
Method | GetVaultNameFromPath | Gets the name of the vault where the specified file or folder resides.
Method | GetVersion | Gets the version of SOLIDWORKS PDM Professional that is installed on this machine.
Method | Login | Logs in to the specified vault using the specified user name and password.
Method | LoginAuto | Logs in to the specified vault.
Method | MsgBox | Displays a message box to the user.
Method | RefreshFolder | Refreshes the file listing in the specified folder.
Method | SetAddInWnd | Obsolete. See Keeping Add-in Windows in the Foreground .
Method | VerifyVersion | Verifies that the installed SOLIDWORKS PDM Professional is at the specified version level or higher.
Top

See Also

IEdmVault5 Interface
EPDM.Interop.epdm Namespace


IEdmVault5 Interface Methods

IEdmVault5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault5 Interface

For a list of all members of this type, see IEdmVault5 members.

Public Methods

 | Name | Description
Method | BrowseForFile | Displays an Open or Save As dialog box in which the user can click one or more files.
Method | BrowseForFolder | Obsolete. Superseded by IEdmVault11::BrowseForFolder2 .
Method | CreatePluginMenu | Obsolete. Superseded by IEdmVault12::CreatePluginMenu2 .
Method | CreateSearch | Obsolete. Superseded by IEdmVault21::CreateSearch2 .
Method | GetDictionary | Gets or creates the specified dictionary.
Method | GetErrorString | Gets the name and description for the specified error code returned by one of SOLIDWORKS PDM Professional's API methods.
Method | GetFileFromPath | Gets an interface to the file with the specified file system path.
Method | GetFolderFromPath | Gets an interface to a folder on the specified file system path.
Method | GetObject | Gets an interface to a SOLIDWORKS PDM Professional object of the specified type and having the specified ID.
Method | GetVaultNameFromPath | Gets the name of the vault where the specified file or folder resides.
Method | GetVersion | Gets the version of SOLIDWORKS PDM Professional that is installed on this machine.
Method | Login | Logs in to the specified vault using the specified user name and password.
Method | LoginAuto | Logs in to the specified vault.
Method | MsgBox | Displays a message box to the user.
Method | RefreshFolder | Refreshes the file listing in the specified folder.
Method | SetAddInWnd | Obsolete. See Keeping Add-in Windows in the Foreground .
Method | VerifyVersion | Verifies that the installed SOLIDWORKS PDM Professional is at the specified version level or higher.
Top

See Also

IEdmVault5 Interface
EPDM.Interop.epdm Namespace


BrowseForFile Method (IEdmVault5)

BrowseForFile Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : BrowseForFile Method (IEdmVault5)

hParentWnd
Parent window handle
lEdmBrowseFlags
Optional combination of EdmBrowseFlag bits
bsFilter
Optional filter string that limits the types of files displayed in the dialog box (see Remarks)
bsDefaultExtension
Optional default file extension to append if the user does not specify an extension
bsDefaultFileName
Optional default file name to display in the file name field of the dialog box
bsDefaultFolder
Optional path to the folder on which the dialog box should initially open
bsCaption
Optional caption for the dialog box
Displays an Open or Save As dialog box in which the user can click one or more files.

Syntax

Visual Basic
Function BrowseForFile( _
   ByVal hParentWnd As System.Integer, _
   Optional ByVal lEdmBrowseFlags As System.Integer, _
   Optional ByVal bsFilter As System.String, _
   Optional ByVal bsDefaultExtension As System.String, _
   Optional ByVal bsDefaultFileName As System.String, _
   Optional ByVal bsDefaultFolder As System.String, _
   Optional ByVal bsCaption As System.String _
) As EdmStrLst5
C#
EdmStrLst5 BrowseForFile(
   System.int hParentWnd,
   System.int lEdmBrowseFlags,
   System.string bsFilter,
   System.string bsDefaultExtension,
   System.string bsDefaultFileName,
   System.string bsDefaultFolder,
   System.string bsCaption
)
C++/CLI
EdmStrLst5^ BrowseForFile(
&   System.int hParentWnd,
&   System.int lEdmBrowseFlags,
&   System.String^ bsFilter,
&   System.String^ bsDefaultExtension,
&   System.String^ bsDefaultFileName,
&   System.String^ bsDefaultFolder,
&   System.String^ bsCaption
)

Parameters

hParentWnd
Parent window handle
lEdmBrowseFlags
Optional combination of EdmBrowseFlag bits
bsFilter
Optional filter string that limits the types of files displayed in the dialog box (see Remarks)
bsDefaultExtension
Optional default file extension to append if the user does not specify an extension
bsDefaultFileName
Optional default file name to display in the file name field of the dialog box
bsDefaultFolder
Optional path to the folder on which the dialog box should initially open
bsCaption
Optional caption for the dialog box

Return Value

IEdmStrLst5; list of paths to multi-selected files; Null if the user clicks Cancel (see Remarks)

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Access Check-in Flags in Check out Dialog (C#)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

If bsFilter is not empty, it contains the options for the Files of type combobox dropdown in the dialog box. Each option consists of a pair of substrings, where the first substring is the description that appears in the combobox dropdown:

All Image Files (*.JPG,*.BMP)

and the second substring consists of one or more extension filters delimited by semicolons:

*.JPG;*.BMP

The substrings are separated by a vertical bar, |, and the entire string is terminated with double vertical bars, ||.

For example, to give the combobox dropdown four options, including JPG and BMP file filters, specify bsFilter with the following string (without quotes):

"All Image Files (*.JPG,*.BMP)|*.JPG;*.BMP|JPEG-Files (*.JPG)|*.JPG|BMP-Files (*.BMP)|*.BMP|All Files (*.*)|*.*||"

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members
IEdmVault5::BrowseForFolder Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


CreateSearch Method (IEdmVault5)

CreateSearch Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : CreateSearch Method (IEdmVault5)

Obsolete. Superseded by IEdmVault21::CreateSearch2 .

Syntax

Visual Basic
Function CreateSearch() As IEdmSearch5
C#
IEdmSearch5 CreateSearch()
C++/CLI
IEdmSearch5^ CreateSearch();

Return Value

IEdmSearch5

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

C++ users must release the returned pointer, IEdmSearch5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetDictionary Method (IEdmVault5)

GetDictionary Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetDictionary Method (IEdmVault5)

bsName
Name of dictionary to get or create
bCreateIfNew
True to create the dictionary if it does not exist, false to not
Gets or creates the specified dictionary.

Syntax

Visual Basic
Function GetDictionary( _
   ByVal bsName As System.String, _
   ByVal bCreateIfNew As System.Boolean _
) As IEdmDictionary5
C#
IEdmDictionary5 GetDictionary(
   System.string bsName,
   System.bool bCreateIfNew
)
C++/CLI
IEdmDictionary5^ GetDictionary(
&   System.String^ bsName,
&   System.bool bCreateIfNew
)

Parameters

bsName
Name of dictionary to get or create
bCreateIfNew
True to create the dictionary if it does not exist, false to not

Return Value

IEdmDictionary5; Null if bCreateIfNew is false and the dictionary with bsName does not exist

Example

Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create and Delete Dictionaries (C#)
Create and Delete Dictionaries (VB.NET)

Remarks

A dictionary in SOLIDWORKS PDM Professional is a way of storing arbitrary data in the SOLIDWORKS PDM Professional database. The data is organized into key-value pairs. The values are always strings. The keys can be either integers or strings.

NOTE: If you intend to store file- or folder-specific data and want the data to be deleted or copied whenever the file or folder is deleted or copied, consider using card variables instead of dictionaries. Card variables stored using IEdmEnumeratorVariable5 do not require corresponding controls in the file or folder data card.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The dictionary with the specified name does not exist, and bCreateIfNew is false.
  • E_EDM_NOT_LOGGED_IN: You must call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetErrorString Method (IEdmVault5)

GetErrorString Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetErrorString Method (IEdmVault5)

lError
Error code for which to get a description
pbsErrorName
Error name as defined in Return codes; hexadecimal number if the error is unknown
pbsDescription
Description of the error
Gets the name and description for the specified error code returned by one of SOLIDWORKS PDM Professional's API methods.

Syntax

Visual Basic
Sub GetErrorString( _
   ByVal lError As System.Integer, _
   Optional ByRef pbsErrorName As System.String, _
   Optional ByRef pbsDescription As System.String _
)
C#
void GetErrorString(
   System.int lError,
   out System.string pbsErrorName,
   out System.string pbsDescription
)
C++/CLI
void GetErrorString(
&   System.int lError,
&   [Out] System.String^ pbsErrorName,
&   [Out] System.String^ pbsDescription
)

Parameters

lError
Error code for which to get a description
pbsErrorName
Error name as defined in Return codes; hexadecimal number if the error is unknown
pbsDescription
Description of the error

Example

Batch Add Files and Folders to Vault (VB.NET)
Batch Add Files and Folders to Vault (C#)

Remarks

You do not have to be logged in to the vault to call this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members
IEdmVault11::GetErrorMessage Method ()
IEdmVault11::GetErrorName Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFileFromPath Method (IEdmVault5)

GetFileFromPath Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetFileFromPath Method (IEdmVault5)

bsFilePath
File system path to the file for which to get an interface
ppoRetParentFolder
IEdmFolder5; 0 to not return an interface
Gets an interface to the file with the specified file system path.

Syntax

Visual Basic
Function GetFileFromPath( _
   ByVal bsFilePath As System.String, _
   Optional ByRef ppoRetParentFolder As IEdmFolder5 _
) As IEdmFile5
C#
IEdmFile5 GetFileFromPath(
   System.string bsFilePath,
   out IEdmFolder5 ppoRetParentFolder
)
C++/CLI
IEdmFile5^ GetFileFromPath(
&   System.String^ bsFilePath,
&   [Out] IEdmFolder5^ ppoRetParentFolder
)

Parameters

bsFilePath
File system path to the file for which to get an interface
ppoRetParentFolder
IEdmFolder5; 0 to not return an interface

Return Value

IEdmFile5; Null if file specified in bsFilePath does not exist

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)
Get File Version Information (C#)
Get File Version Information (VB.NET)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The file was not found.
  • E_EDM_NOT_LOGGED_IN: You must call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

See Also

IEdmVault5 Interface
IEdmVault5 Members
IEdmVault5::GetFolderFromPath Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFolderFromPath Method (IEdmVault5)

GetFolderFromPath Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetFolderFromPath Method (IEdmVault5)

bsFolderPath
File system path to the folder
Gets an interface to a folder on the specified file system path.

Syntax

Visual Basic
Function GetFolderFromPath( _
   ByVal bsFolderPath As System.String _
) As IEdmFolder5
C#
IEdmFolder5 GetFolderFromPath(
   System.string bsFolderPath
)
C++/CLI
IEdmFolder5^ GetFolderFromPath(
&   System.String^ bsFolderPath
)

Parameters

bsFolderPath
File system path to the folder

Return Value

IEdmFolder5; Null if the folder in bsFolderPath is not found

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

C++ users must release the returned interface, IEdmFolder5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The folder was not found.
  • E_EDM_NOT_LOGGED_IN: You must call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

See Also

IEdmVault5 Interface
IEdmVault5 Members
IEdmVault5::GetFileFromPath Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetObject Method (IEdmVault5)

GetObject Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetObject Method (IEdmVault5)

eType
Type of object to get as defined in EdmObjectType
lObjectID
ID of object to get
Gets an interface to a SOLIDWORKS PDM Professional object of the specified type and having the specified ID.

Syntax

Visual Basic
Function GetObject( _
   ByVal eType As EdmObjectType, _
   ByVal lObjectID As System.Integer _
) As IEdmObject5
C#
IEdmObject5 GetObject(
   EdmObjectType eType,
   System.int lObjectID
)
C++/CLI
IEdmObject5^ GetObject(
&   EdmObjectType eType,
&   System.int lObjectID
)

Parameters

eType
Type of object to get as defined in EdmObjectType
lObjectID
ID of object to get

Return Value

IEdmObject5

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

As of SOLIDWORKS PDM Professional 2008 you can call IEdmVault9::GetObjects to get interfaces to several objects at once, which is more efficient than calling this method multiple times.

C++ users must release the returned pointer, IEdmObject5.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: The provided ID was not valid.
  • E_EDM_PERMISSION_DENIED: The logged-in user does not have permission to see the requested object.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetVaultNameFromPath Method (IEdmVault5)

GetVaultNameFromPath Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetVaultNameFromPath Method (IEdmVault5)

bsPath
Full system path to a file or folder
Gets the name of the vault where the specified file or folder resides.

Syntax

Visual Basic
Function GetVaultNameFromPath( _
   ByVal bsPath As System.String _
) As System.String
C#
System.string GetVaultNameFromPath(
   System.string bsPath
)
C++/CLI
System.String^ GetVaultNameFromPath(
&   System.String^ bsPath
)

Parameters

bsPath
Full system path to a file or folder

Return Value

Vault name

Example

Check Out and Copy File (VB.NET)
Check Out and Copy File (C#)

Remarks

You do not need to call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_KEY_NOT_FOUND: The specified path is not in any vault.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetVersion Method (IEdmVault5)

GetVersion Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : GetVersion Method (IEdmVault5)

plMajor
Major version number
plMinor
Minor version number
Gets the version of SOLIDWORKS PDM Professional that is installed on this machine.

Syntax

Visual Basic
Sub GetVersion( _
   ByRef plMajor As System.Integer, _
   ByRef plMinor As System.Integer _
)
C#
void GetVersion(
   out System.int plMajor,
   out System.int plMinor
)
C++/CLI
void GetVersion(
&   [Out] System.int plMajor,
&   [Out] System.int plMinor
)

Parameters

plMajor
Major version number
plMinor
Minor version number

Example

Log Into Vault and Display Information (C#)
Log Into Vault and Display Information (VB.NET)

Remarks

You do not need to call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Login Method (IEdmVault5)

Login Method (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : Login Method (IEdmVault5)

bsUserName
User name of user created in the SOLIDWORKS PDM Professional User Manager
bsPasswd
Password for bsUserName
bsVaultName
Vault name
Logs in to the specified vault using the specified user name and password.

Syntax

Visual Basic
Sub Login( _
   ByVal bsUserName As System.String, _
   ByVal bsPasswd As System.String, _
   ByVal bsVaultName As System.String _
)
C#
void Login(
   System.string bsUserName,
   System.string bsPasswd,
   System.string bsVaultName
)
C++/CLI
void Login(
&   System.String^ bsUserName,
&   System.String^ bsPasswd,
&   System.String^ bsVaultName
)

Parameters

bsUserName
User name of user created in the SOLIDWORKS PDM Professional User Manager
bsPasswd
Password for bsUserName
bsVaultName
Vault name

Remarks

If your application is custom (i.e., it is not supplied or supported by SOLIDWORKS PDM Professional) and your application:

  • logs into SOLIDWORKS PDM Professional
    - or -
  • logs into a vault view
    - or -
  • directly accesses a vault database

when the same user is not already logged into a local view, you must first call IEdmVault13::LoginEx or IEdmVault5::LoginAuto to comply with the SOLIDWORKS End User License Agreement (EULA). Call IEdmVault13::LoginEx or IEdmVault5::LoginAuto before calling this method to ensure that licenses are properly consumed by your application.

Call IEdmVault5::LoginAuto to log in as a user already logged into a vault view through File Explorer or into a vault through the SOLIDWORKS PDM Professional client software. You do not need to specify a username and password when you call IEdmVault5::LoginAuto to share a license with the already logged-in user.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_ALREADY_LOGGED_IN: You are already logged into this vault.
  • E_EDM_LOGIN_FAILED: You entered an invalid user name or password.
  • E_EDM_CANT_OPEN_DATABASE: The database could not be opened.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


LoginAuto Method (IEdmVault5)

LoginAuto Method (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : LoginAuto Method (IEdmVault5)

bsVaultName
Vault name
hParentWnd
Parent window handle; used when the login dialog box displays to ensure it remains visible
Logs in to the specified vault.

Syntax

Visual Basic
Sub LoginAuto( _
   ByVal bsVaultName As System.String, _
   ByVal hParentWnd As System.Integer _
)
C#
void LoginAuto(
   System.string bsVaultName,
   System.int hParentWnd
)
C++/CLI
void LoginAuto(
&   System.String^ bsVaultName,
&   System.int hParentWnd
)

Parameters

bsVaultName
Vault name
hParentWnd
Parent window handle; used when the login dialog box displays to ensure it remains visible

Example

See the IEdmVault5 examples.

Remarks

This method differs from IEdmVault5::Login in that this method does not require the username and password. This method logs into the vault as the same user that is already logged into either the vault view through File Explorer or the vault through the SOLIDWORKS PDM Professional client software. This method allows you to share the license of the already logged-in user. If no user is already logged into the specified file vault, a login dialog box displays. Also unlike IEdmVault5::Login, this method properly consumes a license without first calling IEdmVault13::LoginEx to comply with the SOLIDWORKS End User License Agreement (EULA).

You can retrieve the ID of the SOLIDWORKS PDM Professional client user by calling IEdmVault11::GetLoggedInWindowsUserID. You can also log in silently as the SOLIDWORKS PDM Professional client by calling IEdmVault11::LogInWindowsUser.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_ALREADY_LOGGED_IN: You are already logged in to this vault.
  • E_EDM_CANT_OPEN_DATABASE: The database could not be opened (Maybe the vault name was incorrect?).
  • E_EDM_CANCELLED_BY_USER: The log-in dialog box displays, but the user clicked Cancel instead of logging in.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


MsgBox Method (IEdmVault5)

MsgBox Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : MsgBox Method (IEdmVault5)

lParentWnd
Parent window handle
bsMsg
Message to display in the message box
eType
Optional style of the message box as defined in EdmMBoxType
bsCaption
Optional string to display for the message box caption
Displays a message box to the user.

Syntax

Visual Basic
Function MsgBox( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsMsg As System.String, _
   Optional ByVal eType As EdmMBoxType, _
   Optional ByVal bsCaption As System.String _
) As EdmMBoxResult
C#
EdmMBoxResult MsgBox(
   System.int lParentWnd,
   System.string bsMsg,
   EdmMBoxType eType,
   System.string bsCaption
)
C++/CLI
EdmMBoxResult MsgBox(
&   System.int lParentWnd,
&   System.String^ bsMsg,
&   EdmMBoxType eType,
&   System.String^ bsCaption
)

Parameters

lParentWnd
Parent window handle
bsMsg
Message to display in the message box
eType
Optional style of the message box as defined in EdmMBoxType
bsCaption
Optional string to display for the message box caption

Return Value

Button clicked as defined in EdmMBoxResult

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)

Remarks

The only advantage of this method over the standard Visual Basic MsgBox function is that, with this method, you can specify a parent window handle to ensure that the message box stays on top of whatever parent window you have. For add-ins the parent window is usually the File Explorer window.

You do not need to call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The user pressed Cancel.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


RefreshFolder Method (IEdmVault5)

RefreshFolder Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : RefreshFolder Method (IEdmVault5)

bsFolderPath
File system path to the folder to refresh
Refreshes the file listing in the specified folder.

Syntax

Visual Basic
Sub RefreshFolder( _
   ByVal bsFolderPath As System.String _
)
C#
void RefreshFolder(
   System.string bsFolderPath
)
C++/CLI
void RefreshFolder(
&   System.String^ bsFolderPath
)

Parameters

bsFolderPath
File system path to the folder to refresh

Example

Execute Template (C#)
Execute Template (VB.NET)

Remarks

If you use API methods to add, check out, or change the state of a file, the API does not automatically refresh its folder in File Explorer. That would be inefficient when processing a large number of files. If you check in a file using the API and browse to its folder using File Explorer, it appears to the user that the file is still checked out. This folder can be refreshed by one of the following techniques:

  • Calling this method
  • Pressing F5
  • Navigating to a different folder and back again

There is no way to force a refresh on other machines.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


VerifyVersion Method (IEdmVault5)

VerifyVersion Method (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : VerifyVersion Method (IEdmVault5)

lMajor
Minimum major version number
lMinor
Minimum minor version number
Verifies that the installed SOLIDWORKS PDM Professional is at the specified version level or higher.

Syntax

Visual Basic
Sub VerifyVersion( _
   ByVal lMajor As System.Integer, _
   ByVal lMinor As System.Integer _
)
C#
void VerifyVersion(
   System.int lMajor,
   System.int lMinor
)
C++/CLI
void VerifyVersion(
&   System.int lMajor,
&   System.int lMinor
)

Parameters

lMajor
Minimum major version number
lMinor
Minimum minor version number

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

Add-ins that depend on a specific SOLIDWORKS PDM Professional version should make themselves impossible to install on earlier versions of SOLIDWORKS PDM Professional. To do this, set the minimum version of SOLIDWORKS PDM Professional in mlRequiredVersionMajor and mlRequiredVersionMinor of the EdmAddInInfo structure that is passed as a parameter in IEdmAddIn5::GetAddInInfo.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_UNSUPPORTED_PROGRAM_VERSION: The installed program is at a version level that is lower than the specified version.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVault5 Interface Properties

IEdmVault5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVault5 Interface

For a list of all members of this type, see IEdmVault5 members.

Public Properties

 | Name | Description
Property | CommandID | Gets the command ID count.
Property | IsLoggedIn | Gets whether you are logged in to this vault.
Property | Language | Gets the language used by the SOLIDWORKS PDM Professional client.
Property | Name | Gets the name of this vault.
Property | RootFolder | Gets the root folder of this vault.
Property | RootFolderID | Gets the database ID of the root folder of this vault.
Property | RootFolderPath | Gets the file system path to the root folder of this vault.
Property | SilentMode | Gets whether the add-in is running in silent mode.
Top

See Also

IEdmVault5 Interface
EPDM.Interop.epdm Namespace


CommandID Property (IEdmVault5)

CommandID Property (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : CommandID Property (IEdmVault5)

Gets the command ID count.

Syntax

Visual Basic
ReadOnly Property CommandID As System.Integer
C#
System.int CommandID {get;}
C++/CLI
property System.int CommandID {
   System.int get();
}

Property Value

Command ID; count that is incremented for each new command launched by the user in this vault

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IsLoggedIn Property (IEdmVault5)

IsLoggedIn Property (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : IsLoggedIn Property (IEdmVault5)

Gets whether you are logged in to this vault.

Syntax

Visual Basic
ReadOnly Property IsLoggedIn As System.Boolean
C#
System.bool IsLoggedIn {get;}
C++/CLI
property System.bool IsLoggedIn {
   System.bool get();
}

Property Value

True if logged in, false if not

Example

Add Users (C#)
Add Users (VB.NET)

Remarks

Log in to the vault by calling IEdmVault5::Login or IEdmVault5::LoginAuto.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Language Property (IEdmVault5)

Language Property (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : Language Property (IEdmVault5)

Gets the language used by the SOLIDWORKS PDM Professional client.

Syntax

Visual Basic
ReadOnly Property Language As EdmLanguage
C#
EdmLanguage Language {get;}
C++/CLI
property EdmLanguage Language {
   EdmLanguage get();
}

Property Value

Language as defined in EdmLanguage

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


Name Property (IEdmVault5)

Name Property (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : Name Property (IEdmVault5)

Gets the name of this vault.

Syntax

Visual Basic
ReadOnly Property Name As System.String
C#
System.string Name {get;}
C++/CLI
property System.String^ Name {
   System.String^ get();
}

Property Value

Name of this vault

Example

Traverse Users and Groups in Vault (C#)
Traverse Users and Groups in Vault (VB.NET)

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


RootFolder Property (IEdmVault5)

RootFolder Property (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : RootFolder Property (IEdmVault5)

Gets the root folder of this vault.

Syntax

Visual Basic
ReadOnly Property RootFolder As IEdmFolder5
C#
IEdmFolder5 RootFolder {get;}
C++/CLI
property IEdmFolder5^ RootFolder {
   IEdmFolder5^ get();
}

Property Value

IEdmFolder5

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)
Traverse Folders and Files in Vault (C#)
Traverse Folders and Files in Vault (VB.NET)

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


RootFolderID Property (IEdmVault5)

RootFolderID Property (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : RootFolderID Property (IEdmVault5)

Gets the database ID of the root folder of this vault.

Syntax

Visual Basic
ReadOnly Property RootFolderID As System.Integer
C#
System.int RootFolderID {get;}
C++/CLI
property System.int RootFolderID {
   System.int get();
}

Property Value

ID of the root folder of this vault

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


RootFolderPath Property (IEdmVault5)

RootFolderPath Property (IEdmVault5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : RootFolderPath Property (IEdmVault5)

Gets the file system path to the root folder of this vault.

Syntax

Visual Basic
ReadOnly Property RootFolderPath As System.String
C#
System.string RootFolderPath {get;}
C++/CLI
property System.String^ RootFolderPath {
   System.String^ get();
}

Property Value

File system path to the root folder of this vault

Example

Log Into Vault and Display Information (C#)
Log Into Vault and Display Information (VB.NET)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SilentMode Property (IEdmVault5)

SilentMode Property (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : SilentMode Property (IEdmVault5)

Gets whether the add-in is running in silent mode.

Syntax

Visual Basic
ReadOnly Property SilentMode As System.Boolean
C#
System.bool SilentMode {get;}
C++/CLI
property System.bool SilentMode {
   System.bool get();
}

Property Value

True if in silent mode, false if dialog boxes are displayed

Remarks

This property always returns true on SOLIDWORKS PDM Professional's Web Server. When in silent mode, add-ins may not display a user interface, because that blocks the server.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVault6 Interface

IEdmVault6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVault6 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault6
   Inherits IEdmVault5
C#
public interface IEdmVault6 : IEdmVault5
C++/CLI
public interface class IEdmVault6 : public IEdmVault5

Remarks

This interface:

  • extends IEdmVault5.
  • is extended by IEdmVault7.

See Also

IEdmVault6 Members
EPDM.Interop.epdm Namespace


IEdmVault6 Interface Members

IEdmVault6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault6 Interface

The following tables list the members exposed by IEdmVault6.

Public Methods

 | Name | Description
Method | CreateCardViewEx | Obsolete. Superseded by IEdmVault10::CreateCardViewEx2 .
Method | GetCardID | Gets the ID of a card of the specified type, with the specified name, and in the specified folder.
Top

See Also

IEdmVault6 Interface
EPDM.Interop.epdm Namespace


IEdmVault6 Interface Methods

IEdmVault6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault6 Interface

For a list of all members of this type, see IEdmVault6 members.

Public Methods

 | Name | Description
Method | CreateCardViewEx | Obsolete. Superseded by IEdmVault10::CreateCardViewEx2 .
Method | GetCardID | Gets the ID of a card of the specified type, with the specified name, and in the specified folder.
Top

See Also

IEdmVault6 Interface
EPDM.Interop.epdm Namespace


GetCardID Method (IEdmVault6)

GetCardID Method (IEdmVault6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault6 Interface : GetCardID Method (IEdmVault6)

eType
Type of card to get as defined in EdmCardType
bsName
Name of the card to get
lFolderID
ID of the folder in which the card is stored; 0 for search cards and template
Gets the ID of a card of the specified type, with the specified name, and in the specified folder.

Syntax

Visual Basic
Function GetCardID( _
   ByVal eType As EdmCardType, _
   ByVal bsName As System.String, _
   Optional ByVal lFolderID As System.Integer _
) As System.Integer
C#
System.int GetCardID(
   EdmCardType eType,
   System.string bsName,
   System.int lFolderID
)
C++/CLI
System.int GetCardID(
&   EdmCardType eType,
&   System.String^ bsName,
&   System.int lFolderID
)

Parameters

eType
Type of card to get as defined in EdmCardType
bsName
Name of the card to get
lFolderID
ID of the folder in which the card is stored; 0 for search cards and template

Return Value

Card ID; 0 if not found

Remarks

After calling this method, you can use the returned ID in calls to IEdmVault5::GetObject or IEdmVault6::CreateCardViewEx.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The specified card was not found.

See Also

IEdmVault6 Interface
IEdmVault6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmVault7 Interface

IEdmVault7 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault7 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault7
   Inherits IEdmVault5, IEdmVault6
C#
public interface IEdmVault7 : IEdmVault5, IEdmVault6
C++/CLI
public interface class IEdmVault7 : public IEdmVault5, IEdmVault6

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)
Add Items (C#)
Add Items (VB.NET)
Get File References for a File (C#)
Get File References for a File (VB.NET)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface:

  • extends IEdmVault6.
  • is extended by IEdmVault8.

See Also

IEdmVault7 Members
EPDM.Interop.epdm Namespace


IEdmVault7 Interface Members

IEdmVault7 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault7 Interface

The following tables list the members exposed by IEdmVault7.

Public Methods

 | Name | Description
Method | CreateUtility | Creates a utility interface of the specified type.
Top

See Also

IEdmVault7 Interface
EPDM.Interop.epdm Namespace


IEdmVault7 Interface Methods

IEdmVault7 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault7 Interface

For a list of all members of this type, see IEdmVault7 members.

Public Methods

 | Name | Description
Method | CreateUtility | Creates a utility interface of the specified type.
Top

See Also

IEdmVault7 Interface
EPDM.Interop.epdm Namespace


CreateUtility Method (IEdmVault7)

CreateUtility Method (IEdmVault7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault7 Interface : CreateUtility Method (IEdmVault7)

eType
Type of interface to create as defined in EdmUtility
Creates a utility interface of the specified type.

Syntax

Visual Basic
Function CreateUtility( _
   ByVal eType As EdmUtility _
) As System.Object
C#
System.object CreateUtility(
   EdmUtility eType
)
C++/CLI
System.Object^ CreateUtility(
&   EdmUtility eType
)

Parameters

eType
Type of interface to create as defined in EdmUtility

Return Value

Interface

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)
Add Items (C#)
Add Items (VB.NET)
Get File References for a File (C#)
Get File References for a File (VB.NET)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)
Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault7 Interface
IEdmVault7 Members

Availability

SOLIDWORKS PDM Professional Version 6.2


IEdmVault8 Interface

IEdmVault8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault8 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault8
   Inherits IEdmVault5, IEdmVault6, IEdmVault7
C#
public interface IEdmVault8 : IEdmVault5, IEdmVault6, IEdmVault7
C++/CLI
public interface class IEdmVault8 : public IEdmVault5, IEdmVault6, IEdmVault7

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)
Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)
Set Initial Revision (VB.NET)
Set Initial Revision (C#)
Add Custom File Reference (VB.NET)
Add Custom File Reference (C#)

Remarks

This interface:

  • extends IEdmVault7.
  • is extended by IEdmVault9.

See Also

IEdmVault8 Members
EPDM.Interop.epdm Namespace


IEdmVault8 Interface Members

IEdmVault8 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmVault8 Interface

The following tables list the members exposed by IEdmVault8.

Public Properties

 | Name | Description
Property | ClientType | Gets the type of client installation.
Top

Public Methods

 | Name | Description
Method | GetVaultViews | Gets all of the views set up on this vault.
Method | GetWin32Window | Converts the specified window handle to an Win32Window interface that can be used in the .NET Framework.
Method | OpenContainingFolder | Opens File Explorer on the specified folder and selects the specified file.
Top

See Also

IEdmVault8 Interface
EPDM.Interop.epdm Namespace


IEdmVault8 Interface Methods

IEdmVault8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault8 Interface

For a list of all members of this type, see IEdmVault8 members.

Public Methods

 | Name | Description
Method | GetVaultViews | Gets all of the views set up on this vault.
Method | GetWin32Window | Converts the specified window handle to an Win32Window interface that can be used in the .NET Framework.
Method | OpenContainingFolder | Opens File Explorer on the specified folder and selects the specified file.
Top

See Also

IEdmVault8 Interface
EPDM.Interop.epdm Namespace


GetVaultViews Method (IEdmVault8)

GetVaultViews Method (IEdmVault8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault8 Interface : GetVaultViews Method (IEdmVault8)

ppoRetViews
Array of EdmViewInfo structures; one structure for each view
bOnlyLoggedIn
True to get views in which you are currently logged, false to get all views
Gets all of the views set up on this vault.

Syntax

Visual Basic
Sub GetVaultViews( _
   ByRef ppoRetViews() As EdmViewInfo, _
   ByVal bOnlyLoggedIn As System.Boolean _
)
C#
void GetVaultViews(
   out EdmViewInfo[] ppoRetViews,
   System.bool bOnlyLoggedIn
)
C++/CLI
void GetVaultViews(
&   [Out] array<EdmViewInfo>^ ppoRetViews,
&   System.bool bOnlyLoggedIn
)

Parameters

ppoRetViews
Array of EdmViewInfo structures; one structure for each view
bOnlyLoggedIn
True to get views in which you are currently logged, false to get all views

Example

See the IEdmVault8 examples.

Remarks

You do not have to call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault8 Interface
IEdmVault8 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


GetWin32Window Method (IEdmVault8)

GetWin32Window Method (IEdmVault8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault8 Interface : GetWin32Window Method (IEdmVault8)

lHwnd
Window handle to convert
Converts the specified window handle to an Win32Window interface that can be used in the .NET Framework.

Syntax

Visual Basic
Function GetWin32Window( _
   ByVal lHwnd As System.Integer _
) As System.Object
C#
System.object GetWin32Window(
   System.int lHwnd
)
C++/CLI
System.Object^ GetWin32Window(
&   System.int lHwnd
)

Parameters

lHwnd
Window handle to convert

Return Value

IWin32Window interface

Example

Creating Add-ins (VB.NET)

See Also

IEdmVault8 Interface
IEdmVault8 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


OpenContainingFolder Method (IEdmVault8)

OpenContainingFolder Method (IEdmVault8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault8 Interface : OpenContainingFolder Method (IEdmVault8)

oFilePathOrID
ID or path of file to select; 0 to ignore (see Remarks)
oFolderPathOrID
ID or path of folder on which to open File Explorer; 0 to ignore
Opens File Explorer on the specified folder and selects the specified file.

Syntax

Visual Basic
Sub OpenContainingFolder( _
   ByVal oFilePathOrID As System.Object, _
   Optional ByVal oFolderPathOrID As System.Object _
)
C#
void OpenContainingFolder(
   System.object oFilePathOrID,
   System.object oFolderPathOrID
)
C++/CLI
void OpenContainingFolder(
&   System.Object^ oFilePathOrID,
&   System.Object^ oFolderPathOrID
)

Parameters

oFilePathOrID
ID or path of file to select; 0 to ignore (see Remarks)
oFolderPathOrID
ID or path of folder on which to open File Explorer; 0 to ignore

Example

OpenContainingFolder 102, 33 | Opens folder with ID, 33, and selects file with ID, 102.
OpenContainingFolder “c:\TheVault\SubFolder\test.txt” | Opens folder, SubFolder, and selects file, test.txt.
OpenContainingFolder 0, 45 | Opens the parent folder of folder with ID, 45, and selects the folder with ID, 45.
OpenContainingFolder 321, 0 | Opens first folder where file with ID, 321, is found and selects the file.
OpenContainingFolder 0, “c:\TheVault\SubFolder” | Opens the vault root folder and selects the folder, SubFolder.

Remarks

If oFilePathOrID is a path to a file, oFolderPathOrID is ignored.

See Also

IEdmVault8 Interface
IEdmVault8 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmVault8 Interface Properties

IEdmVault8 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVault8 Interface

For a list of all members of this type, see IEdmVault8 members.

Public Properties

 | Name | Description
Property | ClientType | Gets the type of client installation.
Top

See Also

IEdmVault8 Interface
EPDM.Interop.epdm Namespace


ClientType Property (IEdmVault8)

ClientType Property (IEdmVault8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault8 Interface : ClientType Property (IEdmVault8)

Gets the type of client installation.

Syntax

Visual Basic
ReadOnly Property ClientType As EdmClientType
C#
EdmClientType ClientType {get;}
C++/CLI
property EdmClientType ClientType {
   EdmClientType get();
}

Property Value

Type of client installation as defined in EdmClientType

See Also

IEdmVault8 Interface
IEdmVault8 Members

Availability

SOLIDWORKS PDM Professional Version 6.4


IEdmVault9 Interface

IEdmVault9 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVault9 Interface

Allows you to access a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVault9
   Inherits IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8
C#
public interface IEdmVault9 : IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8
C++/CLI
public interface class IEdmVault9 : public IEdmVault5, IEdmVault6, IEdmVault7, IEdmVault8

Example

Batch Update Card Variables (C#)
Batch Update Card Variables (VB.NET)

Remarks

This interface:

  • extends IEdmVault8.
  • is extended by IEdmVault10.

Accessors

See Also

IEdmVault9 Members
EPDM.Interop.epdm Namespace


IEdmVault9 Interface Members

IEdmVault9 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVault9 Interface

The following tables list the members exposed by IEdmVault9.

Public Methods

 | Name | Description
Method | GetObjects | Gets interfaces to all of the specified objects.
Top

See Also

IEdmVault9 Interface
EPDM.Interop.epdm Namespace


IEdmVault9 Interface Methods

IEdmVault9 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVault9 Interface

For a list of all members of this type, see IEdmVault9 members.

Public Methods

 | Name | Description
Method | GetObjects | Gets interfaces to all of the specified objects.
Top

See Also

IEdmVault9 Interface
EPDM.Interop.epdm Namespace


GetObjects Method (IEdmVault9)

GetObjects Method (IEdmVault9)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVault9 Interface : GetObjects Method (IEdmVault9)

ppoObjects
Array of EdmObjectInfo structures; one structure for each interface to retrieve
Gets interfaces to all of the specified objects.

Syntax

Visual Basic
Sub GetObjects( _
   ByRef ppoObjects() As EdmObjectInfo _
)
C#
void GetObjects(
   out EdmObjectInfo[] ppoObjects
)
C++/CLI
void GetObjects(
&   [Out] array<EdmObjectInfo>^ ppoObjects
)

Parameters

ppoObjects
Array of EdmObjectInfo structures; one structure for each interface to retrieve

Example

Batch Update Card Variables (C#)
Batch Update Card Variables (VB.NET)

Remarks

Call this method to get interfaces to several objects at once, which is more efficient than calling IEdmVault5::GetObject multiple times.

See Also

IEdmVault9 Interface
IEdmVault9 Members

Availability

SOLIDWORKS PDM Professional 2008


IEdmVersion5 Interface

IEdmVersion5 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVersion5 Interface

Allows you to access the version of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVersion5
C#
public interface IEdmVersion5
C++/CLI
public interface class IEdmVersion5

Example

Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is extended by IEdmVersion6.

Whenever a new or modified file is checked in, a new version of it is created and stored in the file vault. The versions are denoted by numbers, e.g., 1,2,3, etc.

Accessors

IEdmEnumeratorVersion5::GetNextVersion

IEdmEnumeratorVersion5::GetVersion

IEdmRevision5::Version

See Also

IEdmVersion5 Members
EPDM.Interop.epdm Namespace


IEdmVersion5 Interface Members

IEdmVersion5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmVersion5 Interface

The following tables list the members exposed by IEdmVersion5.

Public Properties

 | Name | Description
Property | Comment | Gets the comment that is entered during the check-in of this version.
Property | FileDate | Gets the modification date for this version.
Property | FileSize | Gets the file size for this version.
Property | HasRevision | Gets whether this version has one or more revisions.
Property | User | Gets the user who checked in this version.
Property | UserID | Gets the ID of the user who checked in this version.
Property | VersionDate | Gets the time when this version was created.
Property | VersionNo | Gets the version number of this version.
Top

Public Methods

 | Name | Description
Method | GetFileCopy | Retrieves from the archive a copy of this version of a file and places it in the specified location.
Method | GetFirstRevisionPosition | Starts an enumeration of the revisions of this version.
Method | GetNextRevision | Gets the next revision set on this version in an enumeration.
Method | Rollback | Obsolete. Superseded by IEdmVersion6::Rollback2 .
Top

See Also

IEdmVersion5 Interface
EPDM.Interop.epdm Namespace


IEdmVersion5 Interface Methods

IEdmVersion5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVersion5 Interface

For a list of all members of this type, see IEdmVersion5 members.

Public Methods

 | Name | Description
Method | GetFileCopy | Retrieves from the archive a copy of this version of a file and places it in the specified location.
Method | GetFirstRevisionPosition | Starts an enumeration of the revisions of this version.
Method | GetNextRevision | Gets the next revision set on this version in an enumeration.
Method | Rollback | Obsolete. Superseded by IEdmVersion6::Rollback2 .
Top

See Also

IEdmVersion5 Interface
EPDM.Interop.epdm Namespace


GetFileCopy Method (IEdmVersion5)

GetFileCopy Method (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : GetFileCopy Method (IEdmVersion5)

lParentWnd
Parent window handle
poPathOrFolderID
ID or path of the folder where to copy the file; 0 to place a copy of the file in all of its shared folders (default) (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGetFlag.EdmGet_MakeReadOnly
bsNewName
Optional new name of the copied file; "" to create a copy using the file's current name
Retrieves from the archive a copy of this version of a file and places it in the specified location.

Syntax

Visual Basic
Sub GetFileCopy( _
   ByVal lParentWnd As System.Integer, _
   Optional ByRef poPathOrFolderID As System.Object, _
   Optional ByVal lEdmGetFlags As System.Integer, _
   Optional ByVal bsNewName As System.String _
)
C#
void GetFileCopy(
   System.int lParentWnd,
   ref System.object poPathOrFolderID,
   System.int lEdmGetFlags,
   System.string bsNewName
)
C++/CLI
void GetFileCopy(
&   System.int lParentWnd,
&   System.Object^% poPathOrFolderID,
&   System.int lEdmGetFlags,
&   System.String^ bsNewName
)

Parameters

lParentWnd
Parent window handle
poPathOrFolderID
ID or path of the folder where to copy the file; 0 to place a copy of the file in all of its shared folders (default) (see Remarks)
lEdmGetFlags
Optional combination of EdmGetFlag bits; default is EdmGetFlag.EdmGet_MakeReadOnly
bsNewName
Optional new name of the copied file; "" to create a copy using the file's current name

Example

Check Out and Copy File (VB.NET)
Check Out and Copy File (C#)

Remarks

If you specify a folder path in poPathOrFolderID, it must be terminated by a backslash ('\').

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_FILE_NOT_FOUND: The file was not found in the vault.
  • E_EDM_PERMISSION_DENIED: The user is not permitted to see the specified version of the file.

See Also

IEdmVersion5 Interface
IEdmVersion5 Members
IEdmFile5::GetFileCopy Method ()
IEdmRevision5::GetFileCopy Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetFirstRevisionPosition Method (IEdmVersion5)

GetFirstRevisionPosition Method (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : GetFirstRevisionPosition Method (IEdmVersion5)

Starts an enumeration of the revisions of this version.

Syntax

Visual Basic
Function GetFirstRevisionPosition() As IEdmPos5
C#
IEdmPos5 GetFirstRevisionPosition()
C++/CLI
IEdmPos5^ GetFirstRevisionPosition();

Return Value

IEdmPos5; position of the first revision in the enumeration

Example

Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

After calling this method, pass the returned position of the first revision to IEdmVersion5::GetNextRevision to get the first revision in this list. Then call IEdmVersion5::GetNextRevision repeatedly to get the rest of the revisions.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVersion5 Interface
IEdmVersion5 Members
IEdmRevision5 Interface
IEdmEnumeratorVersion5::GetFirstRevisionPosition Method ()
IEdmVersion5::HasRevision Property ()

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNextRevision Method (IEdmVersion5)

GetNextRevision Method (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : GetNextRevision Method (IEdmVersion5)

poPos
IEdmPos5; position of the next revision in the list
Gets the next revision set on this version in an enumeration.

Syntax

Visual Basic
Function GetNextRevision( _
   ByVal poPos As IEdmPos5 _
) As IEdmRevision5
C#
IEdmRevision5 GetNextRevision(
   IEdmPos5 poPos
)
C++/CLI
IEdmRevision5^ GetNextRevision(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next revision in the list

Return Value

IEdmRevision5

Example

Get Revision Names for Local Version of File (C#)
Get Revision Names for Local Version of File (VB.NET)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first revision in the list, IEdmPos5. Call IEdmVersion5::GetFirstRevisionPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the revisions in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmRevision5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVersion5 Interface
IEdmVersion5 Members
IEdmVersion5::HasRevision Property ()

Availability

SOLIDWORKS PDM Professional Version 5.2


Rollback Method (IEdmVersion5)

Rollback Method (IEdmVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : Rollback Method (IEdmVersion5)

Obsolete. Superseded by IEdmVersion6::Rollback2 .

Syntax

Visual Basic
Sub Rollback()
C#
void Rollback()
C++/CLI
void Rollback();

Remarks

This method deletes both the file data and the file data card data when it deletes versions. You cannot undo this rollback, unless you restore a complete backup of the database and the file archives.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user does not have permission to delete files.
  • E_EDM_INVALID_REVISION_NUMBER: The version does not exist.

See Also

IEdmVersion5 Interface
IEdmVersion5 Members
IEdmEnumeratorVersion5::Rollback Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVersion5 Interface Properties

IEdmVersion5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVersion5 Interface

For a list of all members of this type, see IEdmVersion5 members.

Public Properties

 | Name | Description
Property | Comment | Gets the comment that is entered during the check-in of this version.
Property | FileDate | Gets the modification date for this version.
Property | FileSize | Gets the file size for this version.
Property | HasRevision | Gets whether this version has one or more revisions.
Property | User | Gets the user who checked in this version.
Property | UserID | Gets the ID of the user who checked in this version.
Property | VersionDate | Gets the time when this version was created.
Property | VersionNo | Gets the version number of this version.
Top

See Also

IEdmVersion5 Interface
EPDM.Interop.epdm Namespace


Comment Property (IEdmVersion5)

Comment Property (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : Comment Property (IEdmVersion5)

Gets the comment that is entered during the check-in of this version.

Syntax

Visual Basic
ReadOnly Property Comment As System.String
C#
System.string Comment {get;}
C++/CLI
property System.String^ Comment {
   System.String^ get();
}

Property Value

Version comment

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FileDate Property (IEdmVersion5)

FileDate Property (IEdmVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : FileDate Property (IEdmVersion5)

Gets the modification date for this version.

Syntax

Visual Basic
ReadOnly Property FileDate As System.Object
C#
System.object FileDate {get;}
C++/CLI
property System.Object^ FileDate {
   System.Object^ get();
}

Property Value

Modification date

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


FileSize Property (IEdmVersion5)

FileSize Property (IEdmVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : FileSize Property (IEdmVersion5)

Gets the file size for this version.

Syntax

Visual Basic
ReadOnly Property FileSize As System.Integer
C#
System.int FileSize {get;}
C++/CLI
property System.int FileSize {
   System.int get();
}

Property Value

File size

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


HasRevision Property (IEdmVersion5)

HasRevision Property (IEdmVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : HasRevision Property (IEdmVersion5)

Gets whether this version has one or more revisions.

Syntax

Visual Basic
ReadOnly Property HasRevision As System.Boolean
C#
System.bool HasRevision {get;}
C++/CLI
property System.bool HasRevision {
   System.bool get();
}

Property Value

True if this version has one or more revisions, false if not

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


User Property (IEdmVersion5)

User Property (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : User Property (IEdmVersion5)

Gets the user who checked in this version.

Syntax

Visual Basic
ReadOnly Property User As IEdmUser5
C#
IEdmUser5 User {get;}
C++/CLI
property IEdmUser5^ User {
   IEdmUser5^ get();
}

Property Value

IEdmUser5

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


UserID Property (IEdmVersion5)

UserID Property (IEdmVersion5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : UserID Property (IEdmVersion5)

Gets the ID of the user who checked in this version.

Syntax

Visual Basic
ReadOnly Property UserID As System.Integer
C#
System.int UserID {get;}
C++/CLI
property System.int UserID {
   System.int get();
}

Property Value

ID of the user who checked in this version

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


VersionDate Property (IEdmVersion5)

VersionDate Property (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : VersionDate Property (IEdmVersion5)

Gets the time when this version was created.

Syntax

Visual Basic
ReadOnly Property VersionDate As System.Object
C#
System.object VersionDate {get;}
C++/CLI
property System.Object^ VersionDate {
   System.Object^ get();
}

Property Value

Check-in time for this version

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


VersionNo Property (IEdmVersion5)

VersionNo Property (IEdmVersion5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion5 Interface : VersionNo Property (IEdmVersion5)

Gets the version number of this version.

Syntax

Visual Basic
ReadOnly Property VersionNo As System.Integer
C#
System.int VersionNo {get;}
C++/CLI
property System.int VersionNo {
   System.int get();
}

Property Value

Version number

Example

Get File Version Information (C#)
Get File Version Information (VB.NET)

See Also

IEdmVersion5 Interface
IEdmVersion5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmVersion6 Interface

IEdmVersion6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVersion6 Interface

Allows you to access the version of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVersion6
   Inherits IEdmVersion5
C#
public interface IEdmVersion6 : IEdmVersion5
C++/CLI
public interface class IEdmVersion6 : public IEdmVersion5

Remarks

This interface:

  • extends IEdmVersion5.
  • is extended by IEdmVersion7.

See Also

IEdmVersion6 Members
EPDM.Interop.epdm Namespace


IEdmVersion6 Interface Members

IEdmVersion6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVersion6 Interface

The following tables list the members exposed by IEdmVersion6.

Public Methods

 | Name | Description
Method | Rollback2 | Obsolete. Superseded by IEdmVersion8::Rollback3.
Top

See Also

IEdmVersion6 Interface
EPDM.Interop.epdm Namespace


IEdmVersion6 Interface Methods

IEdmVersion6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVersion6 Interface

For a list of all members of this type, see IEdmVersion6 members.

Public Methods

 | Name | Description
Method | Rollback2 | Obsolete. Superseded by IEdmVersion8::Rollback3.
Top

See Also

IEdmVersion6 Interface
EPDM.Interop.epdm Namespace


Rollback2 Method (IEdmVersion6)

Rollback2 Method (IEdmVersion6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion6 Interface : Rollback2 Method (IEdmVersion6)

bsComment
Comment for this rollback
Obsolete. Superseded by IEdmVersion8::Rollback3.

Syntax

Visual Basic
Sub Rollback2( _
   ByVal bsComment As System.String _
)
C#
void Rollback2(
   System.string bsComment
)
C++/CLI
void Rollback2(
&   System.String^ bsComment
)

Parameters

bsComment
Comment for this rollback

Remarks

This method deletes both the file data and the file data card data when it deletes versions. You cannot undo this rollback, unless you restore a complete backup of the database and the file archives.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user does not have permission to delete files.
  • E_EDM_INVALID_REVISION_NUMBER: The version does not exist.

See Also

IEdmVersion6 Interface
IEdmVersion6 Members
IEdmEnumeratorVersion6::Rollback2 Method ()
IEdmRevision6::Rollback2 Method ()

Availability

SOLIDWORKS PDM Professional 2015


IEdmVersion7 Interface

IEdmVersion7 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmVersion7 Interface

Allows you to access the version of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVersion7
   Inherits IEdmVersion5, IEdmVersion6
C#
public interface IEdmVersion7 : IEdmVersion5, IEdmVersion6
C++/CLI
public interface class IEdmVersion7 : public IEdmVersion5, IEdmVersion6

Remarks

This interface:

  • extends IEdmVersion6.
  • is extended by IEdmVersion8.

See Also

IEdmVersion7 Members
EPDM.Interop.epdm Namespace


IEdmVersion7 Interface Members

IEdmVersion7 Interface Members
See Also Properties
EPDM.Interop.epdm Namespace : IEdmVersion7 Interface

The following tables list the members exposed by IEdmVersion7.

Public Properties

 | Name | Description
Property | FileSize2 | Gets the 64-bit file size for this version.
Top

See Also

IEdmVersion7 Interface
EPDM.Interop.epdm Namespace


IEdmVersion7 Interface Properties

IEdmVersion7 Interface Properties
EPDM.Interop.epdm Namespace : IEdmVersion7 Interface

For a list of all members of this type, see IEdmVersion7 members.

Public Properties

 | Name | Description
Property | FileSize2 | Gets the 64-bit file size for this version.
Top

See Also

IEdmVersion7 Interface
EPDM.Interop.epdm Namespace


FileSize2 Property (IEdmVersion7)

FileSize2 Property (IEdmVersion7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmVersion7 Interface : FileSize2 Property (IEdmVersion7)

Gets the 64-bit file size for this version.

Syntax

Visual Basic
ReadOnly Property FileSize2 As System.Long
C#
System.long FileSize2 {get;}
C++/CLI
property System.int64 FileSize2 {
   System.int64 get();
}

Property Value

File size

Example

Get File Version Information (VB.NET)
Get File Version Information (C#)

See Also

IEdmVersion7 Interface
IEdmVersion7 Members

Availability

SOLIDWORKS PDM Professional 2015


IEdmVersion8 Interface

IEdmVersion8 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmVersion8 Interface

Allows you to access the version of a file.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmVersion8
   Inherits IEdmVersion5, IEdmVersion6, IEdmVersion7
C#
public interface IEdmVersion8 : IEdmVersion5, IEdmVersion6, IEdmVersion7
C++/CLI
public interface class IEdmVersion8 : public IEdmVersion5, IEdmVersion6, IEdmVersion7

Example

Roll Back Revisions (C#)
Roll Back Revisions (VB.NET)

Remarks

This interface extends IEdmVersion7.

See Also

IEdmVersion8 Members
EPDM.Interop.epdm Namespace


IEdmVersion8 Interface Members

IEdmVersion8 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmVersion8 Interface

The following tables list the members exposed by IEdmVersion8.

Public Methods

 | Name | Description
Method | Rollback3 | Discards all versions of the file after this version.
Top

See Also

IEdmVersion8 Interface
EPDM.Interop.epdm Namespace


IEdmVersion8 Interface Methods

IEdmVersion8 Interface Methods
EPDM.Interop.epdm Namespace : IEdmVersion8 Interface

For a list of all members of this type, see IEdmVersion8 members.

Public Methods

 | Name | Description
Method | Rollback3 | Discards all versions of the file after this version.
Top

See Also

IEdmVersion8 Interface
EPDM.Interop.epdm Namespace


Rollback3 Method (IEdmVersion8)

Rollback3 Method (IEdmVersion8)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVersion8 Interface : Rollback3 Method (IEdmVersion8)

bsComment
Comment for this rollback
vbRedirectParentRefs
True to roll back the file with its parent references, false to roll back the file without its parent references
Discards all versions of the file after this version.

Syntax

Visual Basic
Sub Rollback3( _
   ByVal bsComment As System.String, _
   ByVal vbRedirectParentRefs As System.Boolean _
)
C#
void Rollback3(
   System.string bsComment,
   System.bool vbRedirectParentRefs
)
C++/CLI
void Rollback3(
&   System.String^ bsComment,
&   System.bool vbRedirectParentRefs
)

Parameters

bsComment
Comment for this rollback
vbRedirectParentRefs
True to roll back the file with its parent references, false to roll back the file without its parent references

Remarks

This method deletes both the file data and the file data card data when it deletes versions. You cannot undo this rollback, unless you restore a complete backup of the database and the file archives.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user does not have permission to delete files.
  • E_EDM_INVALID_REVISION_NUMBER: The version does not exist.

See Also

IEdmVersion8 Interface
IEdmVersion8 Members
IEdmRevision7::Rollback3 Method ()
IEdmEnumeratorVersion7::Rollback3 Method ()

Availability

SOLIDWORKS PDM Professional 2017


IEdmWorkflow6 Interface

IEdmWorkflow6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmWorkflow6 Interface

Allows you to access a workflow set up using SOLIDWORKS PDM Professional's Workflow Editor.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmWorkflow6
   Inherits IEdmObject5
C#
public interface IEdmWorkflow6 : IEdmObject5
C++/CLI
public interface class IEdmWorkflow6 : public IEdmObject5

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface inherits from IEdmObject5 and supersedes IEdmWorkflow5.

Use IEdmWorkflowMgr6 to enumerate the installed workflows.

Accessors

IEdmVault5::GetObject

IEdmWorkflowMgr6::GetNextWorkflow

See Also

IEdmWorkflow6 Members
EPDM.Interop.epdm Namespace


IEdmWorkflow6 Interface Members

IEdmWorkflow6 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmWorkflow6 Interface

The following tables list the members exposed by IEdmWorkflow6.

Public Properties

 | Name | Description
Property | Description | Gets the description of this workflow that is entered in the SOLIDWORKS PDM Professional Workflow Editor.
Property | InitialState | Gets the state in which new files are placed when they are checked in the first time.
Top

Public Methods

 | Name | Description
Method | GetFirstStatePosition | Starts an enumeration of the states in this workflow.
Method | GetFirstTransitionPosition | Starts an enumeration of the state transitions in this workflow.
Method | GetNextState | Gets the next workflow state in an enumeration.
Method | GetNextTransition | Gets the next workflow state transition in an enumeration.
Method | GetState | Gets the workflow state with the specified ID or name.
Method | GetTransition | Gets the workflow state transition with the specified ID.
Top

See Also

IEdmWorkflow6 Interface
EPDM.Interop.epdm Namespace


IEdmWorkflow6 Interface Methods

IEdmWorkflow6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmWorkflow6 Interface

For a list of all members of this type, see IEdmWorkflow6 members.

Public Methods

 | Name | Description
Method | GetFirstStatePosition | Starts an enumeration of the states in this workflow.
Method | GetFirstTransitionPosition | Starts an enumeration of the state transitions in this workflow.
Method | GetNextState | Gets the next workflow state in an enumeration.
Method | GetNextTransition | Gets the next workflow state transition in an enumeration.
Method | GetState | Gets the workflow state with the specified ID or name.
Method | GetTransition | Gets the workflow state transition with the specified ID.
Top

See Also

IEdmWorkflow6 Interface
EPDM.Interop.epdm Namespace


GetFirstStatePosition Method (IEdmWorkflow6)

GetFirstStatePosition Method (IEdmWorkflow6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : GetFirstStatePosition Method (IEdmWorkflow6)

Starts an enumeration of the states in this workflow.

Syntax

Visual Basic
Function GetFirstStatePosition() As IEdmPos5
C#
IEdmPos5 GetFirstStatePosition()
C++/CLI
IEdmPos5^ GetFirstStatePosition();

Return Value

IEdmPos5; position of the first workflow state in the enumeration

Example

See the IEdmWorkflow6 examples.

Remarks

After calling this method, pass the returned position of the first workflow state to IEdmWorkflow6::GetNextState to get the first workflow state in this list. Then call IEdmWorkflow6::GetNextState repeatedly to get the rest of the workflow states.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetFirstTransitionPosition Method (IEdmWorkflow6)

GetFirstTransitionPosition Method (IEdmWorkflow6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : GetFirstTransitionPosition Method (IEdmWorkflow6)

Starts an enumeration of the state transitions in this workflow.

Syntax

Visual Basic
Function GetFirstTransitionPosition() As IEdmPos5
C#
IEdmPos5 GetFirstTransitionPosition()
C++/CLI
IEdmPos5^ GetFirstTransitionPosition();

Return Value

IEdmPos5; position of the first workflow state transition in the enumeration

Example

Graph a Workflow (VB.NET)
Graph a Workflow (C#)

Remarks

After calling this method, pass the returned position of the first workflow state transition to IEdmWorkflow6::GetNextTransition to get the first workflow state transition in this list. Then call IEdmWorkflow6::GetNextTransition repeatedly to get the rest of the workflow state transitions.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetNextState Method (IEdmWorkflow6)

GetNextState Method (IEdmWorkflow6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : GetNextState Method (IEdmWorkflow6)

poPos
IEdmPos5; position of the next workflow state in the list
Gets the next workflow state in an enumeration.

Syntax

Visual Basic
Function GetNextState( _
   ByVal poPos As IEdmPos5 _
) As IEdmState6
C#
IEdmState6 GetNextState(
   IEdmPos5 poPos
)
C++/CLI
IEdmState6^ GetNextState(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next workflow state in the list

Return Value

IEdmState6

Example

See the IEdmWorkflow6 examples.

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first workflow state in the list, IEdmPos5. Call IEdmWorkflow6::GetFirstStatePosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the workflow states in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmState6.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetNextTransition Method (IEdmWorkflow6)

GetNextTransition Method (IEdmWorkflow6)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : GetNextTransition Method (IEdmWorkflow6)

poPos
IEdmPos5; position of the next workflow state transition in the list
Gets the next workflow state transition in an enumeration.

Syntax

Visual Basic
Function GetNextTransition( _
   ByVal poPos As IEdmPos5 _
) As IEdmTransition6
C#
IEdmTransition6 GetNextTransition(
   IEdmPos5 poPos
)
C++/CLI
IEdmTransition6^ GetNextTransition(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next workflow state transition in the list

Return Value

IEdmTransition6

Example

Graph a Workflow (VB.NET)
Graph a Workflow (C#)

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first workflow state transition in the list, IEdmPos5. Call IEdmWorkflow6::GetFirstTransitionPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the workflow state transitions in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmTransition6.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetState Method (IEdmWorkflow6)

GetState Method (IEdmWorkflow6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : GetState Method (IEdmWorkflow6)

poIdOrName
ID or name of workflow state to get
Gets the workflow state with the specified ID or name.

Syntax

Visual Basic
Function GetState( _
   ByRef poIdOrName As System.Object _
) As IEdmState6
C#
IEdmState6 GetState(
   ref System.object poIdOrName
)
C++/CLI
IEdmState6^ GetState(
&   System.Object^% poIdOrName
)

Parameters

poIdOrName
ID or name of workflow state to get

Return Value

IEdmState6; Null if poIdOrName is invalid

Remarks

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmState6.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: poIdOrName contains an invalid name.
  • E_EDM_INVALID_ID: poIdOrName contain an invalid ID.

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetTransition Method (IEdmWorkflow6)

GetTransition Method (IEdmWorkflow6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : GetTransition Method (IEdmWorkflow6)

lTransitionID
ID of workflow state transition to get
Gets the workflow state transition with the specified ID.

Syntax

Visual Basic
Function GetTransition( _
   ByVal lTransitionID As System.Integer _
) As IEdmTransition6
C#
IEdmTransition6 GetTransition(
   System.int lTransitionID
)
C++/CLI
IEdmTransition6^ GetTransition(
&   System.int lTransitionID
)

Parameters

lTransitionID
ID of workflow state transition to get

Return Value

IEdmTransition6

Remarks

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmTransition6.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: lTransitionID is invalid.

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmWorkflow6 Interface Properties

IEdmWorkflow6 Interface Properties
EPDM.Interop.epdm Namespace : IEdmWorkflow6 Interface

For a list of all members of this type, see IEdmWorkflow6 members.

Public Properties

 | Name | Description
Property | Description | Gets the description of this workflow that is entered in the SOLIDWORKS PDM Professional Workflow Editor.
Property | InitialState | Gets the state in which new files are placed when they are checked in the first time.
Top

See Also

IEdmWorkflow6 Interface
EPDM.Interop.epdm Namespace


Description Property (IEdmWorkflow6)

Description Property (IEdmWorkflow6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : Description Property (IEdmWorkflow6)

Gets the description of this workflow that is entered in the SOLIDWORKS PDM Professional Workflow Editor.

Syntax

Visual Basic
ReadOnly Property Description As System.String
C#
System.string Description {get;}
C++/CLI
property System.String^ Description {
   System.String^ get();
}

Property Value

Workflow description

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


InitialState Property (IEdmWorkflow6)

InitialState Property (IEdmWorkflow6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow6 Interface : InitialState Property (IEdmWorkflow6)

Gets the state in which new files are placed when they are checked in the first time.

Syntax

Visual Basic
ReadOnly Property InitialState As IEdmState6
C#
IEdmState6 InitialState {get;}
C++/CLI
property IEdmState6^ InitialState {
   IEdmState6^ get();
}

Property Value

IEdmState6

See Also

IEdmWorkflow6 Interface
IEdmWorkflow6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


IEdmWorkflowMgr6 Interface

IEdmWorkflowMgr6 Interface
See Also Members Example
[image]
EPDM.Interop.epdm Namespace : IEdmWorkflowMgr6 Interface

Allows you to access the workflows installed in a file vault.

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmWorkflowMgr6
C#
public interface IEdmWorkflowMgr6
C++/CLI
public interface class IEdmWorkflowMgr6

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This interface inherits from IDispatch. See IDispatch Interface (Automation).

Accessors

IEdmVault7::CreateUtility

See Also

IEdmWorkflowMgr6 Members
EPDM.Interop.epdm Namespace


IEdmWorkflowMgr6 Interface Members

IEdmWorkflowMgr6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmWorkflowMgr6 Interface

The following tables list the members exposed by IEdmWorkflowMgr6.

Public Methods

 | Name | Description
Method | GetFirstWorkflowPosition | Starts an enumeration of all the workflows in the vault.
Method | GetNextWorkflow | Gets the next workflow in an enumeration.
Top

See Also

IEdmWorkflowMgr6 Interface
EPDM.Interop.epdm Namespace


IEdmWorkflowMgr6 Interface Methods

IEdmWorkflowMgr6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmWorkflowMgr6 Interface

For a list of all members of this type, see IEdmWorkflowMgr6 members.

Public Methods

 | Name | Description
Method | GetFirstWorkflowPosition | Starts an enumeration of all the workflows in the vault.
Method | GetNextWorkflow | Gets the next workflow in an enumeration.
Top

See Also

IEdmWorkflowMgr6 Interface
EPDM.Interop.epdm Namespace


GetFirstWorkflowPosition Method (IEdmWorkflowMgr6)

GetFirstWorkflowPosition Method (IEdmWorkflowMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflowMgr6 Interface : GetFirstWorkflowPosition Method (IEdmWorkflowMgr6)

Starts an enumeration of all the workflows in the vault.

Syntax

Visual Basic
Function GetFirstWorkflowPosition() As IEdmPos5
C#
IEdmPos5 GetFirstWorkflowPosition()
C++/CLI
IEdmPos5^ GetFirstWorkflowPosition();

Return Value

IEdmPos5; position of the first workflow in the enumeration

Example

See the IEdmWorkflowMgr6 examples.

Remarks

After calling this method, pass the returned position of the first workflow to IEdmWorkflowMgr6::GetNextWorkflow to get the first workflow in this list. Then call IEdmWorkflowMgr6::GetNextWorkflow repeatedly to get the rest of the workflows.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmPos5.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmWorkflowMgr6 Interface
IEdmWorkflowMgr6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetNextWorkflow Method (IEdmWorkflowMgr6)

GetNextWorkflow Method (IEdmWorkflowMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflowMgr6 Interface : GetNextWorkflow Method (IEdmWorkflowMgr6)

poPos
IEdmPos5; position of the next workflow in the list
Gets the next workflow in an enumeration.

Syntax

Visual Basic
Function GetNextWorkflow( _
   ByVal poPos As IEdmPos5 _
) As IEdmWorkflow6
C#
IEdmWorkflow6 GetNextWorkflow(
   IEdmPos5 poPos
)
C++/CLI
IEdmWorkflow6^ GetNextWorkflow(
&   IEdmPos5^ poPos
)

Parameters

poPos
IEdmPos5; position of the next workflow in the list

Return Value

IEdmWorkflow6

Example

See the IEdmWorkflowMgr6 examples.

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first workflow in the list, IEdmPos5. Call IEdmWorkflowMgr6::GetFirstWorkflowPosition to obtain poPos.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the workflows in the list.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ users not using smart-pointer wrapper functions must release the returned interface, IEdmWorkflow6.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmWorkflowMgr6 Interface
IEdmWorkflowMgr6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


CreateMenuFlags Enumeration

CreateMenuFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : CreateMenuFlags Enumeration

Types of menu used in calls to IEdmVault5::CreatePluginMenu. Bitmask.

Syntax

Visual Basic
Public Enum CreateMenuFlags
   Inherits System.Enum
C#
public enum CreateMenuFlags : System.Enum
C++/CLI
public enum class CreateMenuFlags : public System.Enum

Members

Member | Description
Cmf_AddMenuIcons | 32 = Adds toolbar button bitmaps to the menu
Cmf_AllItemsInSameFolder | 1 = All of the selected files and folders are located in the same parent folder
Cmf_ContextMenu | 8 = Context-sensitive menu; not a standard popup menu
Cmf_ContextMenuItem | 64 = Context-sensitive menu for an item
Cmf_ContextMenuItemFolder | 128 = Context-sensitive menu for an item folder
Cmf_DisableAddInReload | 16 = Prevent SOLIDWORKS PDM Professional from querying the database to check whether updates have been made to the number of installed add-ins; this can be used to optimize the execution when called several times in a row
Cmf_GrayOutInvalidItems | 4 = Disable menu items that are not currently applicable
Cmf_IncludeAdminReactors | 2 = Include the Administrate Add-ins command
Cmf_ItemToolsMenu | 256 = Tools > Item menu in the Item Explorer
Cmf_MenuBarAction | 512 = Actions menu in the File Explorer
Cmf_MenuBarDisplay | 2048 = Display menu in File Explorer
Cmf_MenuBarModify | 1024 = Modify menu in File Explorer
Cmf_MenuBarTools | 4096 = Tools menu in File Explorer

See Also

EPDM.Interop.epdm Namespace


EdmAddAddInFlags Enumeration

EdmAddAddInFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmAddAddInFlags Enumeration

Options for adding add-ins. Used by IEdmAddInMgr5::AddAddIns.

Syntax

Visual Basic
Public Enum EdmAddAddInFlags
   Inherits System.Enum
C#
public enum EdmAddAddInFlags : System.Enum
C++/CLI
public enum class EdmAddAddInFlags : public System.Enum

Members

Member | Description
EdmAddin_AddAllFilesToOneAddIn | 1 = Add all of the files passed to IEdmAddInMgr5::AddAddIns to the same add-in; this is useful for creating an add-in that has both a 64-bit DLL and a 32-bit DLL
EdmAddin_Nothing | 0 = Attempt to create one add-in per file that is passed to IEdmAddInMgr5::AddAddIns
EdmAddin_ReplaceDuplicates | 2 = Replace an existing add-in that has the same COM class ID (CLSID) and package name; IEdmAddInMgr5::AddAddIns returns an error if the existing add-in has the same CLSID but a different package name

See Also

EPDM.Interop.epdm Namespace


EdmAddCallbackMsgID Enumeration

EdmAddCallbackMsgID Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmAddCallbackMsgID Enumeration

Message IDs used in the message box during an add operation.

Syntax

Visual Basic
Public Enum EdmAddCallbackMsgID
   Inherits System.Enum
C#
public enum EdmAddCallbackMsgID : System.Enum
C++/CLI
public enum class EdmAddCallbackMsgID : public System.Enum

Members

Member | Description
EdmAddMsg_ClearUnique | 2 = Copy over the existing file that has unique values?
EdmAddMsg_DeleteSource | 5 = Could not delete a source file during a move operation
EdmAddMsg_FileFmtReadError | 4 = File could not be read by the file format plugin
EdmAddMsg_GenericError | 0 = Generic error
EdmAddMsg_MissingPluginComponent | 3 = File format plugin component is missing
EdmAddMsg_ReplaceLocal | 1 = Replace the existing file with the same name?

See Also

EPDM.Interop.epdm Namespace


EdmAddFileDlgFlag Enumeration

EdmAddFileDlgFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmAddFileDlgFlag Enumeration

Flags used in IEdmBatchAdd2::ShowDlg to control the appearance of the dialog box.

Syntax

Visual Basic
Public Enum EdmAddFileDlgFlag
   Inherits System.Enum
C#
public enum EdmAddFileDlgFlag : System.Enum
C++/CLI
public enum class EdmAddFileDlgFlag : public System.Enum

Members

Member | Description
Eafdf_Nothing | 0 = Default behavior

See Also

EPDM.Interop.epdm Namespace


EdmAddFlag Enumeration

EdmAddFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmAddFlag Enumeration

Options for adding a file to a folder to the vault, copying a file or folder within the vault, or copying/moving a tree of files and folders. Bitmask.

Syntax

Visual Basic
Public Enum EdmAddFlag
   Inherits System.Enum
C#
public enum EdmAddFlag : System.Enum
C++/CLI
public enum class EdmAddFlag : public System.Enum

Members

Member | Description
EdmAdd_DeleteSource | 64 = Delete the source file once it has been added to the vault
EdmAdd_DoNotCopy | 512 = Do not physically copy the file during the add operations because the file has already been copied
EdmAdd_DontAddCorrupt | 2 = Refuse to add corrupt files; IEdmFolder5::AddFile returns the error code E_EDM_INVALID_FILE
EdmAdd_ForceGenerateSerialNumbers | 128 = Force regeneration of serial numbers when values already exist; if this flag is not set, SOLIDWORKS PDM Professional will only generate values that are missing in the file
EdmAdd_GetInterface | 256 = Return the file interface; only works with IEdmBatchAdd
EdmAdd_KeepExistingSerialNumbers | 4 = Do not replace existing serial numbers with new ones; SOLIDWORKS PDM Professional still creates serial numbers for empty fields; if this flag is not set, SOLIDWORKS PDM Professional writes over existing serial numbers with new ones
EdmAdd_Refresh | 1 = Make all file listings in File Explorer and Open/Save As dialog boxes refresh so that the new file is displayed
EdmAdd_Simple | 0 = Add the file
EdmAdd_UniqueVarClearDuplicate | 16 = Clear duplicated unique constrained variables instead of failing
EdmAdd_UniqueVarDelayCheck | 32 = Delay the unique variable check until the next check-in

See Also

EPDM.Interop.epdm Namespace


EdmAddInFileInfoFlags Enumeration

EdmAddInFileInfoFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmAddInFileInfoFlags Enumeration

Types of file in the add-in package used in EdmAddInFileInfo. Bitmask.

Syntax

Visual Basic
Public Enum EdmAddInFileInfoFlags
   Inherits System.Enum
C#
public enum EdmAddInFileInfoFlags : System.Enum
C++/CLI
public enum class EdmAddInFileInfoFlags : public System.Enum

Members

Member | Description
EdmAdfif_AddInObject32 | 2 = File contains the 32-bit IEdmAddIn5 implementation; the code is used only in combination with EdmAdfif_ComDLL32
EdmAdfif_AddInObject64 | 8 = File contains the 64-bit IEdmAddIn5 implementation; the code is used only in combination with EdmAdfif_ComDLL64
EdmAdfif_ComDll32 | 1 = File should be COM-registered in a 32-bit process
EdmAdfif_ComDll64 | 4 = File should be COM-registered in a 64-bit process
EdmAdfif_DataFile | 0 = Data file that is copied and maintained but not otherwise used by SOLIDWORKS PDM Professional

See Also

EPDM.Interop.epdm Namespace


EdmBatchAddFlag Enumeration

EdmBatchAddFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBatchAddFlag Enumeration

Flags used by IEdmBatchAdd::CommitAdd.

Syntax

Visual Basic
Public Enum EdmBatchAddFlag
   Inherits System.Enum
C#
public enum EdmBatchAddFlag : System.Enum
C++/CLI
public enum class EdmBatchAddFlag : public System.Enum

Members

Member | Description
EdmBaf_Nothing | 0 = Default behavior
EdmBaf_ReplaceDuplicateFiles | 1 = Replace existing files instead of skipping them

See Also

EPDM.Interop.epdm Namespace


EdmBatchAddFolderFlag Enumeration

EdmBatchAddFolderFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBatchAddFolderFlag Enumeration

Flags used by IEdmBatchAddFolders::AddFolder to specify the behavior of the added folder.

Syntax

Visual Basic
Public Enum EdmBatchAddFolderFlag
   Inherits System.Enum
C#
public enum EdmBatchAddFolderFlag : System.Enum
C++/CLI
public enum class EdmBatchAddFolderFlag : public System.Enum

Members

Member | Description
Ebaff_DisableRefresh | 2 = Disable the automatic refresh of folder listings in File Explorer
Ebaff_GetInterface | 1 = Return IEdmFolder6 for the folder in the EdmFolderInfo structure that is returned by IEdmBatchAddFolders::Create
Ebaff_Nothing | 0 = Standard behavior

See Also

EPDM.Interop.epdm Namespace


EdmBatchCreateFolderFlag Enumeration

EdmBatchCreateFolderFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBatchCreateFolderFlag Enumeration

Flags used by IEdmBatchAddFolders::Create.

Syntax

Visual Basic
Public Enum EdmBatchCreateFolderFlag
   Inherits System.Enum
C#
public enum EdmBatchCreateFolderFlag : System.Enum
C++/CLI
public enum class EdmBatchCreateFolderFlag : public System.Enum

Members

Member | Description
Ebcf_Nothing | 0 = Default behavior
Ebcf_RenameExistingRoots | 1 = If this flag is specified, and one of the folders added with IEdmBatchAddFolders::AddFolder already exists in the file vault, the folder is added and renamed to "Copy of Xxxx", where "Xxxx" is the original name. If this flag is not set, the original folder is returned.

See Also

EPDM.Interop.epdm Namespace


EdmBatchFlags Enumeration

EdmBatchFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBatchFlags Enumeration

Flags used in IEdmBatchUpdate::SetVar and IEdmBatchUpdate2::SetFolderVar to control the behavior of IEdmBatchUpdate and IEdmBatchUpdate2. Bitmask.

Syntax

Visual Basic
Public Enum EdmBatchFlags
   Inherits System.Enum
C#
public enum EdmBatchFlags : System.Enum
C++/CLI
public enum class EdmBatchFlags : public System.Enum

Members

Member | Description
EdmBatch_AllConfigs | 1 = Ignore the configuration argument and update the variable value in all configurations
EdmBatch_Nothing | 0 = Normal operation
EdmBatch_RefreshPreview | 2 = Reload data card
EdmBatch_UpdateVarIfNotPartOfCard | 4 = Update all variables, even those that are not visible in this data card

See Also

EPDM.Interop.epdm Namespace


EdmBomColumnType Enumeration

EdmBomColumnType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBomColumnType Enumeration

Types of Bill of Material (BOM) column content; specified in EdmBomColumn and in calls to IEdmBomCell:GetVar, and IEdmBomCell::SetVar.

Syntax

Visual Basic
Public Enum EdmBomColumnType
   Inherits System.Enum
C#
public enum EdmBomColumnType : System.Enum
C++/CLI
public enum class EdmBomColumnType : public System.Enum

Members

Member | Description
EdmBomCol_Configuration | 21 = Name of the current configuration
EdmBomCol_Date | 3 = Modified date of file
EdmBomCol_DocType | 12 = Document
EdmBomCol_FileSize | 2 = File size in bytes
EdmBomCol_FileType | 10 = File type
EdmBomCol_FoundInVersion | 9 = Version where found
EdmBomCol_ID | 23 = File ID
EdmBomCol_LatestFileDate | 17 = File date of the latest version
EdmBomCol_LatestVersion | 4 = Latest version number of the file
EdmBomCol_LockDomain | 15 = Name of computer where file is checked out
EdmBomCol_LockedIn | 8 = Computer name and path of checked-out file
EdmBomCol_LockPath | 14 = File path of checked-out file
EdmBomCol_LockUser | 7 = Name of user who has checked out the file
EdmBomCol_LockUserID | 13 = ID of user who has checked out the file
EdmBomCol_LockViewID | 18 = ID of vault view where file is checked out
EdmBomCol_Name | 1 = File or folder name
EdmBomCol_PartNumber | 24 = Document name, configuration name, or user-specified name; used in BOM lists
EdmBomCol_Path | 5 = Path to file folder
EdmBomCol_RefCount | 11 = Reference count or BOM Quantity
EdmBomCol_RefCountNoBomQty | 25 = Reference count that is not multiplied by BOM quantity
EdmBomCol_RefVariable | 22 = Variable set on a reference to the file, e.g., position number, cut length, etc.
EdmBomCol_Shared | 19 = Number of folders in which the file is shared
EdmBomCol_State | 6 = File workflow state name + new line + file workflow state icon name
EdmBomCol_StateName | 16 = File workflow state name
EdmBomCol_Variable | 0 = This column is linked to a card variable

See Also

EPDM.Interop.epdm Namespace


EdmBomFlag Enumeration

EdmBomFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBomFlag Enumeration

Bill of Materials options used in calls to IEdmFile7::GetComputedBOM. Bitmask.

Syntax

Visual Basic
Public Enum EdmBomFlag
   Inherits System.Enum
C#
public enum EdmBomFlag : System.Enum
C++/CLI
public enum class EdmBomFlag : public System.Enum

Members

Member | Description
EdmBf_AsBuilt | 1 = Include as-built referenced files, i.e., the versions which were present in the cache when the parent file was checked in
EdmBf_ShowSelected | 2 = Include the selected file in the Bill of Materials; if this flag is not set, only its children are included

See Also

EPDM.Interop.epdm Namespace


EdmBomInsertRowOption Enumeration

EdmBomInsertRowOption Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBomInsertRowOption Enumeration

Bill of Materials row insertion options for IEdmBomView2::InsertRow.

Syntax

Visual Basic
Public Enum EdmBomInsertRowOption
   Inherits System.Enum
C#
public enum EdmBomInsertRowOption : System.Enum
C++/CLI
public enum class EdmBomInsertRowOption : public System.Enum

Members

Member | Description
EdmBomInsertRowOption_AboveRow | 0 = Insert the new row above the specified row
EdmBomInsertRowOption_AsChild | 2 = Insert the new row as a child of the specified row
EdmBomInsertRowOption_BelowRow | 1 = Insert the new row below the specified row

See Also

EPDM.Interop.epdm Namespace


EdmBomSetVarOption Enumeration

EdmBomSetVarOption Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBomSetVarOption Enumeration

Types of value passed in IEdmBomCell::SetVar.

Syntax

Visual Basic
Public Enum EdmBomSetVarOption
   Inherits System.Enum
C#
public enum EdmBomSetVarOption : System.Enum
C++/CLI
public enum class EdmBomSetVarOption : public System.Enum

Members

Member | Description
EdmBomSetVarOption_Both | 2 = Both computed and edited value
EdmBomSetVarOption_Computed | 0 = Computed value
EdmBomSetVarOption_Edited | 1 = Edited value

See Also

EPDM.Interop.epdm Namespace


EdmBomType Enumeration

EdmBomType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBomType Enumeration

Types of BOM passed in EdmBomInfo and EdmBomLayout2 structures.

Syntax

Visual Basic
Public Enum EdmBomType
   Inherits System.Enum
C#
public enum EdmBomType : System.Enum
C++/CLI
public enum class EdmBomType : public System.Enum

Members

Member | Description
Computed | 0 = The BOM is computed (check in/out and workflow are not supported)
ComputedActivated | 1 = The BOM is computed, and the Activated checkbox is checked so the BOM appears in File Explorer
ItemBOM | 8
Saved | 2 = The user has saved this BOM
SWBOM | 3 = SOLIDWORKS BOM
SWBOMActivated | 4 = SOLIDWORKS BOM, and the Activated checkbox is checked so the BOM appears in File Explorer
SWBOMSaved | 5 = The user has saved this SOLIDWORKS BOM
UndefinedBOM | 9 = BOM template
WeldmentBOM | 7 = Used as a weldment BOM in the preview
WeldmentCutlist | 6 = Used as a weldment cutlist in the preview

See Also

EPDM.Interop.epdm Namespace


EdmBomVersionType Enumeration

EdmBomVersionType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBomVersionType Enumeration

Types of content specified in EdmBomVersion.meType.

Syntax

Visual Basic
Public Enum EdmBomVersionType
   Inherits System.Enum
C#
public enum EdmBomVersionType : System.Enum
C++/CLI
public enum class EdmBomVersionType : public System.Enum

Members

Member | Description
EdmBomVer_Label | 2 = Label created by the user
EdmBomVer_Revision | 1 = User-defined revision number
EdmBomVer_Version | 0 = Check-in version number

See Also

EPDM.Interop.epdm Namespace


EdmBrowseFlag Enumeration

EdmBrowseFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBrowseFlag Enumeration

Browse options used in calls to IEdmVault5::BrowseForFile. Bitmask.

Syntax

Visual Basic
Public Enum EdmBrowseFlag
   Inherits System.Enum
C#
public enum EdmBrowseFlag : System.Enum
C++/CLI
public enum class EdmBrowseFlag : public System.Enum

Members

Member | Description
EdmBws_ForOpen | 0 = Display the Open dialog box
EdmBws_ForSave | 1 = Display a Save As dialog box
EdmBws_Help | 32 = Display Help in the dialog box
EdmBws_PermitExternalFiles | 16 = Permit the user to select files that are outside the file vault folder tree
EdmBws_PermitLocalFiles | 4 = Permit the user to select files that are inside the file vault folder tree, but not checked in to the vault
EdmBws_PermitMultipleSel | 2 = Permit the user to select more than one file
EdmBws_PermitVaultFiles | 8 = Permit the user to select files that are part of the file vault

See Also

EPDM.Interop.epdm Namespace


EdmBrowseForFolderFlag Enumeration

EdmBrowseForFolderFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmBrowseForFolderFlag Enumeration

Browse options used in calls to IEdmVault11::BrowseForFolder2.

Syntax

Visual Basic
Public Enum EdmBrowseForFolderFlag
   Inherits System.Enum
C#
public enum EdmBrowseForFolderFlag : System.Enum
C++/CLI
public enum class EdmBrowseForFolderFlag : public System.Enum

Members

Member | Description
EdmBwsFld_ExclFileFolders | 1 = Do not permit browsing in file folders
EdmBwsFld_ExclItemFolders | 2 = Do not permit browsing in item folders
EdmBwsFld_None | 0 = Default behavior; permit browsing in both item and file folders

See Also

EPDM.Interop.epdm Namespace


EdmButtonState Enumeration

EdmButtonState Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmButtonState Enumeration

States of a toolbar button; used in calls to IEdmAddInDrawButton5:DrawToolbarButton, IEdmCmdMgr5::AddToolbarImage, and IEdmMenu5::GetButtonImages.

Syntax

Visual Basic
Public Enum EdmButtonState
   Inherits System.Enum
C#
public enum EdmButtonState : System.Enum
C++/CLI
public enum class EdmButtonState : public System.Enum

Members

Member | Description
BState_Cold | 2 = Normal button display
BState_Disabled | 3 = Button is disabled
BState_Hot | 1 = Mouse cursor is hovering over the toolbar button; button should be highlighted

See Also

EPDM.Interop.epdm Namespace


EdmCardControlType Enumeration

EdmCardControlType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCardControlType Enumeration

File or folder data card control types; used in calls to IEdmCardControl5::ControlType.

Syntax

Visual Basic
Public Enum EdmCardControlType
   Inherits System.Enum
C#
public enum EdmCardControlType : System.Enum
C++/CLI
public enum class EdmCardControlType : public System.Enum

Members

Member | Description
EdmCtrl_Button | 5 = Push button
EdmCtrl_Checkbox | 13 = Check box
EdmCtrl_ComboboxDropdown | 8 = Combo box with a drop-down list and an edit box
EdmCtrl_ComboboxDroplist | 9 = Combo box with a drop-down list
EdmCtrl_ComboboxSimple | 7 = Combo box with a list that is always visible
EdmCtrl_CustomPropertySearch | 15 = Search tool control
EdmCtrl_CustomVariableTree | 16 = Search tool control
EdmCtrl_DatePicker | 14 = Date control
EdmCtrl_Editbox | 4 = Edit box
EdmCtrl_Frame | 3 = Static frame with optional text
EdmCtrl_Image | 1 = Static image
EdmCtrl_Invalid | 0 = Error
EdmCtrl_Listbox | 10 = List box
EdmCtrl_RadioColumn | 6 = Radio button
EdmCtrl_Tab | 11 = Tab control with one or more pages
EdmCtrl_Text | 2 = Static text
EdmCtrl_Viewer | DO NOT USE

See Also

EPDM.Interop.epdm Namespace


EdmCardFlag Enumeration

EdmCardFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCardFlag Enumeration

Options for file data card behavior used in EdmCmdData; use these flags to tell SOLIDWORKS PDM Professional what to do when IEdmAddIn5::OnCmd returns.

Syntax

Visual Basic
Public Enum EdmCardFlag
   Inherits System.Enum
C#
public enum EdmCardFlag : System.Enum
C++/CLI
public enum class EdmCardFlag : public System.Enum

Members

Member | Description
EdmCF_CloseDlgCancel | 2 = Close dialog and do not save changes
EdmCF_CloseDlgOK | 1 = Close dialog and save changes
EdmCF_Nothing | 0 = Do nothing

See Also

EPDM.Interop.epdm Namespace


EdmCardType Enumeration

EdmCardType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCardType Enumeration

Types of data card used in calls to IEdmVault6::GetCardID.

Syntax

Visual Basic
Public Enum EdmCardType
   Inherits System.Enum
C#
public enum EdmCardType : System.Enum
C++/CLI
public enum class EdmCardType : public System.Enum

Members

Member | Description
EdmCard_File | 0 = File data card
EdmCard_Folder | 1 = Folder data card
EdmCard_Search | 3 = Search card used by the search tool
EdmCard_Template | 2 = Template card used by the template manager

See Also

EPDM.Interop.epdm Namespace


EdmCardViewFlag Enumeration

EdmCardViewFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCardViewFlag Enumeration

Options for appearance and functionality of card views created with IEdmVault10::CreateCardViewEx2 and IEdmFolder10::CreateCardView2. Bitmask.

Syntax

Visual Basic
Public Enum EdmCardViewFlag
   Inherits System.Enum
C#
public enum EdmCardViewFlag : System.Enum
C++/CLI
public enum class EdmCardViewFlag : public System.Enum

Members

Member | Description
EdmCvf_3StateCheckboxes | 2 = Permit three-state checkboxes
EdmCvf_CallSaveOnCtrlReturn | 512 = Save on CTRL-Enter
EdmCvf_ComputeDefaultValues | 8 = Compute default values in the card
EdmCvf_DisableButtons | 256 = Disable all buttons in the card
EdmCvf_Normal | 253 = Default (1+4+8+16+32+64+128)
EdmCvf_Nothing | 0 = Nothing
EdmCvf_PermitComputedValues | 64 = Permit controls to receive values from input formulas
EdmCvf_PermitControlledTabs | 1 = Permit controlling tab controls with variables
EdmCvf_PermitReadOnlyFields | 32 = Permit the card to have read-only fields
EdmCvf_RunFormulas | 4 = Evaluate input formulas in the card
EdmCvf_RunFormulasOnOpen | 1024 = Force execution of formulas on all controls when opened
EdmCvf_SearchMode | 130 = Search tool mode (2+128)
EdmCvf_SerNoMenu | 1048576 = Show shortcut menu for serial numbers
EdmCvf_TextureBackground | 128 = Fade the card background
EdmCvf_VerifyValues | 16 = Check mandatory and unique values during save

See Also

EPDM.Interop.epdm Namespace


EdmCardViewUpdateType Enumeration

EdmCardViewUpdateType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCardViewUpdateType Enumeration

Card control update types; used in calls to IEdmCardView63::Update.

Syntax

Visual Basic
Public Enum EdmCardViewUpdateType
   Inherits System.Enum
C#
public enum EdmCardViewUpdateType : System.Enum
C++/CLI
public enum class EdmCardViewUpdateType : public System.Enum

Members

Member | Description
EdmCvut_DisableCtrl | 2 = Disable the control
EdmCvut_EnableCtrl | 1 = Enable the control

See Also

EPDM.Interop.epdm Namespace


EdmChangeStateFileListFlag Enumeration

EdmChangeStateFileListFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmChangeStateFileListFlag Enumeration

Options for returning files when making calls to IEdmBatchChangeState::GetFileList. Bitmask.

Syntax

Visual Basic
Public Enum EdmChangeStateFileListFlag
   Inherits System.Enum
C#
public enum EdmChangeStateFileListFlag : System.Enum
C++/CLI
public enum class EdmChangeStateFileListFlag : public System.Enum

Members

Member | Description
Ecsflf_GetActionUpdated | 4 = Return files that were updated by an action that set a variable value
Ecsflf_GetChanged | 1 = Return files that had their state changed
Ecsflf_GetUnprocessed | 2 = Return files that did not have their state changed

See Also

EPDM.Interop.epdm Namespace


EdmClientType Enumeration

EdmClientType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmClientType Enumeration

Types of SOLIDWORKS PDM Professional client; used in calls to IEdmVault8::ClientType.

Syntax

Visual Basic
Public Enum EdmClientType
   Inherits System.Enum
C#
public enum EdmClientType : System.Enum
C++/CLI
public enum class EdmClientType : public System.Enum

Members

Member | Description
Edmct_ConisioLight | 2 = SOLIDWORKS PDM Professional Viewer
Edmct_ConisioLT | 4 = LT (Version 5.3 and older)
Edmct_ConisioProf | 0 = SOLIDWORKS PDM Professional Editor
Edmct_ConisioStd | 1 = SOLIDWORKS PDM Professional Contributor
Edmct_ConisioWeb | 3 = SOLIDWORKS PDM Professional Web
Edmct_None | -1 = No SOLIDWORKS PDM Professional client is installed
Edmct_Reserved | Do not use

See Also

EPDM.Interop.epdm Namespace


EdmCmdNodeProp Enumeration

EdmCmdNodeProp Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCmdNodeProp Enumeration

Types of command node property; used in calls to IEdmCmdNode::GetProperty.

Syntax

Visual Basic
Public Enum EdmCmdNodeProp
   Inherits System.Enum
C#
public enum EdmCmdNodeProp : System.Enum
C++/CLI
public enum class EdmCmdNodeProp : public System.Enum

Members

Member | Description
EdmCmdNode_ChildDocIDs | 2 = File IDs of child files
EdmCmdNode_IsTopNode | 1 = True if a top node, false if not
EdmCmdNode_ParentDocIDs | 3 = File IDs of parent files

See Also

EPDM.Interop.epdm Namespace


EdmCmdType Enumeration

EdmCmdType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCmdType Enumeration

Reasons for SOLIDWORKS PDM Professional to call IEdmAddIn5::OnCmd.

Syntax

Visual Basic
Public Enum EdmCmdType
   Inherits System.Enum
C#
public enum EdmCmdType : System.Enum
C++/CLI
public enum class EdmCmdType : public System.Enum

Members

Member | Description
EdmCmd_ActivateAPITab | 57 = Custom vault view tab is selected in File Explorer; sent only to add-ins that created a vault view tab in File Explorer
EdmCmd_CardButton | 37 = The user clicked either OK or a button whose command is enclosed in brackets ("<...>") in the file data card
EdmCmd_CardInput | 38 = The user modified a value in a file or folder data card
EdmCmd_CardListSrc | 39 = The add-in should provide a list that is used in a card
EdmCmd_DeSelectItem | 56 = Item is deselected File Explorer; sent only to add-ins that created a vault view tab in File Explorer
EdmCmd_InstallAddIn | 23 = The add-in is being installed
EdmCmd_Menu | 1 = User clicked a menu command or a toolbar button that was created by the add-in
EdmCmd_PostAdd | 12 = One or more files were added to the file vault
EdmCmd_PostAddFolder | 28 = One or more folders were added to the file vault
EdmCmd_PostBrowseFolder | 60 = A folder was browsed
EdmCmd_PostCopy | 20 = One or more files were copied to a new folder
EdmCmd_PostCopyFolder | 36 = One or more folders were copied to a new parent folder
EdmCmd_PostDelete | 14 = One or more files have been deleted
EdmCmd_PostDeleteFolder | 30 = One or more folders were deleted from the file vault
EdmCmd_PostGet | 26 = One or more files were copied from the archive to the local hard disk
EdmCmd_PostLabel | 47 = A label has been created
EdmCmd_PostLabelAddItem | 53 = A label has gotten a file or folder added to it
EdmCmd_PostLabelDelete | 49 = A label has been deleted
EdmCmd_PostLabelModify | 51 = A label has been renamed or gotten its comment updated
EdmCmd_PostLock | 4 = One or more files have been checked out
EdmCmd_PostMove | 22 = One or more files were moved to a new folder
EdmCmd_PostMoveFolder | 34 = One or more folders were moved to a new parent folder
EdmCmd_PostRename | 16 = One or more files were renamed
EdmCmd_PostRenameFolder | 32 = One or more folders were renamed
EdmCmd_PostShare | 18 = One or more files were shared to a new folder
EdmCmd_PostState | 10 = One or more files had their states changed
EdmCmd_PostUndoLock | 8 = One or more files had their locks removed without any changes sent to the file vault
EdmCmd_PostUnlock | 6 = One or more files have been checked in
EdmCmd_PreAdd | 11 = One or more files are about to be added to the file vault
EdmCmd_PreAddFolder | 27 = One or more folders are about to be added to the file vault
EdmCmd_PreBrowseFolder | 59 = A folder is about to be browsed
EdmCmd_PreCopy | 19 = One or more files are about to be copied to a new folder
EdmCmd_PreCopyFolder | 35 = One or more folders are about to be copied to a new parent folder
EdmCmd_PreDelete | 13 = One or more files are about to be deleted
EdmCmd_PreDeleteFolder | 29 = One or more folders are about to be deleted from the file vault
EdmCmd_PreExploreInit | 54 = A new instance of File Explorer is opening; handle this command in your add-in by calling IEdmCmdMgf6::AddVaultViewTab for each custom tab you want to add to the vault view in File Explorer
EdmCmd_PreGet | 25 = One or more files are about to be copied from the archive to the local hard disk
EdmCmd_PreLabel | 46 = A label is about to be created
EdmCmd_PreLabelAddItem | 52 = A label is about to get a file or folder added to it
EdmCmd_PreLabelDelete | 48 = A label is about to be deleted
EdmCmd_PreLabelModify | 50 = A label is about to be renamed or get its comment updated
EdmCmd_PreLock | 3 = One or more files are about to be checked out
EdmCmd_PreMove | 21 = One or more files are about to be moved to a new folder
EdmCmd_PreMoveFolder | 33 = One or more folders are about to be moved to a new parent folder
EdmCmd_PreRename | 15 = One or more files are about to be renamed
EdmCmd_PreRenameFolder | 31 = One or more folders are about to be renamed
EdmCmd_PreShare | 17 = One or more files are about to be shared to a new folder
EdmCmd_PreState | 9 = One or more files are about to have their states changed
EdmCmd_PreUndoLock | 7 = One or more files are about to get their locks removed without any changes sent to the file vault
EdmCmd_PreUnlock | 5 = One or more files are about to be checked in
EdmCmd_SelectItem | 55 = Item is selected in File Explorer; sent only to add-ins that created a vault view tab in File Explorer
EdmCmd_SerialNo | 2 = The add-in should generate a new serial number
EdmCmd_TaskDetails | 42 = Use this hook to add your own custom page to the task details dialog box in the task list
EdmCmd_TaskLaunch | 44 = The task is being launched; add your own user interface to permit user input
EdmCmd_TaskLaunchButton | 45 = OK or Cancel was clicked in the task launch dialog box
EdmCmd_TaskRun | 43 = This hook is called on the task server; you should perform the actual work there
EdmCmd_TaskSetup | 40 = Use this hook to add a task setup page to a task properties dialog box wizard
EdmCmd_TaskSetupButton | 41 = OK or Cancel was clicked in the task properties dialog box wizard
EdmCmd_UninstallAddIn | 24 = The add-in is about to be uninstalled
EdmCmd_UserTabDelete | 58 = Sent only to add-ins that created a vault view tab in File Explorer; called when File Explorer closes; opportunity for add-in to clean up tab-related items

See Also

EPDM.Interop.epdm Namespace
EdmCmdData Structure
EdmCmd Structure
IEdmCmdMgr5::AddHook Method


EdmColType Enumeration

EdmColType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmColType Enumeration

Types of file listing column content; specified in the EdmListCol structure.

Syntax

Visual Basic
Public Enum EdmColType
   Inherits System.Enum
C#
public enum EdmColType : System.Enum
C++/CLI
public enum class EdmColType : public System.Enum

Members

Member | Description
EdmCol_AttachedVersion | 10000 = As-built version
EdmCol_Category | 12 = File category
EdmCol_Configuration | 21 = Configuration name
EdmCol_Date | 3 = File last modified date
EdmCol_DaysInState | 32 = Number of days file in workflow state
EdmCol_EdmListRetFileFlag | 30 = Combination of EdmListRetFileFlag flags
EdmCol_FileSize | 2 = File size
EdmCol_FileType | 10 = File type
EdmCol_FoundInVersion | 9 = Version in which the search tool found the file
EdmCol_LatestFileDate | 17 = File latest version date
EdmCol_LatestVersion | 4 = File latest version number
EdmCol_LockComputer | 15 = Name of computer where the file is checked out
EdmCol_LockedIn | 8 = Name of computer and folder path where the file is checked out
EdmCol_LockPath | 14 = Path to folder where the file is checked out
EdmCol_LockUser | 7 = Name of user who has the file checked out
EdmCol_LockUserID | 13 = ID of user who has the file checked out
EdmCol_LockViewID | 18 = ID of the file vault view where the file is checked out
EdmCol_Name | 1 = File name
EdmCol_ParentFileConfiguration | 29 = Name of the configuration referencing this file
EdmCol_ParentFileID | 28 = ID of file referencing this file
EdmCol_Path | 5 = File path
EdmCol_RefCount | 11 = Reference count
EdmCol_Shared | 19 = File share count
EdmCol_State | 6 = File workflow state name + newline + file workflow state icon name
EdmCol_StateName | 16 = File workflow state name
EdmCol_Variable | 0 = The column is linked to a card variable
EdmCol_VersionNumber | 31 = File version number

See Also

EPDM.Interop.epdm Namespace


EdmCopyFlag Enumeration

EdmCopyFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCopyFlag Enumeration

Options for copying files when making calls to IEdmFolder5::CopyFile. Bitmask.

Syntax

Visual Basic
Public Enum EdmCopyFlag
   Inherits System.Enum
C#
public enum EdmCopyFlag : System.Enum
C++/CLI
public enum class EdmCopyFlag : public System.Enum

Members

Member | Description
EdmCpy_NewSerialNumbers | 1 = Generate missing serial numbers; regenerate existing serial numbers
EdmCpy_Simple | 0 = Copy the file

See Also

EPDM.Interop.epdm Namespace


EdmCopyType Enumeration

EdmCopyType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCopyType Enumeration

Types of file copy operations.

Syntax

Visual Basic
Public Enum EdmCopyType
   Inherits System.Enum
C#
public enum EdmCopyType : System.Enum
C++/CLI
public enum class EdmCopyType : public System.Enum

Members

Member | Description
EdmCopy_CopyTree | 1
EdmCopy_Normal | 0

Remarks

This enumerator is used by EdmCmdData.mlLongData1 to store the type of copy operation for PreCopy and PostCopy events.

See Also

EPDM.Interop.epdm Namespace


EdmCreateListExFlags Enumeration

EdmCreateListExFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCreateListExFlags Enumeration

Options for creating lists used in calls to IEdmBatchListing2::CreateListEx. Bitmask.

Syntax

Visual Basic
Public Enum EdmCreateListExFlags
   Inherits System.Enum
C#
public enum EdmCreateListExFlags : System.Enum
C++/CLI
public enum class EdmCreateListExFlags : public System.Enum

Members

Member | Description
Edmclef_AllConfigurations | 2 = Return separate nodes for configurations
Edmclef_AsBuilt | 16 = Use as-built reference versions instead of the latest version
Edmclef_DontGetLatest | 64 = Do not get the latest version
Edmclef_GetDrawings | 8 = Return drawings of added files
Edmclef_GetReferences | 4 = Return references of added files
Edmclef_MayReadFiles | 1 = Permit the API to read variables from the cached files; if this flag is not set, values are read from the database
Edmclef_Nothing | 0 = Default behavior
Edmclef_ReturnReferences | 32 = Return file references for every node that is passed in

See Also

EPDM.Interop.epdm Namespace


EdmCreateReferenceFlags Enumeration

EdmCreateReferenceFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCreateReferenceFlags Enumeration

Options for creating custom references used in calls to IEdmAddCustomRefs::CreateTree.

Syntax

Visual Basic
Public Enum EdmCreateReferenceFlags
   Inherits System.Enum
C#
public enum EdmCreateReferenceFlags : System.Enum
C++/CLI
public enum class EdmCreateReferenceFlags : public System.Enum

Members

Member | Description
Ecrf_Nothing | 0 = Default behavior

See Also

EPDM.Interop.epdm Namespace


EdmCreateVaultFlag Enumeration

EdmCreateVaultFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCreateVaultFlag Enumeration

Options for creating new vaults used in calls to IEdmVault11::CreateNewVault.

Syntax

Visual Basic
Public Enum EdmCreateVaultFlag
   Inherits System.Enum
C#
public enum EdmCreateVaultFlag : System.Enum
C++/CLI
public enum class EdmCreateVaultFlag : public System.Enum

Members

Member | Description
EdmCreateVault_Nothing | 0 = Default behavior; specify a password for the Admin user
EdmCreateVault_UseDefaultAdminPassword | 1 = Use the default Admin password that is stored on the archive server

See Also

EPDM.Interop.epdm Namespace


EdmCreateVaultViewFlag Enumeration

EdmCreateVaultViewFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmCreateVaultViewFlag Enumeration

Options for creating vault views used in calls to IEdmVault11::CreateNewVaultView.

Syntax

Visual Basic
Public Enum EdmCreateVaultViewFlag
   Inherits System.Enum
C#
public enum EdmCreateVaultViewFlag : System.Enum
C++/CLI
public enum class EdmCreateVaultViewFlag : public System.Enum

Members

Member | Description
EdmCreateVaultView_Nothing | 0 = Default behavior; the view is created only for the currently logged in Windows user
EdmCreateVaultView_SharedView | 1 = The view is accessible to all Windows users on this computer

See Also

EPDM.Interop.epdm Namespace


EdmDataPropertyType Enumeration

EdmDataPropertyType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmDataPropertyType Enumeration

Property types; used in calls to IEdmData::Get and IEdmData::Set.

Syntax

Visual Basic
Public Enum EdmDataPropertyType
   Inherits System.Enum
C#
public enum EdmDataPropertyType : System.Enum
C++/CLI
public enum class EdmDataPropertyType : public System.Enum

Members

Member | Description
EdmProp_ID | 1 = Database ID
EdmProp_LinkPath | 8 = Path to linked file
EdmProp_Name | 4 = Name of a file, folder, variable, etc.
EdmProp_Nothing | 0 = Invalid property
EdmProp_Object | 3 = IEdmObject5
EdmProp_ObjectType | 2 = EdmObjectType
EdmProp_Path | 5 = File or folder path
EdmProp_Value | 6 = Variable value
EdmProp_Vault | 7 = IEdmVault5

See Also

EPDM.Interop.epdm Namespace


EdmDataType Enumeration

EdmDataType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmDataType Enumeration

Data types; used in calls to IEdmData::Type.

Syntax

Visual Basic
Public Enum EdmDataType
   Inherits System.Enum
C#
public enum EdmDataType : System.Enum
C++/CLI
public enum class EdmDataType : public System.Enum

Members

Member | Description
EdmData_File | 1 = File
EdmData_Folder | 2 = Folder
EdmData_Link | 4 = Link
EdmData_Nothing | 0 = No data
EdmData_Variable | 3 = Variable

See Also

EPDM.Interop.epdm Namespace
IEdmData Interface
IEdmTemplate53::RunEx Method


EdmDefaultValueType Enumeration

EdmDefaultValueType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmDefaultValueType Enumeration

Default value types in SOLIDWORKS PDM Professional; used in calls to IEdmCardViewCallback6::GetCtrlData.

Syntax

Visual Basic
Public Enum EdmDefaultValueType
   Inherits System.Enum
C#
public enum EdmDefaultValueType : System.Enum
C++/CLI
public enum class EdmDefaultValueType : public System.Enum

Members

Member | Description
Edmdef_CreatedByUser | 8 = ID of created-by user
Edmdef_CreatedByUserAddress | 48 = Address of created-by user
Edmdef_CreatedByUserCity | 50 = City of created-by user
Edmdef_CreatedByUserCompany | 44 = Company of created-by user
Edmdef_CreatedByUserCountry | 52 = Country of created-by user
Edmdef_CreatedByUserData | 21 = User data of created-by user
Edmdef_CreatedByUserData2 | 39 = User data of created-by user
Edmdef_CreatedByUserData3 | 40 = User data of created-by user
Edmdef_CreatedByUserDepartment | 45 = Company department of created-by user
Edmdef_CreatedByUserEmail | 36 = Email of created-by user
Edmdef_CreatedByUserEmail2 | 37 = Email of created-by user
Edmdef_CreatedByUserEmail3 | 38 = Email of created-by user
Edmdef_CreatedByUserFirstName | 31 = First name of created-by user
Edmdef_CreatedByUserFullName | 22 = Full name of created-by user
Edmdef_CreatedByUserHomePhone | 42 = Home phone of created-by user
Edmdef_CreatedByUserInitials | 20 = Initials of created-by user
Edmdef_CreatedByUserJobTitle | 46 = Job title of created-by user
Edmdef_CreatedByUserLastName | 32 = Last name of created-by user
Edmdef_CreatedByUserMiddleName | 33 = Middle name of created-by user
Edmdef_CreatedByUserMobilePhone | 43 = Mobile phone of created-by user
Edmdef_CreatedByUserOffice | 47 = Office of created-by user
Edmdef_CreatedByUserPrefix | 34 = Prefix of created-by user
Edmdef_CreatedByUserState | 51 = State of created-by user
Edmdef_CreatedByUserSuffix | 35 = Suffix of created-by user
Edmdef_CreatedByUserWorkPhone | 41 = Work phone of created-by user
Edmdef_CreatedByUserZipCode | 49 = Zip code of created-by user
Edmdef_CurrentStatus | 12 = Name of the document's current status
Edmdef_CurrentStatusDescription | 15 = Description of the document's current status
Edmdef_CurrentTime | 2 = Show current time
Edmdef_DocumentPath | 6 = File path of the document
Edmdef_FileCardVariable | 1005 = The control gets a default value from the file card
Edmdef_Filename | 18 = Name of the document file
Edmdef_FileNameNoExt | 28 = File name without the extension.
Edmdef_FolderCardVariable | 1004 = The control gets a default value from the folder card
Edmdef_LastLabel | 7 = Last label placed on the document
Edmdef_LastRevComment | 4 = Last revision comment for the document
Edmdef_LastTransComment | 5 = Last transition comment for the document
Edmdef_LastTransitionXByUser | 11 = ID of the last user to perform a certain transition on the document
Edmdef_LastVersion | 10 = Current version number
Edmdef_LastVersionInStatusX | 13 = Version of document the last time it was in a certain workflow state
Edmdef_LastVersionInTransitionX | 14 = Version of document the last time it was subject to a certain workflow transition
Edmdef_LatestTransition | 16 = Name of the latest transition
Edmdef_LatestTransitionDesc | 17 = Description of the latest transition
Edmdef_LockedByUser | 9 = ID of the locked-by user
Edmdef_LockedByUserAddress | 92 = Address of the locked-by user
Edmdef_LockedByUserCity | 94 = City of the locked-by user
Edmdef_LockedByUserCompany | 88 = Company of the locked-by user
Edmdef_LockedByUserCountry | 96 = Country of the locked-by user
Edmdef_LockedByUserData | 24 = User data of the locked-by user
Edmdef_LockedByUserData2 | 83 = User data of the locked-by user
Edmdef_LockedByUserData3 | 84 = User data of the locked-by user
Edmdef_LockedByUserDepartment | 89 = Department of the locked-by user
Edmdef_LockedByUserEmail | 80 = Email of the locked-by user
Edmdef_LockedByUserEmail2 | 81 = Email of the locked-by user
Edmdef_LockedByUserEmail3 | 82 = Email of the locked-by user
Edmdef_LockedByUserFirstName | 75 = First name of the locked-by user
Edmdef_LockedByUserFullName | 22 = Full name of the locked-by user
Edmdef_LockedByUserHomePhone | 86 = Home phone of the locked-by user
Edmdef_LockedByUserInitials | 23 = Initials of the locked-by user
Edmdef_LockedByUserJobTitle | 90 = Job title of the locked-by user
Edmdef_LockedByUserLastName | 76 = Last name of the locked-by user
Edmdef_LockedByUserMiddleName | 77 = Middle name of the locked-by user
Edmdef_LockedByUserMobilePhone | 87 = Mobile phone of the locked-by user
Edmdef_LockedByUserOffice | 91 = Office of the locked-by user
Edmdef_LockedByUserPrefix | 78 = Prefix of the locked-by user
Edmdef_LockedByUserState | 95 = State of the locked-by user
Edmdef_LockedByUserSuffix | 79 = Suffix of the locked-by user
Edmdef_LockedByUserWorkPhone | 85 = Work phone of the locked-by user
Edmdef_LockedByUserZipCode | 93 = Zip code of the locked-by user
Edmdef_LoggedInUserAddress | 70 = Address of the logged-in user
Edmdef_LoggedInUserCity | 72 = City of the logged-in user
Edmdef_LoggedInUserCompany | 66 = Company of the logged-in user
Edmdef_LoggedInUserCountry | 74 = Country of the logged-in user
Edmdef_LoggedInUserData | 27 = User data of the logged-in user
Edmdef_LoggedInUserData2 | 61 = User data of the logged-in user
Edmdef_LoggedInUserData3 | 62 = User data of the logged-in user
Edmdef_LoggedInUserDepartment | 67 = Department of the logged-in user
Edmdef_LoggedInUserEmail | 58 = Email of the logged-in user
Edmdef_LoggedInUserEmail2 | 59 = Email of the logged-in user
Edmdef_LoggedInUserEmail3 | 60 = Email of the logged-in user
Edmdef_LoggedInUserFirstName | 53 = First name of the logged-in user
Edmdef_LoggedInUserFullName | 3 = ID of the current logged-in user
Edmdef_LoggedInUserHomePhone | 64 = Home phone of the logged-in user
Edmdef_LoggedInUserInitials | 26 = Initials of the logged-in user
Edmdef_LoggedInUserJobTitle | 68 = Job title of the logged-in user
Edmdef_LoggedInUserLastName | 54 = Last name of the logged-in user
Edmdef_LoggedInUserMiddleName | 55 = Middle name of the logged-in user
Edmdef_LoggedInUserMobilePhone | 65 = Mobile phone of the logged-in user
Edmdef_LoggedInUserName | 3 = ID of the current logged-in user
Edmdef_LoggedInUserOffice | 69 = Office of the logged-in user
Edmdef_LoggedInUserPrefix | 56 = Prefix of the logged-in user
Edmdef_LoggedInUserState | 73 = State of the logged-in user
Edmdef_LoggedInUserSuffix | 57 = Suffix of the logged-in user
Edmdef_LoggedInUserWorkPhone | 63 = Work phone of the logged-in user
Edmdef_LoggedInUserZipCode | 71 = Zip code of the logged-in user
Edmdef_NoDefaultValue | 0 = No default value
Edmdef_SerialNumber | 1003 = The control is connected to a serial number
Edmdef_String | 1001 = The control has a fixed string as a default value
Edmdef_TodaysDate | 1 = Show today's date
Edmdef_UserListAddress | 128 = Addresses of all users
Edmdef_UserListCity | 130 = Cities of all users
Edmdef_UserListCompany | 124 = Companies of all users
Edmdef_UserListCountry | 132 = Countries of all users
Edmdef_UserListData2 | 119 = User data of all users
Edmdef_UserListData3 | 120 = User data of all users
Edmdef_UserListDepartment | 125 = Departments of all users
Edmdef_UserListEmail | 116 = Emails of all users
Edmdef_UserListEmail2 | 117 = Emails of all users
Edmdef_UserListEmail3 | 118 = Emails of all users
Edmdef_UserListFirstName | 111 = First names of all users
Edmdef_UserListHomePhone | 122 = Home phones of all users
Edmdef_UserListJobTitle | 126 = Job titles of all users
Edmdef_UserListLastName | 112 = Last names of all users
Edmdef_UserListMiddleName | 113 = Middle names of all users
Edmdef_UserListMobilePhone | 123 = Mobile phones of all users
Edmdef_UserListOffice | 127 = Offices of all users
Edmdef_UserListPrefix | 114 = Prefixes of all users
Edmdef_UserListState | 131 = States of all users
Edmdef_UserListSuffix | 115 = Suffixes of all users
Edmdef_UserListWorkPhone | 121 = Work phones of all users
Edmdef_UserListZipCode | 129 = Zip codes of all users

See Also

EPDM.Interop.epdm Namespace


EdmDefValComp Enumeration

EdmDefValComp Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmDefValComp Enumeration

Return options when calling IEdmCardViewCallback6::GetDefaultValueComponent.

Syntax

Visual Basic
Public Enum EdmDefValComp
   Inherits System.Enum
C#
public enum EdmDefValComp : System.Enum
C++/CLI
public enum class EdmDefValComp : public System.Enum

Members

Member | Description
EdmDvc_FileID | 1 = Return the ID of the file
EdmDvc_FilePath | 3 = Return the file's complete path
EdmDvc_FolderID | 2 = Return the ID of the file's parent folder

See Also

EPDM.Interop.epdm Namespace


EdmFileType Enumeration

EdmFileType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmFileType Enumeration

Types of SOLIDWORKS PDM Professional file; used in calls to IEdmFile8::FileType.

Syntax

Visual Basic
Public Enum EdmFileType
   Inherits System.Enum
C#
public enum EdmFileType : System.Enum
C++/CLI
public enum class EdmFileType : public System.Enum

Members

Member | Description
Edmft_CutListItem | 5 = SOLIDWORKS cut list item
Edmft_InternalComponent | 2 = A SOLIDWORKS internal part or assembly
Edmft_Item | 4 = IEdmItem
Edmft_Normal | 1 = File system file
Edmft_Nothing | 0 = Error

See Also

EPDM.Interop.epdm Namespace


EdmFindUserProp Enumeration

EdmFindUserProp Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmFindUserProp Enumeration

Properties to get or set when calling IEdmFindUser::GetPropt and IEdmFindUser::SetPropt.

Syntax

Visual Basic
Public Enum EdmFindUserProp
   Inherits System.Enum
C#
public enum EdmFindUserProp : System.Enum
C++/CLI
public enum class EdmFindUserProp : public System.Enum

Members

Member | Description
Edmfup_Email | 3 = User's email address
Edmfup_FullName | 1 = User's full name
Edmfup_Initials | 2 = User's initials
Edmfup_LoginName | 0 = User's login name
Edmfup_UserData | 4 = User's custom data

See Also

EPDM.Interop.epdm Namespace


EdmFolderHistoryFlag Enumeration

EdmFolderHistoryFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmFolderHistoryFlag Enumeration

Options for adding folders when calling IEdmHistory::AddFolder. Bitmask.

Syntax

Visual Basic
Public Enum EdmFolderHistoryFlag
   Inherits System.Enum
C#
public enum EdmFolderHistoryFlag : System.Enum
C++/CLI
public enum class EdmFolderHistoryFlag : public System.Enum

Members

Member | Description
Edmfhf_IncludeFiles | 2 = Add all files in the folder and subfolders
Edmfhf_Nothing | 0 = Add the folder
Edmfhf_Recursive | 1 = Add subfolders

See Also

EPDM.Interop.epdm Namespace


EdmFolderInfoFlag Enumeration

EdmFolderInfoFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmFolderInfoFlag Enumeration

Return codes in EdmFolderInfo which is returned from IEdmBatchAddFolders::Create.

Syntax

Visual Basic
Public Enum EdmFolderInfoFlag
   Inherits System.Enum
C#
public enum EdmFolderInfoFlag : System.Enum
C++/CLI
public enum class EdmFolderInfoFlag : public System.Enum

Members

Member | Description
Eff_AlreadyExisted | 1 = Folder already existed in the vault; EdmFolderInfo structure contains information about the existing folder
Eff_Nothing | 0 = Folder was successfully added
Eff_PermissionDenied | 2 = Folder could not be added due to lack of permissions

See Also

EPDM.Interop.epdm Namespace


EdmGetCmdFlags Enumeration

EdmGetCmdFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetCmdFlags Enumeration

Options for retrieving files from the vault used in calls to IEdmBatchGet::CreateTree. Bitmask.

Syntax

Visual Basic
Public Enum EdmGetCmdFlags
   Inherits System.Enum
C#
public enum EdmGetCmdFlags : System.Enum
C++/CLI
public enum class EdmGetCmdFlags : public System.Enum

Members

Member | Description
Egcf_AsBuilt | 1 = Use the same versions of referenced files that were used when the referencing file was checked in; if this bit is not set, the latest versions of referenced files are used
Egcf_AsBuiltNotDefault | 128 = Use the as-built versions when creating the tree
Egcf_ForPreview | 16 = Only retrieve referenced files that are needed by the preview when retrieving the referencing file; skip caching referenced files
Egcf_ForViewer | 8192 = Only retrieve referenced files that are needed by the viewer when retrieving the referencing file; skip caching referenced files
Egcf_GetLatestRevision | 65536 = Only retrieve latest revision/version
Egcf_IncludeAutoCacheFiles | 2048 = Selects the Check Out dialog box Get checkbox for the latest version if the referenced file is not in the local cache
Egcf_Lock | 2 = Check out the files instead of just retrieving them
Egcf_LockNoLclCopyFiles | 1024 = Locks the local referenced files if a local cache is not present
Egcf_LockReferencedFilesToo | 64 = Check out files referenced by the checked-out file
Egcf_Nothing | 0 = No options
Egcf_RefreshFileListing | 32 = Refresh file listing in File Explorer after files have been checked out
Egcf_RollbackTree | 4096 = Provide the ability to roll back files in the dialog
Egcf_SingleFileRollback | 16384 = Roll back one file
Egcf_SkipExisting | 8 = Do not retrieve files that already exist in the local cache
Egcf_SkipLockRefFiles | 512 = Skips checking of lock file references
Egcf_SkipOpenFileChecks | 256 = Skips checking whether the file is open in another application
Egcf_SkipUnlockedWritable | 4 = Do not retrieve files that are writable and not checked out
Egcf_XrefsOpenCheck | 32768 = Check whether cross-reference files are open in another application

See Also

EPDM.Interop.epdm Namespace


EdmGetConfirmReason Enumeration

EdmGetConfirmReason Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetConfirmReason Enumeration

Types of confirmation to specify when calling IEdmGetOpCallback::ConfirmReplace.

Syntax

Visual Basic
Public Enum EdmGetConfirmReason
   Inherits System.Enum
C#
public enum EdmGetConfirmReason : System.Enum
C++/CLI
public enum class EdmGetConfirmReason : public System.Enum

Members

Member | Description
Egcr_Locked | 1 = File is checked out
Egcr_UnlockedWritable | 2 = File is checkd in but writable

See Also

EPDM.Interop.epdm Namespace


EdmGetFileListFlag Enumeration

EdmGetFileListFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetFileListFlag Enumeration

Files to return by IEdmBatchGet::GetFileList. Bitmask.

Syntax

Visual Basic
Public Enum EdmGetFileListFlag
   Inherits System.Enum
C#
public enum EdmGetFileListFlag : System.Enum
C++/CLI
public enum class EdmGetFileListFlag : public System.Enum

Members

Member | Description
Egflf_GetFailed | 8 = Operation failed
Egflf_GetLocked | 2 = Return files checked out by the operation
Egflf_GetRetrieved | 1 = Return files retrieved by the operation
Egflf_GetUnprocessed | 4 = Return files not processed by the operation

See Also

EPDM.Interop.epdm Namespace


EdmGetFlag Enumeration

EdmGetFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetFlag Enumeration

Options for retrieving files used in calls to IEdmFile5::GetFileCopy, IEdmEnumeratorVersion5::GetFileCopy, IEdmVersion5::GetFileCopy, and IEdmRevision5::GetFileCopy. Bitmask.

Syntax

Visual Basic
Public Enum EdmGetFlag
   Inherits System.Enum
C#
public enum EdmGetFlag : System.Enum
C++/CLI
public enum class EdmGetFlag : public System.Enum

Members

Member | Description
EdmGet_DisableRefresh | 2 = Do not refresh File Explorer when a file is retrieved
EdmGet_ForPreview | 64 = Only retrieve referenced files that are needed by SOLIDWORKS PDM Professional's preview when retrieving the referencing file
EdmGet_MakeReadOnly | 1 = Mark the retrieved file as read-only
EdmGet_Refs | 4 = Get referenced files
EdmGet_RefsOnlyMissing | 8 = Only get referenced files that are not present on the local hard disk; only valid in combination with EdmGet_Refs
EdmGet_RefsOverwriteLocked | 32 = Retrieve checked out referenced files and their references; only valid in combination with EdmGet_Refs; Warning: Setting this flag means that any previous modifications to checked out files will be lost.
EdmGet_RefsVerLatest | 16 = Retrieve the latest versions of referenced files that you have permission to see instead of attached versions that were used when the file was checked in; only valid in combination with EdmGet_Refs
EdmGet_Simple | 0 = Retrieve the file

See Also

EPDM.Interop.epdm Namespace


EdmGetMenuInfoFlags Enumeration

EdmGetMenuInfoFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetMenuInfoFlags Enumeration

Flags returned from IEdmSearch7::GetMenuInfo.

Syntax

Visual Basic
Public Enum EdmGetMenuInfoFlags
   Inherits System.Enum
C#
public enum EdmGetMenuInfoFlags : System.Enum
C++/CLI
public enum class EdmGetMenuInfoFlags : public System.Enum

Members

Member | Description
Egmif_HasAddins | 1 = The file vault contains add-ins
Egmif_Nothing | 0 = No flags are set

See Also

EPDM.Interop.epdm Namespace


EdmGetMsgFlag Enumeration

EdmGetMsgFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetMsgFlag Enumeration

Types of message returned used in calls to IEdmInbox5::GetFirstMessagePosition.

Syntax

Visual Basic
Public Enum EdmGetMsgFlag
   Inherits System.Enum
C#
public enum EdmGetMsgFlag : System.Enum
C++/CLI
public enum class EdmGetMsgFlag : public System.Enum

Members

Member | Description
EdmGetMsg_Notifications | 4 = Return only file or folder notifications
EdmGetMsg_OnlyNew | 1 = Return only messages that have not been processed before
EdmGetMsg_OnlyUnread | 8 = Return only messages having the IEdmMessage5::IsRead flag set to true
EdmGetMsg_UserMessages | 2 = Return only messages sent from users

See Also

EPDM.Interop.epdm Namespace


EdmGetOpError Enumeration

EdmGetOpError Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetOpError Enumeration

Cold storage file retrieval error codes; used in calls to IEdmGetOpCallback2::ReportFailureEx.

Syntax

Visual Basic
Public Enum EdmGetOpError
   Inherits System.Enum
C#
public enum EdmGetOpError : System.Enum
C++/CLI
public enum class EdmGetOpError : public System.Enum

Members

Member | Description
EdmGetErr_InColdStorageAvailable | 1 = The version you are attempting to retrieve is in cold storage and needs to be retrieved from the backup media
EdmGetErr_InColdStorageDeleted | 2 = The version you are attempting to retrieve was sent to cold storage and deleted
EdmGetErr_InColdStoragePermissionDenied | 3 = The version you are attempting to retrieve is in cold storage, and you lack permission to restore it
EdmGetErr_InColdStorageRestoreFailed | 4 = Could not retrieve the file from cold storage

See Also

EPDM.Interop.epdm Namespace


EdmGetOpMsg Enumeration

EdmGetOpMsg Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetOpMsg Enumeration

Log error messages; used in calls to IEdmGetOpCallback::LogMessage.

Syntax

Visual Basic
Public Enum EdmGetOpMsg
   Inherits System.Enum
C#
public enum EdmGetOpMsg : System.Enum
C++/CLI
public enum class EdmGetOpMsg : public System.Enum

Members

Member | Description
Egom_ErrorRunningPostAddins | 3 = An error occurred running add-ins that implement hooks on EdmCmd_PostGet or EdmCmd_PostLock commands
Egom_LockNotificationsError | 1 = Error sending check-out notifications
Egom_Undefined | 0 = Undefined message
Egom_UndoLockAfterErrorFailed | 2 = The attempt to unlock a file after its check-out failed has failed

See Also

EPDM.Interop.epdm Namespace


EdmGetOpReply Enumeration

EdmGetOpReply Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetOpReply Enumeration

Options for continuing with a command; returned from IEdmGetOpCallback2::ReportFailureEx.

Syntax

Visual Basic
Public Enum EdmGetOpReply
   Inherits System.Enum
C#
public enum EdmGetOpReply : System.Enum
C++/CLI
public enum class EdmGetOpReply : public System.Enum

Members

Member | Description
EdmGetRep_CallReportFailure | 0 = Call IEdmGetOpCallback::ReportFailure
EdmGetRep_Cancel | 1 = Cancel the operation
EdmGetRep_Process | 3 = Proceed to process the file
EdmGetRep_Skip | 2 = Skip the file but proceed with the operation

See Also

EPDM.Interop.epdm Namespace


EdmGetPermFlag Enumeration

EdmGetPermFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetPermFlag Enumeration

Options for returning folder permissions used in calls to IEdmUserMgr7::GetFolderPermissions.

Syntax

Visual Basic
Public Enum EdmGetPermFlag
   Inherits System.Enum
C#
public enum EdmGetPermFlag : System.Enum
C++/CLI
public enum class EdmGetPermFlag : public System.Enum

Members

Member | Description
EdmGetPerm_Nothing | 0 = Default behavior; return all inherited permissions, not just those explicitly set on a folder
EdmGetPerm_OnlyExplicitlySet | 1 = Return only permissions explicitly set on folders

See Also

EPDM.Interop.epdm Namespace


EdmGetVarDataFlag Enumeration

EdmGetVarDataFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGetVarDataFlag Enumeration

Options specified in EdmGetVarData to describe a file. Bitmask.

Syntax

Visual Basic
Public Enum EdmGetVarDataFlag
   Inherits System.Enum
C#
public enum EdmGetVarDataFlag : System.Enum
C++/CLI
public enum class EdmGetVarDataFlag : public System.Enum

Members

Member | Description
Edmgvdf_MayUpdate | 1 = The file's card may be updated by the logged-in user
Edmgvdf_Nothing | 0 = No updates

See Also

EPDM.Interop.epdm Namespace


EdmGroupDataFlags Enumeration

EdmGroupDataFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGroupDataFlags Enumeration

Options specified in EdmGroupData used by IEdmUserMgr6::AddGroups to create new groups.

Syntax

Visual Basic
Public Enum EdmGroupDataFlags
   Inherits System.Enum
C#
public enum EdmGroupDataFlags : System.Enum
C++/CLI
public enum class EdmGroupDataFlags : public System.Enum

Members

Member | Description
Edmgdf_ForceAdd | 4 = Add this group even if validation of the other groups in the array failed
Edmgdf_GetInterface | 1 = Retrieve the interface of the group and return it in EdmGroupData::mpoGroup
Edmgdf_Nothing | 0 = No options
Edmgdf_Replace | 2 = Replace the existing group

See Also

EPDM.Interop.epdm Namespace


EdmGroupSetting Enumeration

EdmGroupSetting Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmGroupSetting Enumeration

User group settings used by IEdmUserGroup9::SetSettingsVar.

Syntax

Visual Basic
Public Enum EdmGroupSetting
   Inherits System.Enum
C#
public enum EdmGroupSetting : System.Enum
C++/CLI
public enum class EdmGroupSetting : public System.Enum

Members

Member | Description
EdmGSv_AutoDelete | 9 = Whether to automatically delete local read-only files that are not part of the vault; 1 = true, 0 = false; this setting corresonds to the "Automatically delete local read-only files that are not part of the file vault" checkbox on the Explorer tab on the Settings dialog that appears when you click "Settings" on the Properties dialog of a group in the Admin Tool
EdmGSv_AutoGetLatest | 11 = Whether to always work with the latest version of files; 1 = true, 0 = false; this setting corresponds to the "Always work with latest version of files" checkbox on the Reference Dialog tab on the Settings dialog that appears when you click "Settings" on the Properties dialog of a group in the Admin Tool
EdmGSv_AutoGetLatestRefs | 43 = Whether to auto-select reference files to get latest when checking out; 1 = true, 0 = false; this setting corresponds to the "Auto select reference files to get latest when checking out" checkbox on the Reference Dialog tab on the Settings dialog that appears when you click "Settings" on the Properties dialog of a group in the Admin Tool

See Also

EPDM.Interop.epdm Namespace


EdmHistoryType Enumeration

EdmHistoryType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmHistoryType Enumeration

Types of history record; used by the IEdmHistory interface. Bitmask.

Syntax

Visual Basic
Public Enum EdmHistoryType
   Inherits System.Enum
C#
public enum EdmHistoryType : System.Enum
C++/CLI
public enum class EdmHistoryType : public System.Enum

Members

Member | Description
Edmhist_ColdStoreRestore | 262144 = A file was restored from cold storage
Edmhist_FileBranch | 4194304
Edmhist_FileBranchMerge | 8388608
Edmhist_FileColdStore | 1024 = A file was moved to the cold storage
Edmhist_FileDelete | 16 = A file was deleted to the bit bucket
Edmhist_FileLabel | 128 = A label was applied to a file
Edmhist_FileLock | 134217728 = A file was locked
Edmhist_FileMove | 4 = A file was moved
Edmhist_FileParallelState | 61708864
Edmhist_FilePendingState | 33554432
Edmhist_FileRename | 2 = A file was renamed
Edmhist_FileRevision | 512 = A revision was set on the file
Edmhist_FileRollback | 8 = A file was rolled back
Edmhist_FileShare | 1 = A file was shared
Edmhist_FileState | 256 = The file’s workflow state was changed
Edmhist_FileTransferLock | 536870912 = A file's ownership was transferred
Edmhist_FileUndelete | 32 = A file was recovered from the bit bucket
Edmhist_FileUndoLock | 2097152 = A file checked out by somebody other than the logged-in user was unlocked
Edmhist_FileUndoLock2 | 268435456 = A file checked out by the logged-in user was unlocked
Edmhist_FileVerFreeVar | 524288 = File version-free variables were updated
Edmhist_FileVersion | 64 = A file was checked in, producing a new version
Edmhist_FileVersionOverwrite | 16777216
Edmhist_FolderCardData | 131072 = A folder’s properties were edited
Edmhist_FolderCreate | 8192 = A folder was created
Edmhist_FolderDelete | 2048 = A folder was deleted to the bit bucket
Edmhist_FolderLabel | 65536 = A label was applied to a folder
Edmhist_FolderMove | 32768 = A folder was moved
Edmhist_FolderRename | 16384 = A folder was renamed
Edmhist_FolderUndelete | 4096 = A folder was recovered from the bit bucket
Edmhist_FolderVerFreeVar | 1048576 = Folder version-free variables were updated

See Also

EPDM.Interop.epdm Namespace


EdmIncRevFlags Enumeration

EdmIncRevFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmIncRevFlags Enumeration

Increment revisions used in IEdmFile5::IncrementRevision. Bitmask.

Syntax

Visual Basic
Public Enum EdmIncRevFlags
   Inherits System.Enum
C#
public enum EdmIncRevFlags : System.Enum
C++/CLI
public enum class EdmIncRevFlags : public System.Enum

Members

Member | Description
EdmIncRev_Simple | 0 = Increment revision using default behavior

See Also

EPDM.Interop.epdm Namespace


EdmInstallFileFlags Enumeration

EdmInstallFileFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmInstallFileFlags Enumeration

Operations used in calls to IEdmVault12::InstallFile to control the installation of data.

Syntax

Visual Basic
Public Enum EdmInstallFileFlags
   Inherits System.Enum
C#
public enum EdmInstallFileFlags : System.Enum
C++/CLI
public enum class EdmInstallFileFlags : public System.Enum

Members

Member | Description
EdmIff_Nothing | 0 = Default operation
EdmIff_ReplaceDuplicates | 1 = This flag is used for CEX-files when you want to replace duplicate objects in the vault; i.e., if you are importing a group named "ABC" and if there is already a different group named "ABC" in the vault, it will be silently replaced; the default behavior is not to replace duplicates

See Also

EPDM.Interop.epdm Namespace


EdmItemGenerationFlags Enumeration

EdmItemGenerationFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmItemGenerationFlags Enumeration

Flags that control the behavior of IEdmBatchItemGeneration::CreateTree.

Syntax

Visual Basic
Public Enum EdmItemGenerationFlags
   Inherits System.Enum
C#
public enum EdmItemGenerationFlags : System.Enum
C++/CLI
public enum class EdmItemGenerationFlags : public System.Enum

Members

Member | Description
Eigcf_Nothing | 0 = Default behavior
Eigcf_OpenItemsCheckbox | 1 = This flag does not change the behavior of the IEdmBatchItemGeneration::CreateTree method itself, but it does affect a subsequent call to IEdmBatchItemGeneration::ShowDlg; the dialog box displayed by IEdmBatchItemGeneration::ShowDlg will contain a checkbox to open items after the completion of the item-creation command if this flag is specified

Remarks

See also the general note about items in the API.

See Also

EPDM.Interop.epdm Namespace


EdmItemLinkType Enumeration

EdmItemLinkType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmItemLinkType Enumeration

Types of linked files to items.

Syntax

Visual Basic
Public Enum EdmItemLinkType
   Inherits System.Enum
C#
public enum EdmItemLinkType : System.Enum
C++/CLI
public enum class EdmItemLinkType : public System.Enum

Members

Member | Description
EdmItemLnk_Attachment | 1 = Attachment links are referred to as static links in the user interface; a statically linked file does not drive the associated item; it is just an attachment
EdmItemLnk_Dynamic | 0 = Dynamic links are referred to as auto-update links in the user interface in SOLIDWORKS PDM Professional 2010 and later; this means that some changes in the linked file automatically propagates to the item

See Also

EPDM.Interop.epdm Namespace
EdmGenItemInfo Structure


EdmLangCode Enumeration

EdmLangCode Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmLangCode Enumeration

Localization language used in IEdmHistory3::GetEventDescription.

Syntax

Visual Basic
Public Enum EdmLangCode
   Inherits System.Enum
C#
public enum EdmLangCode : System.Enum
C++/CLI
public enum class EdmLangCode : public System.Enum

Members

Member | Description
LanChinSimplified | 13
LanChinTraditional | 12
LanCzech | 1
LanEng | 0
LanFrench | 4
LanGerman | 2
LanItalian | 5
LanJapanese | 6
LanKorean | 7
LanPolish | 8
LanPortuguese | 9
LanRussian | 10
LanSpanish | 3
LanTurkish | 11

See Also

EPDM.Interop.epdm Namespace


EdmLanguage Enumeration

EdmLanguage Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmLanguage Enumeration

Types of languages; used by IEdmVault5::Language.

Syntax

Visual Basic
Public Enum EdmLanguage
   Inherits System.Enum
C#
public enum EdmLanguage : System.Enum
C++/CLI
public enum class EdmLanguage : public System.Enum

Members

Member | Description
EdmLang_Afrikaans | 0x36 = Afrikaans
EdmLang_Albanian | 0x1c = Albanian
EdmLang_Arabic | 0x1 = Arabic
EdmLang_Armenian | 0x2b = Armenian
EdmLang_Assamese | 0x4d = Assamese
EdmLang_Azeri | 0x2c = Azeri
EdmLang_Basque | 0x2d = Basque
EdmLang_Belarusian | 0x23 = Belarusian
EdmLang_Bengali | 0x45 = Bengali
EdmLang_Bulgarian | 0x2 = Bulgarian
EdmLang_Canada | 0x4b = Canadian
EdmLang_Catalan | 0x3 = Catalan
EdmLang_Chinese | 0x4 = Chinese
EdmLang_Chinese_Traditional | 0x7c04 = Chinese traditional
EdmLang_Croatian | 0x1a = Croatian
EdmLang_Czech | 0x5 = Czech
EdmLang_Danish | 0x6 = Danish
EdmLang_Dutch | 0x13 = Dutch
EdmLang_English | 0x9 = English
EdmLang_Estonian | 0x25 = Estonian
EdmLang_Faeroese | 0x38 = Faeroese
EdmLang_Farsi | 0x29 = Farsi
EdmLang_Finnish | 0xb = Finnish
EdmLang_French | 0xc = French
EdmLang_Georgian | 0x37 = Georgian
EdmLang_German | 0x7 = German
EdmLang_Greek | 0x8 = Greek
EdmLang_Gujarati | 0x47 = Gujarati
EdmLang_Hebrew | 0xd = Hebrew
EdmLang_Hindi | 0x39 = Hindi
EdmLang_Hungarian | 0xe = Hungarian
EdmLang_Icelandic | 0xf = Icelandic
EdmLang_Indonesian | 0x21 = 0x21
EdmLang_Italian | 0x10 = Italian
EdmLang_Japanese | 0x11 = Japanese
EdmLang_Kashmiri | 0x60 = Kashmiri
EdmLang_Kazak | 0x3f = Kazak
EdmLang_Konkani | 0x57 = Konkani
EdmLang_Korean | 0x12 = Korean
EdmLang_Latvian | 0x26 = Latvian
EdmLang_Lithuanian | 0x27 = Lithuanian
EdmLang_Macedonian | 0x2f = Macedonian
EdmLang_Malay | 0x3e = Malay
EdmLang_Malayalam | 0x4c = Malayalam
EdmLang_Manipuri | 0x58 = Manipuri
EdmLang_Marathi | 0x4e = Marathi
EdmLang_Nepali | 0x61 = Nepali
EdmLang_Norwegian | 0x14 = Norwegian
EdmLang_Oriya | 0x48 = Oriya
EdmLang_Polish | 0x15 = Polish
EdmLang_Portuguese | 0x16 = Portuguese
EdmLang_Punjabi | 0x46 = Punjabi
EdmLang_Romanian | 0x18 = Romanian
EdmLang_Russian | 0x19 = Russian
EdmLang_Sanskrit | 0x4f = Sanskrit
EdmLang_Serbian | 0x1a = Serbian
EdmLang_Sindhi | 0x59 = Sindhi
EdmLang_Slovak | 0x1b = Slovak
EdmLang_Slovenian | 0x24 = Slovenian
EdmLang_Spanish | 0xa = Spanish
EdmLang_Swahili | 0x41 = Swahili
EdmLang_Swedish | 0x1d = Swedish
EdmLang_Tamil | 0x49 = Tamil
EdmLang_Tatar | 0x44 = Tatar
EdmLang_Telugu | 0x4a = Telugu
EdmLang_Thai | 0x1e = Thai
EdmLang_Turkish | 0x1f = Turkish
EdmLang_Ukrainian | 0x22 = Ukrainian
EdmLang_Urdu | 0x20 = Urdu
EdmLang_Uzbek | 0x43 = Uzbek
EdmLang_Vietnamese | 0x2a = Vietnamese

Remarks

These enumerators indicate which language the user is currently running in SOLIDWORKS PDM Professional. The values of the language enumerators correspond to the Win32 macros LANG_XXXXX in Visual C++.

See Also

EPDM.Interop.epdm Namespace


EdmLaunchSearchFlags Enumeration

EdmLaunchSearchFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmLaunchSearchFlags Enumeration

Flags which control the behavior of IEdmSearch7::LaunchApp.

Syntax

Visual Basic
Public Enum EdmLaunchSearchFlags
   Inherits System.Enum
C#
public enum EdmLaunchSearchFlags : System.Enum
C++/CLI
public enum class EdmLaunchSearchFlags : public System.Enum

Members

Member | Description
Elsf_DefaultIsAFavorite | 4 = The bsDefault argument to IEdmSearch7::LaunchApp is the name of a favorite, not a form
Elsf_HidePreview | 2 = Hides the preview area under the result listing in the search tool
Elsf_HideTree | 1 = Hides the tree pane in the search tool
Elsf_Nothing | 0 = Default behavior

See Also

EPDM.Interop.epdm Namespace


EdmLibVer Enumeration

EdmLibVer Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmLibVer Enumeration

Type library and SOLIDWORKS PDM version numbers.

Syntax

Visual Basic
Public Enum EdmLibVer
   Inherits System.Enum
C#
public enum EdmLibVer : System.Enum
C++/CLI
public enum class EdmLibVer : public System.Enum

Members

Member | Description
EdmLibVer_Major | 5
EdmLibVer_Minor | 29; For SOLIDWORKS PDM 2026

Remarks

The type library version is not the same as the SOLIDWORKS PDM version number that you see in the user interface.

Type Library | SOLIDWORKS PDM
5.9 | 2006
5.10 | 2007
5.11 | 2007 SP03 (64-bit)
5.12 | 2008
5.13 | 2009
5.14 | 2010
5.15 | 2011
5.15 | 2012
5.16 | 2013
5.17 | 2014
5.18 | 2015
5.19 | 2016
5.20 | 2017
5.21 | 2018
5.22 | 2019
5.23 | 2020
5.24 | 2021
5.25 | 2022
5.26 | 2023
5.27 | 2024
5.28 | 2025
5.29 | 2026

See Also

EPDM.Interop.epdm Namespace


EdmLicenseType Enumeration

EdmLicenseType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmLicenseType Enumeration

Types of license types, which are used in struct EdmLicense.

Syntax

Visual Basic
Public Enum EdmLicenseType
   Inherits System.Enum
C#
public enum EdmLicenseType : System.Enum
C++/CLI
public enum class EdmLicenseType : public System.Enum

Members

Member | Description
EdmLic_Contributor | 2 = Contributor and web client license
EdmLic_Editor | 1 = Editor license
EdmLic_Processor | 4 = Processor license
EdmLic_Viewer | 3 = Viewer (read-only) license

Remarks

See the SOLIDWORKS PDM Professional client Help file for more information about what you can or cannot do with respective license type.

See Also

EPDM.Interop.epdm Namespace


EdmListFileFlags Enumeration

EdmListFileFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmListFileFlags Enumeration

Flags passed to IEdmBatchListing::AddFile. Bitmask.

Syntax

Visual Basic
Public Enum EdmListFileFlags
   Inherits System.Enum
C#
public enum EdmListFileFlags : System.Enum
C++/CLI
public enum class EdmListFileFlags : public System.Enum

Members

Member | Description
EdmList_IsCutListItem | 2 = The file is a cut list item in another file
EdmList_IsInternalComponent | 4 = The file is a virtual component in another file
EdmList_MayNotReadFile | 1 = The file must not be accessed, even if it is checked out and modified
EdmList_Nothing | 0 = Default behavior

See Also

EPDM.Interop.epdm Namespace


EdmListFolderFlags Enumeration

EdmListFolderFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmListFolderFlags Enumeration

Flags used in calls to IEdmBatchListing::AddFolder to tell how to add the folder to the list.

Syntax

Visual Basic
Public Enum EdmListFolderFlags
   Inherits System.Enum
C#
public enum EdmListFolderFlags : System.Enum
C++/CLI
public enum class EdmListFolderFlags : public System.Enum

Members

Member | Description
EdmListFolder_Nothing | 0 = None of the other values
EdmListFolder_Recursive | 1 = Add the files inside the folder instead of adding the folder itself to the list; the files in any subfolders are added recursively

See Also

EPDM.Interop.epdm Namespace


EdmListRetFileFlag Enumeration

EdmListRetFileFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmListRetFileFlag Enumeration

Flags returned in an IEdmBatchListing column if you specify column type EdmCol_EdmListRetFileFlag.

Syntax

Visual Basic
Public Enum EdmListRetFileFlag
   Inherits System.Enum
C#
public enum EdmListRetFileFlag : System.Enum
C++/CLI
public enum class EdmListRetFileFlag : public System.Enum

Members

Member | Description
EdmLstRet_Drawing | 1 = It is a backwards drawing reference (i.e., it displayed as blue links in Enterprise's command dialog boxes)
EdmLstRet_InternalComponent | 2 = Internal SOLIDWORKS part, cut list, etc.; i.e., it is not a physical file
EdmLstRet_Nothing | 0 = It is an ordinary system file
EdmLstRet_ToolboxPart | 4 = This is a part file from the Toolbox library

See Also

EPDM.Interop.epdm Namespace
IEdmBatchListing2::CreateListEx Method ()


EdmLockFlag Enumeration

EdmLockFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmLockFlag Enumeration

Flags used in IEdmFile5::LockFile. Bitmask.

Syntax

Visual Basic
Public Enum EdmLockFlag
   Inherits System.Enum
C#
public enum EdmLockFlag : System.Enum
C++/CLI
public enum class EdmLockFlag : public System.Enum

Members

Member | Description
EdmLock_Simple | 0 = Check out the file using default behavior

See Also

EPDM.Interop.epdm Namespace


EdmMBoxResult Enumeration

EdmMBoxResult Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmMBoxResult Enumeration

Types of clicked button returned by IEdmVault5::MsgBox.

Syntax

Visual Basic
Public Enum EdmMBoxResult
   Inherits System.Enum
C#
public enum EdmMBoxResult : System.Enum
C++/CLI
public enum class EdmMBoxResult : public System.Enum

Members

Member | Description
EdmMbr_Abort | 3 = User clicked Abort
EdmMbr_Cancel | 2 = User clicked Cancel or Close in the caption
EdmMbr_Ignore | 5 = User clicked Ignore
EdmMbr_No | 7 = User clicked No
EdmMbr_NoAll | 10 = User clicked No to All
EdmMbr_OK | 1 = User clicked OK
EdmMbr_OkAll | 8 = User clicked OK to All
EdmMbr_Retry | 4 = User clicked Retry
EdmMbr_Yes | 6 = User clicked Yes
EdmMbr_YesAll | 9 = User clicked Yes to All

See Also

EPDM.Interop.epdm Namespace


EdmMBoxType Enumeration

EdmMBoxType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmMBoxType Enumeration

Types of widget to insert or display in IEdmVault5::MsgBox. Bitmask.

Syntax

Visual Basic
Public Enum EdmMBoxType
   Inherits System.Enum
C#
public enum EdmMBoxType : System.Enum
C++/CLI
public enum class EdmMBoxType : public System.Enum

Members

Member | Description
EdmMbt_AbortRetryIgnore | 2 = Insert Abort, Retry, and Ignore
EdmMbt_Icon_Information | 64 = Display the information icon
EdmMbt_Icon_Question | 32 = Display the question icon
EdmMbt_Icon_Warning | 48 = Display the warning icon
EdmMbt_OKCancel | 1 = Insert OK and Cancel
EdmMbt_OKOnly | 0 = Insert OK
EdmMbt_RetryCancel | 5 = Insert Retry and Cancel
EdmMbt_YesNo | 4 = Insert Yes and No
EdmMbt_YesNoCancel | 3 = Insert Yes, No, and Cancel

See Also

EPDM.Interop.epdm Namespace


EdmMenuFlags Enumeration

EdmMenuFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmMenuFlags Enumeration

Flags used by IEdmCmdMgr5::AddCmd when writing an add-in that supports menu commands. Bitmask.

Syntax

Visual Basic
Public Enum EdmMenuFlags
   Inherits System.Enum
C#
public enum EdmMenuFlags : System.Enum
C++/CLI
public enum class EdmMenuFlags : public System.Enum

Members

Member | Description
EdmMenu_Administration | 512 = The command is displayed in SOLIDWORKS PDM Professional Administration tool instead of the File Explorer
EdmMenu_ContextMenuItem | 1024 = The command is displayed in the file's context menu
EdmMenu_ContextMenuItemFolder | 2048 = The command is displayed in the folder's context menu
EdmMenu_HastItemToolbarButton | 8192 = The command has a button in the Item Explorer toolbar
EdmMenu_HasToolbarButton | 128 = The command has a button in the File Explorer toolbar; see IEdmCmdMgr5::AddToolbarImage
EdmMenu_ItemToolsMenu | 4096 = The command is displayed in the Item Explorer tools menu
EdmMenu_MustHaveSelection | 1 = The command is only available when the user has selected files or folders in the File Explorer file list
EdmMenu_NeverInContextMenu | 64 = The command should not be present in the right-click, context menu, only in the File Explorer Tools menu
EdmMenu_Nothing | 0 = Default behavior; no restrictions and no toolbar
EdmMenu_OnlyFiles | 2 = The command is not available for selections containing folders, only for files
EdmMenu_OnlyFolders | 4 = The command is not available for selections containing files, only for folders
EdmMenu_OnlyInContextMenu | 32 = The command should only be present in the right-click, context menu, not in the File Explorer Tools menu
EdmMenu_OnlyMultipleSelection | 16 = The command is only available for multiple selections, not for single files or folders
EdmMenu_OnlySingleSelection | 8 = The command is only available if only one file or folder has been selected, not for multiple selections
EdmMenu_OwnerDrawToolbarButton | 256 = The command uses custom drawing of its toolbar button by implementing IEdmAddInDrawButton5
EdmMenu_ShowInMenuBarAction | 16384 = The command is displayed in the Action menu in the File Explorer toolbar
EdmMenu_ShowInMenuBarDisplay | 65536 = The command is displayed in the Display menu in the File Explorer toolbar
EdmMenu_ShowInMenuBarModify | 32768 = The command is displayed in the Modify menu in the File Explorer toolbar
EdmMenu_ShowInMenuBarTools | 131072 = The command is displayed in the Tools menu in the File Explorer toolbar

Remarks

The flags specify various properties for your command.

See Also

EPDM.Interop.epdm Namespace


EdmMenuStrType Enumeration

EdmMenuStrType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmMenuStrType Enumeration

Types of arguments sent to IEdmMenu5::GetString to specify which string to return.

Syntax

Visual Basic
Public Enum EdmMenuStrType
   Inherits System.Enum
C#
public enum EdmMenuStrType : System.Enum
C++/CLI
public enum class EdmMenuStrType : public System.Enum

Members

Member | Description
MenuStr_MenuStr | 1 = The menu item string
MenuStr_StatusBar | 2 = The help string to show in the status bar
MenuStr_Tooltip | 3 = The ToolTip help string to show when the mouse cursor is over the command's toolbar button

See Also

EPDM.Interop.epdm Namespace


EdmMsgType Enumeration

EdmMsgType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmMsgType Enumeration

Types of messages sent to a user.

Syntax

Visual Basic
Public Enum EdmMsgType
   Inherits System.Enum
C#
public enum EdmMsgType : System.Enum
C++/CLI
public enum class EdmMsgType : public System.Enum

Members

Member | Description
EdmMsgType_ExternalNotification | 4 = The message is an external notification
EdmMsgType_FileNotification | 2 = The message is a file notification
EdmMsgType_FolderNotification | 3 = The message is a folder notification
EdmMsgType_Invalid | 0 = Invalid message (internal error code)
EdmMsgType_UserMessage | 1 = The message is a file notification

See Also

EPDM.Interop.epdm Namespace
IEdmMessage5::MessageType


EdmObjectType Enumeration

EdmObjectType Enumeration
See Also Example
[image]
EPDM.Interop.epdm Namespace : EdmObjectType Enumeration

Types of objects returned by IEdmObject5::ObjectType, IEdmFile5::ObjectType, and IEdmFolder5::ObjectType.

Syntax

Visual Basic
Public Enum EdmObjectType
   Inherits System.Enum
C#
public enum EdmObjectType : System.Enum
C++/CLI
public enum class EdmObjectType : public System.Enum

Members

Member | Description
EdmObject_Attribute | 10 = The object is an attribute, used in variables, and it supports the IEdmAttribute5 interface
EdmObject_BOM | 15 = The object is a Bill of Materials; see IEdmBom
EdmObject_Card | 5 = The object is a file/folder data card, and it supports the IEdmCard5 interface
EdmObject_CardControl | 6 = The object is a control in a file/folder data card, and it supports the IEdmCardControl5 interface
EdmObject_Category | 14 = The object is a category; see IEdmCategory6
EdmObject_Dictionary | 12 = The object is a dictionary, and it supports the IEdmDictionary5 interface
EdmObject_File | 1 = The object is a file, and it supports the IEdmFile5 interface
EdmObject_Folder | 2 = The object is a folder, and it supports the IEdmFolder5 interface
EdmObject_Invalid | 0 = This is not an object type; it is an error code
EdmObject_Item | 16 = The object is an item; see IEdmItem
EdmObject_ItemFolder | 17 = The object is a parent folder of an item; see IEdmFolder6
EdmObject_ItemRootFolder | 18 = The object is the invisible root folder of all item folders; see IEdmFolder6
EdmObject_Label | 11 = The object is a label, and it supports the IEdmLabel5 interface
EdmObject_State | 3 = The object is a workflow state, and it supports the IEdmState5 interface
EdmObject_Transition | 4 = The object is a transition (i.e., a workflow state change), and it supports the IEdmTransition5 interface
EdmObject_User | 7 = The object is a user, and it supports the IEdmUser5 interface
EdmObject_UserGroup | 8 = The object is a user group, and it supports the IEdmUserGroup5 interface
EdmObject_Variable | 9 = The object is a variable (for file/folder data cards), and it supports the IEdmVariable5 interface
EdmObject_Workflow | 13 = The object is a workflow; see IEdmWorkflow5 and IEdmWorkflow6

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)

Remarks

All interfaces that inherit from IEdmObject5 have a corresponding EdmObjectType value indicating the kind of object.

See Also

EPDM.Interop.epdm Namespace
IEdmVault5::GetObject Method ()


EdmProgressType Enumeration

EdmProgressType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmProgressType Enumeration

Types of progress bars that are affected by certain operations.

Syntax

Visual Basic
Public Enum EdmProgressType
   Inherits System.Enum
C#
public enum EdmProgressType : System.Enum
C++/CLI
public enum class EdmProgressType : public System.Enum

Members

Member | Description
Ept_FileTransfer | 2 = Progress bar for copying the data of a single file
Ept_Operation | 1 = Progress bar for the entire operation
Ept_UpdateReference | 3 = Progress bar for updating file references

See Also

EPDM.Interop.epdm Namespace
IEdmGetOpCallback::ProgressBegin Method ()
IEdmGetOpCallback::ProgressEnd Method ()
IEdmGetOpCallback::ProgressStep Method ()
IEdmUnlockOpCallback::ProgressBegin Method ()
IEdmUnlockOpCallback::ProgressEnd Method ()
IEdmUnlockOpCallback::ProgressStep Method ()
IEdmUnlockOpCallback::ProgressStepEvent Method ()


EdmRawRefFlags Enumeration

EdmRawRefFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRawRefFlags Enumeration

Flags used in EdmRawReference. Bitmask.

Syntax

Visual Basic
Public Enum EdmRawRefFlags
   Inherits System.Enum
C#
public enum EdmRawRefFlags : System.Enum
C++/CLI
public enum class EdmRawRefFlags : public System.Enum

Members

Member | Description
Edmrrf_Ghost | 1 = DWG files can store grandchildren as references; for example, in the file tree: A.dwg=>B.dwg=>C.dwg the file C.dwg can be stored as a ghost reference in A.dwg and as a normal reference in B.dwg; SOLIDWORKS PDM Professional does not show ghost references in check-in dialog boxes but does update them when files are moved
Edmrrf_InternalComponent | 2 = Not used
Edmrrf_Nothing | 0 = Normal file reference

See Also

EPDM.Interop.epdm Namespace


EdmRefFlags Enumeration

EdmRefFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRefFlags Enumeration

Types of item reference. Bitmask.

Syntax

Visual Basic
Public Enum EdmRefFlags
   Inherits System.Enum
C#
public enum EdmRefFlags : System.Enum
C++/CLI
public enum class EdmRefFlags : public System.Enum

Members

Member | Description
EdmRef_Dynamic | 4 = Auto-update item to file reference
EdmRef_File | 1 = Item to file reference
EdmRef_Item | 2 = Item to item reference
EdmRef_Static | 8 = Attachment-type item to file reference

See Also

EPDM.Interop.epdm Namespace
EdmItemRef Structure
IEdmReference7::EdmRefFlags Property ()
IEdmReference7::GetFirstChildPosition2
IEdmReference7::GetFirstParentPosition2 Method ()
IEdmBatchItemGeneration2::AddSelection2 Method ()


EdmRefItemProperty Enumeration

EdmRefItemProperty Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRefItemProperty Enumeration

Types of property that can be accessed in IEdmRefItem objects via IEdmRefItem::GetProperty and IEdmRefItem::SetProperty.

Syntax

Visual Basic
Public Enum EdmRefItemProperty
   Inherits System.Enum
C#
public enum EdmRefItemProperty : System.Enum
C++/CLI
public enum class EdmRefItemProperty : public System.Enum

Members

Member | Description
Edmrip_CheckAdd | 27 = R+W; Boolean; add file?
Edmrip_CheckChangeState | 28 = R+W; Boolean; change the state of the file?
Edmrip_CheckCopy | 24 = R+W; Boolean; copy file?
Edmrip_CheckGet | 20 = R+W; Boolean; retrieve file?
Edmrip_CheckHasBlockingWarning | 30 = R+W; Boolean; file has blocking warning?
Edmrip_CheckIncRev | 21 = R+W; Boolean; increment revision?
Edmrip_CheckKeepLocked | 19 = R+W; Boolean; keep check-out state after check in?
Edmrip_CheckLock | 17 = R+W; Boolean; check out file?
Edmrip_CheckOverwriteLatestVersion | 29 = R+W; Boolean; overwrite the latest version of the file with the new changes instead of creating a new version?
Edmrip_CheckRemoveLocal | 23 = R+W; Boolean; Check In container; remove local file copy after check in?
Edmrip_CheckUndoLock | 22 = R+W; Boolean; Check In container; remove check-out state without producing a new version?
Edmrip_CheckUnlock | 18 = R+W; Boolean; Check In container; check in file?
Edmrip_FileName | 2 = R; string; All container; filename
Edmrip_FoundPath | 7 = R; string; Check In container; file system path to folder where file is found
Edmrip_HasReadPermission | 35 = Boolean; Has read permission?
Edmrip_ID | 0 = R; string; All container; unique ID of the item in the container
Edmrip_IncludedAs | 6 = R; string; Check In container; include path used to reference this file
Edmrip_LockComputer | 4 = R; string; Check In container; name of computer where file is checked out
Edmrip_LockPath | 3 = R; string; Check In container; file system path to folder where file is checked out
Edmrip_LockUser | 5 = R; string; Check In container; name of user who checked out file
Edmrip_RefName | 1 = R; string; All container; name of file reference; does not have to be the filename
Edmrip_RevisionLatest | 15 = R; string; current revision number of file
Edmrip_RevisionNew | 16 = R; string; next revision number of file
Edmrip_ShowMultipleWarnings | 31 = R+W; Boolean; display the Multiple Warnings link in the command dialog box's warning column?
Edmrip_Size | 33 = R; integer; file size
Edmrip_StatusHresult | 25 = R; HRESULT; All container; binary error code for this item
Edmrip_StatusText | 26 = R; string; All container; error code
Edmrip_TransitionID | 34 = R; integer; Transition ID returned with change state operation
Edmrip_Type | 32 = R; integer; Check In container; type of file: 1=normal, 2=virtual, 3=BOM, 4=item, 5=cutlist, 6=toolbox part
Edmrip_VersionAttached | 11 = R; integer; Check In container; version that was referenced before check in
Edmrip_VersionLatest | 9 = R; integer; Check In container; latest version of the file
Edmrip_VersionLocal | 8 = R; integer; Check In container; version of file copy on the local disk
Edmrip_VersionNew | 10 = R; integer; Check In container; next version of the file
Edmrip_VersionNewAttached | 12 = R; integer; Check In container; version that will be referenced after check in
Edmrip_WorkflowStateIcon | 14 = R; string; Check In container; name of the file's current workflow state icon
Edmrip_WorkflowStateName | 13 = R; string; Check In container; name of the file's current workflow state

Remarks

See Also

EPDM.Interop.epdm Namespace


EdmRefItemType Enumeration

EdmRefItemType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRefItemType Enumeration

Items to return from IEdmRefItemContainer::GetItems.

Syntax

Visual Basic
Public Enum EdmRefItemType
   Inherits System.Enum
C#
public enum EdmRefItemType : System.Enum
C++/CLI
public enum class EdmRefItemType : public System.Enum

Members

Member | Description
Edmrit_All | 2 = Return all items in the container (recursively)
Edmrit_Roots | 1 = Return only root items in the container

See Also

EPDM.Interop.epdm Namespace


EdmRefreshFlag Enumeration

EdmRefreshFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRefreshFlag Enumeration

Flags that cause SOLIDWORKS PDM Professional to refresh elements of the user interface. Bitmask.

Syntax

Visual Basic
Public Enum EdmRefreshFlag
   Inherits System.Enum
C#
public enum EdmRefreshFlag : System.Enum
C++/CLI
public enum class EdmRefreshFlag : public System.Enum

Members

Member | Description
EdmRefresh_FileList | 1 = Refresh the file listing in File Explorer; this value should be returned if you add, delete, rename, check out, check in, etc., a file and want the change to be immediately visible to the user
EdmRefresh_Hooks | 2 = Force reloading of hooks; this value is normally only returned if your add-in changes the number of registered hooks
EdmRefresh_Menu | 4 = Force an update of the Tools menu in the File Explorer; this value is normally only returned if your add-in changes the number of registered menu commands
EdmRefresh_Nothing | 0 = No refresh is required
EdmRefresh_Toolbar | 8 = Force an update of the toolbar in File Explorer; this value is normally only returned if your add-in changes the number of registered menu commands with toolbar buttons

Remarks

You can return a combination of these flags from your add-in's IEdmAddIn5::OnCmd via the EdmCmd struct to cause SOLIDWORKS PDM Professional to refresh certain parts of the user interface.

See Also

EPDM.Interop.epdm Namespace
EdmCmd::mlEdmRefreshFlags Field


EdmRefType Enumeration

EdmRefType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRefType Enumeration

Types of references to return from IEdmRefItem::GetRefs.

Syntax

Visual Basic
Public Enum EdmRefType
   Inherits System.Enum
C#
public enum EdmRefType : System.Enum
C++/CLI
public enum class EdmRefType : public System.Enum

Members

Member | Description
Edmrt_Children | 1 = Return normal file references
Edmrt_SubParents | 2 = Return sub-parents, which are parent files displayed as blue children in the reference dialog box; drawing files for some CAD formats are displayed this way

See Also

EPDM.Interop.epdm Namespace


EdmRepaintType Enumeration

EdmRepaintType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRepaintType Enumeration

Types of flags passed into IEdmImage::Reposition to control how to handle repainting of the background window.

Syntax

Visual Basic
Public Enum EdmRepaintType
   Inherits System.Enum
C#
public enum EdmRepaintType : System.Enum
C++/CLI
public enum class EdmRepaintType : public System.Enum

Members

Member | Description
EdmRepaint_Erase | 2 = Trigger both paint and erase (WM_ERASEBKGND) message
EdmRepaint_Nothing | 0 = Do not refresh the window
EdmRepaint_Repaint | 1 = Trigger a repaint (WM_PAINT) message but not a background erase

See Also

EPDM.Interop.epdm Namespace


EdmResolveAction Enumeration

EdmResolveAction Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmResolveAction Enumeration

Types of flags that you return to SOLIDWORKS PDM Professional from IEdmCallback6::Resolve. Bitmask.

Syntax

Visual Basic
Public Enum EdmResolveAction
   Inherits System.Enum
C#
public enum EdmResolveAction : System.Enum
C++/CLI
public enum class EdmResolveAction : public System.Enum

Members

Member | Description
Edmra_ClearUnique | 2 = Clear the duplicated unique-constrained values
Edmra_CopySerial | 4 = Copy existing serial number values from the source file
Edmra_CreateSerial | 8 = Create new serial number values
Edmra_ForceGenerateSerial | 128 = Force regeneration of serial numbers when values already exist; without the flag, SOLIDWORKS PDM Professional only generates values that are missing in the file
Edmra_KeepExistingSerialNumbers | 32 = Do not replace existing serial numbers with new ones; SOLIDWORKS PDM Professional still creates serial numbers for empty fields; if this flag is not specified, SOLIDWORKS PDM Professional overwrites existing serial numbers with new ones
Edmra_Replace | 1 = Replace existing file with the new one
Edmra_Skip | 16 = Do not process this file
Edmra_UniqueVarDelayCheck | 64 = Delay the unique variable check to next check in

See Also

EPDM.Interop.epdm Namespace


EdmResolveReason Enumeration

EdmResolveReason Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmResolveReason Enumeration

Types of flags, which contain the reason for the function call, to pass to your implementation of IEdmCallback6::Resolve. Bitmask.

Syntax

Visual Basic
Public Enum EdmResolveReason
   Inherits System.Enum
C#
public enum EdmResolveReason : System.Enum
C++/CLI
public enum class EdmResolveReason : public System.Enum

Members

Member | Description
Edmrr_DstExists | 1 = Destination file name is already used in the folder
Edmrr_DstExistsGlobal | 64 = Destination file name is already used in the vault
Edmrr_FolderExists | 32 = Folder with the same name exists
Edmrr_LockedByYouHere | 2 = Destination (existing) file is checked out by the logged-in user
Edmrr_SameAsSource | 4 = Source file and the destination file are the same
Edmrr_SerialNumber | 16 = Source file contains serial number values
Edmrr_UniqueValues | 8 = Source file contains unique, constrained, variable values that must be cleared on copy

See Also

EPDM.Interop.epdm Namespace


EdmRevComponentFlags Enumeration

EdmRevComponentFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmRevComponentFlags Enumeration

Flags used to control the members of the struct EdmRevComponent2. Bitmask.

Syntax

Visual Basic
Public Enum EdmRevComponentFlags
   Inherits System.Enum
C#
public enum EdmRevComponentFlags : System.Enum
C++/CLI
public enum class EdmRevComponentFlags : public System.Enum

Members

Member | Description
Edmrcf_EndOfListContinue | 4 = Continue to use the last list item when the end of the list is reached
Edmrcf_EndOfListRestart | 2 = Restart from the first list item when the end of the list is reached
Edmrcf_EndOfListSendMail | 16 = Send mail to a user or group when the end of the list is reached; the recipient ID is stored in the EdmRevcomponent2 mlRecipientID struct field
Edmrcf_EndOfListStop | 8 = Halt the operation when the end of the list is reached
Edmrcf_RecipientIsGroup | 1 = EdmRevcomponent2 mlRecipientID struct field is a group ID; this flag is only used in combination with Edmrcf_EndOflistSendMail
Edmrcf_TypeFormatString | 32 = Revision number is of type format string
Edmrcf_TypeList | 64 = Revision number is of type list

See Also

EPDM.Interop.epdm Namespace


EdmRightFlags Enumeration

EdmRightFlags Enumeration
See Also Example
[image]
EPDM.Interop.epdm Namespace : EdmRightFlags Enumeration

Flags used in calls to IEdmFolder5::HasRights and IEdmFolder5::HasRightsEx to check user rights. Bitmask.

Syntax

Visual Basic
Public Enum EdmRightFlags
   Inherits System.Enum
C#
public enum EdmRightFlags : System.Enum
C++/CLI
public enum class EdmRightFlags : public System.Enum

Members

Member | Description
EdmRight_Add | 8 = Permission to add files
EdmRight_AddFolder | 16777216 = Permission to create subfolders
EdmRight_All | -1 or 0xffffffff = Complete set of rights NOTE: Do not use this constant in rights checking, because more flags might be added in the future. Instead, explicitly specify the rights bits.
EdmRight_BomActivate | 1024 = Activate computed BOM
EdmRight_ChangeCard | 65536 = Permission to change the contents of a file/folder data card
EdmRight_ColdStoreRestore | 524288 = Restore file from cold storage
EdmRight_Delete | 4 = Permission to delete files
EdmRight_DeleteFolder | 64 = Permission to delete subfolders
EdmRight_DestroyTrash | 256 = Destroy
EdmRight_EditFolderCard | 512 = Edit folder card data
EdmRight_EditVerFreeVarData | 1048576 = Edit version free variable data
EdmRight_IncrementRevision | 32 = Permission to increment revision on files
EdmRight_Lock | 2 = Permission to check out files
EdmRight_MandatoryVersionComments | 67108864 = Must enter revision comments
EdmRight_MaySeeComputedBOM | 2048 = See computed BOM
EdmRight_MoveFile | 2097152 = Permission to move files
EdmRight_MoveFolder | 8388608 = Permission to move folders
EdmRight_None | 0 = No rights at all; used internally
EdmRight_OverwriteLatestVersion | 33554432 = Overwrite latest version
EdmRight_PrivateState | 4194304 = Permission to make state private
EdmRight_Read | 1 = Permission to read files
EdmRight_RecoverTrash | 128 = Recover files from the recycle bin
EdmRight_Rename | 8 = Permission to rename files
EdmRight_RenameFolder | 16777216 = Permission to rename folders
EdmRight_Rollback | 262144 = Can run the rollback command in the history dialog box
EdmRight_SeePrivateStateFileContent | 536870912 = For Web2, permission to see contents of private state file
EdmRight_Share | 16 = Permission to share files
EdmRight_ShowWorkingVersion | 131072 = Permission to see working versions, not just revisions

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)

See Also

EPDM.Interop.epdm Namespace


EdmSearchToken Enumeration

EdmSearchToken Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmSearchToken Enumeration

Values that determine which search criteria to set.

Syntax

Visual Basic
Public Enum EdmSearchToken
   Inherits System.Enum
C#
public enum EdmSearchToken : System.Enum
C++/CLI
public enum class EdmSearchToken : public System.Enum

Members

Member | Description
Edmstok_AllVersions | 2 = VT_BOOL; search all versions of a file
Edmstok_Category | 44 = VT_BSTR; search for files in this category
Edmstok_ContentText | 36 = VT_BSTR; search for this string in the file body itself; this requires that the indexing service has been enabled in the administration tool
Edmstok_ContentTextExact | 40 = VT_BOOL; find only exact matches of the content string, not individual words
Edmstok_ContentTextInBody | 37 = VT_BOOL; do content search in the file body
Edmstok_ContentTextInProperties | 38 = VT_BOOL; do content search in the file custom properties
Edmstok_ContentTextOr | 39 = VT_BOOL; search for any words, instead of all of the words, in the content search string
Edmstok_FindFiles | 31 = VT_BOOL; return files in the result
Edmstok_FindFolders | 32 = VT_BOOL; return folders in the result
Edmstok_FindItems | 41 = VT_BOOL; return items in the search result
Edmstok_FolderID | 5 = VT_I4; ID of folder to start the search in
Edmstok_FolderPath | 4 = VT_BSTR; search starting in this folder path
Edmstok_HexSearchID | 50 = VT_BSTR; search by hexadecimal search ID
Edmstok_HistoryAfter | 34 = VT_DATE; search history after this date
Edmstok_HistoryBefore | 33 = VT_DATE; search history before this date
Edmstok_HistoryString | 25 = VT_BSTR; search for string in file history
Edmstok_HistoryStringConfiguration | 43 = VT_BOOL; search for keyword among configuration names
Edmstok_HistoryStringFileName | 42 = VT_BOOL; search for keyword among file names
Edmstok_HistoryStringLabels | 27 = VT_BOOL; search labels for the history string
Edmstok_HistoryStringRevisionComment | 29 = VT_BOOL; search revisions comments for the history string
Edmstok_HistoryStringStateComment | 28 = VT_BOOL; search workflow state change comments for the history string
Edmstok_HistoryStringVariableValues | 30 = VT_BOOL; search variable values for the history string
Edmstok_HistoryStringVersionComment | 26 = VT_BOOL; search version comments for the history string
Edmstok_Label | 20 = VT_BSTR; search for this string in labels
Edmstok_LabelAfter | 24 = VT_DATE; search for labels set after this date
Edmstok_LabelBefore | 23 = VT_DATE; search for labels set before this date
Edmstok_LabelByUser | 22 = VT_BSTR; search for files where a user with this name created a label
Edmstok_LabelComment | 21 = VT_BOOL; search for the label string in the comment
Edmstok_Locked | 6 = VT_BOOL; search for checked out files
Edmstok_LockedBy | 8 = VT_BSTR; search for files checked out by users with this name
Edmstok_LoggedInUser | 47 = VT_BSTR; search for this logged in user
Edmstok_LoggedOutUser | 48 = VT_BSTR; search for this logged out user
Edmstok_MigratedFiles | 51 = VT_BOOL; search only in imported files
Edmstok_Name | 3 = VT_BSTR; search for file or folder by name
Edmstok_PrivateStateFiles | 45 = VT_BSTR; search for files in the vault that have not been checked in yet
Edmstok_Recursive | 1 = VT_BOOL; search subfolders recursively
Edmstok_RevisionNo | 46 = VT_I4; search by revision number
Edmstok_SearchID | 49 = VT_I4; search by search ID
Edmstok_StateAfter | 19 = VT_DATE; only find files where a state change was made after this date
Edmstok_StateBefore | 18 = VT_DATE; only find files where a state change was made before this date
Edmstok_StateByUser | 17 = VT_BSTR; find files where a user with this name has changed workflow state
Edmstok_StateHistoric | 16 = VT_BOOL; search in historic states, not just the latest state
Edmstok_StateID | 15 = VT_I4; only find files in the workflow state with this ID
Edmstok_StateName | 14 = VT_BSTR; only find files in workflow states with this name
Edmstok_Unlocked | 7 = VT_BOOL; search for checked in files
Edmstok_VersionComment | 10 = VT_BSTR; search for files with this version comment
Edmstok_VersionsAfter | 13 = VT_DATE; only find files that have been checked in after this date
Edmstok_VersionsBefore | 12 = VT_DATE; only find files that have been checked in before this date
Edmstok_VersionsByUser | 11 = VT-BSTR; only find files that have been checked in by a user with this name
Edmstok_WorkflowName | 35 = VT_BSTR; search for files part of this workflow

Remarks

Used by IEdmSearch6::GetToken and IEdmSearch6::SetToken.

See Also

EPDM.Interop.epdm Namespace


EdmStateFlags Enumeration

EdmStateFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmStateFlags Enumeration

Flags used in calls to IEdmFile5::ChangeState to set options for the operation. Bitmask.

Syntax

Visual Basic
Public Enum EdmStateFlags
   Inherits System.Enum
C#
public enum EdmStateFlags : System.Enum
C++/CLI
public enum class EdmStateFlags : public System.Enum

Members

Member | Description
EdmState_Refs | 1 = Include references when changing state
EdmState_Simple | 0 = Default behavior of the operation

See Also

EPDM.Interop.epdm Namespace


EdmSysPerm Enumeration

EdmSysPerm Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmSysPerm Enumeration

Types of system permissions for a user or group.

Syntax

Visual Basic
Public Enum EdmSysPerm
   Inherits System.Enum
C#
public enum EdmSysPerm : System.Enum
C++/CLI
public enum class EdmSysPerm : public System.Enum

Members

Member | Description
EdmSysPerm_AcceptTasks | 1026 = May accept tasks to execute on a host
EdmSysPerm_CanAddCustomColsInFileDetails | 1032 = May add custom columns in File details
EdmSysPerm_CanAddCustomColsInFileOperations | 1033 = May add custom columns in File operations
EdmSysPerm_CanAddDelLabels | 2048 = May add and delete labels
EdmSysPerm_CanDeleteLabels | 1029 = May delete labels
EdmSysPerm_CanPurgeHistory | 1024 = May purge history listings
EdmSysPerm_CanSetLabels | 1030 = May set labels
EdmSysPerm_CantIgnoreWarnings | 4096 = Cannot click OK in the Check-in, Check-out, Get, etc., dialog boxes if there are any warnings in them
EdmSysPerm_CanUndoCheckOutAndCheckInForOthers

1028 =

  1. May check in a file checked out to a different user in the same vault view
  2. May undo checkouts of files that are checked out to a different user in the same or different vault view
  3. Default permission for the Admin user in a new or upgraded 2018 vault
  4. Applicable to all users/groups
EdmSysPerm_CanUpdateHistoryComments | 1031 = May delete history comments
EdmSysPerm_CanViewTask | 1034 = may view task list
EdmSysPerm_EditAddins | 4 = May install or uninstall add-ins
EdmSysPerm_EditReportQuery | 512 = May modify report queries
EdmSysPerm_EditSharedSearchQuery | 64 = May update shared search favorites
EdmSysPerm_EditTemplates | 256 = May update templates
EdmSysPerm_EditUserMgr | 1 = May update user and group properties
EdmSysPerm_EditWorkflow | 2 = May edit workflows
EdmSysPerm_ExportWebFolder | 128 = May export file vault folders to the internet
EdmSysPerm_MandatoryMailLogin | 32 = Must enter password before sending email
EdmSysPerm_MandatoryStateComments | 16 = Must enter change state comments
EdmSysPerm_MandatoryVersionComments | 8 = Must enter version comments
EdmSysPerm_MaySeeAdminTool | 67108864 = May see the Administration tool menu command item in File Explorer
EdmSysPerm_ModifyCardLists | 131072 = May update definitions of lists used in cards
EdmSysPerm_ModifyCategories | 8192 = May update category definitions
EdmSysPerm_ModifyColdStore | 268435456 = May update the cold storage settings
EdmSysPerm_ModifyColumns | 65536 = May update column definitions, including BOM definitions
EdmSysPerm_ModifyERPCfg | 1073741824 = May update XML Import and Export settings
EdmSysPerm_ModifyIndexing | 536870912 = May update the indexing settings
EdmSysPerm_ModifyItemNoGen | 2097152 = May administrate items
EdmSysPerm_ModifyLicenseKey | 524288 = May enter a new license key
EdmSysPerm_ModifyMailCfg | 1048576 = May update the notification settings
EdmSysPerm_ModifyReplication | 4194304 = May update vault replication settings
EdmSysPerm_ModifyRevisionNumbers | 32768 = May update the definition of revision numbers
EdmSysPerm_ModifySearchForms | 16777216 = May save search cards with the card editor
EdmSysPerm_ModifySerialNumbers | 262144 = May update serial number generators
EdmSysPerm_ModifyTasks | 1025 = May manage task definitions in the Administration tool
EdmSysPerm_ModifyTemplateForms | 33554432 = May save template cards with the card editor
EdmSysPerm_ModifyToolbox | 1027 = May update Toolbox Library settings in the Administration tool
EdmSysPerm_ModifyVariables | 16384 = May update variable definitions
EdmSysPerm_None | 0 = No rights at all
EdmSysPerm_RefuseLogin | 134217728 = Block the user from logging in

Remarks

This enumeration was added in SOLIDWORKS PDM Professional 2010 and supersedes the EdmSysRightFlags enumeration.

Always use the IEdmUser7::HasSysRightEx and IEdmUserGroup6::HasSysRightEx methods instead of the obsoleted IEdmUser5::HasSysRight and IEdmUserGroup5::HasSysRight methods when writing code for SOLIDWORKS PDM Professional 2010 and later.

See Also

EPDM.Interop.epdm Namespace


EdmSysRightFlags Enumeration

EdmSysRightFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmSysRightFlags Enumeration

Obsolete. Superseded by EdmSysPerm .

Syntax

Visual Basic
Public Enum EdmSysRightFlags
   Inherits System.Enum
C#
public enum EdmSysRightFlags : System.Enum
C++/CLI
public enum class EdmSysRightFlags : public System.Enum

Members

Member | Description
EdmSysRight_CanAddDelLabels | 2048 = May add and delete labels
EdmSysRight_CanPurgeHistory | 1024 = May delete the contents of history listings
EdmSysRight_CantIgnoreWarnings | 4096 = May not click OK in the check in, check out, Get, etc. dialog boxes if there are warnings in them
EdmSysRight_EditAddins | 4 = May install or uninstall add-ins
EdmSysRight_EditReportQuery | 512 = May use the Report Generator
EdmSysRight_EditSharedSearchQuery | 64 = May update shared search favorites
EdmSysRight_EditTemplates | 256 = May run the Template Manager
EdmSysRight_EditUserMgr | 1 = May run the User Manager
EdmSysRight_EditWorkflow | 2 = May run the Workflow Editor
EdmSysRight_ExportWebFolder | 128 = May export file vault folders to the internet
EdmSysRight_MandatoryMailLogin | 32 = Must enter password before sending email
EdmSysRight_MandatoryStateComments | 16 = Must enter change state comments
EdmSysRight_MandatoryVersionComments | 8 = Must enter version comments
EdmSysRight_MaySeeAdminTool | 67108864 = May see the Administration tool in the Tools menu in the File Explorer
EdmSysRight_ModifyCardLists | 131072 = May update lists used in cards
EdmSysRight_ModifyCategories | 8192 = May update category definitions in the SOLIDWORKS PDM Professional Administration tool
EdmSysRight_ModifyColdStore | 268435456 = May update the cold storage settings
EdmSysRight_ModifyColumns | 65536 = May update column definitions
EdmSysRight_ModifyERPCfg | 1073741824 = May update ERP import/export settings
EdmSysRight_ModifyIndexing | 536870912 = May update indexing settings
EdmSysRight_ModifyItemNoGen | 2097152 = May update item settings
EdmSysRight_ModifyLicenseKey | 524288 = May enter a new license key
EdmSysRight_ModifyMailCfg | 1048576 = May update the notification settings
EdmSysRight_ModifyReplication | 4194304 = May update replication settings
EdmSysRight_ModifyRevisionNumbers | 32768 = May update the definition of revision numbers
EdmSysRight_ModifySearchForms | 16777216 = May update search forms
EdmSysRight_ModifySerialNumbers | 262144 = May update serial number generators
EdmSysRight_ModifyTemplateForms | 33554432 = May update template input forms
EdmSysRight_ModifyVariables | 16384 = May update variable definitions
EdmSysRight_None | 0 = No permissions
EdmSysRight_RefuseLogin | 134217728 = Block the user from logging in

Remarks

Flags that indicate which SOLIDWORKS PDM Professional permissions a user has, etc. Bitmask.

See Also

EPDM.Interop.epdm Namespace


EdmTaskFlag Enumeration

EdmTaskFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmTaskFlag Enumeration

Task add-in flags used in IEdmTaskProperties::TaskFlags and EdmTaskInfo. Bitmask.

Syntax

Visual Basic
Public Enum EdmTaskFlag
   Inherits System.Enum
C#
public enum EdmTaskFlag : System.Enum
C++/CLI
public enum class EdmTaskFlag : public System.Enum

Members

Member | Description
EdmTask_Nothing | 0 = None of the other flags
EdmTask_SupportsChangeState | 16 = Task can be launched via a workflow, state, change command
EdmTask_SupportsDetails | 4 = Add-in extends the task details dialog box in the task list window in the Administration tool; the add-in will receive a call to its IEdmAddIn5::OnCmd method with the argument EdmCmdType.EdmCmd_TaskDetails when the dialog box is to be extended
EdmTask_SupportsInitExec | 2 = Add-in wants to have its IEdmAddIn5::OnCmd method called when the user launches the task; this callback type (EdmCmdType.EdmCmd_TaskLaunch) can be used to provide a more sophisticated user interface than one created with the card editor; if this flag is included, then multiple files will be processed by a single task instance; otherwise, each file will be processed by a separate task instance
EdmTask_SupportsInitForm | 1 = Add-in supports displaying of a card created with the card editor; the card is used as the user interface when the task is launched, and the values of the card are accessible to the task add-in when it is executed
EdmTask_SupportsScheduling | 8 = Task can be scheduled

Remarks

The flags indicate what a task add-in is capable of doing.

See Also

EPDM.Interop.epdm Namespace
Programming Tasks


EdmTaskStatus Enumeration

EdmTaskStatus Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmTaskStatus Enumeration

Task add-in statuses.

Syntax

Visual Basic
Public Enum EdmTaskStatus
   Inherits System.Enum
C#
public enum EdmTaskStatus : System.Enum
C++/CLI
public enum class EdmTaskStatus : public System.Enum

Members

Member | Description
EdmTaskStat_CancelPending | 6 = Cancel clicked, but the host computer hasn't noticed it yet
EdmTaskStat_DoneCancelled | 8 = Task terminated through canceling
EdmTaskStat_DoneFailed | 9 = Task completed with errors
EdmTaskStat_DoneOK | 7 = Task completed successfully
EdmTaskStat_ResumePending | 11 = Resume clicked after task was suspended, but the host server hasn't noticed it yet
EdmTaskStat_Retrying | 4 = Execution has failed at least once, but the framework is trying to execute the add-in again
EdmTaskStat_Running | 3 = Task add-in is running on the host computer
EdmTaskStat_Starting | 2 = Task starting on the host computer
EdmTaskStat_Suspended | 5 = Task suspended by the user
EdmTaskStat_SuspensionPending | 10 = Suspend clicked, but the task add-in hasn't noticed it yet

See Also

EPDM.Interop.epdm Namespace
IEdmTaskInstance::GetStatus Method ()
IEdmTaskInstance::SetStatus Method ()


EdmTransitionRightFlags Enumeration

EdmTransitionRightFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmTransitionRightFlags Enumeration

Transition permission flags.

Syntax

Visual Basic
Public Enum EdmTransitionRightFlags
   Inherits System.Enum
C#
public enum EdmTransitionRightFlags : System.Enum
C++/CLI
public enum class EdmTransitionRightFlags : public System.Enum

Members

Member | Description
EdmTransitionRight_DisallowSequentialStateChanges | 2 = Disallow sequential state changes
EdmTransitionRight_MandatoryStateComments | 4
EdmTransitionRight_Permit | 1 = Permit transition

See Also

EPDM.Interop.epdm Namespace


EdmTransitionType Enumeration

EdmTransitionType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmTransitionType Enumeration

Types of transitions.

Syntax

Visual Basic
Public Enum EdmTransitionType
   Inherits System.Enum
C#
public enum EdmTransitionType : System.Enum
C++/CLI
public enum class EdmTransitionType : public System.Enum

Members

Member | Description
EdmTransitionType_Automatic | 1
EdmTransitionType_Normal | 0
EdmTransitionType_Parallel | 2

See Also

EPDM.Interop.epdm Namespace


EdmUnlockBuildTreeFlags Enumeration

EdmUnlockBuildTreeFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockBuildTreeFlags Enumeration

Flags used to control the creation of the check-in file tree created by the IEdmBatchUnlock interface. Bitmask.

Syntax

Visual Basic
Public Enum EdmUnlockBuildTreeFlags
   Inherits System.Enum
C#
public enum EdmUnlockBuildTreeFlags : System.Enum
C++/CLI
public enum class EdmUnlockBuildTreeFlags : public System.Enum

Members

Member | Description
Eubtf_ForceUnlock | 32768 = Unlock the file even if it is not modified; use only in combination with Eubtf_MayUnlock
Eubtf_IgnoreReferences | 65536 = Ignore the child references at check-in; unlock root items only
Eubtf_MayUndoLock | 2 = Support undo file check-out
Eubtf_MayUnlock | 1 = Support file check-in
Eubtf_MayUnlockWithLatest | 4096 = Check in latest version instead of cached version; use only in combination with Eubtf_MayUnlock
Eubtf_MayUnlockWithoutOverwrite | 16384 = Check in without version overwrite; use only in combination with Eubtf_MayUnlock
Eubtf_NoCallbackDlgErrors | 256 = Do not pass dialog box errors to the callback
Eubtf_NoRemoveLocalCopy | 128 = Do not display the Remove Local Copy column in the dialog box
Eubtf_Nothing | 0 = None of the other flags
Eubtf_RefreshFileListing | 32 = Refresh the file listing in the File Explorer when the operation completes
Eubtf_SearchForDrawings | 512 = Include drawings as sub-parent nodes
Eubtf_ShowCloseAfterCheckinOption | 2048 = Display the Reload or Close Files after Check In dropdown on the Check In or Undo Check Out dialog box toolbar; this option permits the user to choose whether to close the files in SOLIDWORKS after the check-in operation has succeeded or reload them in SOLIDWORKS
Eubtf_ShowMultipleWarnings | 8192 = Display Multiple Warnings link in warning column of dialog
Eubtf_SkipOpenFileChecks | 1024 = Do not check whether files are open in another application
Eubtf_UndoLockDefault | 4 = Make undo check-out the default operation
Eubtf_Warn_UndoLockModifiedInCb | 16 = Warn the caller of undo check-out of modified files via the callback interface
Eubtf_Warn_UndoLockModifiedInDlg | 8 = Show warning icon in the Undo Check Out dialog box for modified files marked for undo check-out

See Also

EPDM.Interop.epdm Namespace


EdmUnlockEvent Enumeration

EdmUnlockEvent Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockEvent Enumeration

Types of check-in command passed to the IEdmUnlockOpCallback interface to notify the caller about what is happening while checking in files with the IEdmBatchUnlock interface.

Syntax

Visual Basic
Public Enum EdmUnlockEvent
   Inherits System.Enum
C#
public enum EdmUnlockEvent : System.Enum
C++/CLI
public enum class EdmUnlockEvent : public System.Enum

Members

Member | Description
Euev_CompressingTree | 3 = Check-in command is compressing the reference tree
Euev_ReadingFileRefs | 1 = Check-in command is reading external references from the file
Euev_UnlockFile | 2 = Check-in command is checking in a file

See Also

EPDM.Interop.epdm Namespace


EdmUnlockEventMsg Enumeration

EdmUnlockEventMsg Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockEventMsg Enumeration

Type of check-in commands passed to IEdmUnlockOpCallback while checking in files with the IEdmBatchUnlock interface in order to notify the caller about the progress of the operation.

Syntax

Visual Basic
Public Enum EdmUnlockEventMsg
   Inherits System.Enum
C#
public enum EdmUnlockEventMsg : System.Enum
C++/CLI
public enum class EdmUnlockEventMsg : public System.Enum

Members

Member | Description
Euev_ReadingDbFileInfo | 1 = Check-in command is reading information from the database about the selected files

See Also

EPDM.Interop.epdm Namespace


EdmUnlockFileListFlag Enumeration

EdmUnlockFileListFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockFileListFlag Enumeration

Flags telling IEdmBatchUnlock::GetFileList what kind of files to get. Bitmask.

Syntax

Visual Basic
Public Enum EdmUnlockFileListFlag
   Inherits System.Enum
C#
public enum EdmUnlockFileListFlag : System.Enum
C++/CLI
public enum class EdmUnlockFileListFlag : public System.Enum

Members

Member | Description
Euflf_GetUndoLocked | 2 = Files with their locks undone
Euflf_GetUnlocked | 1 = Checked-in files
Euflf_GetUnprocessed | 4 = Files not processed by the operation

See Also

EPDM.Interop.epdm Namespace


EdmUnlockFlag Enumeration

EdmUnlockFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockFlag Enumeration

Flags used in IEdmFile5::UnlockFile to control the behavior of the check-in operation. Bitmask.

Syntax

Visual Basic
Public Enum EdmUnlockFlag
   Inherits System.Enum
C#
public enum EdmUnlockFlag : System.Enum
C++/CLI
public enum class EdmUnlockFlag : public System.Enum

Members

Member | Description
EdmUnlock_FailOnRegenerationNeed | 16 = Fail if the file needs to be regenerated in the CAD program NOTE: Only files resaved in SOLIDWORKS 2009 or later can trigger this flag
EdmUnlock_ForceUnlock | 256 = Unlock the file even if it is not modified
EdmUnlock_IgnoreCorruptFile | 4 = Ignore files with file formats unrecognized by SOLIDWORKS PDM Professional; without this flag, SOLIDWORKS PDM Professional returns E_EDM_INVALID_FILE if it encounters a corrupt file or a file containing a newer format than SOLIDWORKS PDM Professional can handle
EdmUnlock_IgnoreReferences | 128 = Silently unlock parent files without their references
EdmUnlock_IgnoreRefsNotLockedByCaller | 32 = Ignore references not locked by caller
EdmUnlock_IgnoreRefsOutsideVault | 8 = Ignore references to files outside the vault
EdmUnlock_KeepLocked | 1 = Keep the file checked out after creating the new version in the archive
EdmUnlock_OverwriteLatestVersion | 64 = Do not create a new version; overwrite the last version of the file with new changes
EdmUnlock_RemoveLocalCopy | 2 = Remove the local copy of the file from the hard disk after the file has been checked in
EdmUnlock_Simple | 0 = Check in the file using default behavior

See Also

EPDM.Interop.epdm Namespace


EdmUnlockOpMsg Enumeration

EdmUnlockOpMsg Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockOpMsg Enumeration

Types of constant passed to IEdmUnlockOpCallback::MsgBox when the caller should either display a message to the user or process the message in some other way.

Syntax

Visual Basic
Public Enum EdmUnlockOpMsg
   Inherits System.Enum
C#
public enum EdmUnlockOpMsg : System.Enum
C++/CLI
public enum class EdmUnlockOpMsg : public System.Enum

Members

Member | Description
Euom_AdminUndoLock | 5 = You are logged in as Admin and are trying to undo the check-out flag on a file checked out by another user
Euom_AdminUnlock | 8 = You are logged in as Admin and are trying to check in a file that is checked out by another user
Euom_CircularReference | 9 = The files checked have circular references
Euom_DocumentDoesNotMeetConditionsInAnyCategory | 11 = The document cannot be unlocked because it does not meet the conditions of any category
Euom_DocumentDoesNotMeetConditionsInAnyWorkflow | 10 = The document cannot be unlocked because it does not meet the conditions of any workflow
Euom_DuplicateUniqueVar | 1 = The file has a unique variable with a duplicate value
Euom_LocalFileNotFound | 6 = The local copy of the file was not found
Euom_LocalFileShareError | 7 = Sharing violation accessing the local copy of the file
Euom_MissingMandatoryVar | 2 = The file cannot be checked in, because the file contains a unique and constrained variable with a value that is already used elsewhere
Euom_UndoLockModified | 4 = The file about whose check out you about to undo, has been modified
Euom_UnknownFileFormat | 3 = SOLIDWORKS PDM Professional cannot read references or variables from the file, because its file format is unknown

Remarks

This constant tells which message to display.

See Also

EPDM.Interop.epdm Namespace


EdmUnlockOpReply Enumeration

EdmUnlockOpReply Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockOpReply Enumeration

Types of operations returned from your IEdmUnlockOpCallback::MsgBox method if you implement an IEdmUnlockOpCallback interface to use with the IEdmBatchUnlock interface.

Syntax

Visual Basic
Public Enum EdmUnlockOpReply
   Inherits System.Enum
C#
public enum EdmUnlockOpReply : System.Enum
C++/CLI
public enum class EdmUnlockOpReply : public System.Enum

Members

Member | Description
Euor_Cancel | 1 = Cancel the entire operation
Euor_ClearVar | 10 = Clear the value of the conflicting unique variable
Euor_Error | -1 = Internal error code; typically not returned by you
Euor_OK | 0 = Continue the operation
Euor_Retry | 12 = Retry operation
Euor_SkipFile | 11 = Continue the operation, but skip this particular file

Remarks

The return value tells SOLIDWORKS PDM Professional what to do.

See Also

EPDM.Interop.epdm Namespace


EdmUnlockStatusFlag Enumeration

EdmUnlockStatusFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUnlockStatusFlag Enumeration

Statuses returned by IEdmBatchUnlock2::GetStatus.

Syntax

Visual Basic
Public Enum EdmUnlockStatusFlag
   Inherits System.Enum
C#
public enum EdmUnlockStatusFlag : System.Enum
C++/CLI
public enum class EdmUnlockStatusFlag : public System.Enum

Members

Member | Description
Eusf_CloseAfterCheckinFlag | 1 = Return true if user selects Close File after Check In on the Check In dialog box toolbar, return false if user selects Reload File after Check In
Eusf_Nothing | 0 = Do not use

See Also

EPDM.Interop.epdm Namespace


EdmUserDataExFlag Enumeration

EdmUserDataExFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUserDataExFlag Enumeration

Flags that tell which members of EdmUserDataEx are valid. Bitmask.

Syntax

Visual Basic
Public Enum EdmUserDataExFlag
   Inherits System.Enum
C#
public enum EdmUserDataExFlag : System.Enum
C++/CLI
public enum class EdmUserDataExFlag : public System.Enum

Members

Member | Description
Edmudex_All | A combination of all the other flags NOTE: To get better performance, call IEdmUser10::GetUserDataEx and only specify the enumerators that you need.
Edmudex_CellPhone | 32 = mbsCellPhone of EdmUserDataEx is valid
Edmudex_CompleteName | 2 = mbsCompleteName of EdmUserDataEx is valid
Edmudex_Email | 8 = mbsEmail of EdmUserDataEx is valid
Edmudex_Initials | 1 = mbsInitials of EdmUserDataEx is valid
Edmudex_Nothing | 0 = None of EdmUserDataEx members are valid
Edmudex_Phone | 16 = mbsPhone of EdmUserDataEx is valid
Edmudex_PicturePath | 64 = mbsPicturePath of EdmUserDataEx is valid
Edmudex_PresenceNote | 2048 = mbsPresenceNote of EdmUserDataEx is valid
Edmudex_UserData | 4 = mbsUserData of EdmUserDataEx is valid
Edmudex_WebSite1 | 128 = mbsWebSite1 of EdmUserDataEx is valid
Edmudex_WebSite2 | 256 = mbsWebSite2 of EdmUserDataEx is valid
Edmudex_WebSite3 | 512 = mbsWebSite3 of EdmUserDataEx is valid
Edmudex_WebSite4 | 1024 = mbsWebSite4 of EdmUserDataEx is valid

See Also

EPDM.Interop.epdm Namespace
IEdmUser10::SetUserDataEx Method ()


EdmUserDataFlags Enumeration

EdmUserDataFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUserDataFlags Enumeration

Flags used in EdmUserData's mlFlags field when adding users with IEdmUserMgr6::AddUsers.

Syntax

Visual Basic
Public Enum EdmUserDataFlags
   Inherits System.Enum
C#
public enum EdmUserDataFlags : System.Enum
C++/CLI
public enum class EdmUserDataFlags : public System.Enum

Members

Member | Description
Edmudf_CopySettings | 4 = Copy the settings from the user with EdmUserData.mlUserID
Edmudf_ForceAdd | 2 = Add this user even if other users in the array sent to IEdmUserMgr7::AddUsers2 cannot be added
Edmudf_GetInterface | 1 = Return the IEdmUser6 interface in the structure
Edmudf_Nothing | 0 = None of the other flags

See Also

EPDM.Interop.epdm Namespace


EdmUserPictureFlag Enumeration

EdmUserPictureFlag Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUserPictureFlag Enumeration

Flags that are passed in the lEdmUserPictureFlags argument of IEdmUserMgr8::CreateUserPicture.

Syntax

Visual Basic
Public Enum EdmUserPictureFlag
   Inherits System.Enum
C#
public enum EdmUserPictureFlag : System.Enum
C++/CLI
public enum class EdmUserPictureFlag : public System.Enum

Members

Member | Description
Edmup_Nothing | 0 = Only valid flag in SOLIDWORKS PDM Professional 2013 and later

See Also

EPDM.Interop.epdm Namespace


EdmUserSetting Enumeration

EdmUserSetting Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUserSetting Enumeration

User settings used by IEdmUser11::SetSettingsVar.

Syntax

Visual Basic
Public Enum EdmUserSetting
   Inherits System.Enum
C#
public enum EdmUserSetting : System.Enum
C++/CLI
public enum class EdmUserSetting : public System.Enum

Members

Member | Description
EdmUSv_AutoDelete | 9 = Whether to automatically delete local read-only files that are not part of the vault; 1 = true, 0 = false; this setting corresonds to the "Automatically delete local read-only files that are not part of the file vault" checkbox on the Explorer tab on the Settings dialog that appears when you click "Settings" on the Properties dialog of a user in the Admin Tool
EdmUSv_AutoGetLatest | 11 = Whether to always work with the latest version of files; 1 = true, 0 = false; this setting corresponds to the "Always work with latest version of files" checkbox on the Reference Dialog tab on the Settings dialog that appears when you click "Settings" on the Properties dialog of a user in the Admin Tool
EdmUSv_AutoGetLatestRefs | 43 = Whether to auto-select reference files to get latest when checking out; 1 = true, 0 = false; this setting corresponds to the "Auto select reference files to get latest when checking out" checkbox on the Reference Dialog tab on the Settings dialog that appears when you click "Settings" on the Properties dialog of a user in the Admin Tool

See Also

EPDM.Interop.epdm Namespace


EdmUserType Enumeration

EdmUserType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUserType Enumeration

Type of user passed in UserType of IEdmUserMgr10::AddUsers3.

Syntax

Visual Basic
Public Enum EdmUserType
   Inherits System.Enum
C#
public enum EdmUserType : System.Enum
C++/CLI
public enum class EdmUserType : public System.Enum

Members

Member | Description
EdmUser_Invalid | 0
EdmUser_LDAP | 3
EdmUser_PDM | 1
EdmUser_Windows | 2

See Also

EPDM.Interop.epdm Namespace


EdmUtility Enumeration

EdmUtility Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmUtility Enumeration

Constants that are passed to the IEdmVault7::CreateUtility to create utility interfaces of various kinds.

Syntax

Visual Basic
Public Enum EdmUtility
   Inherits System.Enum
C#
public enum EdmUtility : System.Enum
C++/CLI
public enum class EdmUtility : public System.Enum

Members

Member | Description
EdmUtil_AddCustomRefs | 8 = IEdmAddCustomRefs
EdmUtil_BatchAdd | 16 = IEdmBatchAdd
EdmUtil_BatchAddFolders | 14 = IEdmBatchAddFolders
EdmUtil_BatchChangeState | 22 = IEdmBatchChangeState
EdmUtil_BatchDelete | 20 = IEdmBatchDelete
EdmUtil_BatchGet | 12 = IEdmBatchGet
EdmUtil_BatchItemGeneration | 23 = IEdmBatchItemGeneration
EdmUtil_BatchItemReferenceUpdate | 25 = IEdmBatchItemReferenceUpdate
EdmUtil_BatchList | 13 = IEdmBatchListing
EdmUtil_BatchRefVars | 26 = IEdmBatchRefVars
EdmUtil_BatchUnlock | 6 = IEdmBatchUnlock
EdmUtil_BatchUpdate | 2 = IEdmBatchUpdate
EdmUtil_BomMgr | 24 = IEdmBomMgr
EdmUtil_CategoryMgr | 5 = IEdmCategoryMgr6
EdmUtil_ClearLocalCache | 19 = IEdmClearLocalCache
EdmUtil_FindUser | 29 = IEdmFindUser
EdmUtil_History | 17 = IEdmHistory
EdmUtil_HistoryUpdate | 21 = IEdmHistoryUpdate
EdmUtil_RawReferenceMgr | 15 = IEdmRawReferenceMgr
EdmUtil_RevisionMgr | 18 = IEdmRevisionMgr
EdmUtil_Search | 1 = IEdmSearch5 (creates regular search objects only; to create an advanced search object, use IEdmVault21::CreateSearch2)
EdmUtil_SerNoGen | 11 = IEdmSerNoGen6
EdmUtil_TaskMgr | 30 = IEdmTaskMgr
EdmUtil_TemplateMgr | 10 = IEdmTemplateMgr5
EdmUtil_UpdateReferences | 27 = IEdmUpdateReferences
EdmUtil_UserMgr | 3 = IEdmUserMgr5
EdmUtil_VariableMgr | 9 = IEdmVariableMgr5
EdmUtil_WorkflowMgr | 4 = IEdmWorkflowMgr6

See Also

EPDM.Interop.epdm Namespace


EdmVariableFlags Enumeration

EdmVariableFlags Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmVariableFlags Enumeration

Flags that set the style of variables used in file and folder data cards. Bitmask.

Syntax

Visual Basic
Public Enum EdmVariableFlags
   Inherits System.Enum
C#
public enum EdmVariableFlags : System.Enum
C++/CLI
public enum class EdmVariableFlags : public System.Enum

Members

Member | Description
EdmVar_Mandatory | 2 = Missing values are not permitted; only used for files, ignored for folders
EdmVar_Unique | 1 = Values of the variable must be unique; only used for files, ignored for folders
EdmVar_VerFreeUpdateAll | 4 = Every version and every revision, regardless access, workflow states etc., are affected by the variable update
EdmVar_VerFreeUpdateLatest | 8 = Only the latest version is affected by the variable update

Remarks

Used in IEdmVariable5::Flags.

See Also

EPDM.Interop.epdm Namespace


EdmVariableType Enumeration

EdmVariableType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmVariableType Enumeration

Constants that identify the data type of a variable.

Syntax

Visual Basic
Public Enum EdmVariableType
   Inherits System.Enum
C#
public enum EdmVariableType : System.Enum
C++/CLI
public enum class EdmVariableType : public System.Enum

Members

Member | Description
EdmVarType_Bool | 4 = Boolean data (i.e., yes or no values)
EdmVarType_Date | 5 = Date and time data
EdmVarType_Float | 3 = Floating-point data (64 bit)
EdmVarType_Int | 2 = Integer data (32 bit)
EdmVarType_None | 0 = Error code; used internally
EdmVarType_Text | 1 = String data

Remarks

Used in IEdmVariable5::VariableType.

See Also

EPDM.Interop.epdm Namespace


EdmVarOp Enumeration

EdmVarOp Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmVarOp Enumeration

Operators for variable searches.

Syntax

Visual Basic
Public Enum EdmVarOp
   Inherits System.Enum
C#
public enum EdmVarOp : System.Enum
C++/CLI
public enum class EdmVarOp : public System.Enum

Members

Member | Description
EdmVarOp_DateEqualTo | 130
EdmVarOp_DateGreaterThan | 133
EdmVarOp_DateGreaterThanOrEqualTo | 135
EdmVarOp_DateLessThan | 132
EdmVarOp_DateLessThanOrEqualTo | 134
EdmVarOp_DateNotEqualTo | 131
EdmVarOp_NumberEqualTo | 120
EdmVarOp_NumberGreaterThan | 123
EdmVarOp_NumberGreaterThanOrEqualTo | 125
EdmVarOp_NumberLessThan | 122
EdmVarOp_NumberLessThanOrEqualTo | 124
EdmVarOp_NumberNotEqualTo | 121
EdmVarOp_StringContains | 106
EdmVarOp_StringDoesNotContain | 107
EdmVarOp_StringEqualTo | 100
EdmVarOp_StringGreaterThan | 103
EdmVarOp_StringGreaterThanOrEqualTo | 105
EdmVarOp_StringLessThan | 102
EdmVarOp_StringLessThanOrEqualTo | 104
EdmVarOp_StringNotEqualTo | 101

See Also

EPDM.Interop.epdm Namespace


EdmVaultType Enumeration

EdmVaultType Enumeration
[image]
EPDM.Interop.epdm Namespace : EdmVaultType Enumeration

Vault types.

Syntax

Visual Basic
Public Enum EdmVaultType
   Inherits System.Enum
C#
public enum EdmVaultType : System.Enum
C++/CLI
public enum class EdmVaultType : public System.Enum

Members

Member | Description
EdmVault_Invalid | 2
EdmVault_Professional | 0
EdmVault_Standard | 1

See Also

EPDM.Interop.epdm Namespace


EdmAddFileInfo Structure

EdmAddFileInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmAddFileInfo Structure

Contains information about a file.

Syntax

Visual Basic
Public Structure EdmAddFileInfo
   Inherits System.ValueType
C#
public struct EdmAddFileInfo : System.ValueType
C++/CLI
public value class EdmAddFileInfo : public System.ValueType

Example

struct EdmAddFileInfo{
  integer mlSrcDocumentID;
  integer mlSrcProjectID;
  string mbsPath;
  string mbsNewName;
  integer mlEdmAddFlags;
  integer mlFileID;
};

Example

Add Files to Vault (VB.NET)
Add Files to Vault (C#)

Remarks

Returned by IEdmFolder6::AddFiles.

See Also

EdmAddFileInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 6.0 of SOLIDWORKS PDM Professional


EdmAddFileInfo Structure Fields

EdmAddFileInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddFileInfo Structure

For a list of all members of this type, see EdmAddFileInfo members.

Public Fields

 | Name | Description
public Field | mbsNewName | Optional new name of the added file.
public Field | mbsPath | File system path to the source file.
public Field | mlEdmAddFlags | File add flags.
public Field | mlFileID | ID of the added file.
public Field | mlSrcDocumentID | Optional source file ID.
public Field | mlSrcProjectID | Optional ID of the source file's parent folder.
Top

See Also

EdmAddFileInfo Structure
EPDM.Interop.epdm Namespace


EdmAddFileInfo Structure Members

EdmAddFileInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddFileInfo Structure

The following tables list the members exposed by EdmAddFileInfo.

Public Fields

 | Name | Description
public Field | mbsNewName | Optional new name of the added file.
public Field | mbsPath | File system path to the source file.
public Field | mlEdmAddFlags | File add flags.
public Field | mlFileID | ID of the added file.
public Field | mlSrcDocumentID | Optional source file ID.
public Field | mlSrcProjectID | Optional ID of the source file's parent folder.
Top

See Also

EdmAddFileInfo Structure
EPDM.Interop.epdm Namespace


mbsNewName Field

mbsNewName Field
[image]
EPDM.Interop.epdm Namespace > EdmAddFileInfo Structure : mbsNewName Field

Optional new name of the added file.

Syntax

Visual Basic
Public mbsNewName As System.String
C#
public System.string mbsNewName
C++/CLI
public:
System.String^ mbsNewName

See Also

EdmAddFileInfo Structure
EdmAddFileInfo Members


mbsPath Field

mbsPath Field
[image]
EPDM.Interop.epdm Namespace > EdmAddFileInfo Structure : mbsPath Field

File system path to the source file.

Syntax

Visual Basic
Public mbsPath As System.String
C#
public System.string mbsPath
C++/CLI
public:
System.String^ mbsPath

See Also

EdmAddFileInfo Structure
EdmAddFileInfo Members


mlEdmAddFlags Field

mlEdmAddFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmAddFileInfo Structure : mlEdmAddFlags Field

File add flags.

Syntax

Visual Basic
Public mlEdmAddFlags As System.Integer
C#
public System.int mlEdmAddFlags
C++/CLI
public:
System.int mlEdmAddFlags

Field Value

Combination of EdmAddFlag bits. IEdmFolder6::AddFiles returns the HRESULT code for the file add in this member. The code is S_OK (0) if the file add is successful.

See Also

EdmAddFileInfo Structure
EdmAddFileInfo Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmAddFileInfo Structure : mlFileID Field

ID of the added file.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

See Also

EdmAddFileInfo Structure
EdmAddFileInfo Members


mlSrcDocumentID Field

mlSrcDocumentID Field
[image]
EPDM.Interop.epdm Namespace > EdmAddFileInfo Structure : mlSrcDocumentID Field

Optional source file ID.

Syntax

Visual Basic
Public mlSrcDocumentID As System.Integer
C#
public System.int mlSrcDocumentID
C++/CLI
public:
System.int mlSrcDocumentID

Field Value

0, if the source file is a local file or located outside the file vault

See Also

EdmAddFileInfo Structure
EdmAddFileInfo Members


mlSrcProjectID Field

mlSrcProjectID Field
[image]
EPDM.Interop.epdm Namespace > EdmAddFileInfo Structure : mlSrcProjectID Field

Optional ID of the source file's parent folder.

Syntax

Visual Basic
Public mlSrcProjectID As System.Integer
C#
public System.int mlSrcProjectID
C++/CLI
public:
System.int mlSrcProjectID

Field Value

0, if the source file is located outside the file vault

See Also

EdmAddFileInfo Structure
EdmAddFileInfo Members


EdmAddInFileInfo Structure

EdmAddInFileInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmAddInFileInfo Structure

Contains information about a single file in an add-in package.

Syntax

Visual Basic
Public Structure EdmAddInFileInfo
   Inherits System.ValueType
C#
public struct EdmAddInFileInfo : System.ValueType
C++/CLI
public value class EdmAddInFileInfo : public System.ValueType

Example

struct EdmAddInFileInfo{
  string  mbsFileName;
  integer mlEdmAddInFileInfoFlags;
};

Example

Install Add-in (VB.NET)
Install Add-in (C#)

Remarks

Returned by IEdmAddInMgr8.

See Also

EdmAddInFileInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmAddInFileInfo Structure Fields

EdmAddInFileInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInFileInfo Structure

For a list of all members of this type, see EdmAddInFileInfo members.

Public Fields

 | Name | Description
public Field | mbsFileName | Contains the add-in file name.
public Field | mlEdmAddInFileInfoFlags | Add-in file information flags.
Top

See Also

EdmAddInFileInfo Structure
EPDM.Interop.epdm Namespace


EdmAddInFileInfo Structure Members

EdmAddInFileInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInFileInfo Structure

The following tables list the members exposed by EdmAddInFileInfo.

Public Fields

 | Name | Description
public Field | mbsFileName | Contains the add-in file name.
public Field | mlEdmAddInFileInfoFlags | Add-in file information flags.
Top

See Also

EdmAddInFileInfo Structure
EPDM.Interop.epdm Namespace


EdmAddInInfo Structure

EdmAddInInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmAddInInfo Structure

Provides SOLIDWORKS PDM Professional with information about your add-in.

Syntax

Visual Basic
Public Structure EdmAddInInfo
   Inherits System.ValueType
C#
public struct EdmAddInInfo : System.ValueType
C++/CLI
public value class EdmAddInInfo : public System.ValueType

Example

struct EdmAddInInfo{
  string mbsAddInName;
  string mbsCompany;
  string mbsDescription;
  integer mlAddInVersion;
  integer mlRequiredVersionMajor;
  integer mlRequiredVersionMinor;
};

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)
Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#))

Remarks

Returned by IEdmAddIn5::GetAddInInfo.

The data is displayed in the Administrate Add-ins dialog box. If your add-in relies on features in a specific version of SOLIDWORKS PDM Professional, make it impossible to load the add-in in older versions of SOLIDWORKS PDM Professional by populating the mlRequiredVersionMajor and mlRequiredVersionMinor members.

C++ programmers must set string members to strings allocated with the Win32 function SysAllocString.

See Also

EdmAddInInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 5.2 of SOLIDWORKS PDM Professional


EdmAddInInfo2 Structure

EdmAddInInfo2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmAddInInfo2 Structure

Provides SOLIDWORKS PDM Professional with information about your add-in.

Syntax

Visual Basic
Public Structure EdmAddInInfo2
   Inherits System.ValueType
C#
public struct EdmAddInInfo2 : System.ValueType
C++/CLI
public value class EdmAddInInfo2 : public System.ValueType

Example

struct EdmAddInInfo2{
  string mbsAddInName;
  string mbsCompany;
  string mbsDescription;
  integer mlAddInVersion;
  integer mlRequiredVersionMajor;
  integer mlRequiredVersionMinor;
  string mbsClassID;
  string mbsModulePath;
};

Example

Install Add-in (VB.NET)
Install Add-in (C#)

Remarks

Extends EdmAddInInfo and is returned by IEdmAddInMgr6::GetAddInInfo2.

The data is displayed in the Administrate Add-ins dialog box. If your add-in relies on features in a specific version of SOLIDWORKS PDM Professional, make it impossible to load the add-in in older versions of SOLIDWORKS PDM Professional by populating the mlRequiredVersionMajor and mlRequiredVersionMinor members.

If your add-in relies on features in a specific version of SOLIDWORKS PDM Professional, make it impossible to load the add-in in other versions of SOLIDWORKS PDM Professional by populating the mlRequiredVersionMajor and mlRequiredVersionMinor members.

To restrict your add-in to run only in PDM Pro version... | Populate mlRequiredVersionMajor with... | Populate mlRequiredVersionMinor with...
2019 SP05 | 27 | 5
2020 SP03 | 28 | 3
2021 SP0 | 29 | 0

In general, you can find the major and minor versions for the PDM client version you are running in the Build number field of SOLIDWORKS PDM Administration Tool's Help > About.

C++ programmers must set string members to strings allocated with the Win32 function SysAllocString.

See Also

EdmAddInInfo2 Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmAddInInfo2 Structure Fields

EdmAddInInfo2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInInfo2 Structure

For a list of all members of this type, see EdmAddInInfo2 members.

Public Fields

 | Name | Description
public Field | mbsAddInName | Name of add-in.
public Field | mbsClassID | ID of class that implements IEdmAddIn5.
public Field | mbsCompany | Company that wrote the add-in.
public Field | mbsDescription | Description of add-in.
public Field | mbsModulePath | Path to the DLL that implements the add-in.
public Field | mlAddInVersion | Add-in version number.
public Field | mlRequiredVersionMajor | Required SOLIDWORKS PDM Professional major version.
public Field | mlRequiredVersionMinor | Required SOLIDWORKS PDM Professional minor version.
Top

See Also

EdmAddInInfo2 Structure
EPDM.Interop.epdm Namespace


EdmAddInInfo2 Structure Members

EdmAddInInfo2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInInfo2 Structure

The following tables list the members exposed by EdmAddInInfo2.

Public Fields

 | Name | Description
public Field | mbsAddInName | Name of add-in.
public Field | mbsClassID | ID of class that implements IEdmAddIn5.
public Field | mbsCompany | Company that wrote the add-in.
public Field | mbsDescription | Description of add-in.
public Field | mbsModulePath | Path to the DLL that implements the add-in.
public Field | mlAddInVersion | Add-in version number.
public Field | mlRequiredVersionMajor | Required SOLIDWORKS PDM Professional major version.
public Field | mlRequiredVersionMinor | Required SOLIDWORKS PDM Professional minor version.
Top

See Also

EdmAddInInfo2 Structure
EPDM.Interop.epdm Namespace


mbsAddInName Field

mbsAddInName Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mbsAddInName Field

Name of add-in.

Syntax

Visual Basic
Public mbsAddInName As System.String
C#
public System.string mbsAddInName
C++/CLI
public:
System.String^ mbsAddInName

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mbsClassID Field

mbsClassID Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mbsClassID Field

ID of class that implements IEdmAddIn5.

Syntax

Visual Basic
Public mbsClassID As System.String
C#
public System.string mbsClassID
C++/CLI
public:
System.String^ mbsClassID

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mbsCompany Field

mbsCompany Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mbsCompany Field

Company that wrote the add-in.

Syntax

Visual Basic
Public mbsCompany As System.String
C#
public System.string mbsCompany
C++/CLI
public:
System.String^ mbsCompany

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mbsDescription Field

mbsDescription Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mbsDescription Field

Description of add-in.

Syntax

Visual Basic
Public mbsDescription As System.String
C#
public System.string mbsDescription
C++/CLI
public:
System.String^ mbsDescription

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mbsModulePath Field

mbsModulePath Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mbsModulePath Field

Path to the DLL that implements the add-in.

Syntax

Visual Basic
Public mbsModulePath As System.String
C#
public System.string mbsModulePath
C++/CLI
public:
System.String^ mbsModulePath

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mlAddInVersion Field

mlAddInVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mlAddInVersion Field

Add-in version number.

Syntax

Visual Basic
Public mlAddInVersion As System.Integer
C#
public System.int mlAddInVersion
C++/CLI
public:
System.int mlAddInVersion

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mlRequiredVersionMajor Field

mlRequiredVersionMajor Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mlRequiredVersionMajor Field

Required SOLIDWORKS PDM Professional major version.

Syntax

Visual Basic
Public mlRequiredVersionMajor As System.Integer
C#
public System.int mlRequiredVersionMajor
C++/CLI
public:
System.int mlRequiredVersionMajor

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


mlRequiredVersionMinor Field

mlRequiredVersionMinor Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo2 Structure : mlRequiredVersionMinor Field

Required SOLIDWORKS PDM Professional minor version.

Syntax

Visual Basic
Public mlRequiredVersionMinor As System.Integer
C#
public System.int mlRequiredVersionMinor
C++/CLI
public:
System.int mlRequiredVersionMinor

See Also

EdmAddInInfo2 Structure
EdmAddInInfo2 Members


EdmAddInMenuInfo Structure

EdmAddInMenuInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmAddInMenuInfo Structure

Contains information about a menu command implemented by an add-in.

Syntax

Visual Basic
Public Structure EdmAddInMenuInfo
   Inherits System.ValueType
C#
public struct EdmAddInMenuInfo : System.ValueType
C++/CLI
public value class EdmAddInMenuInfo : public System.ValueType

Example

struct EdmAddInMenuInfo{
  integer  mlCmdID;
  integer  mlEdmMenuFlags;
  integer  mlToolbarButtonIndex;
  integer  mlToolbarImageID;
  string  mbsMenuStr;
  string  mbsStatusBarHelp;
  string  mbsToolbarToolTip;
};

Example

Install Add-in (VB.NET)
Install Add-in (C#)

Remarks

Returned by IEdmAddInMgr8::GetInstalledAddIn.

See Also

EdmAddInMenuInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmAddInMenuInfo Structure Fields

EdmAddInMenuInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInMenuInfo Structure

For a list of all members of this type, see EdmAddInMenuInfo members.

Public Fields

 | Name | Description
public Field | mbsMenuStr | String to display in menu.
public Field | mbsStatusBarHelp | Status bar help for the command.
public Field | mbsToolbarToolTip | Tooltip to show for the toolbar button.
public Field | mlCmdID | ID of the command.
public Field | mlEdmMenuFlags | Menu flags.
public Field | mlToolbarButtonIndex | Index of the toolbar image in a resource containing multiple images.
public Field | mlToolbarImageID | ID of an image added via IEdmCmdMgr5::AddToolbarImage.
Top

See Also

EdmAddInMenuInfo Structure
EPDM.Interop.epdm Namespace


EdmAddInMenuInfo Structure Members

EdmAddInMenuInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInMenuInfo Structure

The following tables list the members exposed by EdmAddInMenuInfo.

Public Fields

 | Name | Description
public Field | mbsMenuStr | String to display in menu.
public Field | mbsStatusBarHelp | Status bar help for the command.
public Field | mbsToolbarToolTip | Tooltip to show for the toolbar button.
public Field | mlCmdID | ID of the command.
public Field | mlEdmMenuFlags | Menu flags.
public Field | mlToolbarButtonIndex | Index of the toolbar image in a resource containing multiple images.
public Field | mlToolbarImageID | ID of an image added via IEdmCmdMgr5::AddToolbarImage.
Top

See Also

EdmAddInMenuInfo Structure
EPDM.Interop.epdm Namespace


mbsMenuStr Field

mbsMenuStr Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mbsMenuStr Field

String to display in menu.

Syntax

Visual Basic
Public mbsMenuStr As System.String
C#
public System.string mbsMenuStr
C++/CLI
public:
System.String^ mbsMenuStr

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


mbsStatusBarHelp Field

mbsStatusBarHelp Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mbsStatusBarHelp Field

Status bar help for the command.

Syntax

Visual Basic
Public mbsStatusBarHelp As System.String
C#
public System.string mbsStatusBarHelp
C++/CLI
public:
System.String^ mbsStatusBarHelp

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


mbsToolbarToolTip Field

mbsToolbarToolTip Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mbsToolbarToolTip Field

Tooltip to show for the toolbar button.

Syntax

Visual Basic
Public mbsToolbarToolTip As System.String
C#
public System.string mbsToolbarToolTip
C++/CLI
public:
System.String^ mbsToolbarToolTip

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


mlCmdID Field

mlCmdID Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mlCmdID Field

ID of the command.

Syntax

Visual Basic
Public mlCmdID As System.Integer
C#
public System.int mlCmdID
C++/CLI
public:
System.int mlCmdID

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


mlEdmMenuFlags Field

mlEdmMenuFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mlEdmMenuFlags Field

Menu flags.

Syntax

Visual Basic
Public mlEdmMenuFlags As System.Integer
C#
public System.int mlEdmMenuFlags
C++/CLI
public:
System.int mlEdmMenuFlags

Field Value

Combination of EdmMenuFlags bits.

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


mlToolbarButtonIndex Field

mlToolbarButtonIndex Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mlToolbarButtonIndex Field

Index of the toolbar image in a resource containing multiple images.

Syntax

Visual Basic
Public mlToolbarButtonIndex As System.Integer
C#
public System.int mlToolbarButtonIndex
C++/CLI
public:
System.int mlToolbarButtonIndex

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


mlToolbarImageID Field

mlToolbarImageID Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInMenuInfo Structure : mlToolbarImageID Field

ID of an image added via IEdmCmdMgr5::AddToolbarImage.

Syntax

Visual Basic
Public mlToolbarImageID As System.Integer
C#
public System.int mlToolbarImageID
C++/CLI
public:
System.int mlToolbarImageID

See Also

EdmAddInMenuInfo Structure
EdmAddInMenuInfo Members


EdmAttributeData Structure

EdmAttributeData Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmAttributeData Structure

Contains information about an attribute mapping in a variable (EdmVariableData).

Syntax

Visual Basic
Public Structure EdmAttributeData
   Inherits System.ValueType
C#
public struct EdmAttributeData : System.ValueType
C++/CLI
public value class EdmAttributeData : public System.ValueType

Example

struct EdmAttributeData{
  string mbsAttribName;
  string mbsBlockName;
  string mbsExtensions;
};

Example

Add Card Variables to Vault (VB.NET)
Add Card Variables to Vault (C#)

Remarks

Used by IEdmVariableMgr6::AddVariables to create new variables.

See Also

EdmAttributeData Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmAttributeData Structure Fields

EdmAttributeData Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmAttributeData Structure

For a list of all members of this type, see EdmAttributeData members.

Public Fields

 | Name | Description
public Field | mbsAttribName | Name of attribute in block.
public Field | mbsBlockName | Name of block that contains the attribute.
public Field | mbsExtensions | Comma-delimited list of file extensions of file types where to find this attribute, e.g., "sldasm, sldprt".
Top

See Also

EdmAttributeData Structure
EPDM.Interop.epdm Namespace


EdmAttributeData Structure Members

EdmAttributeData Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmAttributeData Structure

The following tables list the members exposed by EdmAttributeData.

Public Fields

 | Name | Description
public Field | mbsAttribName | Name of attribute in block.
public Field | mbsBlockName | Name of block that contains the attribute.
public Field | mbsExtensions | Comma-delimited list of file extensions of file types where to find this attribute, e.g., "sldasm, sldprt".
Top

See Also

EdmAttributeData Structure
EPDM.Interop.epdm Namespace


mbsAttribName Field

mbsAttribName Field
[image]
EPDM.Interop.epdm Namespace > EdmAttributeData Structure : mbsAttribName Field

Name of attribute in block.

Syntax

Visual Basic
Public mbsAttribName As System.String
C#
public System.string mbsAttribName
C++/CLI
public:
System.String^ mbsAttribName

See Also

EdmAttributeData Structure
EdmAttributeData Members


mbsBlockName Field

mbsBlockName Field
[image]
EPDM.Interop.epdm Namespace > EdmAttributeData Structure : mbsBlockName Field

Name of block that contains the attribute.

Syntax

Visual Basic
Public mbsBlockName As System.String
C#
public System.string mbsBlockName
C++/CLI
public:
System.String^ mbsBlockName

See Also

EdmAttributeData Structure
EdmAttributeData Members


mbsExtensions Field

mbsExtensions Field
[image]
EPDM.Interop.epdm Namespace > EdmAttributeData Structure : mbsExtensions Field

Comma-delimited list of file extensions of file types where to find this attribute, e.g., "sldasm, sldprt".

Syntax

Visual Basic
Public mbsExtensions As System.String
C#
public System.string mbsExtensions
C++/CLI
public:
System.String^ mbsExtensions

See Also

EdmAttributeData Structure
EdmAttributeData Members


EdmBatchDelErrInfo Structure

EdmBatchDelErrInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBatchDelErrInfo Structure

Contains information about an error that occurred during execution of IEdmBatchDelete::CommitDelete.

Syntax

Visual Basic
Public Structure EdmBatchDelErrInfo
   Inherits System.ValueType
C#
public struct EdmBatchDelErrInfo : System.ValueType
C++/CLI
public value class EdmBatchDelErrInfo : public System.ValueType

Example

struct EdmBatchDelErrInfo{
  integer mlDocID;
  integer mlProjID;
  string mbsPathName;
  integer mlErrorCode;
};

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

Remarks

Returned by IEdmBatchDelete3::GetCommitErrors.

See Also

EdmBatchDelErrInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 12.0 of SOLIDWORKS PDM Professional


EdmBatchDelErrInfo Structure Fields

EdmBatchDelErrInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBatchDelErrInfo Structure

For a list of all members of this type, see EdmBatchDelErrInfo members.

Public Fields

 | Name | Description
public Field | mbsPathName | File system path to the file or folder.
public Field | mlDocID | ID of the document.
public Field | mlErrorCode | Error code.
public Field | mlProjID | ID of the folder.
Top

See Also

EdmBatchDelErrInfo Structure
EPDM.Interop.epdm Namespace


EdmBatchDelErrInfo Structure Members

EdmBatchDelErrInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBatchDelErrInfo Structure

The following tables list the members exposed by EdmBatchDelErrInfo.

Public Fields

 | Name | Description
public Field | mbsPathName | File system path to the file or folder.
public Field | mlDocID | ID of the document.
public Field | mlErrorCode | Error code.
public Field | mlProjID | ID of the folder.
Top

See Also

EdmBatchDelErrInfo Structure
EPDM.Interop.epdm Namespace


mbsPathName Field

mbsPathName Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchDelErrInfo Structure : mbsPathName Field

File system path to the file or folder.

Syntax

Visual Basic
Public mbsPathName As System.String
C#
public System.string mbsPathName
C++/CLI
public:
System.String^ mbsPathName

See Also

EdmBatchDelErrInfo Structure
EdmBatchDelErrInfo Members


mlDocID Field

mlDocID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchDelErrInfo Structure : mlDocID Field

ID of the document.

Syntax

Visual Basic
Public mlDocID As System.Integer
C#
public System.int mlDocID
C++/CLI
public:
System.int mlDocID

See Also

EdmBatchDelErrInfo Structure
EdmBatchDelErrInfo Members


mlErrorCode Field

mlErrorCode Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchDelErrInfo Structure : mlErrorCode Field

Error code.

Syntax

Visual Basic
Public mlErrorCode As System.Integer
C#
public System.int mlErrorCode
C++/CLI
public:
System.int mlErrorCode

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

See Also

EdmBatchDelErrInfo Structure
EdmBatchDelErrInfo Members


mlProjID Field

mlProjID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchDelErrInfo Structure : mlProjID Field

ID of the folder.

Syntax

Visual Basic
Public mlProjID As System.Integer
C#
public System.int mlProjID
C++/CLI
public:
System.int mlProjID

See Also

EdmBatchDelErrInfo Structure
EdmBatchDelErrInfo Members


EdmBatchError Structure

EdmBatchError Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBatchError Structure

Contains error information.

Syntax

Visual Basic
Public Structure EdmBatchError
   Inherits System.ValueType
C#
public struct EdmBatchError : System.ValueType
C++/CLI
public value class EdmBatchError : public System.ValueType

Example

struct EdmBatchError{
  integer mlFileID;
  integer mlVariableID;
  integer mlErrorCode;
};

Remarks

Returned by IEdmBatchUpdate::Commit

See Also

EdmBatchError Members
EPDM.Interop.epdm Namespace

Availability

Version 6.2 of SOLIDWORKS PDM Professional


EdmBatchError2 Structure

EdmBatchError2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBatchError2 Structure

Contains error information.

Syntax

Visual Basic
Public Structure EdmBatchError2
   Inherits System.ValueType
C#
public struct EdmBatchError2 : System.ValueType
C++/CLI
public value class EdmBatchError2 : public System.ValueType

Example

struct EdmBatchError2{
  integer mlFileID;
  integer mlFolderID;
  integer mlVariableID;
  integer mlErrorCode;
};

Example

Batch Update Card Variables (VB.NET)
Batch Update Card Variables (C#)

Remarks

Extends the EdmBatchError structure and is returned by IEdmBatchUpdate2::CommitUpdate.

See Also

EdmBatchError2 Members
EPDM.Interop.epdm Namespace

Availability

Version 6.3 of SOLIDWORKS PDM Professional


EdmBatchError2 Structure Fields

EdmBatchError2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBatchError2 Structure

For a list of all members of this type, see EdmBatchError2 members.

Public Fields

 | Name | Description
public Field | mlErrorCode | Error code.
public Field | mlFileID | ID of the file that caused the error.
public Field | mlFolderID | ID of folder that caused the error.
public Field | mlVariableID | ID of the variable affected by the error.
Top

See Also

EdmBatchError2 Structure
EPDM.Interop.epdm Namespace


EdmBatchError2 Structure Members

EdmBatchError2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBatchError2 Structure

The following tables list the members exposed by EdmBatchError2.

Public Fields

 | Name | Description
public Field | mlErrorCode | Error code.
public Field | mlFileID | ID of the file that caused the error.
public Field | mlFolderID | ID of folder that caused the error.
public Field | mlVariableID | ID of the variable affected by the error.
Top

See Also

EdmBatchError2 Structure
EPDM.Interop.epdm Namespace


mlErrorCode Field

mlErrorCode Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError2 Structure : mlErrorCode Field

Error code.

Syntax

Visual Basic
Public mlErrorCode As System.Integer
C#
public System.int mlErrorCode
C++/CLI
public:
System.int mlErrorCode

Remarks

Call IEdmVault5::GetErrorString to get the name and description of the error.

See Also

EdmBatchError2 Structure
EdmBatchError2 Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError2 Structure : mlFileID Field

ID of the file that caused the error.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

Field Value

0, if the error was caused by a folder or if the error is not file- or folder-specific.

See Also

EdmBatchError2 Structure
EdmBatchError2 Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError2 Structure : mlFolderID Field

ID of folder that caused the error.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

Field Value

0, if it was caused by a file or if the error is not file- or folder-specific.

See Also

EdmBatchError2 Structure
EdmBatchError2 Members


mlVariableID Field

mlVariableID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError2 Structure : mlVariableID Field

ID of the variable affected by the error.

Syntax

Visual Basic
Public mlVariableID As System.Integer
C#
public System.int mlVariableID
C++/CLI
public:
System.int mlVariableID

Field Value

0 if the error is not variable-specific.

See Also

EdmBatchError2 Structure
EdmBatchError2 Members


EdmBomColumn Structure

EdmBomColumn Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBomColumn Structure

Contains information about a single column in a Bill of Materials.

Syntax

Visual Basic
Public Structure EdmBomColumn
   Inherits System.ValueType
C#
public struct EdmBomColumn : System.ValueType
C++/CLI
public value class EdmBomColumn : public System.ValueType

Example

struct EdmBomColumn{
  integer mlColumnID;
  integer mlVariableID;
  enum EdmVariableType mlVariableType;
  integer mlFlags;
  enum EdmBomColumnType meType;
  string mbsCaption;
  integer mlWidth;
};

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

See Also

EdmBomColumn Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmBomColumn Structure Fields

EdmBomColumn Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomColumn Structure

For a list of all members of this type, see EdmBomColumn members.

Public Fields

 | Name | Description
public Field | mbsCaption | Column caption.
public Field | meType | Type of data to show in this column.
public Field | mlColumnID | Unique ID of the column.
public Field | mlFlags | Column flags.
public Field | mlVariableID | ID of the variable displayed in the column.
public Field | mlVariableType | Type of variable displayed in the column.
public Field | mlWidth | Default width of the column.
Top

See Also

EdmBomColumn Structure
EPDM.Interop.epdm Namespace


EdmBomColumn Structure Members

EdmBomColumn Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomColumn Structure

The following tables list the members exposed by EdmBomColumn.

Public Fields

 | Name | Description
public Field | mbsCaption | Column caption.
public Field | meType | Type of data to show in this column.
public Field | mlColumnID | Unique ID of the column.
public Field | mlFlags | Column flags.
public Field | mlVariableID | ID of the variable displayed in the column.
public Field | mlVariableType | Type of variable displayed in the column.
public Field | mlWidth | Default width of the column.
Top

See Also

EdmBomColumn Structure
EPDM.Interop.epdm Namespace


EdmBomDefaultSetting Structure

EdmBomDefaultSetting Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBomDefaultSetting Structure

Contains the default view settings of a computed BOM.

Syntax

Visual Basic
Public Structure EdmBomDefaultSetting
   Inherits System.ValueType
C#
public struct EdmBomDefaultSetting : System.ValueType
C++/CLI
public value class EdmBomDefaultSetting : public System.ValueType

Example

struct EdmBomDefaultSetting{
  integer mlBomDisplayType;
  integer mlBomRefVersion;
  integer mlBomSelectedFile;
  integer mlBomTreeView;
  integer mlBOMViewSettings;
  integer mlBOMWeldmentCutListType;
};

Remarks

Returned by IEdmBomMgr4::GetBomDefaultSetting.

See Also

EdmBomDefaultSetting Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2025


EdmBomDefaultSetting Structure Fields

EdmBomDefaultSetting Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomDefaultSetting Structure

For a list of all members of this type, see EdmBomDefaultSetting members.

Public Fields

 | Name | Description
public Field | mlBomDisplayType | BOM's display type.
public Field | mlBomRefVersion | BOM's reference version.
public Field | mlBomSelectedFile | BOM's selected file display status.
public Field | mlBomTreeView | BOM's tree view status.
public Field | mlBOMViewSettings | BOM's view type.
public Field | mlBOMWeldmentCutListType | BOM's weldment cut list type.
Top

See Also

EdmBomDefaultSetting Structure
EPDM.Interop.epdm Namespace


EdmBomDefaultSetting Structure Members

EdmBomDefaultSetting Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomDefaultSetting Structure

The following tables list the members exposed by EdmBomDefaultSetting.

Public Fields

 | Name | Description
public Field | mlBomDisplayType | BOM's display type.
public Field | mlBomRefVersion | BOM's reference version.
public Field | mlBomSelectedFile | BOM's selected file display status.
public Field | mlBomTreeView | BOM's tree view status.
public Field | mlBOMViewSettings | BOM's view type.
public Field | mlBOMWeldmentCutListType | BOM's weldment cut list type.
Top

See Also

EdmBomDefaultSetting Structure
EPDM.Interop.epdm Namespace


mlBomDisplayType Field

mlBomDisplayType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomDefaultSetting Structure : mlBomDisplayType Field

BOM's display type.

Syntax

Visual Basic
Public mlBomDisplayType As System.Integer
C#
public System.int mlBomDisplayType
C++/CLI
public:
System.int mlBomDisplayType

Field Value

1 if indented (default), 2 if parts only, 3 if top level only, 4 if flattened

See Also

EdmBomDefaultSetting Structure
EdmBomDefaultSetting Members


mlBomRefVersion Field

mlBomRefVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmBomDefaultSetting Structure : mlBomRefVersion Field

BOM's reference version.

Syntax

Visual Basic
Public mlBomRefVersion As System.Integer
C#
public System.int mlBomRefVersion
C++/CLI
public:
System.int mlBomRefVersion

Field Value

1 if as built (default), 2 if latest

See Also

EdmBomDefaultSetting Structure
EdmBomDefaultSetting Members


mlBomSelectedFile Field

mlBomSelectedFile Field
[image]
EPDM.Interop.epdm Namespace > EdmBomDefaultSetting Structure : mlBomSelectedFile Field

BOM's selected file display status.

Syntax

Visual Basic
Public mlBomSelectedFile As System.Integer
C#
public System.int mlBomSelectedFile
C++/CLI
public:
System.int mlBomSelectedFile

Field Value

1 to show selected file, 2 to hide selected file (default)

See Also

EdmBomDefaultSetting Structure
EdmBomDefaultSetting Members


mlBomTreeView Field

mlBomTreeView Field
[image]
EPDM.Interop.epdm Namespace > EdmBomDefaultSetting Structure : mlBomTreeView Field

BOM's tree view status.

Syntax

Visual Basic
Public mlBomTreeView As System.Integer
C#
public System.int mlBomTreeView
C++/CLI
public:
System.int mlBomTreeView

Field Value

1 to show tree (default), 2 to hide tree

See Also

EdmBomDefaultSetting Structure
EdmBomDefaultSetting Members


mlBOMViewSettings Field

mlBOMViewSettings Field
[image]
EPDM.Interop.epdm Namespace > EdmBomDefaultSetting Structure : mlBOMViewSettings Field

BOM's view type.

Syntax

Visual Basic
Public mlBOMViewSettings As System.Integer
C#
public System.int mlBOMViewSettings
C++/CLI
public:
System.int mlBOMViewSettings

Field Value

See Remarks

Remarks

0 = None (default)

1 = Include cut list references

2 = Include derived part references

See Also

EdmBomDefaultSetting Structure
EdmBomDefaultSetting Members


mlBOMWeldmentCutListType Field

mlBOMWeldmentCutListType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomDefaultSetting Structure : mlBOMWeldmentCutListType Field

BOM's weldment cut list type.

Syntax

Visual Basic
Public mlBOMWeldmentCutListType As System.Integer
C#
public System.int mlBOMWeldmentCutListType
C++/CLI
public:
System.int mlBOMWeldmentCutListType

Field Value

0 if none (default), 1 for weldment cut list, 2 for weldment BOM

See Also

EdmBomDefaultSetting Structure
EdmBomDefaultSetting Members


EdmBomInfo Structure

EdmBomInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBomInfo Structure

Contains information about a Bill of Materials.

Syntax

Visual Basic
Public Structure EdmBomInfo
   Inherits System.ValueType
C#
public struct EdmBomInfo : System.ValueType
C++/CLI
public value class EdmBomInfo : public System.ValueType

Example

struct EdmBomInfo{
  integer mlBomID;
  enum EdmBomType  meType;
  string mbsBomName;
};

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

Returned by IEdmFile7::GetDerivedBOMs.

See Also

EdmBomInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmBomInfo Structure Fields

EdmBomInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomInfo Structure

For a list of all members of this type, see EdmBomInfo members.

Public Fields

 | Name | Description
public Field | mbsBomName | BOM name.
public Field | meType | BOM type as defined in EdmBomType.
public Field | mlBomID | Unique ID of the BOM.
Top

See Also

EdmBomInfo Structure
EPDM.Interop.epdm Namespace


EdmBomInfo Structure Members

EdmBomInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomInfo Structure

The following tables list the members exposed by EdmBomInfo.

Public Fields

 | Name | Description
public Field | mbsBomName | BOM name.
public Field | meType | BOM type as defined in EdmBomType.
public Field | mlBomID | Unique ID of the BOM.
Top

See Also

EdmBomInfo Structure
EPDM.Interop.epdm Namespace


mbsBomName Field

mbsBomName Field
[image]
EPDM.Interop.epdm Namespace > EdmBomInfo Structure : mbsBomName Field

BOM name.

Syntax

Visual Basic
Public mbsBomName As System.String
C#
public System.string mbsBomName
C++/CLI
public:
System.String^ mbsBomName

See Also

EdmBomInfo Structure
EdmBomInfo Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomInfo Structure : meType Field

BOM type as defined in EdmBomType.

Syntax

Visual Basic
Public meType As EdmBomType
C#
public EdmBomType meType
C++/CLI
public:
EdmBomType meType

See Also

EdmBomInfo Structure
EdmBomInfo Members


mlBomID Field

mlBomID Field
[image]
EPDM.Interop.epdm Namespace > EdmBomInfo Structure : mlBomID Field

Unique ID of the BOM.

Syntax

Visual Basic
Public mlBomID As System.Integer
C#
public System.int mlBomID
C++/CLI
public:
System.int mlBomID

See Also

EdmBomInfo Structure
EdmBomInfo Members


EdmBomLayout Structure

EdmBomLayout Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBomLayout Structure

Contains information about a Bill of Materials layout.

Syntax

Visual Basic
Public Structure EdmBomLayout
   Inherits System.ValueType
C#
public struct EdmBomLayout : System.ValueType
C++/CLI
public value class EdmBomLayout : public System.ValueType

Example

struct EdmBomLayout{
  integer mlLayoutID;
  string mbsLayoutName;
};

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

Remarks

Returned by IEdmBomMgr::GetBomLayouts.

See Also

EdmBomLayout Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmBomLayout2 Structure

EdmBomLayout2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBomLayout2 Structure

Contains information about a Bill of Materials layout.

Syntax

Visual Basic
Public Structure EdmBomLayout2
   Inherits System.ValueType
C#
public struct EdmBomLayout2 : System.ValueType
C++/CLI
public value class EdmBomLayout2 : public System.ValueType

Example

struct EdmBomLayout2{
  integer mlLayoutID;
  EdmBomType meType;
  string mbsLayoutName;
};

Remarks

This structure:

  • Extends EdmBomLayout.
  • Is used in IEdmBomMgr2::GetBomLayouts2 to get all BOM layouts and BOM types.

See Also

EdmBomLayout2 Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2020


EdmBomLayout2 Structure Fields

EdmBomLayout2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomLayout2 Structure

For a list of all members of this type, see EdmBomLayout2 members.

Public Fields

 | Name | Description
public Field | mbsLayoutName | Layout name.
public Field | meType | BOM type as defined in EdmBomType.
public Field | mlLayoutID | Unique ID of the BOM layout.
Top

See Also

EdmBomLayout2 Structure
EPDM.Interop.epdm Namespace


EdmBomLayout2 Structure Members

EdmBomLayout2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomLayout2 Structure

The following tables list the members exposed by EdmBomLayout2.

Public Fields

 | Name | Description
public Field | mbsLayoutName | Layout name.
public Field | meType | BOM type as defined in EdmBomType.
public Field | mlLayoutID | Unique ID of the BOM layout.
Top

See Also

EdmBomLayout2 Structure
EPDM.Interop.epdm Namespace


mbsLayoutName Field

mbsLayoutName Field
[image]
EPDM.Interop.epdm Namespace > EdmBomLayout2 Structure : mbsLayoutName Field

Layout name.

Syntax

Visual Basic
Public mbsLayoutName As System.String
C#
public System.string mbsLayoutName
C++/CLI
public:
System.String^ mbsLayoutName

See Also

EdmBomLayout2 Structure
EdmBomLayout2 Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomLayout2 Structure : meType Field

BOM type as defined in EdmBomType.

Syntax

Visual Basic
Public meType As EdmBomType
C#
public EdmBomType meType
C++/CLI
public:
EdmBomType meType

See Also

EdmBomLayout2 Structure
EdmBomLayout2 Members


mlLayoutID Field

mlLayoutID Field
[image]
EPDM.Interop.epdm Namespace > EdmBomLayout2 Structure : mlLayoutID Field

Unique ID of the BOM layout.

Syntax

Visual Basic
Public mlLayoutID As System.Integer
C#
public System.int mlLayoutID
C++/CLI
public:
System.int mlLayoutID

See Also

EdmBomLayout2 Structure
EdmBomLayout2 Members


EdmBomVersion Structure

EdmBomVersion Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBomVersion Structure

Contains information about a Bill of Materials version, revision, or label.

Syntax

Visual Basic
Public Structure EdmBomVersion
   Inherits System.ValueType
C#
public struct EdmBomVersion : System.ValueType
C++/CLI
public value class EdmBomVersion : public System.ValueType

Example

struct EdmBomVersion{
  enum EdmBomVersionType meType;
  integer mlVersion;
  datetime moDate;
  string mbsTag;
  string mbsComment;
};

Example

Access Bill of Materials (VB.NET)
Access Bill of Materials (C#)

See Also

EdmBomVersion Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmBomVersion Structure Fields

EdmBomVersion Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomVersion Structure

For a list of all members of this type, see EdmBomVersion members.

Public Fields

 | Name | Description
public Field | mbsComment | Comment entered by the user.
public Field | mbsTag | Label or revision name.
public Field | meType | Type of BOM version.
public Field | mlVersion | Version number.
public Field | moDate | Time when the version, revision, or label was created.
Top

See Also

EdmBomVersion Structure
EPDM.Interop.epdm Namespace


EdmBomVersion Structure Members

EdmBomVersion Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomVersion Structure

The following tables list the members exposed by EdmBomVersion.

Public Fields

 | Name | Description
public Field | mbsComment | Comment entered by the user.
public Field | mbsTag | Label or revision name.
public Field | meType | Type of BOM version.
public Field | mlVersion | Version number.
public Field | moDate | Time when the version, revision, or label was created.
Top

See Also

EdmBomVersion Structure
EPDM.Interop.epdm Namespace


EdmCardViewParams Structure

EdmCardViewParams Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmCardViewParams Structure

Contains card view parameters.

Syntax

Visual Basic
Public Structure EdmCardViewParams
   Inherits System.ValueType
C#
public struct EdmCardViewParams : System.ValueType
C++/CLI
public value class EdmCardViewParams : public System.ValueType

Example

struct EdmCardViewParams{
  integer mlFileID;
  integer mlFolderID;
  integer mlCardID;
  integer mlX;
  integer mlY;
  integer mhParentWindow;
  integer mlEdmCardViewFlags;
};

Example

Create Custom Card View (VB.NET)
Create Custom Card View (C#)

Remarks

Used by IEdmVault10::CreateCardViewEx2 to create a card view.

See Also

EdmCardViewParams Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmCardViewParams Structure Fields

EdmCardViewParams Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmCardViewParams Structure

For a list of all members of this type, see EdmCardViewParams members.

Public Fields

 | Name | Description
public Field | mhParentWindow | Handle of parent window for the card.
public Field | mlCardID | ID of this card.
public Field | mlEdmCardViewFlags | Card view flags.
public Field | mlFileID | ID of the file for this card.
public Field | mlFolderID | ID of the folder for this card or ID of the file card's parent folder.
public Field | mlX | Horizontal position of card.
public Field | mlY | Vertical position of card.
Top

See Also

EdmCardViewParams Structure
EPDM.Interop.epdm Namespace


EdmCardViewParams Structure Members

EdmCardViewParams Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmCardViewParams Structure

The following tables list the members exposed by EdmCardViewParams.

Public Fields

 | Name | Description
public Field | mhParentWindow | Handle of parent window for the card.
public Field | mlCardID | ID of this card.
public Field | mlEdmCardViewFlags | Card view flags.
public Field | mlFileID | ID of the file for this card.
public Field | mlFolderID | ID of the folder for this card or ID of the file card's parent folder.
public Field | mlX | Horizontal position of card.
public Field | mlY | Vertical position of card.
Top

See Also

EdmCardViewParams Structure
EPDM.Interop.epdm Namespace


mhParentWindow Field

mhParentWindow Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mhParentWindow Field

Handle of parent window for the card.

Syntax

Visual Basic
Public mhParentWindow As System.Integer
C#
public System.int mhParentWindow
C++/CLI
public:
System.int mhParentWindow

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


mlCardID Field

mlCardID Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mlCardID Field

ID of this card.

Syntax

Visual Basic
Public mlCardID As System.Integer
C#
public System.int mlCardID
C++/CLI
public:
System.int mlCardID

Field Value

0, if mlFileID and mlFolderID are valid.

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


mlEdmCardViewFlags Field

mlEdmCardViewFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mlEdmCardViewFlags Field

Card view flags.

Syntax

Visual Basic
Public mlEdmCardViewFlags As System.Integer
C#
public System.int mlEdmCardViewFlags
C++/CLI
public:
System.int mlEdmCardViewFlags

Field Value

Combination of EdmCardViewFlag bits.

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mlFileID Field

ID of the file for this card.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

Field Value

0, if this card is a folder card or mlCardID is not 0.

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mlFolderID Field

ID of the folder for this card or ID of the file card's parent folder.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

Field Value

0, if mlCardID is not 0.

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


mlX Field

mlX Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mlX Field

Horizontal position of card.

Syntax

Visual Basic
Public mlX As System.Integer
C#
public System.int mlX
C++/CLI
public:
System.int mlX

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


mlY Field

mlY Field
[image]
EPDM.Interop.epdm Namespace > EdmCardViewParams Structure : mlY Field

Vertical position of card.

Syntax

Visual Basic
Public mlY As System.Integer
C#
public System.int mlY
C++/CLI
public:
System.int mlY

See Also

EdmCardViewParams Structure
EdmCardViewParams Members


EdmChangeStateTransitionInfo Structure

EdmChangeStateTransitionInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmChangeStateTransitionInfo Structure

Workflow state transition information.

Syntax

Visual Basic
Public Structure EdmChangeStateTransitionInfo
   Inherits System.ValueType
C#
public struct EdmChangeStateTransitionInfo : System.ValueType
C++/CLI
public value class EdmChangeStateTransitionInfo : public System.ValueType

Example

struct EdmChangeStateTransitionInfo

{
  short mbIsRevoke;
  integer mlCommitsNum;
  integer mlRequiredNum;
  string moDescription;
  string moIcon;
  string moName;
 };

Example

Batch Change States of Files (VB.NET)
Batch Change States of Files (C#)

See Also

EdmChangeStateTransitionInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2013


EdmChangeStateTransitionInfo Structure Fields

EdmChangeStateTransitionInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmChangeStateTransitionInfo Structure

For a list of all members of this type, see EdmChangeStateTransitionInfo members.

Public Fields

 | Name | Description
public Field | mbIsRevoke | The revoke state of this state transition.
public Field | mlCommitsNum | Number of commits for this state transition.
public Field | mlRequiredNum | ID of this state transition.
public Field | moDescription | Description of this state transition.
public Field | moIcon | File name of the icon for this state transition.
public Field | moName | Name of this state transition.
Top

See Also

EdmChangeStateTransitionInfo Structure
EPDM.Interop.epdm Namespace


EdmChangeStateTransitionInfo Structure Members

EdmChangeStateTransitionInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmChangeStateTransitionInfo Structure

The following tables list the members exposed by EdmChangeStateTransitionInfo.

Public Fields

 | Name | Description
public Field | mbIsRevoke | The revoke state of this state transition.
public Field | mlCommitsNum | Number of commits for this state transition.
public Field | mlRequiredNum | ID of this state transition.
public Field | moDescription | Description of this state transition.
public Field | moIcon | File name of the icon for this state transition.
public Field | moName | Name of this state transition.
Top

See Also

EdmChangeStateTransitionInfo Structure
EPDM.Interop.epdm Namespace


mbIsRevoke Field

mbIsRevoke Field
[image]
EPDM.Interop.epdm Namespace > EdmChangeStateTransitionInfo Structure : mbIsRevoke Field

The revoke state of this state transition.

Syntax

Visual Basic
Public mbIsRevoke As System.Short
C#
public System.short mbIsRevoke
C++/CLI
public:
System.short mbIsRevoke

Field Value

1 if revoked, 0 if not

See Also

EdmChangeStateTransitionInfo Structure
EdmChangeStateTransitionInfo Members


mlCommitsNum Field

mlCommitsNum Field
[image]
EPDM.Interop.epdm Namespace > EdmChangeStateTransitionInfo Structure : mlCommitsNum Field

Number of commits for this state transition.

Syntax

Visual Basic
Public mlCommitsNum As System.Integer
C#
public System.int mlCommitsNum
C++/CLI
public:
System.int mlCommitsNum

See Also

EdmChangeStateTransitionInfo Structure
EdmChangeStateTransitionInfo Members


mlRequiredNum Field

mlRequiredNum Field
[image]
EPDM.Interop.epdm Namespace > EdmChangeStateTransitionInfo Structure : mlRequiredNum Field

ID of this state transition.

Syntax

Visual Basic
Public mlRequiredNum As System.Integer
C#
public System.int mlRequiredNum
C++/CLI
public:
System.int mlRequiredNum

See Also

EdmChangeStateTransitionInfo Structure
EdmChangeStateTransitionInfo Members


moDescription Field

moDescription Field
[image]
EPDM.Interop.epdm Namespace > EdmChangeStateTransitionInfo Structure : moDescription Field

Description of this state transition.

Syntax

Visual Basic
Public moDescription As System.String
C#
public System.string moDescription
C++/CLI
public:
System.String^ moDescription

See Also

EdmChangeStateTransitionInfo Structure
EdmChangeStateTransitionInfo Members


moIcon Field

moIcon Field
[image]
EPDM.Interop.epdm Namespace > EdmChangeStateTransitionInfo Structure : moIcon Field

File name of the icon for this state transition.

Syntax

Visual Basic
Public moIcon As System.String
C#
public System.string moIcon
C++/CLI
public:
System.String^ moIcon

See Also

EdmChangeStateTransitionInfo Structure
EdmChangeStateTransitionInfo Members


moName Field

moName Field
[image]
EPDM.Interop.epdm Namespace > EdmChangeStateTransitionInfo Structure : moName Field

Name of this state transition.

Syntax

Visual Basic
Public moName As System.String
C#
public System.string moName
C++/CLI
public:
System.String^ moName

See Also

EdmChangeStateTransitionInfo Structure
EdmChangeStateTransitionInfo Members


EdmCheckRef Structure

EdmCheckRef Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmCheckRef Structure

Contains information about a file reference.

Syntax

Visual Basic
Public Structure EdmCheckRef
   Inherits System.ValueType
C#
public struct EdmCheckRef : System.ValueType
C++/CLI
public value class EdmCheckRef : public System.ValueType

Example

struct EdmCheckRef{
  integer mlParentFileID;
  integer mlRefFileID;
  string mbsParentPath;
  string mbsRefPath;
  integer mlRefVersion;
  integer mlRefLatestVersion;
  integer mlRefFolderID;
};

Remarks

Returned by IEdmRevisionMgr3::VerUpgrade_ReferenceCheck.

See Also

EdmCheckRef Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmCheckRef Structure Fields

EdmCheckRef Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmCheckRef Structure

For a list of all members of this type, see EdmCheckRef members.

Public Fields

 | Name | Description
public Field | mbsParentPath | File system path to the referencing file.
public Field | mbsRefPath | File system path to the referenced file.
public Field | mlParentFileID | ID of the referencing file.
public Field | mlRefFileID | ID of the referenced file.
public Field | mlRefFolderID | ID of the referenced file's parent folder.
public Field | mlRefLatestVersion | Latest version of the referenced file.
public Field | mlRefVersion | Version of the referenced file.
Top

See Also

EdmCheckRef Structure
EPDM.Interop.epdm Namespace


EdmCheckRef Structure Members

EdmCheckRef Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmCheckRef Structure

The following tables list the members exposed by EdmCheckRef.

Public Fields

 | Name | Description
public Field | mbsParentPath | File system path to the referencing file.
public Field | mbsRefPath | File system path to the referenced file.
public Field | mlParentFileID | ID of the referencing file.
public Field | mlRefFileID | ID of the referenced file.
public Field | mlRefFolderID | ID of the referenced file's parent folder.
public Field | mlRefLatestVersion | Latest version of the referenced file.
public Field | mlRefVersion | Version of the referenced file.
Top

See Also

EdmCheckRef Structure
EPDM.Interop.epdm Namespace


mbsParentPath Field

mbsParentPath Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mbsParentPath Field

File system path to the referencing file.

Syntax

Visual Basic
Public mbsParentPath As System.String
C#
public System.string mbsParentPath
C++/CLI
public:
System.String^ mbsParentPath

See Also

EdmCheckRef Structure
EdmCheckRef Members


mbsRefPath Field

mbsRefPath Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mbsRefPath Field

File system path to the referenced file.

Syntax

Visual Basic
Public mbsRefPath As System.String
C#
public System.string mbsRefPath
C++/CLI
public:
System.String^ mbsRefPath

See Also

EdmCheckRef Structure
EdmCheckRef Members


mlParentFileID Field

mlParentFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mlParentFileID Field

ID of the referencing file.

Syntax

Visual Basic
Public mlParentFileID As System.Integer
C#
public System.int mlParentFileID
C++/CLI
public:
System.int mlParentFileID

See Also

EdmCheckRef Structure
EdmCheckRef Members


mlRefFileID Field

mlRefFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mlRefFileID Field

ID of the referenced file.

Syntax

Visual Basic
Public mlRefFileID As System.Integer
C#
public System.int mlRefFileID
C++/CLI
public:
System.int mlRefFileID

See Also

EdmCheckRef Structure
EdmCheckRef Members


mlRefFolderID Field

mlRefFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mlRefFolderID Field

ID of the referenced file's parent folder.

Syntax

Visual Basic
Public mlRefFolderID As System.Integer
C#
public System.int mlRefFolderID
C++/CLI
public:
System.int mlRefFolderID

See Also

EdmCheckRef Structure
EdmCheckRef Members


mlRefLatestVersion Field

mlRefLatestVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mlRefLatestVersion Field

Latest version of the referenced file.

Syntax

Visual Basic
Public mlRefLatestVersion As System.Integer
C#
public System.int mlRefLatestVersion
C++/CLI
public:
System.int mlRefLatestVersion

See Also

EdmCheckRef Structure
EdmCheckRef Members


mlRefVersion Field

mlRefVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmCheckRef Structure : mlRefVersion Field

Version of the referenced file.

Syntax

Visual Basic
Public mlRefVersion As System.Integer
C#
public System.int mlRefVersion
C++/CLI
public:
System.int mlRefVersion

See Also

EdmCheckRef Structure
EdmCheckRef Members


EdmCmd Structure

EdmCmd Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmCmd Structure

Contains the kind of command issued and information common to all files and folders affected by the command.

Syntax

Visual Basic
Public Structure EdmCmd
   Inherits System.ValueType
C#
public struct EdmCmd : System.ValueType
C++/CLI
public value class EdmCmd : public System.ValueType

Example

struct EdmCmd{
   enum EdmCmdType meCmdType;
   integer mlParentWnd;
   integer mlCurrentFolderID;
   integer mlCmdID;
   IEdmVault5 *mpoVault;
   string mbsComment;
   integer mlEdmRefreshFlags;
   object *mpoExtra;
   boolean mbSilentMode;
   boolean mbCancel;
};

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)
Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

Returned by reference when an add-in's IEdmAddIn5::OnCmd is called by SOLIDWORKS PDM Professional.

See Also

EdmCmd Members
EPDM.Interop.epdm Namespace

Availability

Version 5.2 of SOLIDWORKS PDM Professional


EdmCmd Structure Fields

EdmCmd Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmCmd Structure

For a list of all members of this type, see EdmCmd members.

Public Fields

 | Name | Description
public Field | mbCancel | Command cancel status.
public Field | mbsComment | Contains information specific to EdmCmd.meCmdType.
public Field | mbSilentMode | Silent mode status for the command.
public Field | meCmdType | Type of command.
public Field | mlCmdID | Command ID.
public Field | mlCurrentFolderID | ID of the active folder.
public Field | mlEdmRefreshFlags | Controls how SOLIDWORKS PDM Professional refreshes File Explorer after a call to IEdmAddIn5::OnCmd.
public Field | mlParentWnd | Window handle of the parent window.
public Field | mpoExtra | Pointer to an object containing command-specific information.
public Field | mpoVault | Pointer to the file vault's interface.
Top

See Also

EdmCmd Structure
EPDM.Interop.epdm Namespace


EdmCmd Structure Members

EdmCmd Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmCmd Structure

The following tables list the members exposed by EdmCmd.

Public Fields

 | Name | Description
public Field | mbCancel | Command cancel status.
public Field | mbsComment | Contains information specific to EdmCmd.meCmdType.
public Field | mbSilentMode | Silent mode status for the command.
public Field | meCmdType | Type of command.
public Field | mlCmdID | Command ID.
public Field | mlCurrentFolderID | ID of the active folder.
public Field | mlEdmRefreshFlags | Controls how SOLIDWORKS PDM Professional refreshes File Explorer after a call to IEdmAddIn5::OnCmd.
public Field | mlParentWnd | Window handle of the parent window.
public Field | mpoExtra | Pointer to an object containing command-specific information.
public Field | mpoVault | Pointer to the file vault's interface.
Top

See Also

EdmCmd Structure
EPDM.Interop.epdm Namespace


EdmCmdData Structure

EdmCmdData Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmCmdData Structure

Contains command data.

Syntax

Visual Basic
Public Structure EdmCmdData
   Inherits System.ValueType
C#
public struct EdmCmdData : System.ValueType
C++/CLI
public value class EdmCmdData : public System.ValueType

Example

struct EdmCmdData{
   integer mlObjectID1;
   integer mlObjectID2;
   integer mlObjectID3;
   integer mlObjectID4;
   string mbsStrData1;
   string mbsStrData2;
   string mbsStrData3;
   integer mlLongData1;
   integer mlLongData2;
   integer mlLongData3;
   object* mpoExtra;
};

Example

Notify User When File Changes State (VB.NET)
Notify User When File Changes State (C#)
Change Card Variables Add-in (VB.NET)
Change Card Variables Add-in (C#)

Remarks

SOLIDWORKS PDM Professional passes an array of 0 or more EdmCmdData structures when it calls to IEdmAddIn5::OnCmd.

Typically there is one structure for each file affected by the command. For instance, if the user has selected five files and two folders and launches an add-in-implemented menu command, the add-in receives seven structures, one for each of the selected files and folders. If the reason for calling IEdmAddIn5::OnCmd is a hook on a command like Check out, Check in, Get, Change state, etc., the add-in receives one structure per file. The actual meaning of each structure member varies with the reason for calling IEdmAddIn5::OnCmd. The reason for a call can be determined by examining the meCmdType member of the EdmCmd structure that is passed in the first argument of IEdmAddIn5::OnCmd.

The following tables contain all members for each EdmCmdType. Members that are not listed for a certain type of command do not use EdmCmdData.

EdmCmdType.EdmCmd_ActivateAPITab

When a custom vault view tab is selected in a vault view in File Explorer, sends only to the add-in that adds the custom vault view tab to File Explorer.

EdmCmdData Members | Type | Description
mbsStrData3 | string | Unique ID of this control

EdmCmdType.EdmCmd_PreExploreInit

When a new instance of File Explorer to about to be created, this event is sent to allow you to create custom tabs in the vault view in File Explorer. This event does not provide any EdmCmdData information. But you will receive a pointer to the IEdmCmdMgr6 interface in the EdmCmd::mpoExtra member. In the event handler, call IEdmCmdMgr6::AddValtViewTab for each tab you want to add to the vault view in File Explorer.

EdmCmdType.EdmCmd_Menu

The user has activated a menu item or toolbar button that your add-in has added. This command returns a combination of refresh flags in the mlEdmRefreshFlags member of the EdmCmd structure.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file; 0 if a folder is selected
mlObjectID2 | integer | ID of folder; 0 if a file is selected
mlObjectID3 | integer | ID of parent folder of the selected file or folder
mbsStrData1 | string | Name of file or folder, not the full path
mbsStrData2 | string | Full path to file or folder

EdmCmdType.EdmCmd_CardButton

The user clicked a button in a file or folder data card, and the button is connected to an add-in. This notification is also sent when the user clicks OK or Apply in the card.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file for which the card is displayed; 0 for folder cards
mlObjectID2 | integer | ID of folder; parent folder ID for file data cards
mlObjectID3 | integer | ID of file data card
mbsStrData1 | string | Name of active configuration; can be changed to switch to a new configuration
mbsStrData2 | string | Path to file
mlLongData1 | integer | Optionally return a EdmCardFlag return code here
mlLongData2 | integer | Optionally return the ID of a card control to set focus to here
mpoExtra | object* | Pointer to an IEdmStrLst5 interface with the names of all configurations

Note: You will also receive pointers to the IEdmEnumeratorVariable5 and IEdmCard5 interfaces in the EdmCmd::mpoExtra member. The content of the EdmCmd::mbsComment member is the button command string entered in the Card Editor.

EdmCmdType.EdmCmd_CardInput

The user has modified some data in a file or folder data card.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of the modified card control
mlObjectID2 | integer | ID of the file; 0 for folder cards
mlObjectID3 | integer | ID of the folder
mlObjectID4 | integer | ID of the card
mbsStrData1 | string | Name of the active configuration
mbsStrData2 | string | Full path to the file
mlLongData1 | integer | ID of the updated variable
mpoExtra | object* | Pointer to an IEdmStrLst5 interface with all configuration names

Note: You will also receive pointers to the IEdmEnumeratorVariable5 and IEdmCard5 interfaces in the EdmCmd::mpoExtra member. The content of the EdmCmd::mbsComment member is the name of the modified variable.

EdmCmdType.EdmCmd_CardListSrc

A file or folder data card containing a list box or combo box is displayed. The add-in’s IEdmAddIn5::OnCmd method is given the opportunity to fill in the rows in the list instead of using the list contents defined in the card editor.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of the card control
mlObjectID2 | integer | ID of the file; 0 for folder cards
mlObjectID3 | integer | ID of the folder
mlObjectID4 | integer | ID of the card
mbsStrData1 | string | Name of the active configuration
mbsStrData2 | string | Full path to the file
mbsStrData3 | string | Name of the control’s variable
mlLongData1 | integer | ID of the control’s variable
mpoExtra | object* | Pointer to an IEdmStrLst5 interface with all configuration names

Note: You will also receive a pointer to the IEdmEnumeratorVariable5 and IEdmCard5 interfaces via the EdmCmd::mpoExtra member. The content of the EdmCmd::mbsComment member is the return value from your add-in's IEdmAddIn5::OnCmd implementation. This variable should be set to a newline delimited list of strings to be inserted into the list box or combo box. Leave this variable untouched to use the standard values from the card editor.

EdmCmdType.EdmCmd_DeSelectItem

When an item is deselected in a vault view in File Explorer, sends only to the add-in that adds a vault view tab to File Explorer.

EdmCmdData Members | Type | Description
mbsStrData1 | string | File name
mbsStrData2 | string | Folder name
mbsStrData3 | string | Unique ID of this control

EdmCmdType.EdmCmd_PreAdd

A file is about to be added.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of parent folder
mbsStrData1 | string | Local file path
mlLongData1 | integer | 0 for normal files; 1 for network sharing links

EdmCmdType.EdmCmd_PostAdd

A file has been added.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of parent folder
mlObjectID2 | integer | ID of file
mbsStrData1 | string | Full path to file
mlLongData1 | integer | 0 for normal files; 1 for network sharing links

EdmCmdType.EdmCmd_PreAddFolder

A folder is about to be added.

EdmCmdData Members | Type | Description
mlObjectID3 | integer | ID of parent folder
mbsStrData1 | string | Path to new folder

EdmCmdType.EdmCmd_PostAddFolder

A folder has been added.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of new folder
mlObjectID3 | integer | ID of parent folder
mbsStrData1 | string | Path to the new folder

EdmCmdType.EdmCmd_PreBrowseFolder and EdmCmdType.EdmCmd_PostBrowseFolder

A folder is being browsed.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of browsed folder

EdmCmdType.EdmCmd_PreCopy and EdmCmdType.EdmCmd_PostCopy

A file is copied.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of destination folder
mlObjectID2 | integer | ID of file
mlObjectID3 | integer | ID of source folder
mbsStrData1 | string | Source file path
mbsStrData2 | string | Destination file path

EdmCmdType.EdmCmd_PreCopyFolder

A folder is about to be copied.

EdmCmdData Members | Type | Description
mlObjectID2 | integer | Source folder ID
mlObjectID3 | integer | Destination parent folder ID
mbsStrData1 | string | Path of new folder

EdmCmdType.EdmCmd_PostCopyFolder

A folder has been copied.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of new folder
mlObjectID2 | integer | Source folder ID
mlObjectID3 | integer | Destination parent folder ID
mbsStrData1 | string | Path of new folder

EdmCmdType.EdmCmd_PreDelete

A file is about to be deleted.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to delete
mlObjectID2 | integer | ID of folder to delete file in
mbsStrData1 | string | Path to file to delete

EdmCmdType.EdmCmd_PostDelete

A file has been deleted.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file that was deleted
mlObjectID2 | integer | ID of folder in which the file was deleted
mbsStrData1 | string | Path to file that was deleted
mlLongData1 | integer | Number of folders to which the file is shared

EdmCmdType.EdmCmd_PreDeleteFolder and EdmCmdType.EdmCmd_PostDeleteFolder

A folder is deleted.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of folder to delete
mbsStrData1 | string | Path to folder to delete

EdmCmdType.EdmCmd_PreGet and EdmCmdType.EdmCmd_PostGet

A file is retrieved from the archive to the local hard disk.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to get
mlObjectID2 | integer | ID of folder to get file to; 0 to retrieve a file to a temporary folder
mbsStrData1 | string | Destination file path
mlLongData1 | integer | Version number of file to get

EdmCmdType.EdmCmd_PreLabel and EdmCmdType.EdmCmd_PostLabel

A label is being created on files and/or folders.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to set label on; 0 for folders
mlObjectID2 | integer | ID of folder to set label on; parent folder ID for files; note that this ID is zero when creating a file label via the API, since that does not happen within the context of a folder
mlObjectID3 | integer | 0 for EdmCmd_PreLabel; ID of the created label for EdmCmd_PostLabel
mbsStrData1 | string | Label
mbsStrData2 | string | Path to file or folder to create label for; note that this member will only contain the file name without path when file labels are created via the API, since that is not done within the context of a folder
mlLongData1 | integer | Non 0 if label is created recursively for this folder, 0 otherwise

EdmCmdType.EdmCmd_PreLabelDelete, EdmCmdType.EdmCmd_PostLabelDelete, EdmCmdType.EdmCmd_PreLabelModify, and EdmCmdType.EdmCmd_PostLabelModify

A label is being deleted or modified.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of the label
mbsStrData1 | string | Label

EdmCmdType.EdmCmd_PreLabelAddItem and EdmCmdType.EdmCmd_PostLabelAddItem

A file or folder is being added to an existing label.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID the label
mlObjectID2 | integer | ID of the file to add; 0 for folders
mlObjectID3 | integer | ID of the folder to add; 0 for files
mbsStrData1 | string | Label
mlLongData1 | integer | Non 0 if a folder is added recursively, 0 otherwise

EdmCmdType.EdmCmd_PreLock and EdmCmdType.EdmCmd_PostLock

A file is checked out.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to check out
mlObjectID2 | integer | ID of folder where put checked-out file
mbsStrData1 | string | Path to file

EdmCmdType.EdmCmd_PreMove and EdmCmdType.EdmCmd_PostMove

A file is moved from one folder to another one.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to move
mlObjectID2 | integer | ID of source folder
mlObjectID3 | integer | ID of destination folder
mbsStrData1 | string | Source file path
mbsStrData2 | string | Destination file path

EdmCmdType.EdmCmd_PreMoveFolder and EdmCmdType.EdmCmd_PostMoveFolder

A folder is moved from one parent folder to another one.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of folder to move
mlObjectID2 | integer | ID of source parent folder
mlObjectID3 | integer | ID of destination parent folder
mbsStrData1 | string | Source folder path
mbsStrData2 | string | Destination folder path

EdmCmdType.EdmCmd_PreRename and EdmCmdType.EdmCmd_PostRename

A file is renamed.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to rename
mlObjectID2 | integer | ID of the file's parent folder
mbsStrData1 | string | Old file name
mbsStrData2 | string | New file name

EdmCmdType.EdmCmd_PreRenameFolder and EdmCmdType.EdmCmd_PostRenameFolder

A folder is renamed.

EdCmdData Members | Type | Description
mlObjectID1 | integer | ID of folder to rename
mlObjectID2 | integer | ID of the folder's parent folder
mbsStrData1 | string | Old folder name
mbsStrData2 | string | New folder name

EdmCmdType.EdmCmd_PreShare and EdmCmdType.EdmCmd_PostShare

A file is shared from one folder to another one.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to share
mlObjectID2 | integer | ID of folder to share file from
mlObjectID3 | integer | ID of folder to share file to
mbsStrData1 | string | Source file path

EdmCmdType.EdmCmd_PreState and EdmCmdType.EdmCmd_PostState

The user changes the workflow state of a file.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to change state on
mlObjectID2 | integer | ID of the file's parent folder
mlObjectID3 | integer | ID of the transition (state change) to perform
mlObjectID4 | integer | ID of user that performs the state change
mbsStrData1 | string | Path to file
mbsStrData2 | string | Name of the destination state
mlLongData1 | integer | Source state ID
mlLongData2 | integer | Destination state ID

You will receive an IEdmCmdNode interface in the mpoExtra member of the struct as of version 2011 during the change state operation.

CmdType.EdmCmd_PreUndoLock and EdmCmdType.EdmCmd_PostUndoLock

The user runs the command Undo check-out on a file. (This is the same as check-in of an unmodified file.)

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to perform undo check-out on
mlObjectID2 | integer | ID of the file's parent folder
mbsStrData1 | string | Path to file

EdmCmdType.EdmCmd_PreUnlock and EdmCmdType.EdmCmd_PostUnlock

The user runs a check-in on a modified file. (Checking in unmodified files results in an Undo check-out operation.)

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to check in
mlObjectID2 | integer | ID of the file's parent folder
mbsStrData1 | string | Path to the file

EdmCmdType.EdmCmd_SelectItem

When an item is selected in a vault view in File Explorer, sends only to the add-in that adds a vault view tab to File Explorer.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of the item
mbsStrData1 | string | File name
mbsStrData2 | string | Folder name
mbsStrData3 | string | Unique ID of this control

EdmCmdType.EdmCmd_SerialNo

New serial number(s) should be generated by your add-in.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of file to generate serial number for; 0 if not generated for a file
mlObjectID2 | integer | ID of the file's parent folder
mlObjectID3 | integer | ID of the file data card
mlObjectID4 | integer | ID of the control in the file data card
mbsStrData1 | string | Return the generated serial number here (C++ users must allocate the string with the Win32 function SysAllocString)
mbsStrData2 | string | Path to file; folder path if the serial number is created for the template manager as part of the folder name
mbsStrData3 | string | Name of configuration
mlLongData1 | integer | Serial number counter value

EdmCmdType.EdmCmd_TaskSetup

This call is made to your add-in when the task definition property dialog box is called. The call makes it possible for you to add your own custom pages to the wizard. The EdmCmd::mpoExtra pointer points to IEdmTaskProperties, the interface of the task definition.

You typically do the following in this call:

  • Call IEdmTaskProperties::SetSetupPages to add property dialog box pages.
  • Call IEdmTaskProperties::SetMenuCmds to add menu commands to show in File Explorer.
  • Update the IEdmTaskProperties::TaskFlags property to inform the framework about what your add-in is capable of.

None of the members in the EdmCmdData structure are used.

See the Code Samples section of Programming Tasks.

EdmCmdType.EdmCmd_TaskSetupButton

This call is made to your add-in when the task definition property dialog box is closed. The EdmCmd::mbsComment string is either "OK" or "Cancel", depending on how the dialog box closed. (The string is the same in all localized versions of the program.) The call makes it possible for you to save your own properties when OK is clicked. You can prevent the dialog box from closing by setting the EdmCmd::mbCancel member to true. You can return the name of an add-in page to set focus to in the EdmCmd::mbsComment string if EdmCmd::mbCancel is set to true. EdmCmd::mpoExtra points to IEdmTaskProperties, the interface of the task definition.

None of the members in the EdmCmdData structure are used.

See the Code Samples section of Programming Tasks.

EdmCmdType.EdmCmd_TaskDetails

This call is made to your add-in when the task details dialog box is displayed from the task list in the administration tool. You must specify the flag EdmTaskFlag.EdmTask_SupportsDetails in the IEdmTaskProperties::TaskFlags property in order to get the EdmCmd_TaskDetails call. You can set the flag when you get the EdmCmdType.EdmCmd_TaskSetup call. EdmCmd::mpoExtra points to IEdmTaskInstance, the interface of the task instance.

The EdmCmd::mpoExtra pointer should be set to your implementation of the extra page. The framework keeps this pointer referenced until the dialog box is closed. You return the window handle of the extra page in the member EdmCmd::mlParentWnd. The property dialog box calls ShowWindow when the page is displayed or hidden.

None of the members in the EdmCmdData structure are used.

See the Code Samples section of Programming Tasks.

EdmCmdType.EdmCmd_TaskRun

This is the callback that is called when the actual work of the task is supposed to be executed. The task is usually executed on a remote server so you must not display any user interface during this call. See the OnTaskRun function in the task sample code for an example of how to return status information and errors to the user.

The EdmCmd::mlCurrentFolderID argument is the ID of the current folder when the task was launched. It is zero if the task was launched from the administration tool.

EdmCmd::mpoExtra points to the IEdmTaskInstance interface of the task instance.

See the Code Samples section of Programming Tasks.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of the selected object (IEdmObject5::ID)
mlObjectID2 | integer | Parent folder ID if the selected object is a file
mbsStrData1 | string | Complete file system path to the object
mbsStrData2 | string | Configuration name if the object is a file
mlLongData1 | integer | EdmObjectType constant telling what kind of object this is

EdmCmdType.EdmCmd_TaskLaunch

You need to specify the EdmTask_SupportsInitExec in the IEdmTaskProperties::TaskFlags property in order to get this callback. This callback makes it possible for you to display a message box or a custom dialog box (System.Windows.Form) in which the user selects files or enters data that can be passed back to the task add-in (e.g., poCmd.mbCancel).

EdmCmd::mpoExtra points to IEdmTaskInstance, the interface of the task.

You can set EdmCmd::mbCancel to true to halt further execution of the task.

See the Code Samples section of Programming Tasks.

EdmCmdData Members | Type | Description
mlObjectID1 | integer | ID of the selected object (IEdmObject5::ID)
mlObjectID2 | integer | Parent folder ID if the selected object is a file
mbsStrData1 | string | Complete file system path to the object
mbsStrData2 | string | Configuration name if the object is a file
mlLongData1 | integer | EdmObjectType constant telling what kind of object this is
mlLongData2 | integer | Local version number of the file

EdmCmdType.EdmCmd_TaskLaunchButton

This callback is made if the framework displays a dialog box during the launching of a task using the EdmCmdType.EdmCmd_TaskLaunch callback and the user clicks a button in the dialog. You can query EdmCmd::mbsComment which contains the string "OK" or "Cancel", depending on which button was clicked in the task launch dialog. The strings are the same on all localized versions of the program. Depending on the user's button click in the task launch dialog, implement this callback to set EdmCmd::mbCancel to true to halt further execution of the task or false to continue the task execution.

EdmCmd::mpoExtra points to IEdmTaskInstance, the interface of the task.

None of the members in the EdmCmdData structure are used.

See the Code Samples section of Programming Tasks,

See Also

EdmCmdData Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmCmdData Structure Fields

EdmCmdData Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmCmdData Structure

For a list of all members of this type, see EdmCmdData members.

Public Fields

 | Name | Description
public Field | mbsStrData1 | Name of a variable, configuration, label, or path, depending on the type of command.
public Field | mbsStrData2 | Name of a variable, configuration, label, or path, depending on the type of command.
public Field | mbsStrData3 | Name of a variable, configuration, label, or path, depending on the type of command.
public Field | mlLongData1 | ID, constant, return code, serial number, or boolean value, depending on the type of command.
public Field | mlLongData2 | ID, constant, return code, serial number, or boolean value, depending on the type of command.
public Field | mlLongData3 | ID, constant, return code, serial number, version number, or boolean value, depending on the type of command.
public Field | mlObjectID1 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mlObjectID2 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mlObjectID3 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mlObjectID4 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mpoExtra | Names of all the configurations for the specified command type.
Top

See Also

EdmCmdData Structure
EPDM.Interop.epdm Namespace


EdmCmdData Structure Members

EdmCmdData Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmCmdData Structure

The following tables list the members exposed by EdmCmdData.

Public Fields

 | Name | Description
public Field | mbsStrData1 | Name of a variable, configuration, label, or path, depending on the type of command.
public Field | mbsStrData2 | Name of a variable, configuration, label, or path, depending on the type of command.
public Field | mbsStrData3 | Name of a variable, configuration, label, or path, depending on the type of command.
public Field | mlLongData1 | ID, constant, return code, serial number, or boolean value, depending on the type of command.
public Field | mlLongData2 | ID, constant, return code, serial number, or boolean value, depending on the type of command.
public Field | mlLongData3 | ID, constant, return code, serial number, version number, or boolean value, depending on the type of command.
public Field | mlObjectID1 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mlObjectID2 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mlObjectID3 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mlObjectID4 | ID of a file, folder, data card, or control, depending on the type of command.
public Field | mpoExtra | Names of all the configurations for the specified command type.
Top

See Also

EdmCmdData Structure
EPDM.Interop.epdm Namespace


mbsStrData1 Field

mbsStrData1 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mbsStrData1 Field

Name of a variable, configuration, label, or path, depending on the type of command.

Syntax

Visual Basic
Public mbsStrData1 As System.String
C#
public System.string mbsStrData1
C++/CLI
public:
System.String^ mbsStrData1

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mbsStrData2 Field

mbsStrData2 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mbsStrData2 Field

Name of a variable, configuration, label, or path, depending on the type of command.

Syntax

Visual Basic
Public mbsStrData2 As System.String
C#
public System.string mbsStrData2
C++/CLI
public:
System.String^ mbsStrData2

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mbsStrData3 Field

mbsStrData3 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mbsStrData3 Field

Name of a variable, configuration, label, or path, depending on the type of command.

Syntax

Visual Basic
Public mbsStrData3 As System.String
C#
public System.string mbsStrData3
C++/CLI
public:
System.String^ mbsStrData3

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlLongData1 Field

mlLongData1 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlLongData1 Field

ID, constant, return code, serial number, or boolean value, depending on the type of command.

Syntax

Visual Basic
Public mlLongData1 As System.Integer
C#
public System.int mlLongData1
C++/CLI
public:
System.int mlLongData1

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlLongData2 Field

mlLongData2 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlLongData2 Field

ID, constant, return code, serial number, or boolean value, depending on the type of command.

Syntax

Visual Basic
Public mlLongData2 As System.Integer
C#
public System.int mlLongData2
C++/CLI
public:
System.int mlLongData2

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlLongData3 Field

mlLongData3 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlLongData3 Field

ID, constant, return code, serial number, version number, or boolean value, depending on the type of command.

Syntax

Visual Basic
Public mlLongData3 As System.Integer
C#
public System.int mlLongData3
C++/CLI
public:
System.int mlLongData3

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlObjectID1 Field

mlObjectID1 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlObjectID1 Field

ID of a file, folder, data card, or control, depending on the type of command.

Syntax

Visual Basic
Public mlObjectID1 As System.Integer
C#
public System.int mlObjectID1
C++/CLI
public:
System.int mlObjectID1

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlObjectID2 Field

mlObjectID2 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlObjectID2 Field

ID of a file, folder, data card, or control, depending on the type of command.

Syntax

Visual Basic
Public mlObjectID2 As System.Integer
C#
public System.int mlObjectID2
C++/CLI
public:
System.int mlObjectID2

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlObjectID3 Field

mlObjectID3 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlObjectID3 Field

ID of a file, folder, data card, or control, depending on the type of command.

Syntax

Visual Basic
Public mlObjectID3 As System.Integer
C#
public System.int mlObjectID3
C++/CLI
public:
System.int mlObjectID3

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mlObjectID4 Field

mlObjectID4 Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mlObjectID4 Field

ID of a file, folder, data card, or control, depending on the type of command.

Syntax

Visual Basic
Public mlObjectID4 As System.Integer
C#
public System.int mlObjectID4
C++/CLI
public:
System.int mlObjectID4

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


mpoExtra Field

mpoExtra Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdData Structure : mpoExtra Field

Names of all the configurations for the specified command type.

Syntax

Visual Basic
Public mpoExtra As System.Object
C#
public System.object mpoExtra
C++/CLI
public:
System.Object^ mpoExtra

Field Value

IEdmStrLst5; contains the names of all configurations for the specified command type

Remarks

See EdmCmdData Remarks.

See Also

EdmCmdData Structure
EdmCmdData Members


EdmCmdInfo Structure

EdmCmdInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmCmdInfo Structure

Contains information about menu command items.

Syntax

Visual Basic
Public Structure EdmCmdInfo
   Inherits System.ValueType
C#
public struct EdmCmdInfo : System.ValueType
C++/CLI
public value class EdmCmdInfo : public System.ValueType

Example

struct EdmCmdInfo{
  integer mlCmdID;
  string mbsCmdStr;
  string mbsTooltip;
  string mbsStatusBarHelp;
  integer mlEdmMenuFlags;
  object moData;
};

Example

Get Menu Command Items (VB.NET)
Get Menu Command Items (C#)

Remarks

Used in IEdmMenu6.

See Also

EdmCmdInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2009


EdmCmdInfo Structure Fields

EdmCmdInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmCmdInfo Structure

For a list of all members of this type, see EdmCmdInfo members.

Public Fields

 | Name | Description
public Field | mbsCmdStr | User interface command string.
public Field | mbsStatusBarHelp | Status bar help.
public Field | mbsTooltip | Command tooltip.
public Field | mlCmdID | ID of the command.
public Field | mlEdmMenuFlags | Command flags.
public Field | moData | Reserved.
Top

See Also

EdmCmdInfo Structure
EPDM.Interop.epdm Namespace


EdmCmdInfo Structure Members

EdmCmdInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmCmdInfo Structure

The following tables list the members exposed by EdmCmdInfo.

Public Fields

 | Name | Description
public Field | mbsCmdStr | User interface command string.
public Field | mbsStatusBarHelp | Status bar help.
public Field | mbsTooltip | Command tooltip.
public Field | mlCmdID | ID of the command.
public Field | mlEdmMenuFlags | Command flags.
public Field | moData | Reserved.
Top

See Also

EdmCmdInfo Structure
EPDM.Interop.epdm Namespace


mbsCmdStr Field

mbsCmdStr Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdInfo Structure : mbsCmdStr Field

User interface command string.

Syntax

Visual Basic
Public mbsCmdStr As System.String
C#
public System.string mbsCmdStr
C++/CLI
public:
System.String^ mbsCmdStr

See Also

EdmCmdInfo Structure
EdmCmdInfo Members


mbsStatusBarHelp Field

mbsStatusBarHelp Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdInfo Structure : mbsStatusBarHelp Field

Status bar help.

Syntax

Visual Basic
Public mbsStatusBarHelp As System.String
C#
public System.string mbsStatusBarHelp
C++/CLI
public:
System.String^ mbsStatusBarHelp

See Also

EdmCmdInfo Structure
EdmCmdInfo Members


mbsTooltip Field

mbsTooltip Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdInfo Structure : mbsTooltip Field

Command tooltip.

Syntax

Visual Basic
Public mbsTooltip As System.String
C#
public System.string mbsTooltip
C++/CLI
public:
System.String^ mbsTooltip

See Also

EdmCmdInfo Structure
EdmCmdInfo Members


mlCmdID Field

mlCmdID Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdInfo Structure : mlCmdID Field

ID of the command.

Syntax

Visual Basic
Public mlCmdID As System.Integer
C#
public System.int mlCmdID
C++/CLI
public:
System.int mlCmdID

Remarks

Used with IEdmMenu5::OnMenuItem.

See Also

EdmCmdInfo Structure
EdmCmdInfo Members


mlEdmMenuFlags Field

mlEdmMenuFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdInfo Structure : mlEdmMenuFlags Field

Command flags.

Syntax

Visual Basic
Public mlEdmMenuFlags As System.Integer
C#
public System.int mlEdmMenuFlags
C++/CLI
public:
System.int mlEdmMenuFlags

Field Value

Command flags as defined in EdmMenuFlags.

See Also

EdmCmdInfo Structure
EdmCmdInfo Members


moData Field

moData Field
[image]
EPDM.Interop.epdm Namespace > EdmCmdInfo Structure : moData Field

Reserved.

Syntax

Visual Basic
Public moData As System.Object
C#
public System.object moData
C++/CLI
public:
System.Object^ moData

See Also

EdmCmdInfo Structure
EdmCmdInfo Members


EdmColumnSet Structure

EdmColumnSet Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmColumnSet Structure

Contains information about a column set's name and ID.

Syntax

Visual Basic
Public Structure EdmColumnSet
   Inherits System.ValueType
C#
public struct EdmColumnSet : System.ValueType
C++/CLI
public value class EdmColumnSet : public System.ValueType

Example

struct EdmColumnSet

{
  string mbsColumnSetName;
  integer mlColumnSetID;
};

See Also

EdmColumnSet Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2024


EdmColumnSet Structure Fields

EdmColumnSet Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmColumnSet Structure

For a list of all members of this type, see EdmColumnSet members.

Public Fields

 | Name | Description
public Field | mbsColumnSetName | Column set name.
public Field | mlColumnSetID | Unique ID for the column set.
Top

See Also

EdmColumnSet Structure
EPDM.Interop.epdm Namespace


EdmColumnSet Structure Members

EdmColumnSet Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmColumnSet Structure

The following tables list the members exposed by EdmColumnSet.

Public Fields

 | Name | Description
public Field | mbsColumnSetName | Column set name.
public Field | mlColumnSetID | Unique ID for the column set.
Top

See Also

EdmColumnSet Structure
EPDM.Interop.epdm Namespace


mbsColumnSetName Field

mbsColumnSetName Field
[image]
EPDM.Interop.epdm Namespace > EdmColumnSet Structure : mbsColumnSetName Field

Column set name.

Syntax

Visual Basic
Public mbsColumnSetName As System.String
C#
public System.string mbsColumnSetName
C++/CLI
public:
System.String^ mbsColumnSetName

Field Value

Name

See Also

EdmColumnSet Structure
EdmColumnSet Members


mlColumnSetID Field

mlColumnSetID Field
[image]
EPDM.Interop.epdm Namespace > EdmColumnSet Structure : mlColumnSetID Field

Unique ID for the column set.

Syntax

Visual Basic
Public mlColumnSetID As System.Integer
C#
public System.int mlColumnSetID
C++/CLI
public:
System.int mlColumnSetID

Field Value

Unique ID

See Also

EdmColumnSet Structure
EdmColumnSet Members


EdmCopyTreeOptions Structure

EdmCopyTreeOptions Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmCopyTreeOptions Structure

Contains options for copying an assembly tree of files to a destination folder.

Syntax

Visual Basic
Public Structure EdmCopyTreeOptions
   Inherits System.ValueType
C#
public struct EdmCopyTreeOptions : System.ValueType
C++/CLI
public value class EdmCopyTreeOptions : public System.ValueType

Example

struct EdmCopyTreeOptions

{
  string mbsPrefix;
  string mbsSuffix;
  VARIANT_BOOL mbIncludeDrawings;
  VARIANT_BOOL mbUseLatestVersion;
};

Example

Copy Assembly Tree of Files (VB.NET)
Copy Assembly Tree of Files (C#)

See Also

EdmCopyTreeOptions Members
EPDM.Interop.epdm Namespace


EdmCopyTreeOptions Structure Fields

EdmCopyTreeOptions Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmCopyTreeOptions Structure

For a list of all members of this type, see EdmCopyTreeOptions members.

Public Fields

 | Name | Description
public Field | mbIncludeDrawings | Whether to include drawings in the copy.
public Field | mbsPrefix | Prefix to append to copied file names.
public Field | mbsSuffix | Suffix to append to copied file names.
public Field | mbUseLatestVersion | Whether to copy the latest versions of files.
Top

See Also

EdmCopyTreeOptions Structure
EPDM.Interop.epdm Namespace


EdmCopyTreeOptions Structure Members

EdmCopyTreeOptions Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmCopyTreeOptions Structure

The following tables list the members exposed by EdmCopyTreeOptions.

Public Fields

 | Name | Description
public Field | mbIncludeDrawings | Whether to include drawings in the copy.
public Field | mbsPrefix | Prefix to append to copied file names.
public Field | mbsSuffix | Suffix to append to copied file names.
public Field | mbUseLatestVersion | Whether to copy the latest versions of files.
Top

See Also

EdmCopyTreeOptions Structure
EPDM.Interop.epdm Namespace


mbIncludeDrawings Field

mbIncludeDrawings Field
[image]
EPDM.Interop.epdm Namespace > EdmCopyTreeOptions Structure : mbIncludeDrawings Field

Whether to include drawings in the copy.

Syntax

Visual Basic
Public mbIncludeDrawings As System.Short
C#
public System.short mbIncludeDrawings
C++/CLI
public:
System.short mbIncludeDrawings

Field Value

-1 or VARIANT_TRUE to include drawings, 0 or VARIANT_FALSE to not

See Also

EdmCopyTreeOptions Structure
EdmCopyTreeOptions Members


mbsPrefix Field

mbsPrefix Field
[image]
EPDM.Interop.epdm Namespace > EdmCopyTreeOptions Structure : mbsPrefix Field

Prefix to append to copied file names.

Syntax

Visual Basic
Public mbsPrefix As System.String
C#
public System.string mbsPrefix
C++/CLI
public:
System.String^ mbsPrefix

Field Value

File name prefix

See Also

EdmCopyTreeOptions Structure
EdmCopyTreeOptions Members


mbsSuffix Field

mbsSuffix Field
[image]
EPDM.Interop.epdm Namespace > EdmCopyTreeOptions Structure : mbsSuffix Field

Suffix to append to copied file names.

Syntax

Visual Basic
Public mbsSuffix As System.String
C#
public System.string mbsSuffix
C++/CLI
public:
System.String^ mbsSuffix

Field Value

File name suffix

See Also

EdmCopyTreeOptions Structure
EdmCopyTreeOptions Members


mbUseLatestVersion Field

mbUseLatestVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmCopyTreeOptions Structure : mbUseLatestVersion Field

Whether to copy the latest versions of files.

Syntax

Visual Basic
Public mbUseLatestVersion As System.Short
C#
public System.short mbUseLatestVersion
C++/CLI
public:
System.short mbUseLatestVersion

Field Value

-1 or VARIANT_TRUE to copy the latest versions of files, 0 or VARIANT_FALSE to copy referenced versions

See Also

EdmCopyTreeOptions Structure
EdmCopyTreeOptions Members


EdmDeletedItems Structure

EdmDeletedItems Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmDeletedItems Structure

Contains information about deleted items.

Syntax

Visual Basic
Public Structure EdmDeletedItems
   Inherits System.ValueType
C#
public struct EdmDeletedItems : System.ValueType
C++/CLI
public value class EdmDeletedItems : public System.ValueType

Example

struct EdmDeletedItems

{
  integer mlFileID;
  integer mlObjectType;
  integer mlProjectID;
  string moName;
};

See Also

EdmDeletedItems Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Pro 2018


EdmDeletedItems Structure Fields

EdmDeletedItems Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmDeletedItems Structure

For a list of all members of this type, see EdmDeletedItems members.

Public Fields

 | Name | Description
public Field | mlFileID | ID of the deleted item.
public Field | mlObjectType | Object type of the deleted item.
public Field | mlProjectID | Parent folder ID of the deleted item.
public Field | moName | Name of the deleted item.
Top

See Also

EdmDeletedItems Structure
EPDM.Interop.epdm Namespace


EdmDeletedItems Structure Members

EdmDeletedItems Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmDeletedItems Structure

The following tables list the members exposed by EdmDeletedItems.

Public Fields

 | Name | Description
public Field | mlFileID | ID of the deleted item.
public Field | mlObjectType | Object type of the deleted item.
public Field | mlProjectID | Parent folder ID of the deleted item.
public Field | moName | Name of the deleted item.
Top

See Also

EdmDeletedItems Structure
EPDM.Interop.epdm Namespace


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmDeletedItems Structure : mlFileID Field

ID of the deleted item.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

See Also

EdmDeletedItems Structure
EdmDeletedItems Members


mlObjectType Field

mlObjectType Field
[image]
EPDM.Interop.epdm Namespace > EdmDeletedItems Structure : mlObjectType Field

Object type of the deleted item.

Syntax

Visual Basic
Public mlObjectType As System.Integer
C#
public System.int mlObjectType
C++/CLI
public:
System.int mlObjectType

Field Value

Object type of the deleted item as defined in EdmObjectType

See Also

EdmDeletedItems Structure
EdmDeletedItems Members


mlProjectID Field

mlProjectID Field
[image]
EPDM.Interop.epdm Namespace > EdmDeletedItems Structure : mlProjectID Field

Parent folder ID of the deleted item.

Syntax

Visual Basic
Public mlProjectID As System.Integer
C#
public System.int mlProjectID
C++/CLI
public:
System.int mlProjectID

See Also

EdmDeletedItems Structure
EdmDeletedItems Members


moName Field

moName Field
[image]
EPDM.Interop.epdm Namespace > EdmDeletedItems Structure : moName Field

Name of the deleted item.

Syntax

Visual Basic
Public moName As System.String
C#
public System.string moName
C++/CLI
public:
System.String^ moName

See Also

EdmDeletedItems Structure
EdmDeletedItems Members


EdmDocIDs Structure

EdmDocIDs Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmDocIDs Structure

Contains information about one document in the vault; used in IEdmVault20::GetFiles.

Syntax

Visual Basic
Public Structure EdmDocIDs
   Inherits System.ValueType
C#
public struct EdmDocIDs : System.ValueType
C++/CLI
public value class EdmDocIDs : public System.ValueType

Example

struct EdmDocIDs

{
  integer mlDocID;
  integer mlProjID;
};

See Also

EdmDocIDs Members
EPDM.Interop.epdm Namespace


EdmDocIDs Structure Fields

EdmDocIDs Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmDocIDs Structure

For a list of all members of this type, see EdmDocIDs members.

Public Fields

 | Name | Description
public Field | mlDocID | Unique ID of the vault document.
public Field | mlProjID | Unique ID of the document's parent folder in the vault.
Top

See Also

EdmDocIDs Structure
EPDM.Interop.epdm Namespace


EdmDocIDs Structure Members

EdmDocIDs Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmDocIDs Structure

The following tables list the members exposed by EdmDocIDs.

Public Fields

 | Name | Description
public Field | mlDocID | Unique ID of the vault document.
public Field | mlProjID | Unique ID of the document's parent folder in the vault.
Top

See Also

EdmDocIDs Structure
EPDM.Interop.epdm Namespace


mlDocID Field

mlDocID Field
[image]
EPDM.Interop.epdm Namespace > EdmDocIDs Structure : mlDocID Field

Unique ID of the vault document.

Syntax

Visual Basic
Public mlDocID As System.Integer
C#
public System.int mlDocID
C++/CLI
public:
System.int mlDocID

See Also

EdmDocIDs Structure
EdmDocIDs Members


mlProjID Field

mlProjID Field
[image]
EPDM.Interop.epdm Namespace > EdmDocIDs Structure : mlProjID Field

Unique ID of the document's parent folder in the vault.

Syntax

Visual Basic
Public mlProjID As System.Integer
C#
public System.int mlProjID
C++/CLI
public:
System.int mlProjID

See Also

EdmDocIDs Structure
EdmDocIDs Members


EdmFileInfo Structure

EdmFileInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmFileInfo Structure

Information about a file or folder that is added to or removed from the vault.

Syntax

Visual Basic
Public Structure EdmFileInfo
   Inherits System.ValueType
C#
public struct EdmFileInfo : System.ValueType
C++/CLI
public value class EdmFileInfo : public System.ValueType

Example

struct EdmFileInfo{
  integer mlArg;
  integer mlFileID;
  integer mlFolderID;
  integer mhResult;
  string mbsPath;
  IEdmObject5* mpoObject;
};

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

Remarks

Returned by IEdmBatchAdd::CommitAdd. One structure is returned for each file or folder added to the batch using one of the IEdmBatchAdd::AddXxxxx methods.

See Also

EdmFileInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmFileInfo Structure Fields

EdmFileInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmFileInfo Structure

For a list of all members of this type, see EdmFileInfo members.

Public Fields

 | Name | Description
public Field | mbsPath | File system path to the file or folder.
public Field | mhResult | Result code for the add operation.
public Field | mlArg | Caller-defined argument passed to one of the add methods.
public Field | mlFileID | ID of the created file.
public Field | mlFolderID | ID of the created file's parent folder.
public Field | mpoObject | Interface for the file or folder that was added to the batch using one of the IEdmBatchAdd::AddXxxxx methods.
Top

See Also

EdmFileInfo Structure
EPDM.Interop.epdm Namespace


EdmFileInfo Structure Members

EdmFileInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmFileInfo Structure

The following tables list the members exposed by EdmFileInfo.

Public Fields

 | Name | Description
public Field | mbsPath | File system path to the file or folder.
public Field | mhResult | Result code for the add operation.
public Field | mlArg | Caller-defined argument passed to one of the add methods.
public Field | mlFileID | ID of the created file.
public Field | mlFolderID | ID of the created file's parent folder.
public Field | mpoObject | Interface for the file or folder that was added to the batch using one of the IEdmBatchAdd::AddXxxxx methods.
Top

See Also

EdmFileInfo Structure
EPDM.Interop.epdm Namespace


mbsPath Field

mbsPath Field
[image]
EPDM.Interop.epdm Namespace > EdmFileInfo Structure : mbsPath Field

File system path to the file or folder.

Syntax

Visual Basic
Public mbsPath As System.String
C#
public System.string mbsPath
C++/CLI
public:
System.String^ mbsPath

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

See Also

EdmFileInfo Structure
EdmFileInfo Members


mhResult Field

mhResult Field
[image]
EPDM.Interop.epdm Namespace > EdmFileInfo Structure : mhResult Field

Result code for the add operation.

Syntax

Visual Basic
Public mhResult As System.Integer
C#
public System.int mhResult
C++/CLI
public:
System.int mhResult

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

See Also

EdmFileInfo Structure
EdmFileInfo Members


mlArg Field

mlArg Field
[image]
EPDM.Interop.epdm Namespace > EdmFileInfo Structure : mlArg Field

Caller-defined argument passed to one of the add methods.

Syntax

Visual Basic
Public mlArg As System.Integer
C#
public System.int mlArg
C++/CLI
public:
System.int mlArg

See Also

EdmFileInfo Structure
EdmFileInfo Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmFileInfo Structure : mlFileID Field

ID of the created file.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

Field Value

0, if a folder

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

See Also

EdmFileInfo Structure
EdmFileInfo Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmFileInfo Structure : mlFolderID Field

ID of the created file's parent folder.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

See Also

EdmFileInfo Structure
EdmFileInfo Members


mpoObject Field

mpoObject Field
[image]
EPDM.Interop.epdm Namespace > EdmFileInfo Structure : mpoObject Field

Interface for the file or folder that was added to the batch using one of the IEdmBatchAdd::AddXxxxx methods.

Syntax

Visual Basic
Public mpoObject As IEdmObject5
C#
public IEdmObject5 mpoObject
C++/CLI
public:
IEdmObject5^ mpoObject

Field Value

IEdmFile6, if a file, or IEdmFolder6, if a folder

Remarks

This member is valid only if you specify EdmBatchAddFolderFlag.Ebaff_GetInterface or EdmAddFlag.EdmAdd_GetInterface in the method that adds the file or folder to the batch.

See Also

EdmFileInfo Structure
EdmFileInfo Members


EdmFolderInfo Structure

EdmFolderInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmFolderInfo Structure

Information about a folder that is added to the vault.

Syntax

Visual Basic
Public Structure EdmFolderInfo
   Inherits System.ValueType
C#
public struct EdmFolderInfo : System.ValueType
C++/CLI
public value class EdmFolderInfo : public System.ValueType

Example

struct EdmFolderInfo{
  integer mlFolderID;
  string mbsPath;
  integer mlParam;
  integer mlEdmFolderInfoFlags;
  IEdmFolder6* mpoFolder;
};

Example

Batch Add Folders (VB.NET)
Batch Add Folders (C#)

Remarks

Returned by IEdmBatchAddFolders::Create. One structure is returned for each folder added to the batch using IEdmBatchAddFolders::AddFolder.

See Also

EdmFolderInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 6.3 of SOLIDWORKS PDM Professional


EdmFolderInfo Structure Fields

EdmFolderInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmFolderInfo Structure

For a list of all members of this type, see EdmFolderInfo members.

Public Fields

 | Name | Description
public Field | mbsPath | Complete path to the folder.
public Field | mlEdmFolderInfoFlags | Non-critical errors about this folder.
public Field | mlFolderID | ID of the folder.
public Field | mlParam | User-defined lParam argument passed to IEdmBatchAddFolders::AddFolder.
public Field | mpoFolder | Interface for the folder that was added to the batch using IEdmBatchAddFolders::AddFolder.
Top

See Also

EdmFolderInfo Structure
EPDM.Interop.epdm Namespace


EdmFolderInfo Structure Members

EdmFolderInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmFolderInfo Structure

The following tables list the members exposed by EdmFolderInfo.

Public Fields

 | Name | Description
public Field | mbsPath | Complete path to the folder.
public Field | mlEdmFolderInfoFlags | Non-critical errors about this folder.
public Field | mlFolderID | ID of the folder.
public Field | mlParam | User-defined lParam argument passed to IEdmBatchAddFolders::AddFolder.
public Field | mpoFolder | Interface for the folder that was added to the batch using IEdmBatchAddFolders::AddFolder.
Top

See Also

EdmFolderInfo Structure
EPDM.Interop.epdm Namespace


EdmFolderPermission Structure

EdmFolderPermission Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmFolderPermission Structure

Contains permission settings.

Syntax

Visual Basic
Public Structure EdmFolderPermission
   Inherits System.ValueType
C#
public struct EdmFolderPermission : System.ValueType
C++/CLI
public value class EdmFolderPermission : public System.ValueType

Example

struct EdmFolderPermission
{
  integer mlEdmRightFlag;
  integer mlFolderID;
  integer mlOwnerID;
  enum EdmObjectType meOwnerType;
};

Example

Get and Set Folder Permissions (VB.NET)
Get and Set Folder Permissions (C#)

Remarks

Used by IEdmUserMgr7::GetFolderPermissions and IEdmUserMgr7::SetFolderPermissions.

See Also

EdmFolderPermission Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmFolderPermission Structure Fields

EdmFolderPermission Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmFolderPermission Structure

For a list of all members of this type, see EdmFolderPermission members.

Public Fields

 | Name | Description
public Field | meOwnerType | Folder owner type.
public Field | mlEdmRightFlag | Folder rights.
public Field | mlFolderID | ID of folder to which to assign permissions.
public Field | mlOwnerID | ID of meOwnerType for whom to assign permissions.
Top

See Also

EdmFolderPermission Structure
EPDM.Interop.epdm Namespace


EdmFolderPermission Structure Members

EdmFolderPermission Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmFolderPermission Structure

The following tables list the members exposed by EdmFolderPermission.

Public Fields

 | Name | Description
public Field | meOwnerType | Folder owner type.
public Field | mlEdmRightFlag | Folder rights.
public Field | mlFolderID | ID of folder to which to assign permissions.
public Field | mlOwnerID | ID of meOwnerType for whom to assign permissions.
Top

See Also

EdmFolderPermission Structure
EPDM.Interop.epdm Namespace


meOwnerType Field

meOwnerType Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderPermission Structure : meOwnerType Field

Folder owner type.

Syntax

Visual Basic
Public meOwnerType As EdmObjectType
C#
public EdmObjectType meOwnerType
C++/CLI
public:
EdmObjectType meOwnerType

Field Value

EdmObjectType.EdmObject_User or EdmObjectType.EdmObject_UserGroup

See Also

EdmFolderPermission Structure
EdmFolderPermission Members


mlEdmRightFlag Field

mlEdmRightFlag Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderPermission Structure : mlEdmRightFlag Field

Folder rights.

Syntax

Visual Basic
Public mlEdmRightFlag As System.Integer
C#
public System.int mlEdmRightFlag
C++/CLI
public:
System.int mlEdmRightFlag

Field Value

Combination of EdmRightFlags bits.

See Also

EdmFolderPermission Structure
EdmFolderPermission Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderPermission Structure : mlFolderID Field

ID of folder to which to assign permissions.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

See Also

EdmFolderPermission Structure
EdmFolderPermission Members


mlOwnerID Field

mlOwnerID Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderPermission Structure : mlOwnerID Field

ID of meOwnerType for whom to assign permissions.

Syntax

Visual Basic
Public mlOwnerID As System.Integer
C#
public System.int mlOwnerID
C++/CLI
public:
System.int mlOwnerID

See Also

EdmFolderPermission Structure
EdmFolderPermission Members


EdmGenItemInfo Structure

EdmGenItemInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmGenItemInfo Structure

Contains information about generated items.

Syntax

Visual Basic
Public Structure EdmGenItemInfo
   Inherits System.ValueType
C#
public struct EdmGenItemInfo : System.ValueType
C++/CLI
public value class EdmGenItemInfo : public System.ValueType

Example

struct EdmGenItemInfo{
  integer mlFileID;
  integer mlFileParentFolderID;
  string mbsConfiguration;
  integer mlFileVersion;
  string mbsFileFolderPath;
  string mbsFileName;
  integer mlItemID;
  integer mlItemParentFolderID;
  enum EdmItemLinkType meLinkType;
  string mbsItemFolderPath;
  string mbsItemName;
  string mbsItemAlternativeName;
  integer mhResult;
};

Example

Add Items (C#)
Add Items (VB.NET)

Remarks

Returned by IEdmBatchItemGeneration::GenerateItems.

See Also

EdmGenItemInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmGenItemInfo Structure Fields

EdmGenItemInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmGenItemInfo Structure

For a list of all members of this type, see EdmGenItemInfo members.

Public Fields

 | Name | Description
public Field | mbsConfiguration | Name of the configuration to which the item is linked.
public Field | mbsFileFolderPath | Path to the file's parent folder.
public Field | mbsFileName | File's name.
public Field | mbsItemAlternativeName | Item's descriptive name.
public Field | mbsItemFolderPath | Path to the item's parent folder.
public Field | mbsItemName | Item ID.
public Field | meLinkType | Type of link between the file and the item.
public Field | mhResult | Result code of the item generation operation.
public Field | mlFileID | ID of the file to which the item is linked.
public Field | mlFileParentFolderID | ID of the file's parent folder.
public Field | mlFileVersion | File version number for which to create the item.
public Field | mlItemID | ID of the item.
public Field | mlItemParentFolderID | ID of the item's parent folder.
Top

See Also

EdmGenItemInfo Structure
EPDM.Interop.epdm Namespace


EdmGenItemInfo Structure Members

EdmGenItemInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmGenItemInfo Structure

The following tables list the members exposed by EdmGenItemInfo.

Public Fields

 | Name | Description
public Field | mbsConfiguration | Name of the configuration to which the item is linked.
public Field | mbsFileFolderPath | Path to the file's parent folder.
public Field | mbsFileName | File's name.
public Field | mbsItemAlternativeName | Item's descriptive name.
public Field | mbsItemFolderPath | Path to the item's parent folder.
public Field | mbsItemName | Item ID.
public Field | meLinkType | Type of link between the file and the item.
public Field | mhResult | Result code of the item generation operation.
public Field | mlFileID | ID of the file to which the item is linked.
public Field | mlFileParentFolderID | ID of the file's parent folder.
public Field | mlFileVersion | File version number for which to create the item.
public Field | mlItemID | ID of the item.
public Field | mlItemParentFolderID | ID of the item's parent folder.
Top

See Also

EdmGenItemInfo Structure
EPDM.Interop.epdm Namespace


mbsConfiguration Field

mbsConfiguration Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mbsConfiguration Field

Name of the configuration to which the item is linked.

Syntax

Visual Basic
Public mbsConfiguration As System.String
C#
public System.string mbsConfiguration
C++/CLI
public:
System.String^ mbsConfiguration

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mbsFileFolderPath Field

mbsFileFolderPath Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mbsFileFolderPath Field

Path to the file's parent folder.

Syntax

Visual Basic
Public mbsFileFolderPath As System.String
C#
public System.string mbsFileFolderPath
C++/CLI
public:
System.String^ mbsFileFolderPath

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mbsFileName Field

mbsFileName Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mbsFileName Field

File's name.

Syntax

Visual Basic
Public mbsFileName As System.String
C#
public System.string mbsFileName
C++/CLI
public:
System.String^ mbsFileName

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mbsItemAlternativeName Field

mbsItemAlternativeName Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mbsItemAlternativeName Field

Item's descriptive name.

Syntax

Visual Basic
Public mbsItemAlternativeName As System.String
C#
public System.string mbsItemAlternativeName
C++/CLI
public:
System.String^ mbsItemAlternativeName

Remarks

This member is based on a variable value in the item card.

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mbsItemFolderPath Field

mbsItemFolderPath Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mbsItemFolderPath Field

Path to the item's parent folder.

Syntax

Visual Basic
Public mbsItemFolderPath As System.String
C#
public System.string mbsItemFolderPath
C++/CLI
public:
System.String^ mbsItemFolderPath

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mbsItemName Field

mbsItemName Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mbsItemName Field

Item ID.

Syntax

Visual Basic
Public mbsItemName As System.String
C#
public System.string mbsItemName
C++/CLI
public:
System.String^ mbsItemName

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


meLinkType Field

meLinkType Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : meLinkType Field

Type of link between the file and the item.

Syntax

Visual Basic
Public meLinkType As EdmItemLinkType
C#
public EdmItemLinkType meLinkType
C++/CLI
public:
EdmItemLinkType meLinkType

Field Value

Type of link as define din EdmItemLinkType

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mhResult Field

mhResult Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mhResult Field

Result code of the item generation operation.

Syntax

Visual Basic
Public mhResult As System.Integer
C#
public System.int mhResult
C++/CLI
public:
System.int mhResult

Remarks

Call IEdmVault5::GetErrorString to get a meaningful description of the error.

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mlFileID Field

ID of the file to which the item is linked.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mlFileParentFolderID Field

mlFileParentFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mlFileParentFolderID Field

ID of the file's parent folder.

Syntax

Visual Basic
Public mlFileParentFolderID As System.Integer
C#
public System.int mlFileParentFolderID
C++/CLI
public:
System.int mlFileParentFolderID

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mlFileVersion Field

mlFileVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mlFileVersion Field

File version number for which to create the item.

Syntax

Visual Basic
Public mlFileVersion As System.Integer
C#
public System.int mlFileVersion
C++/CLI
public:
System.int mlFileVersion

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mlItemID Field

mlItemID Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mlItemID Field

ID of the item.

Syntax

Visual Basic
Public mlItemID As System.Integer
C#
public System.int mlItemID
C++/CLI
public:
System.int mlItemID

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


mlItemParentFolderID Field

mlItemParentFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmGenItemInfo Structure : mlItemParentFolderID Field

ID of the item's parent folder.

Syntax

Visual Basic
Public mlItemParentFolderID As System.Integer
C#
public System.int mlItemParentFolderID
C++/CLI
public:
System.int mlItemParentFolderID

See Also

EdmGenItemInfo Structure
EdmGenItemInfo Members


EdmGetVarData Structure

EdmGetVarData Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmGetVarData Structure

Contains extra file information.

Syntax

Visual Basic
Public Structure EdmGetVarData
   Inherits System.ValueType
C#
public struct EdmGetVarData : System.ValueType
C++/CLI
public value class EdmGetVarData : public System.ValueType

Example

struct EdmGetVarData{
  integer mlVersion;
  integer mlLatestVersion;
  string mbsRevision;
  string mbsState;
  string mbsWorkflow;
  string mbsCategory;
  integer mlDateFmt;
  integer mlEdmGetVarDataFlags;
};

Example

Get File Variable Data (VB.NET)
Get File Variable Data (C#)

Remarks

Returned by IEdmEnumeratorVariable7::GetVersionVars.

See Also

EdmGetVarData Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmGetVarData Structure Fields

EdmGetVarData Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmGetVarData Structure

For a list of all members of this type, see EdmGetVarData members.

Public Fields

 | Name | Description
public Field | mbsCategory | Name of the file's category.
public Field | mbsRevision | Name of the current revision.
public Field | mbsState | Name of the current workflow state.
public Field | mbsWorkflow | Name of the current workflow.
public Field | mlDateFmt | SQL-server date format of the date used in the vault.
public Field | mlEdmGetVarDataFlags | Date flags.
public Field | mlLatestVersion | Latest version of the file.
public Field | mlVersion | Local version of the file.
Top

See Also

EdmGetVarData Structure
EPDM.Interop.epdm Namespace


EdmGetVarData Structure Members

EdmGetVarData Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmGetVarData Structure

The following tables list the members exposed by EdmGetVarData.

Public Fields

 | Name | Description
public Field | mbsCategory | Name of the file's category.
public Field | mbsRevision | Name of the current revision.
public Field | mbsState | Name of the current workflow state.
public Field | mbsWorkflow | Name of the current workflow.
public Field | mlDateFmt | SQL-server date format of the date used in the vault.
public Field | mlEdmGetVarDataFlags | Date flags.
public Field | mlLatestVersion | Latest version of the file.
public Field | mlVersion | Local version of the file.
Top

See Also

EdmGetVarData Structure
EPDM.Interop.epdm Namespace


EdmGroupData Structure

EdmGroupData Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmGroupData Structure

Contains information about a user group.

Syntax

Visual Basic
Public Structure EdmGroupData
   Inherits System.ValueType
C#
public struct EdmGroupData : System.ValueType
C++/CLI
public value class EdmGroupData : public System.ValueType

Example

struct EdmGroupData

{
  string mbsName;

  string mbsDescription;

integer mlFlags;

integer mlSysRights;

short mbAutoAdd;

array moMembers;

integer mlGroupID;

integer mhStatus;

  IEdmUserGroup5 *mpoGroup;
};

Remarks

Used in IEdmUserMgr6::AddGroups. This structure is extended by EdmGroupData2, which should be used instead of this structure in version 2010 and later.

See Also

EdmGroupData Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmGroupData2 Structure

EdmGroupData2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmGroupData2 Structure

Contains information about a user group.

Syntax

Visual Basic
Public Structure EdmGroupData2
   Inherits System.ValueType
C#
public struct EdmGroupData2 : System.ValueType
C++/CLI
public value class EdmGroupData2 : public System.ValueType

Example

struct EdmGroupData2{
  string mbsName;
  string mbsDescription;
  integer mlFlags;
  array(enum EdmSysPerm) moSysPerms;
  short mbAutoAdd;
  array(integer) moMembers;
  integer mlGroupID;
  integer mhStatus;
  IEdmUserGroup5 *mpoGroup;
};

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

Remarks

This structure extends EdmGroupData and is used in IEdmUserMgr7::AddGroups2 to add user groups to the vault.

See Also

EdmGroupData2 Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmGroupData2 Structure Fields

EdmGroupData2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmGroupData2 Structure

For a list of all members of this type, see EdmGroupData2 members.

Public Fields

 | Name | Description
public Field | mbAutoAdd | Whether to automatically add new users to this group.
public Field | mbsDescription | Group description.
public Field | mbsName | Name of the group.
public Field | mhStatus | Status of the group creation.
public Field | mlFlags | Group creation flags.
public Field | mlGroupID | ID of the group.
public Field | moMembers | Array of IDS of users to add to this group.
public Field | moSysPerms | Group system permissions.
public Field | mpoGroup | Group interface.
Top

See Also

EdmGroupData2 Structure
EPDM.Interop.epdm Namespace


EdmGroupData2 Structure Members

EdmGroupData2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmGroupData2 Structure

The following tables list the members exposed by EdmGroupData2.

Public Fields

 | Name | Description
public Field | mbAutoAdd | Whether to automatically add new users to this group.
public Field | mbsDescription | Group description.
public Field | mbsName | Name of the group.
public Field | mhStatus | Status of the group creation.
public Field | mlFlags | Group creation flags.
public Field | mlGroupID | ID of the group.
public Field | moMembers | Array of IDS of users to add to this group.
public Field | moSysPerms | Group system permissions.
public Field | mpoGroup | Group interface.
Top

See Also

EdmGroupData2 Structure
EPDM.Interop.epdm Namespace


mbAutoAdd Field

mbAutoAdd Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mbAutoAdd Field

Whether to automatically add new users to this group.

Syntax

Visual Basic
Public mbAutoAdd As System.Short
C#
public System.short mbAutoAdd
C++/CLI
public:
System.short mbAutoAdd

Field Value

1 to automatically add users, 0 to not

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


mbsDescription Field

mbsDescription Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mbsDescription Field

Group description.

Syntax

Visual Basic
Public mbsDescription As System.String
C#
public System.string mbsDescription
C++/CLI
public:
System.String^ mbsDescription

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


mbsName Field

mbsName Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mbsName Field

Name of the group.

Syntax

Visual Basic
Public mbsName As System.String
C#
public System.string mbsName
C++/CLI
public:
System.String^ mbsName

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


mhStatus Field

mhStatus Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mhStatus Field

Status of the group creation.

Syntax

Visual Basic
Public mhStatus As System.Integer
C#
public System.int mhStatus
C++/CLI
public:
System.int mhStatus

Field Value

0 if successful, 1 if not

Remarks

Call IEdmVault5::GetErrorString to obtain a readable description of the error.

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


mlFlags Field

mlFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mlFlags Field

Group creation flags.

Syntax

Visual Basic
Public mlFlags As System.Integer
C#
public System.int mlFlags
C++/CLI
public:
System.int mlFlags

Field Value

Combination of EdmGroupDataFlags bits.

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


mlGroupID Field

mlGroupID Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mlGroupID Field

ID of the group.

Syntax

Visual Basic
Public mlGroupID As System.Integer
C#
public System.int mlGroupID
C++/CLI
public:
System.int mlGroupID

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


moMembers Field

moMembers Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : moMembers Field

Array of IDS of users to add to this group.

Syntax

Visual Basic
Public moMembers As System.Integer()
C#
public System.int[] moMembers
C++/CLI
public:
System.array<int>^ moMembers

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


moSysPerms Field

moSysPerms Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : moSysPerms Field

Group system permissions.

Syntax

Visual Basic
Public moSysPerms As EdmSysPerm()
C#
public EdmSysPerm[] moSysPerms
C++/CLI
public:
array<EdmSysPerm>^ moSysPerms

Field Value

Array of EdmSysPerm numbers

Remarks

EdmSysPerm numbers replace the older EdmSysRightFlags bits that were used in EdmGroupData.

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


mpoGroup Field

mpoGroup Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData2 Structure : mpoGroup Field

Group interface.

Syntax

Visual Basic
Public mpoGroup As IEdmUserGroup5
C#
public IEdmUserGroup5 mpoGroup
C++/CLI
public:
IEdmUserGroup5^ mpoGroup

Field Value

IEdmUserGroup5

Remarks

This member is valid only if EdmGroupData2::mlFlags sets the EdmGroupDataFlags.Edmgdf_GetInterface bit and EdmGroupData2::mhStatus is S_OK (0).

See Also

EdmGroupData2 Structure
EdmGroupData2 Members


EdmHistoryItem Structure

EdmHistoryItem Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmHistoryItem Structure

Contains a history item.

Syntax

Visual Basic
Public Structure EdmHistoryItem
   Inherits System.ValueType
C#
public struct EdmHistoryItem : System.ValueType
C++/CLI
public value class EdmHistoryItem : public System.ValueType

Example

struct EdmHistoryItem{
  enum EdmHistoryType meType;
  datetime moDate;
  integer mlVersion;
  integer mlUserID;
  integer mlFileID;
  integer mlFolderID;
  string mbsItemName;
  string mbsUserName;
  string mbsComment;
  struct EdmCmdData moData;
};

Example

Get Histories of Files (VB.NET)
Get Histories of Files (C#)

Remarks

Returned by IEdmHistory.

See Also

EdmHistoryItem Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmHistoryItem Structure Fields

EdmHistoryItem Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmHistoryItem Structure

For a list of all members of this type, see EdmHistoryItem members.

Public Fields

 | Name | Description
public Field | mbsComment | Comment entered by the user when the record is created.
public Field | mbsItemName | Name of file or folder.
public Field | mbsUserName | Name of user who created the history record.
public Field | meType | Type of history record.
public Field | mlFileID | ID of the file for this record
public Field | mlFolderID | ID of the folder for this record.
public Field | mlUserID | ID of the user who created the history record.
public Field | mlVersion | Version of the file when the item was created.
public Field | moData | Extra data.
public Field | moDate | Date and time when the history record was created.
Top

See Also

EdmHistoryItem Structure
EPDM.Interop.epdm Namespace


EdmHistoryItem Structure Members

EdmHistoryItem Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmHistoryItem Structure

The following tables list the members exposed by EdmHistoryItem.

Public Fields

 | Name | Description
public Field | mbsComment | Comment entered by the user when the record is created.
public Field | mbsItemName | Name of file or folder.
public Field | mbsUserName | Name of user who created the history record.
public Field | meType | Type of history record.
public Field | mlFileID | ID of the file for this record
public Field | mlFolderID | ID of the folder for this record.
public Field | mlUserID | ID of the user who created the history record.
public Field | mlVersion | Version of the file when the item was created.
public Field | moData | Extra data.
public Field | moDate | Date and time when the history record was created.
Top

See Also

EdmHistoryItem Structure
EPDM.Interop.epdm Namespace


mbsComment Field

mbsComment Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mbsComment Field

Comment entered by the user when the record is created.

Syntax

Visual Basic
Public mbsComment As System.String
C#
public System.string mbsComment
C++/CLI
public:
System.String^ mbsComment

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


mbsItemName Field

mbsItemName Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mbsItemName Field

Name of file or folder.

Syntax

Visual Basic
Public mbsItemName As System.String
C#
public System.string mbsItemName
C++/CLI
public:
System.String^ mbsItemName

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


mbsUserName Field

mbsUserName Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mbsUserName Field

Name of user who created the history record.

Syntax

Visual Basic
Public mbsUserName As System.String
C#
public System.string mbsUserName
C++/CLI
public:
System.String^ mbsUserName

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : meType Field

Type of history record.

Syntax

Visual Basic
Public meType As EdmHistoryType
C#
public EdmHistoryType meType
C++/CLI
public:
EdmHistoryType meType

Field Value

Type of record as defined in EdmHistoryType

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mlFileID Field

ID of the file for this record

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

Field Value

0 for folder items

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mlFolderID Field

ID of the folder for this record.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

Field Value

0 for file items

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


mlUserID Field

mlUserID Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mlUserID Field

ID of the user who created the history record.

Syntax

Visual Basic
Public mlUserID As System.Integer
C#
public System.int mlUserID
C++/CLI
public:
System.int mlUserID

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


mlVersion Field

mlVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : mlVersion Field

Version of the file when the item was created.

Syntax

Visual Basic
Public mlVersion As System.Integer
C#
public System.int mlVersion
C++/CLI
public:
System.int mlVersion

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


moData Field

moData Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : moData Field

Extra data.

Syntax

Visual Basic
Public moData As EdmCmdData
C#
public EdmCmdData moData
C++/CLI
public:
EdmCmdData moData

Field Value

EdmCmdData structure whose content depends on EdmHistoryItem::meType (see Remarks)

Remarks

The members of the structure stored in this member have different values, depending on the value of EdmHistoryItem::meType. The tables below contain the moData structure member values for each EdmHistoryItem::meType. Any members not listed in the tables are undefined for that data type.

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileShare

EdmCmdData Members | Description
mbsStrData1 | Destination folder path
mlObjectID1 | Destination folder ID

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileRename

EdmCmdData Members | Description
mbsStrData1 | Old file name

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileMove

EdmCmdData Members | Description
mbsStrData1 | Source folder path
mbsStrData2 | Destination folder path
mlObjectID1 | Source folder ID
mlObjectID2 | Destination folder ID

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileRollback

EdmCmdData Members | Description
mlLongData1 | From version
mlLongData2 | To version

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileDelete

EdmCmdData Members | Description
mlObjectID1 | Parent folder ID
mbsStrData1 | Parent folder path

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileUndelete

EdmCmdData Members | Description
mlObjectID1 | Parent folder ID
mbsStrData1 | Parent folder path

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileLabel

EdmCmdData Members | Description
mbsStrData1 | Label name
mlObjectID1 | Label ID

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileState

EdmCmdData Members | Description
mbsStrData1 | Source workflow name + <newline> + source state name
mbsStrData2 | Destination workflow name + <newline> + destination state name
mlLongData1 | Transition number

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileRevision

EdmCmdData Members | Description
mbsStrData1 | Revision name

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FileColdStore

EdmCmdData Members | Description
mbsStrData1 | Media name
mlLongData1 | Storage type

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderDelete

EdmCmdData Members | Description
mbsStrData1 | Folder path

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderUndelete

EdmCmdData Members | Description
mbsStrData1 | Folder path

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderCreate

EdmCmdData Members | Description
mbsStrData1 | Folder path

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderCardData

EdmCmdData Members | Description
mbsStrData1 | Folder path

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderRename

EdmCmdData Members | Description
mbsStrData1 | Old folder name

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderMove

EdmCmdData Members | Description
mbsStrData1 | From folder path
mbsStrData2 | To folder path
mlObjectID1 | From folder ID
mlObjectID2 | To folder ID

EdmHistoryItem::meType = EdmHistoryType.Edmhist_FolderLabel

EdmCmdData Members | Description
mbsStrData1 | Label name
mlObjectID1 | Label ID

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


moDate Field

moDate Field
[image]
EPDM.Interop.epdm Namespace > EdmHistoryItem Structure : moDate Field

Date and time when the history record was created.

Syntax

Visual Basic
Public moDate As System.Date
C#
public System.DateTime moDate
C++/CLI
public:
System.DateTime moDate

See Also

EdmHistoryItem Structure
EdmHistoryItem Members


EdmItemRef Structure

EdmItemRef Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmItemRef Structure

Contains information about an item reference.

Syntax

Visual Basic
Public Structure EdmItemRef
   Inherits System.ValueType
C#
public struct EdmItemRef : System.ValueType
C++/CLI
public value class EdmItemRef : public System.ValueType

Example

struct EdmItemRef

{
  integer mlEdmRefFlags;
  string mbsConfiguration;
  object moNamePathOrID;
  object moParentNamePathOrItemID;
  integer mhResult;
};

Example

Batch Add Item References (VB.NET)
Batch Add Item References (C#)
Get and Set Item References (VB.NET)
Get and Set Item References (C#)

Remarks

Used by IEdmItem::GetReferences, IEdmItem::UpdateReferences, and IEdmBatchItemReferenceUpdate::UpdateReferences.

See Also

EdmItemRef Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmItemRef Structure Fields

EdmItemRef Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmItemRef Structure

For a list of all members of this type, see EdmItemRef members.

Public Fields

 | Name | Description
public Field | mbsConfiguration | Name of the configuration to which the item is linked.
public Field | mhResult | Result code containing the status of the operation.
public Field | mlEdmRefFlags | Item reference flags.
public Field | moNamePathOrID | ID of the referenced file or item.
public Field | moParentNamePathOrItemID | ID of the parent item to which to add the reference.
Top

See Also

EdmItemRef Structure
EPDM.Interop.epdm Namespace


EdmItemRef Structure Members

EdmItemRef Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmItemRef Structure

The following tables list the members exposed by EdmItemRef.

Public Fields

 | Name | Description
public Field | mbsConfiguration | Name of the configuration to which the item is linked.
public Field | mhResult | Result code containing the status of the operation.
public Field | mlEdmRefFlags | Item reference flags.
public Field | moNamePathOrID | ID of the referenced file or item.
public Field | moParentNamePathOrItemID | ID of the parent item to which to add the reference.
Top

See Also

EdmItemRef Structure
EPDM.Interop.epdm Namespace


mbsConfiguration Field

mbsConfiguration Field
[image]
EPDM.Interop.epdm Namespace > EdmItemRef Structure : mbsConfiguration Field

Name of the configuration to which the item is linked.

Syntax

Visual Basic
Public mbsConfiguration As System.String
C#
public System.string mbsConfiguration
C++/CLI
public:
System.String^ mbsConfiguration

See Also

EdmItemRef Structure
EdmItemRef Members


mhResult Field

mhResult Field
[image]
EPDM.Interop.epdm Namespace > EdmItemRef Structure : mhResult Field

Result code containing the status of the operation.

Syntax

Visual Basic
Public mhResult As System.Integer
C#
public System.int mhResult
C++/CLI
public:
System.int mhResult

Field Value

S_OK or 0 if successful

See Also

EdmItemRef Structure
EdmItemRef Members


mlEdmRefFlags Field

mlEdmRefFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmItemRef Structure : mlEdmRefFlags Field

Item reference flags.

Syntax

Visual Basic
Public mlEdmRefFlags As System.Integer
C#
public System.int mlEdmRefFlags
C++/CLI
public:
System.int mlEdmRefFlags

Field Value

Combination of EdmRefFlags bits

See Also

EdmItemRef Structure
EdmItemRef Members


moNamePathOrID Field

moNamePathOrID Field
[image]
EPDM.Interop.epdm Namespace > EdmItemRef Structure : moNamePathOrID Field

ID of the referenced file or item.

Syntax

Visual Basic
Public moNamePathOrID As System.Object
C#
public System.object moNamePathOrID
C++/CLI
public:
System.Object^ moNamePathOrID

See Also

EdmItemRef Structure
EdmItemRef Members


moParentNamePathOrItemID Field

moParentNamePathOrItemID Field
[image]
EPDM.Interop.epdm Namespace > EdmItemRef Structure : moParentNamePathOrItemID Field

ID of the parent item to which to add the reference.

Syntax

Visual Basic
Public moParentNamePathOrItemID As System.Object
C#
public System.object moParentNamePathOrItemID
C++/CLI
public:
System.Object^ moParentNamePathOrItemID

See Also

EdmItemRef Structure
EdmItemRef Members


EdmLicense Structure

EdmLicense Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmLicense Structure

Contains information about a license type and is returned by IEdmVault11::GetLicense.

Syntax

Visual Basic
Public Structure EdmLicense
   Inherits System.ValueType
C#
public struct EdmLicense : System.ValueType
C++/CLI
public value class EdmLicense : public System.ValueType

Example

struct EdmLicense

{
  enum EdmLicenseType meType;
  integer mlUserCount;
};

Example

Vault Utilities (VB.NET)
Vault Utilities (C#)

See Also

EdmLicense Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmLicense Structure Fields

EdmLicense Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmLicense Structure

For a list of all members of this type, see EdmLicense members.

Public Fields

 | Name | Description
public Field | meType | Type of license.
public Field | mlUserCount | Maximum number of users for this license type.
Top

See Also

EdmLicense Structure
EPDM.Interop.epdm Namespace


EdmLicense Structure Members

EdmLicense Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmLicense Structure

The following tables list the members exposed by EdmLicense.

Public Fields

 | Name | Description
public Field | meType | Type of license.
public Field | mlUserCount | Maximum number of users for this license type.
Top

See Also

EdmLicense Structure
EPDM.Interop.epdm Namespace


EdmListCol Structure

EdmListCol Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmListCol Structure

Contains information about a column in a file listing.

Syntax

Visual Basic
Public Structure EdmListCol
   Inherits System.ValueType
C#
public struct EdmListCol : System.ValueType
C++/CLI
public value class EdmListCol : public System.ValueType

Example

struct EdmListCol{
  string mbsCaption;
  integer mlEdmListColFlags;
  enum EdmColType meColType;
  integer mlVariableID;
  enum EdmVariableType meVarType;
  integer mlWidth;
}

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

Also see the IEdmSearch10 examples.

This structure is returned by IEdmSearchResult6::GetCustomColumnsInfo.

See Also

EdmListCol Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmListCol Structure Fields

EdmListCol Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmListCol Structure

For a list of all members of this type, see EdmListCol members.

Public Fields

 | Name | Description
public Field | mbsCaption | Column caption.
public Field | meColType | Type of column.
public Field | meVarType | Type of variable to which the column is connected.
public Field | mlEdmListColFlags | Bit flags specifying alignment, etc., of the column. (See LVCFMT_LEFT in the Win32 Help.)
public Field | mlVariableID | ID of variable to which the column is connected, or 0 if not connected to a variable.
public Field | mlWidth | Default column width.
Top

See Also

EdmListCol Structure
EPDM.Interop.epdm Namespace


EdmListCol Structure Members

EdmListCol Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmListCol Structure

The following tables list the members exposed by EdmListCol.

Public Fields

 | Name | Description
public Field | mbsCaption | Column caption.
public Field | meColType | Type of column.
public Field | meVarType | Type of variable to which the column is connected.
public Field | mlEdmListColFlags | Bit flags specifying alignment, etc., of the column. (See LVCFMT_LEFT in the Win32 Help.)
public Field | mlVariableID | ID of variable to which the column is connected, or 0 if not connected to a variable.
public Field | mlWidth | Default column width.
Top

See Also

EdmListCol Structure
EPDM.Interop.epdm Namespace


mbsCaption Field

mbsCaption Field
[image]
EPDM.Interop.epdm Namespace > EdmListCol Structure : mbsCaption Field

Column caption.

Syntax

Visual Basic
Public mbsCaption As System.String
C#
public System.string mbsCaption
C++/CLI
public:
System.String^ mbsCaption

See Also

EdmListCol Structure
EdmListCol Members


meColType Field

meColType Field
[image]
EPDM.Interop.epdm Namespace > EdmListCol Structure : meColType Field

Type of column.

Syntax

Visual Basic
Public meColType As EdmColType
C#
public EdmColType meColType
C++/CLI
public:
EdmColType meColType

See Also

EdmListCol Structure
EdmListCol Members


meVarType Field

meVarType Field
[image]
EPDM.Interop.epdm Namespace > EdmListCol Structure : meVarType Field

Type of variable to which the column is connected.

Syntax

Visual Basic
Public meVarType As EdmVariableType
C#
public EdmVariableType meVarType
C++/CLI
public:
EdmVariableType meVarType

Remarks

EdmVariableType.EdmVarType_None if not connected to a variable.

See Also

EdmListCol Structure
EdmListCol Members


mlEdmListColFlags Field

mlEdmListColFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmListCol Structure : mlEdmListColFlags Field

Bit flags specifying alignment, etc., of the column. (See LVCFMT_LEFT in the Win32 Help.)

Syntax

Visual Basic
Public mlEdmListColFlags As System.Integer
C#
public System.int mlEdmListColFlags
C++/CLI
public:
System.int mlEdmListColFlags

See Also

EdmListCol Structure
EdmListCol Members


mlVariableID Field

mlVariableID Field
[image]
EPDM.Interop.epdm Namespace > EdmListCol Structure : mlVariableID Field

ID of variable to which the column is connected, or 0 if not connected to a variable.

Syntax

Visual Basic
Public mlVariableID As System.Integer
C#
public System.int mlVariableID
C++/CLI
public:
System.int mlVariableID

See Also

EdmListCol Structure
EdmListCol Members


mlWidth Field

mlWidth Field
[image]
EPDM.Interop.epdm Namespace > EdmListCol Structure : mlWidth Field

Default column width.

Syntax

Visual Basic
Public mlWidth As System.Integer
C#
public System.int mlWidth
C++/CLI
public:
System.int mlWidth

Remarks

This field is -1 if you specified a list of explicit variables to retrieve.

See Also

EdmListCol Structure
EdmListCol Members


EdmListFile Structure

EdmListFile Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmListFile Structure

Holds information about a file returned by the IEdmBatchListing::GetFiles method.

Syntax

Visual Basic
Public Structure EdmListFile
   Inherits System.ValueType
C#
public struct EdmListFile : System.ValueType
C++/CLI
public value class EdmListFile : public System.ValueType

Example

struct EdmListFile

{
  integer mlFileID;
  integer mlFolderID;
  integer mlParam;
  integer mlLatestVersion;
  integer mlLocalVersion;
  string mbsLockUser;
  string mbsLockComputer;
  string mbsLockPath;
  string mbsRevisionName;
  struct EdmWorkflowInfo moCurrentState;
  object moColumnData;
};

Remarks

This struct is extended by EdmListFile2, which is returned by the IEdmBatchListing4::GetFiles2 method.

See Also

EdmListFile Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmListFile2 Structure

EdmListFile2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmListFile2 Structure

Holds information about a file returned by the IEdmBatchListing4::GetFiles2 method.

Syntax

Visual Basic
Public Structure EdmListFile2
   Inherits System.ValueType
C#
public struct EdmListFile2 : System.ValueType
C++/CLI
public value class EdmListFile2 : public System.ValueType

Example

struct EdmListFile

{
  short mbHasLockRights;
  short mbLocalOverwrittenVersionObsolete;
  string mbsLockComputer;
  string mbsLockPath;
  string mbsLockUser;
  string mbsLockViewID;
  string mbsRevisionName;
  integer mlFileID;
  integer mlFolderID;
  integer mlLatestVersion;
  integer mlLocalVersion;
  integer mlLockProjectID;
  integer mlParam;
  object moColumnData;
  struct EdmWorkflowInfo moCurrentState;
};

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This struct is an extended version of the EdmListFile struct, which is returned by the IEdmBatchListing::GetFiles method.

See Also

EdmListFile2 Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2017


EdmListFile2 Structure Fields

EdmListFile2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmListFile2 Structure

For a list of all members of this type, see EdmListFile2 members.

Public Fields

 | Name | Description
public Field | mbHasLockRights | Gets whether a file in a user's local cache can be checked out.
public Field | mbLocalOverwrittenVersionObsolete | Gets whether a file in a user's local cache is valid or obsolete because the file was overwritten by another user who checked out the file, modified the file, and checked in the file.
public Field | mbsLockComputer | Name of computer on which the file is checked out.
public Field | mbsLockPath | Path to the folder where the file is checked out.
public Field | mbsLockUser | Name of user to whom this file is checked out.
public Field | mbsLockViewID | GUID of the vault view where this file is checked out.
public Field | mbsRevisionName | Name of the file’s current revision.
public Field | mlFileID | ID of the file.
public Field | mlFolderID | ID of the file’s parent folder.
public Field | mlLatestVersion | Latest version of the file.
public Field | mlLocalVersion | Version of the file in the local cache, based on the date of the file passed to the IEdmBatchListing::AddFile method.
public Field | mlLockProjectID | ID of the project where this file is checked out.
public Field | mlParam | Caller-defined parameter that was passed to the IEdmBatchListing::AddFile method.
public Field | moColumnData | Column data for the selected column set.
public Field | moCurrentState | File’s current workflow state.
Top

See Also

EdmListFile2 Structure
EPDM.Interop.epdm Namespace


EdmListFile2 Structure Members

EdmListFile2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmListFile2 Structure

The following tables list the members exposed by EdmListFile2.

Public Fields

 | Name | Description
public Field | mbHasLockRights | Gets whether a file in a user's local cache can be checked out.
public Field | mbLocalOverwrittenVersionObsolete | Gets whether a file in a user's local cache is valid or obsolete because the file was overwritten by another user who checked out the file, modified the file, and checked in the file.
public Field | mbsLockComputer | Name of computer on which the file is checked out.
public Field | mbsLockPath | Path to the folder where the file is checked out.
public Field | mbsLockUser | Name of user to whom this file is checked out.
public Field | mbsLockViewID | GUID of the vault view where this file is checked out.
public Field | mbsRevisionName | Name of the file’s current revision.
public Field | mlFileID | ID of the file.
public Field | mlFolderID | ID of the file’s parent folder.
public Field | mlLatestVersion | Latest version of the file.
public Field | mlLocalVersion | Version of the file in the local cache, based on the date of the file passed to the IEdmBatchListing::AddFile method.
public Field | mlLockProjectID | ID of the project where this file is checked out.
public Field | mlParam | Caller-defined parameter that was passed to the IEdmBatchListing::AddFile method.
public Field | moColumnData | Column data for the selected column set.
public Field | moCurrentState | File’s current workflow state.
Top

See Also

EdmListFile2 Structure
EPDM.Interop.epdm Namespace


mbHasLockRights Field

mbHasLockRights Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbHasLockRights Field

Gets whether a file in a user's local cache can be checked out.

Syntax

Visual Basic
Public mbHasLockRights As System.Short
C#
public System.short mbHasLockRights
C++/CLI
public:
System.short mbHasLockRights

Field Value

  • 0 = file in the user’s local cache can be checked out
  • 1 = file in the user’s local cache cannot be checked out

See Also

EdmListFile2 Structure
EdmListFile2 Members


mbLocalOverwrittenVersionObsolete Field

mbLocalOverwrittenVersionObsolete Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbLocalOverwrittenVersionObsolete Field

Gets whether a file in a user's local cache is valid or obsolete because the file was overwritten by another user who checked out the file, modified the file, and checked in the file.

Syntax

Visual Basic
Public mbLocalOverwrittenVersionObsolete As System.Short
C#
public System.short mbLocalOverwrittenVersionObsolete
C++/CLI
public:
System.short mbLocalOverwrittenVersionObsolete

Field Value

  • 0 = file in the user’s local cache is valid
  • 1 = file in the user’s local cache is obsolete

See Also

EdmListFile2 Structure
EdmListFile2 Members


mbsLockComputer Field

mbsLockComputer Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbsLockComputer Field

Name of computer on which the file is checked out.

Syntax

Visual Basic
Public mbsLockComputer As System.String
C#
public System.string mbsLockComputer
C++/CLI
public:
System.String^ mbsLockComputer

See Also

EdmListFile2 Structure
EdmListFile2 Members


mbsLockPath Field

mbsLockPath Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbsLockPath Field

Path to the folder where the file is checked out.

Syntax

Visual Basic
Public mbsLockPath As System.String
C#
public System.string mbsLockPath
C++/CLI
public:
System.String^ mbsLockPath

See Also

EdmListFile2 Structure
EdmListFile2 Members


mbsLockUser Field

mbsLockUser Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbsLockUser Field

Name of user to whom this file is checked out.

Syntax

Visual Basic
Public mbsLockUser As System.String
C#
public System.string mbsLockUser
C++/CLI
public:
System.String^ mbsLockUser

See Also

EdmListFile2 Structure
EdmListFile2 Members


mbsLockViewID Field

mbsLockViewID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbsLockViewID Field

GUID of the vault view where this file is checked out.

Syntax

Visual Basic
Public mbsLockViewID As System.String
C#
public System.string mbsLockViewID
C++/CLI
public:
System.String^ mbsLockViewID

See Also

EdmListFile2 Structure
EdmListFile2 Members


mbsRevisionName Field

mbsRevisionName Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mbsRevisionName Field

Name of the file’s current revision.

Syntax

Visual Basic
Public mbsRevisionName As System.String
C#
public System.string mbsRevisionName
C++/CLI
public:
System.String^ mbsRevisionName

See Also

EdmListFile2 Structure
EdmListFile2 Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mlFileID Field

ID of the file.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

See Also

EdmListFile2 Structure
EdmListFile2 Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mlFolderID Field

ID of the file’s parent folder.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

See Also

EdmListFile2 Structure
EdmListFile2 Members


mlLatestVersion Field

mlLatestVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mlLatestVersion Field

Latest version of the file.

Syntax

Visual Basic
Public mlLatestVersion As System.Integer
C#
public System.int mlLatestVersion
C++/CLI
public:
System.int mlLatestVersion

See Also

EdmListFile2 Structure
EdmListFile2 Members


mlLocalVersion Field

mlLocalVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mlLocalVersion Field

Version of the file in the local cache, based on the date of the file passed to the IEdmBatchListing::AddFile method.

Syntax

Visual Basic
Public mlLocalVersion As System.Integer
C#
public System.int mlLocalVersion
C++/CLI
public:
System.int mlLocalVersion

Field Value

Version of the file in the local cache or 0 if the date of the version of the file in local cache passed to IEdmBatchListing::AddFile doesn’t match any version of the file in the vault

See Also

EdmListFile2 Structure
EdmListFile2 Members


mlLockProjectID Field

mlLockProjectID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mlLockProjectID Field

ID of the project where this file is checked out.

Syntax

Visual Basic
Public mlLockProjectID As System.Integer
C#
public System.int mlLockProjectID
C++/CLI
public:
System.int mlLockProjectID

See Also

EdmListFile2 Structure
EdmListFile2 Members


mlParam Field

mlParam Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : mlParam Field

Caller-defined parameter that was passed to the IEdmBatchListing::AddFile method.

Syntax

Visual Basic
Public mlParam As System.Integer
C#
public System.int mlParam
C++/CLI
public:
System.int mlParam

See Also

EdmListFile2 Structure
EdmListFile2 Members


moColumnData Field

moColumnData Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : moColumnData Field

Column data for the selected column set.

Syntax

Visual Basic
Public moColumnData As System.Object
C#
public System.object moColumnData
C++/CLI
public:
System.Object^ moColumnData

See Also

EdmListFile2 Structure
EdmListFile2 Members


moCurrentState Field

moCurrentState Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile2 Structure : moCurrentState Field

File’s current workflow state.

Syntax

Visual Basic
Public moCurrentState As EdmWorkflowInfo
C#
public EdmWorkflowInfo moCurrentState
C++/CLI
public:
EdmWorkflowInfo moCurrentState

See Also

EdmListFile2 Structure
EdmListFile2 Members


EdmListFolder Structure

EdmListFolder Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmListFolder Structure

Contains information about a folder returned from IEdmBatchListing::GetFolders.

Syntax

Visual Basic
Public Structure EdmListFolder
   Inherits System.ValueType
C#
public struct EdmListFolder : System.ValueType
C++/CLI
public value class EdmListFolder : public System.ValueType

Example

struct EdmListFolder{
  integer mlFolderID;
  integer mlParam;
  string mbsPath;
  object moColumnData;
};

See Also

EdmListFolder Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmListFolder Structure Fields

EdmListFolder Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmListFolder Structure

For a list of all members of this type, see EdmListFolder members.

Public Fields

 | Name | Description
public Field | mbsPath | Path to the folder.
public Field | mlFolderID | ID of the folder.
public Field | mlParam | Caller-defined parameter passed to IEdmBatchListing::AddFolder.
public Field | moColumnData | Column data for the selected column set.
Top

See Also

EdmListFolder Structure
EPDM.Interop.epdm Namespace


EdmListFolder Structure Members

EdmListFolder Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmListFolder Structure

The following tables list the members exposed by EdmListFolder.

Public Fields

 | Name | Description
public Field | mbsPath | Path to the folder.
public Field | mlFolderID | ID of the folder.
public Field | mlParam | Caller-defined parameter passed to IEdmBatchListing::AddFolder.
public Field | moColumnData | Column data for the selected column set.
Top

See Also

EdmListFolder Structure
EPDM.Interop.epdm Namespace


EdmListRef Structure

EdmListRef Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmListRef Structure

Contains information about file references.

Syntax

Visual Basic
Public Structure EdmListRef
   Inherits System.ValueType
C#
public struct EdmListRef : System.ValueType
C++/CLI
public value class EdmListRef : public System.ValueType

Example

struct EdmListRef
{
  integer mlChildID;
  integer mlChildFolderID;
  integer mlChildRefVersion;
  integer mlParentFileID;
  integer mlParentFolderID;};

Remarks

Returned by IEdmBatchListing3::GetReferences.

See Also

EdmListRef Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2014


EdmListRef Structure Fields

EdmListRef Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmListRef Structure

For a list of all members of this type, see EdmListRef members.

Public Fields

 | Name | Description
public Field | mlChildFileID | ID of referenced part or subassembly.
public Field | mlChildFolderID | ID of the referenced file's parent folder.
public Field | mlChildRefVersion | Referenced version of the child.
public Field | mlParentFileID | ID of referencing assembly or drawing.
public Field | mlParentFolderID | ID of teh referencing file's parent folder.
Top

See Also

EdmListRef Structure
EPDM.Interop.epdm Namespace


EdmListRef Structure Members

EdmListRef Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmListRef Structure

The following tables list the members exposed by EdmListRef.

Public Fields

 | Name | Description
public Field | mlChildFileID | ID of referenced part or subassembly.
public Field | mlChildFolderID | ID of the referenced file's parent folder.
public Field | mlChildRefVersion | Referenced version of the child.
public Field | mlParentFileID | ID of referencing assembly or drawing.
public Field | mlParentFolderID | ID of teh referencing file's parent folder.
Top

See Also

EdmListRef Structure
EPDM.Interop.epdm Namespace


mlChildFileID Field

mlChildFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmListRef Structure : mlChildFileID Field

ID of referenced part or subassembly.

Syntax

Visual Basic
Public mlChildFileID As System.Integer
C#
public System.int mlChildFileID
C++/CLI
public:
System.int mlChildFileID

Example

See Also

EdmListRef Structure
EdmListRef Members


mlChildFolderID Field

mlChildFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmListRef Structure : mlChildFolderID Field

ID of the referenced file's parent folder.

Syntax

Visual Basic
Public mlChildFolderID As System.Integer
C#
public System.int mlChildFolderID
C++/CLI
public:
System.int mlChildFolderID

See Also

EdmListRef Structure
EdmListRef Members


mlChildRefVersion Field

mlChildRefVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmListRef Structure : mlChildRefVersion Field

Referenced version of the child.

Syntax

Visual Basic
Public mlChildRefVersion As System.Integer
C#
public System.int mlChildRefVersion
C++/CLI
public:
System.int mlChildRefVersion

See Also

EdmListRef Structure
EdmListRef Members


mlParentFileID Field

mlParentFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmListRef Structure : mlParentFileID Field

ID of referencing assembly or drawing.

Syntax

Visual Basic
Public mlParentFileID As System.Integer
C#
public System.int mlParentFileID
C++/CLI
public:
System.int mlParentFileID

See Also

EdmListRef Structure
EdmListRef Members


mlParentFolderID Field

mlParentFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmListRef Structure : mlParentFolderID Field

ID of teh referencing file's parent folder.

Syntax

Visual Basic
Public mlParentFolderID As System.Integer
C#
public System.int mlParentFolderID
C++/CLI
public:
System.int mlParentFolderID

See Also

EdmListRef Structure
EdmListRef Members


EdmMemberFolder Structure

EdmMemberFolder Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmMemberFolder Structure

Adds a user as a member of a group to a specific folder.

Syntax

Visual Basic
Public Structure EdmMemberFolder
   Inherits System.ValueType
C#
public struct EdmMemberFolder : System.ValueType
C++/CLI
public value class EdmMemberFolder : public System.ValueType

Example

struct EdmMemberFolder{
  integer mlUserID;
  integer mlFolderID;
};

Example

Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

Remarks

Used by IEdmUserGroup7::AddMembersWithFolders.

See Also

EdmMemberFolder Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2011


EdmMemberFolder Structure Fields

EdmMemberFolder Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmMemberFolder Structure

For a list of all members of this type, see EdmMemberFolder members.

Public Fields

 | Name | Description
public Field | mlFolderID | ID of user to add as a member.
public Field | mlUserID | ID of folder to which to add the user as a member.
Top

See Also

EdmMemberFolder Structure
EPDM.Interop.epdm Namespace


EdmMemberFolder Structure Members

EdmMemberFolder Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmMemberFolder Structure

The following tables list the members exposed by EdmMemberFolder.

Public Fields

 | Name | Description
public Field | mlFolderID | ID of user to add as a member.
public Field | mlUserID | ID of folder to which to add the user as a member.
Top

See Also

EdmMemberFolder Structure
EPDM.Interop.epdm Namespace


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmMemberFolder Structure : mlFolderID Field

ID of user to add as a member.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

Example

See the EdmMemberFolder examples.

See Also

EdmMemberFolder Structure
EdmMemberFolder Members


mlUserID Field

mlUserID Field
[image]
EPDM.Interop.epdm Namespace > EdmMemberFolder Structure : mlUserID Field

ID of folder to which to add the user as a member.

Syntax

Visual Basic
Public mlUserID As System.Integer
C#
public System.int mlUserID
C++/CLI
public:
System.int mlUserID

Example

See the EdmMemberFolder examples.

See Also

EdmMemberFolder Structure
EdmMemberFolder Members


EdmObjectInfo Structure

EdmObjectInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmObjectInfo Structure

Use in calls to IEdmVault9::GetObjects.

Syntax

Visual Basic
Public Structure EdmObjectInfo
   Inherits System.ValueType
C#
public struct EdmObjectInfo : System.ValueType
C++/CLI
public value class EdmObjectInfo : public System.ValueType

Example

struct EdmObjectInfo

{
  EdmObjectType meType;
  object moObjectID;
  IEdmObject5*  mpoObject;
  integer mhResult;
};

Example

Batch Update Card Variables (C#)
Batch Update Card Variables (VB.NET)

Remarks

The structure contains both input and output.

See Also

EdmObjectInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2008


EdmObjectInfo Structure Fields

EdmObjectInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmObjectInfo Structure

For a list of all members of this type, see EdmObjectInfo members.

Public Fields

 | Name | Description
public Field | meType | Type of object to return in mpoObject as defined in EdmObjectType.
public Field | mhResult | Can be passed to IEdmVault5::GetErrorString to get a human-readable error message.
public Field | moObjectID | ID of object to return in mpoObject.
public Field | mpoObject | Type of object to return in mpoObject.
Top

See Also

EdmObjectInfo Structure
EPDM.Interop.epdm Namespace


EdmObjectInfo Structure Members

EdmObjectInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmObjectInfo Structure

The following tables list the members exposed by EdmObjectInfo.

Public Fields

 | Name | Description
public Field | meType | Type of object to return in mpoObject as defined in EdmObjectType.
public Field | mhResult | Can be passed to IEdmVault5::GetErrorString to get a human-readable error message.
public Field | moObjectID | ID of object to return in mpoObject.
public Field | mpoObject | Type of object to return in mpoObject.
Top

See Also

EdmObjectInfo Structure
EPDM.Interop.epdm Namespace


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmObjectInfo Structure : meType Field

Type of object to return in mpoObject as defined in EdmObjectType.

Syntax

Visual Basic
Public meType As EdmObjectType
C#
public EdmObjectType meType
C++/CLI
public:
EdmObjectType meType

Example

See the EdmObjectInfo examples.

Requirements

See Also

EdmObjectInfo Structure
EdmObjectInfo Members


mhResult Field

mhResult Field
[image]
EPDM.Interop.epdm Namespace > EdmObjectInfo Structure : mhResult Field

Can be passed to IEdmVault5::GetErrorString to get a human-readable error message.

Syntax

Visual Basic
Public mhResult As System.Integer
C#
public System.int mhResult
C++/CLI
public:
System.int mhResult

Remarks

HRESULT result code.

See Also

EdmObjectInfo Structure
EdmObjectInfo Members


moObjectID Field

moObjectID Field
[image]
EPDM.Interop.epdm Namespace > EdmObjectInfo Structure : moObjectID Field

ID of object to return in mpoObject.

Syntax

Visual Basic
Public moObjectID As System.Object
C#
public System.object moObjectID
C++/CLI
public:
System.Object^ moObjectID

Example

See the EdmObjectInfo examples.

Requirements

See Also

EdmObjectInfo Structure
EdmObjectInfo Members


mpoObject Field

mpoObject Field
[image]
EPDM.Interop.epdm Namespace > EdmObjectInfo Structure : mpoObject Field

Type of object to return in mpoObject.

Syntax

Visual Basic
Public mpoObject As IEdmObject5
C#
public IEdmObject5 mpoObject
C++/CLI
public:
IEdmObject5^ mpoObject

Example

See the EdmObjectInfo examples.

Requirements

See Also

EdmObjectInfo Structure
EdmObjectInfo Members


EdmPoint Structure

EdmPoint Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmPoint Structure

Holds a point.

Syntax

Visual Basic
Public Structure EdmPoint
   Inherits System.ValueType
C#
public struct EdmPoint : System.ValueType
C++/CLI
public value class EdmPoint : public System.ValueType

Example

struct EdmPoint{
  integer mlX;
  integer mlY;
};

Example

Graph a Workflow (VB.NET)
Graph a Workflow (C#)

See Also

EdmPoint Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2011


EdmPoint Structure Fields

EdmPoint Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmPoint Structure

For a list of all members of this type, see EdmPoint members.

Public Fields

 | Name | Description
public Field | mlX | X coordinate.
public Field | mlY | Y coordinate.
Top

See Also

EdmPoint Structure
EPDM.Interop.epdm Namespace


EdmPoint Structure Members

EdmPoint Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmPoint Structure

The following tables list the members exposed by EdmPoint.

Public Fields

 | Name | Description
public Field | mlX | X coordinate.
public Field | mlY | Y coordinate.
Top

See Also

EdmPoint Structure
EPDM.Interop.epdm Namespace


mlX Field

mlX Field
[image]
EPDM.Interop.epdm Namespace > EdmPoint Structure : mlX Field

X coordinate.

Syntax

Visual Basic
Public mlX As System.Integer
C#
public System.int mlX
C++/CLI
public:
System.int mlX

See Also

EdmPoint Structure
EdmPoint Members


mlY Field

mlY Field
[image]
EPDM.Interop.epdm Namespace > EdmPoint Structure : mlY Field

Y coordinate.

Syntax

Visual Basic
Public mlY As System.Integer
C#
public System.int mlY
C++/CLI
public:
System.int mlY

See Also

EdmPoint Structure
EdmPoint Members


EdmRawReference Structure

EdmRawReference Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRawReference Structure

Contains information about a file reference.

Syntax

Visual Basic
Public Structure EdmRawReference
   Inherits System.ValueType
C#
public struct EdmRawReference : System.ValueType
C++/CLI
public value class EdmRawReference : public System.ValueType

Example

struct EdmRawReference

{
  string mbsRefID;
  string mbsIncludePath;
  string mbsRefName;
  integer mlFlags;
  integer mlCount;
};

Example

Update File Raw References (C#)
Update File Raw References (VB.NET)

Remarks

This structure is used by the IEdmRawReferenceMgr interface.

See Also

EdmRawReference Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmRawReference Structure Fields

EdmRawReference Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRawReference Structure

For a list of all members of this type, see EdmRawReference members.

Public Fields

 | Name | Description
public Field | mbsIncludePath | How the file is referenced by the referencing file.
public Field | mbsRefID | Internal ID of the file reference.
public Field | mbsRefName | Reference name.
public Field | mlCount | Number of times the file is referenced.
public Field | mlFlags | A combination of EdmRawRefFlags bits.
Top

See Also

EdmRawReference Structure
EPDM.Interop.epdm Namespace


EdmRawReference Structure Members

EdmRawReference Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRawReference Structure

The following tables list the members exposed by EdmRawReference.

Public Fields

 | Name | Description
public Field | mbsIncludePath | How the file is referenced by the referencing file.
public Field | mbsRefID | Internal ID of the file reference.
public Field | mbsRefName | Reference name.
public Field | mlCount | Number of times the file is referenced.
public Field | mlFlags | A combination of EdmRawRefFlags bits.
Top

See Also

EdmRawReference Structure
EPDM.Interop.epdm Namespace


mbsIncludePath Field

mbsIncludePath Field
[image]
EPDM.Interop.epdm Namespace > EdmRawReference Structure : mbsIncludePath Field

How the file is referenced by the referencing file.

Syntax

Visual Basic
Public mbsIncludePath As System.String
C#
public System.string mbsIncludePath
C++/CLI
public:
System.String^ mbsIncludePath

Example

See the EdmRawReference examples.

Remarks

Equivalent to the included as column in the check-in dialog box.

See Also

EdmRawReference Structure
EdmRawReference Members


mbsRefID Field

mbsRefID Field
[image]
EPDM.Interop.epdm Namespace > EdmRawReference Structure : mbsRefID Field

Internal ID of the file reference.

Syntax

Visual Basic
Public mbsRefID As System.String
C#
public System.string mbsRefID
C++/CLI
public:
System.String^ mbsRefID

Example

See the EdmRawReference examples.

See Also

EdmRawReference Structure
EdmRawReference Members


mbsRefName Field

mbsRefName Field
[image]
EPDM.Interop.epdm Namespace > EdmRawReference Structure : mbsRefName Field

Reference name.

Syntax

Visual Basic
Public mbsRefName As System.String
C#
public System.string mbsRefName
C++/CLI
public:
System.String^ mbsRefName

Example

See the EdmRawReference examples.

See Also

EdmRawReference Structure
EdmRawReference Members


mlCount Field

mlCount Field
[image]
EPDM.Interop.epdm Namespace > EdmRawReference Structure : mlCount Field

Number of times the file is referenced.

Syntax

Visual Basic
Public mlCount As System.Integer
C#
public System.int mlCount
C++/CLI
public:
System.int mlCount

Example

See the EdmRawReference examples.

Remarks

This member returns 0 for file formats that do not support counting of file references.

See Also

EdmRawReference Structure
EdmRawReference Members


mlFlags Field

mlFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmRawReference Structure : mlFlags Field

A combination of EdmRawRefFlags bits.

Syntax

Visual Basic
Public mlFlags As System.Integer
C#
public System.int mlFlags
C++/CLI
public:
System.int mlFlags

Example

See the EdmRawReference examples.

See Also

EdmRawReference Structure
EdmRawReference Members


EdmRect Structure

EdmRect Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRect Structure

Encapsulates a rectangle and is identical to the Win32 RECT struct.

Syntax

Visual Basic
Public Structure EdmRect
   Inherits System.ValueType
C#
public struct EdmRect : System.ValueType
C++/CLI
public value class EdmRect : public System.ValueType

Example

struct EdmRect{
  integer mlLeft;
  integer mlTop;
  integer mlRight;
  integer mlBottom;
};

Example

Graph a Workflow (VB.NET)
Graph a Workflow (C#)

See Also

EdmRect Members
EPDM.Interop.epdm Namespace

Availability

Version 5.2 of SOLIDWORKS PDM Professional


EdmRect Structure Fields

EdmRect Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRect Structure

For a list of all members of this type, see EdmRect members.

Public Fields

 | Name | Description
public Field | mlBottom | Rectangle's bottom edge + 1 (top + height).
public Field | mlLeft | X position of the rectangle's top-left corner.
public Field | mlRight | Rectangle's right edge + 1 (left + width) .
public Field | mlTop | Y position of the rectangle's top-left corner.
Top

See Also

EdmRect Structure
EPDM.Interop.epdm Namespace


EdmRect Structure Members

EdmRect Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRect Structure

The following tables list the members exposed by EdmRect.

Public Fields

 | Name | Description
public Field | mlBottom | Rectangle's bottom edge + 1 (top + height).
public Field | mlLeft | X position of the rectangle's top-left corner.
public Field | mlRight | Rectangle's right edge + 1 (left + width) .
public Field | mlTop | Y position of the rectangle's top-left corner.
Top

See Also

EdmRect Structure
EPDM.Interop.epdm Namespace


mlBottom Field

mlBottom Field
[image]
EPDM.Interop.epdm Namespace > EdmRect Structure : mlBottom Field

Rectangle's bottom edge + 1 (top + height).

Syntax

Visual Basic
Public mlBottom As System.Integer
C#
public System.int mlBottom
C++/CLI
public:
System.int mlBottom

See Also

EdmRect Structure
EdmRect Members


mlLeft Field

mlLeft Field
[image]
EPDM.Interop.epdm Namespace > EdmRect Structure : mlLeft Field

X position of the rectangle's top-left corner.

Syntax

Visual Basic
Public mlLeft As System.Integer
C#
public System.int mlLeft
C++/CLI
public:
System.int mlLeft

See Also

EdmRect Structure
EdmRect Members


mlRight Field

mlRight Field
[image]
EPDM.Interop.epdm Namespace > EdmRect Structure : mlRight Field

Rectangle's right edge + 1 (left + width) .

Syntax

Visual Basic
Public mlRight As System.Integer
C#
public System.int mlRight
C++/CLI
public:
System.int mlRight

See Also

EdmRect Structure
EdmRect Members


mlTop Field

mlTop Field
[image]
EPDM.Interop.epdm Namespace > EdmRect Structure : mlTop Field

Y position of the rectangle's top-left corner.

Syntax

Visual Basic
Public mlTop As System.Integer
C#
public System.int mlTop
C++/CLI
public:
System.int mlTop

See Also

EdmRect Structure
EdmRect Members


EdmRefVar Structure

EdmRefVar Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRefVar Structure

Holds information about a single file reference variable; i.e., a variable stored on the reference relationship between an assembly file and one of its part files.

Syntax

Visual Basic
Public Structure EdmRefVar
   Inherits System.ValueType
C#
public struct EdmRefVar : System.ValueType
C++/CLI
public value class EdmRefVar : public System.ValueType

Example

struct EdmRefVar{
  integer mlVarID;
  integer mlParentFileID;
  integer mlParentVersion;
  integer mlChildFileID;
  string mbsChildCfgName;
  string mbsParentCfgName;
  object moValue;
  integer mhResult;
};

Example

Batch Get and Set Reference Variables (VB.NET)
Batch Get and Set Reference Variables (C#)

Remarks

Reference variables are used in Bill of Materials columns that are configured to look for reference-specific values. To create a reference variable:

  1. Open the SOLIDWORKS PDM Professional Administration tool.
  2. Log into a vault.
  3. Double-click Bill of Materials > BOM.
  4. Click a column in the Columns list.
  5. Select Look for variable in reference specific values.
  6. Click OK.
  7. In a vault view, check out an assembly.
  8. Click the Bill of Materials tab.
  9. In the column configured to use reference-specific values, type text.
  10. Click Save in the Bill of Materials toolbar.

Each component of the assembly is in a separate reference relationship with the assembly. The BOM column configured to Look for variable in reference specific values contains reference variable values. Use IEdmBatchRefVars to get and set these reference variable values.

See Also

EdmRefVar Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmRefVar Structure Fields

EdmRefVar Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRefVar Structure

For a list of all members of this type, see EdmRefVar members.

Public Fields

 | Name | Description
public Field | mbsChildCfgName | Child file (part) configuration name.
public Field | mbsParentCfgName | Parent file (assembly) configuration name.
public Field | mhResult | Result of operation.
public Field | mlChildFileID | ID of child file (part).
public Field | mlParentFileID | ID of parent file (assembly).
public Field | mlParentVersion | Version of parent file (assembly).
public Field | mlVarID | ID of the reference variable.
public Field | moValue | Value of the reference variable.
Top

See Also

EdmRefVar Structure
EPDM.Interop.epdm Namespace


EdmRefVar Structure Members

EdmRefVar Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRefVar Structure

The following tables list the members exposed by EdmRefVar.

Public Fields

 | Name | Description
public Field | mbsChildCfgName | Child file (part) configuration name.
public Field | mbsParentCfgName | Parent file (assembly) configuration name.
public Field | mhResult | Result of operation.
public Field | mlChildFileID | ID of child file (part).
public Field | mlParentFileID | ID of parent file (assembly).
public Field | mlParentVersion | Version of parent file (assembly).
public Field | mlVarID | ID of the reference variable.
public Field | moValue | Value of the reference variable.
Top

See Also

EdmRefVar Structure
EPDM.Interop.epdm Namespace


mbsChildCfgName Field

mbsChildCfgName Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mbsChildCfgName Field

Child file (part) configuration name.

Syntax

Visual Basic
Public mbsChildCfgName As System.String
C#
public System.string mbsChildCfgName
C++/CLI
public:
System.String^ mbsChildCfgName

See Also

EdmRefVar Structure
EdmRefVar Members


mbsParentCfgName Field

mbsParentCfgName Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mbsParentCfgName Field

Parent file (assembly) configuration name.

Syntax

Visual Basic
Public mbsParentCfgName As System.String
C#
public System.string mbsParentCfgName
C++/CLI
public:
System.String^ mbsParentCfgName

See Also

EdmRefVar Structure
EdmRefVar Members


mhResult Field

mhResult Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mhResult Field

Result of operation.

Syntax

Visual Basic
Public mhResult As System.Integer
C#
public System.int mhResult
C++/CLI
public:
System.int mhResult

Remarks

All errors that can be returned on a file level by IEdmBatchRefVars::GetRefVars and IEdmBatchRefVars::SetRefVars are returned here rather than failing the entire method call.

See Also

EdmRefVar Structure
EdmRefVar Members


mlChildFileID Field

mlChildFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mlChildFileID Field

ID of child file (part).

Syntax

Visual Basic
Public mlChildFileID As System.Integer
C#
public System.int mlChildFileID
C++/CLI
public:
System.int mlChildFileID

See Also

EdmRefVar Structure
EdmRefVar Members


mlParentFileID Field

mlParentFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mlParentFileID Field

ID of parent file (assembly).

Syntax

Visual Basic
Public mlParentFileID As System.Integer
C#
public System.int mlParentFileID
C++/CLI
public:
System.int mlParentFileID

See Also

EdmRefVar Structure
EdmRefVar Members


mlParentVersion Field

mlParentVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mlParentVersion Field

Version of parent file (assembly).

Syntax

Visual Basic
Public mlParentVersion As System.Integer
C#
public System.int mlParentVersion
C++/CLI
public:
System.int mlParentVersion

Remarks

This member is ignored during write operations, because only the latest version can be updated. Read operations interpret the value, 0, as the latest version.

See Also

EdmRefVar Structure
EdmRefVar Members


mlVarID Field

mlVarID Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : mlVarID Field

ID of the reference variable.

Syntax

Visual Basic
Public mlVarID As System.Integer
C#
public System.int mlVarID
C++/CLI
public:
System.int mlVarID

See Also

EdmRefVar Structure
EdmRefVar Members


moValue Field

moValue Field
[image]
EPDM.Interop.epdm Namespace > EdmRefVar Structure : moValue Field

Value of the reference variable.

Syntax

Visual Basic
Public moValue As System.Object
C#
public System.object moValue
C++/CLI
public:
System.Object^ moValue

See Also

EdmRefVar Structure
EdmRefVar Members


EdmRevComponent2 Structure

EdmRevComponent2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRevComponent2 Structure

Holds information about a single revision number component.

Syntax

Visual Basic
Public Structure EdmRevComponent2
   Inherits System.ValueType
C#
public struct EdmRevComponent2 : System.ValueType
C++/CLI
public value class EdmRevComponent2 : public System.ValueType

Example

struct EdmRevComponent2{
  integer mlComponentID;
  string mbsComponentName;
  integer mlEdmRevComponentFlags;
  string mbsData;
  integer mlRecipientID;
  integer mlInitialCounter;
};

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)
Set Initial Revision (VB.NET)
Set Initial Revision (C#)

Remarks

You can obtain this structure by calling IEdmRevisionMgr2::GetRevisionNumberComponents2.

See Also

EdmRevComponent2 Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007 SP03


EdmRevComponent2 Structure Fields

EdmRevComponent2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevComponent2 Structure

For a list of all members of this type, see EdmRevComponent2 members.

Public Fields

 | Name | Description
public Field | mbsComponentName | Component's name.
public Field | mbsData | Format string entered in the administration tool if mlEdmRevComponentFlags contains the flag Edmrcf_TypeFormatString; if mbsDataField contains Edmrcf_TypeList, then the data member contains a new line-delimited list of list items.
public Field | mlComponentID | Component ID.
public Field | mlEdmRevComponentFlags | Combination of EdmRevComponentFlags flags.
public Field | mlInitialCounter | Initial counter value for the component.
public Field | mlRecipientID | ID of the user or group notified by mail when the end of a revision number list is reached.
Top

See Also

EdmRevComponent2 Structure
EPDM.Interop.epdm Namespace


EdmRevComponent2 Structure Members

EdmRevComponent2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevComponent2 Structure

The following tables list the members exposed by EdmRevComponent2.

Public Fields

 | Name | Description
public Field | mbsComponentName | Component's name.
public Field | mbsData | Format string entered in the administration tool if mlEdmRevComponentFlags contains the flag Edmrcf_TypeFormatString; if mbsDataField contains Edmrcf_TypeList, then the data member contains a new line-delimited list of list items.
public Field | mlComponentID | Component ID.
public Field | mlEdmRevComponentFlags | Combination of EdmRevComponentFlags flags.
public Field | mlInitialCounter | Initial counter value for the component.
public Field | mlRecipientID | ID of the user or group notified by mail when the end of a revision number list is reached.
Top

See Also

EdmRevComponent2 Structure
EPDM.Interop.epdm Namespace


mbsComponentName Field

mbsComponentName Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent2 Structure : mbsComponentName Field

Component's name.

Syntax

Visual Basic
Public mbsComponentName As System.String
C#
public System.string mbsComponentName
C++/CLI
public:
System.String^ mbsComponentName

See Also

EdmRevComponent2 Structure
EdmRevComponent2 Members


mbsData Field

mbsData Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent2 Structure : mbsData Field

Format string entered in the administration tool if mlEdmRevComponentFlags contains the flag Edmrcf_TypeFormatString; if mbsDataField contains Edmrcf_TypeList, then the data member contains a new line-delimited list of list items.

Syntax

Visual Basic
Public mbsData As System.String
C#
public System.string mbsData
C++/CLI
public:
System.String^ mbsData

Remarks

The mbsData member can contain the following format specifiers when mlEdmRevComponentFlags contains Edmrcf_TypeFormatString.

Specifier | Meaning
%C | Uppercase A, B, C...Z
%c | Lowercase a, b, c...z
%01d | Number, 0-padded to 1 digit
%02d | Number, 0-padded to 2 digits, etc.
%01x | Lowercase hex number, 0-padded to 1 digit
%02x | Lowercase hex number, 0-padded to 2 digits, etc.
%01X | Uppercase hex number, 0-padded to 1 digit
%02X | Uppercase hex number, 0-padded to 2 digits, etc.
%4y | 4-digit year
%2y | 2-digit year
%01m | Month number without 0 padding (1-12)
%02m | Month number, 0-padded to two digits (01-12)
%01D | Day number without 0 padding (1-31)
%02D | Day number, 0-padded to 2 digits (00-31)
%01H | Hour without 0 padding (0-23)
%02H | Hour, 0-padded to 2 digits (00-23)
%01M | Minute without 0 padding (0-59)
%02M | Minute, 0-padded to 2 digits (00-59)
%01S | Second without 0 padding (0-59)
%02S | Second, 0-padded to 2 digits (00-59)

See Also

EdmRevComponent2 Structure
EdmRevComponent2 Members


mlComponentID Field

mlComponentID Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent2 Structure : mlComponentID Field

Component ID.

Syntax

Visual Basic
Public mlComponentID As System.Integer
C#
public System.int mlComponentID
C++/CLI
public:
System.int mlComponentID

See Also

EdmRevComponent2 Structure
EdmRevComponent2 Members


mlEdmRevComponentFlags Field

mlEdmRevComponentFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent2 Structure : mlEdmRevComponentFlags Field

Combination of EdmRevComponentFlags flags.

Syntax

Visual Basic
Public mlEdmRevComponentFlags As System.Integer
C#
public System.int mlEdmRevComponentFlags
C++/CLI
public:
System.int mlEdmRevComponentFlags

See Also

EdmRevComponent2 Structure
EdmRevComponent2 Members


mlInitialCounter Field

mlInitialCounter Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent2 Structure : mlInitialCounter Field

Initial counter value for the component.

Syntax

Visual Basic
Public mlInitialCounter As System.Integer
C#
public System.int mlInitialCounter
C++/CLI
public:
System.int mlInitialCounter

See Also

EdmRevComponent2 Structure
EdmRevComponent2 Members


mlRecipientID Field

mlRecipientID Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent2 Structure : mlRecipientID Field

ID of the user or group notified by mail when the end of a revision number list is reached.

Syntax

Visual Basic
Public mlRecipientID As System.Integer
C#
public System.int mlRecipientID
C++/CLI
public:
System.int mlRecipientID

Remarks

This member is only valid if mlEdmRevComponentFlags contains Edmrcf_EndOfListSendMail.

See Also

EdmRevComponent2 Structure
EdmRevComponent2 Members


EdmRevCounter Structure

EdmRevCounter Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRevCounter Structure

Used in calls to IEdmRevisionMgr::SetRevisionCounters, this structure holds information about a single counter.

Syntax

Visual Basic
Public Structure EdmRevCounter
   Inherits System.ValueType
C#
public struct EdmRevCounter : System.ValueType
C++/CLI
public value class EdmRevCounter : public System.ValueType

Example

struct EdmRevCounter{
  string mbsComponentName;
  integer mlCounter;
};

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

See Also

EdmRevCounter Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmRevCounter Structure Fields

EdmRevCounter Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevCounter Structure

For a list of all members of this type, see EdmRevCounter members.

Public Fields

 | Name | Description
public Field | mbsComponentName | Name of revision number component as specified in the administration tool.
public Field | mlCounter | New counter value for the component.
Top

See Also

EdmRevCounter Structure
EPDM.Interop.epdm Namespace


EdmRevCounter Structure Members

EdmRevCounter Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevCounter Structure

The following tables list the members exposed by EdmRevCounter.

Public Fields

 | Name | Description
public Field | mbsComponentName | Name of revision number component as specified in the administration tool.
public Field | mlCounter | New counter value for the component.
Top

See Also

EdmRevCounter Structure
EPDM.Interop.epdm Namespace


mbsComponentName Field

mbsComponentName Field
[image]
EPDM.Interop.epdm Namespace > EdmRevCounter Structure : mbsComponentName Field

Name of revision number component as specified in the administration tool.

Syntax

Visual Basic
Public mbsComponentName As System.String
C#
public System.string mbsComponentName
C++/CLI
public:
System.String^ mbsComponentName

See Also

EdmRevCounter Structure
EdmRevCounter Members


mlCounter Field

mlCounter Field
[image]
EPDM.Interop.epdm Namespace > EdmRevCounter Structure : mlCounter Field

New counter value for the component.

Syntax

Visual Basic
Public mlCounter As System.Integer
C#
public System.int mlCounter
C++/CLI
public:
System.int mlCounter

See Also

EdmRevCounter Structure
EdmRevCounter Members


EdmRevError Structure

EdmRevError Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRevError Structure

Returned from IEdmRevisionMgr::Commit if something goes wrong when incrementing the revision number on a file.

Syntax

Visual Basic
Public Structure EdmRevError
   Inherits System.ValueType
C#
public struct EdmRevError : System.ValueType
C++/CLI
public value class EdmRevError : public System.ValueType

Example

struct EdmRevError{
  integer mlFileID;
  integer mhError;
};

Example

Set Initial Revision (VB.NET)
Set Initial Revision (C#)

See Also

EdmRevError Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmRevError Structure Fields

EdmRevError Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevError Structure

For a list of all members of this type, see EdmRevError members.

Public Fields

 | Name | Description
public Field | mhError | Error code.
public Field | mlFileID | ID of file affected by the error.
Top

See Also

EdmRevError Structure
EPDM.Interop.epdm Namespace


EdmRevError Structure Members

EdmRevError Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevError Structure

The following tables list the members exposed by EdmRevError.

Public Fields

 | Name | Description
public Field | mhError | Error code.
public Field | mlFileID | ID of file affected by the error.
Top

See Also

EdmRevError Structure
EPDM.Interop.epdm Namespace


mhError Field

mhError Field
[image]
EPDM.Interop.epdm Namespace > EdmRevError Structure : mhError Field

Error code.

Syntax

Visual Basic
Public mhError As System.Integer
C#
public System.int mhError
C++/CLI
public:
System.int mhError

Remarks

You can get more information about the error by calling IEdmVault5::GetErrorString.

See Also

EdmRevError Structure
EdmRevError Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmRevError Structure : mlFileID Field

ID of file affected by the error.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

See Also

EdmRevError Structure
EdmRevError Members


EdmRevNo Structure

EdmRevNo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRevNo Structure

Holds information about a revision number and is returned from IEdmRevisionMgr2::GetRevisionNumbers..

Syntax

Visual Basic
Public Structure EdmRevNo
   Inherits System.ValueType
C#
public struct EdmRevNo : System.ValueType
C++/CLI
public value class EdmRevNo : public System.ValueType

Example

struct EdmRevNo{
  integer mlRevNoID;
  string mbsRevNoName;
  string mbsData;
};

Example

Find Revisions Using Component (C#)
Find Revisions Using Component (VB.NET)

Remarks

You can get the components of a revision number by calling IEdmRevisionMgr2::GetRevisionNumberComponents2 and passing a negative value to the EdmRevNo struct's mlRevNoID field as the argument.

See Also

EdmRevNo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007 SP03


EdmRevNo Structure Fields

EdmRevNo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevNo Structure

For a list of all members of this type, see EdmRevNo members.

Public Fields

 | Name | Description
public Field | mbsData | Format string as entered in the administration tool.
public Field | mbsRevNoName | Name of the revision number.
public Field | mlRevNoID | ID of the revision number.
Top

See Also

EdmRevNo Structure
EPDM.Interop.epdm Namespace


EdmRevNo Structure Members

EdmRevNo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevNo Structure

The following tables list the members exposed by EdmRevNo.

Public Fields

 | Name | Description
public Field | mbsData | Format string as entered in the administration tool.
public Field | mbsRevNoName | Name of the revision number.
public Field | mlRevNoID | ID of the revision number.
Top

See Also

EdmRevNo Structure
EPDM.Interop.epdm Namespace


mbsData Field

mbsData Field
[image]
EPDM.Interop.epdm Namespace > EdmRevNo Structure : mbsData Field

Format string as entered in the administration tool.

Syntax

Visual Basic
Public mbsData As System.String
C#
public System.string mbsData
C++/CLI
public:
System.String^ mbsData

Remarks

The components are represented by escape sequences like this "%1n", "%2n"... where 1 and 2 are the database IDs of the components; i.e., the same as EdmRevComponent's mlComponentID field.

See Also

EdmRevNo Structure
EdmRevNo Members


mbsRevNoName Field

mbsRevNoName Field
[image]
EPDM.Interop.epdm Namespace > EdmRevNo Structure : mbsRevNoName Field

Name of the revision number.

Syntax

Visual Basic
Public mbsRevNoName As System.String
C#
public System.string mbsRevNoName
C++/CLI
public:
System.String^ mbsRevNoName

See Also

EdmRevNo Structure
EdmRevNo Members


mlRevNoID Field

mlRevNoID Field
[image]
EPDM.Interop.epdm Namespace > EdmRevNo Structure : mlRevNoID Field

ID of the revision number.

Syntax

Visual Basic
Public mlRevNoID As System.Integer
C#
public System.int mlRevNoID
C++/CLI
public:
System.int mlRevNoID

See Also

EdmRevNo Structure
EdmRevNo Members


EdmSelectionObject Structure

EdmSelectionObject Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmSelectionObject Structure

Contains data returned from IEdmSelectionList6::GetNext2.

Syntax

Visual Basic
Public Structure EdmSelectionObject
   Inherits System.ValueType
C#
public struct EdmSelectionObject : System.ValueType
C++/CLI
public value class EdmSelectionObject : public System.ValueType

Example

struct EdmSelectionObject{
  EdmObjectType meType;
  string mbsPath;
  integer mlID;
  integer mlProjectID;
  integer mlGetVersion;
  integer mlLocalVersion;
  integer mlLatestVersion;
};

Example

Batch Change States of Files (VB.NET)
Batch Change States of Files (C#)

See Also

EdmSelectionObject Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmSelectionObject Structure Fields

EdmSelectionObject Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmSelectionObject Structure

For a list of all members of this type, see EdmSelectionObject members.

Public Fields

 | Name | Description
public Field | mbsPath | Object's path.
public Field | meType | Object type.
public Field | mlGetVersion | Version to get.
public Field | mlID | Object's database ID.
public Field | mlLatestVersion | Latest version.
public Field | mlLocalVersion | Local version.
public Field | mlProjectID | Object's parent folder ID.
Top

See Also

EdmSelectionObject Structure
EPDM.Interop.epdm Namespace


EdmSelectionObject Structure Members

EdmSelectionObject Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmSelectionObject Structure

The following tables list the members exposed by EdmSelectionObject.

Public Fields

 | Name | Description
public Field | mbsPath | Object's path.
public Field | meType | Object type.
public Field | mlGetVersion | Version to get.
public Field | mlID | Object's database ID.
public Field | mlLatestVersion | Latest version.
public Field | mlLocalVersion | Local version.
public Field | mlProjectID | Object's parent folder ID.
Top

See Also

EdmSelectionObject Structure
EPDM.Interop.epdm Namespace


mbsPath Field

mbsPath Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : mbsPath Field

Object's path.

Syntax

Visual Basic
Public mbsPath As System.String
C#
public System.string mbsPath
C++/CLI
public:
System.String^ mbsPath

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : meType Field

Object type.

Syntax

Visual Basic
Public meType As EdmObjectType
C#
public EdmObjectType meType
C++/CLI
public:
EdmObjectType meType

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


mlGetVersion Field

mlGetVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : mlGetVersion Field

Version to get.

Syntax

Visual Basic
Public mlGetVersion As System.Integer
C#
public System.int mlGetVersion
C++/CLI
public:
System.int mlGetVersion

Remarks

Valid if retrieved from tree created by EdmUtility.EdmUtil_BatchGet.

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


mlID Field

mlID Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : mlID Field

Object's database ID.

Syntax

Visual Basic
Public mlID As System.Integer
C#
public System.int mlID
C++/CLI
public:
System.int mlID

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


mlLatestVersion Field

mlLatestVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : mlLatestVersion Field

Latest version.

Syntax

Visual Basic
Public mlLatestVersion As System.Integer
C#
public System.int mlLatestVersion
C++/CLI
public:
System.int mlLatestVersion

Remarks

Valid if retrieved from tree created by EdmUtility.EdmUtil_BatchGet.

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


mlLocalVersion Field

mlLocalVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : mlLocalVersion Field

Local version.

Syntax

Visual Basic
Public mlLocalVersion As System.Integer
C#
public System.int mlLocalVersion
C++/CLI
public:
System.int mlLocalVersion

Remarks

Valid if retrieved from tree created by EdmUtility.EdmUtil_BatchGet.

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


mlProjectID Field

mlProjectID Field
[image]
EPDM.Interop.epdm Namespace > EdmSelectionObject Structure : mlProjectID Field

Object's parent folder ID.

Syntax

Visual Basic
Public mlProjectID As System.Integer
C#
public System.int mlProjectID
C++/CLI
public:
System.int mlProjectID

See Also

EdmSelectionObject Structure
EdmSelectionObject Members


EdmSelItem Structure

EdmSelItem Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmSelItem Structure

Contains information about one selected file; e.g., used with IEdmBatchUnlock::AddSelection.

Syntax

Visual Basic
Public Structure EdmSelItem
   Inherits System.ValueType
C#
public struct EdmSelItem : System.ValueType
C++/CLI
public value class EdmSelItem : public System.ValueType

Example

struct EdmSelItem

{
  integer mlDocID;
  integer mlProjID;
};

Example

Batch Check Out Files (VB.NET)
Batch Check Out Files (C#)
Access Check-in Flags in Check out Dialog (C#)
Access Check-in Flags in Check out Dialog (VB.NET)
Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

See Also

EdmSelItem Members
EPDM.Interop.epdm Namespace

Availability

Version 6.3 of SOLIDWORKS PDM Professional


EdmSelItem2 Structure

EdmSelItem2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmSelItem2 Structure

Contains information about a selected item.

Syntax

Visual Basic
Public Structure EdmSelItem2
   Inherits System.ValueType
C#
public struct EdmSelItem2 : System.ValueType
C++/CLI
public value class EdmSelItem2 : public System.ValueType

Example

struct EdmSelItem2

{
    EdmObjectType meType;

    integer mlID;
    integer mlParentID;
    integer mlVersion;
};

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)
Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

Used by:

  • oNotificationAttachments argument of IEdmTaskInstance::SetStatus.
  • poSelections argument of IEdmTaskMgr::RunTask.

See Also

EdmSelItem2 Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmSelItem2 Structure Fields

EdmSelItem2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmSelItem2 Structure

For a list of all members of this type, see EdmSelItem2 members.

Public Fields

 | Name | Description
public Field | meType | Type of object.
public Field | mlID | Database ID of the selected object.
public Field | mlParentID | Object's parent folder ID.
public Field | mlVersion | Object's version number.
Top

See Also

EdmSelItem2 Structure
EPDM.Interop.epdm Namespace


EdmSelItem2 Structure Members

EdmSelItem2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmSelItem2 Structure

The following tables list the members exposed by EdmSelItem2.

Public Fields

 | Name | Description
public Field | meType | Type of object.
public Field | mlID | Database ID of the selected object.
public Field | mlParentID | Object's parent folder ID.
public Field | mlVersion | Object's version number.
Top

See Also

EdmSelItem2 Structure
EPDM.Interop.epdm Namespace


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmSelItem2 Structure : meType Field

Type of object.

Syntax

Visual Basic
Public meType As EdmObjectType
C#
public EdmObjectType meType
C++/CLI
public:
EdmObjectType meType

See Also

EdmSelItem2 Structure
EdmSelItem2 Members


mlID Field

mlID Field
[image]
EPDM.Interop.epdm Namespace > EdmSelItem2 Structure : mlID Field

Database ID of the selected object.

Syntax

Visual Basic
Public mlID As System.Integer
C#
public System.int mlID
C++/CLI
public:
System.int mlID

See Also

EdmSelItem2 Structure
EdmSelItem2 Members


mlParentID Field

mlParentID Field
[image]
EPDM.Interop.epdm Namespace > EdmSelItem2 Structure : mlParentID Field

Object's parent folder ID.

Syntax

Visual Basic
Public mlParentID As System.Integer
C#
public System.int mlParentID
C++/CLI
public:
System.int mlParentID

See Also

EdmSelItem2 Structure
EdmSelItem2 Members


mlVersion Field

mlVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmSelItem2 Structure : mlVersion Field

Object's version number.

Syntax

Visual Basic
Public mlVersion As System.Integer
C#
public System.int mlVersion
C++/CLI
public:
System.int mlVersion

See Also

EdmSelItem2 Structure
EdmSelItem2 Members


EdmSimpleXRefInfo Structure

EdmSimpleXRefInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmSimpleXRefInfo Structure

Contains cross-reference information.

Syntax

Visual Basic
Public Structure EdmSimpleXRefInfo
   Inherits System.ValueType
C#
public struct EdmSimpleXRefInfo : System.ValueType
C++/CLI
public value class EdmSimpleXRefInfo : public System.ValueType

Example

struct EdmSimpleXRefInfo

{
    long VersionNo;
    long XRefDocumentID;
    long XRefProjectID;
    long XRefVersionNo;
};

See Also

EdmSimpleXRefInfo Members
EPDM.Interop.epdm Namespace


EdmSimpleXRefInfo Structure Fields

EdmSimpleXRefInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmSimpleXRefInfo Structure

For a list of all members of this type, see EdmSimpleXRefInfo members.

Public Fields

 | Name | Description
public Field | VersionNo | Version number.
public Field | XRefDocumentID | Document ID.
public Field | XRefProjectID | Parent folder ID.
public Field | XRefVersionNo | Cross-reference version number.
Top

See Also

EdmSimpleXRefInfo Structure
EPDM.Interop.epdm Namespace


EdmSimpleXRefInfo Structure Members

EdmSimpleXRefInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmSimpleXRefInfo Structure

The following tables list the members exposed by EdmSimpleXRefInfo.

Public Fields

 | Name | Description
public Field | VersionNo | Version number.
public Field | XRefDocumentID | Document ID.
public Field | XRefProjectID | Parent folder ID.
public Field | XRefVersionNo | Cross-reference version number.
Top

See Also

EdmSimpleXRefInfo Structure
EPDM.Interop.epdm Namespace


VersionNo Field

VersionNo Field
[image]
EPDM.Interop.epdm Namespace > EdmSimpleXRefInfo Structure : VersionNo Field

Version number.

Syntax

Visual Basic
Public VersionNo As System.Integer
C#
public System.int VersionNo
C++/CLI
public:
System.int VersionNo

See Also

EdmSimpleXRefInfo Structure
EdmSimpleXRefInfo Members


XRefDocumentID Field

XRefDocumentID Field
[image]
EPDM.Interop.epdm Namespace > EdmSimpleXRefInfo Structure : XRefDocumentID Field

Document ID.

Syntax

Visual Basic
Public XRefDocumentID As System.Integer
C#
public System.int XRefDocumentID
C++/CLI
public:
System.int XRefDocumentID

See Also

EdmSimpleXRefInfo Structure
EdmSimpleXRefInfo Members


XRefProjectID Field

XRefProjectID Field
[image]
EPDM.Interop.epdm Namespace > EdmSimpleXRefInfo Structure : XRefProjectID Field

Parent folder ID.

Syntax

Visual Basic
Public XRefProjectID As System.Integer
C#
public System.int XRefProjectID
C++/CLI
public:
System.int XRefProjectID

See Also

EdmSimpleXRefInfo Structure
EdmSimpleXRefInfo Members


XRefVersionNo Field

XRefVersionNo Field
[image]
EPDM.Interop.epdm Namespace > EdmSimpleXRefInfo Structure : XRefVersionNo Field

Cross-reference version number.

Syntax

Visual Basic
Public XRefVersionNo As System.Integer
C#
public System.int XRefVersionNo
C++/CLI
public:
System.int XRefVersionNo

See Also

EdmSimpleXRefInfo Structure
EdmSimpleXRefInfo Members


EdmStatePermission Structure

EdmStatePermission Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmStatePermission Structure

Contains state permission information.

Syntax

Visual Basic
Public Structure EdmStatePermission
   Inherits System.ValueType
C#
public struct EdmStatePermission : System.ValueType
C++/CLI
public value class EdmStatePermission : public System.ValueType

Example

struct EdmStatePermission
{
  enum EdmObjectType meOwnerType;
  integer mlOwnerID;
  integer mlStateID;
  integer mlEdmRightFlag;

};

Remarks

Used by IEdmUserMgr9::GetStatePermissions and IEdmUserMgr9::SetStatePermissions.

See Also

EdmStatePermission Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2017


EdmStatePermission Structure Fields

EdmStatePermission Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmStatePermission Structure

For a list of all members of this type, see EdmStatePermission members.

Public Fields

 | Name | Description
public Field | meOwnerType | Type of mlOwnerID.
public Field | mlEdmRightFlag | State rights.
public Field | mlOwnerID | ID of meOwnerType for whom to assign permissions.
public Field | mlStateID | ID of the state to which these permissions apply.
Top

See Also

EdmStatePermission Structure
EPDM.Interop.epdm Namespace


EdmStatePermission Structure Members

EdmStatePermission Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmStatePermission Structure

The following tables list the members exposed by EdmStatePermission.

Public Fields

 | Name | Description
public Field | meOwnerType | Type of mlOwnerID.
public Field | mlEdmRightFlag | State rights.
public Field | mlOwnerID | ID of meOwnerType for whom to assign permissions.
public Field | mlStateID | ID of the state to which these permissions apply.
Top

See Also

EdmStatePermission Structure
EPDM.Interop.epdm Namespace


meOwnerType Field

meOwnerType Field
[image]
EPDM.Interop.epdm Namespace > EdmStatePermission Structure : meOwnerType Field

Type of mlOwnerID.

Syntax

Visual Basic
Public meOwnerType As EdmObjectType
C#
public EdmObjectType meOwnerType
C++/CLI
public:
EdmObjectType meOwnerType

Field Value

EdmObjectType.EdmObject_User or EdmObjectType.EdmObject_UserGroup

See Also

EdmStatePermission Structure
EdmStatePermission Members


mlEdmRightFlag Field

mlEdmRightFlag Field
[image]
EPDM.Interop.epdm Namespace > EdmStatePermission Structure : mlEdmRightFlag Field

State rights.

Syntax

Visual Basic
Public mlEdmRightFlag As System.Integer
C#
public System.int mlEdmRightFlag
C++/CLI
public:
System.int mlEdmRightFlag

Field Value

Combination of EdmRightFlags bits

See Also

EdmStatePermission Structure
EdmStatePermission Members


mlOwnerID Field

mlOwnerID Field
[image]
EPDM.Interop.epdm Namespace > EdmStatePermission Structure : mlOwnerID Field

ID of meOwnerType for whom to assign permissions.

Syntax

Visual Basic
Public mlOwnerID As System.Integer
C#
public System.int mlOwnerID
C++/CLI
public:
System.int mlOwnerID

Field Value

Owner ID

See Also

EdmStatePermission Structure
EdmStatePermission Members


mlStateID Field

mlStateID Field
[image]
EPDM.Interop.epdm Namespace > EdmStatePermission Structure : mlStateID Field

ID of the state to which these permissions apply.

Syntax

Visual Basic
Public mlStateID As System.Integer
C#
public System.int mlStateID
C++/CLI
public:
System.int mlStateID

Field Value

State ID

See Also

EdmStatePermission Structure
EdmStatePermission Members


EdmTaskInfo Structure

EdmTaskInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmTaskInfo Structure

Used by IEdmTaskMgr::RunTask.

Syntax

Visual Basic
Public Structure EdmTaskInfo
   Inherits System.ValueType
C#
public struct EdmTaskInfo : System.ValueType
C++/CLI
public value class EdmTaskInfo : public System.ValueType

Example

struct EdmTaskInfo{
  string mbsTaskName;
  long mllShortTaskInfoFlags;
  integer mlTaskID;
};

See Also

EdmTaskInfo Members
EPDM.Interop.epdm Namespace
Programming Tasks


EdmTaskInfo Structure Fields

EdmTaskInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskInfo Structure

For a list of all members of this type, see EdmTaskInfo members.

Public Fields

 | Name | Description
public Field | mbsTaskName | Task add-in name.
public Field | mllShortTaskInfoFlags | Combination of EdmTaskFlags flags.
public Field | mlTaskID | Task add-in ID.
Top

See Also

EdmTaskInfo Structure
EPDM.Interop.epdm Namespace
Programming Tasks


EdmTaskInfo Structure Members

EdmTaskInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskInfo Structure

The following tables list the members exposed by EdmTaskInfo.

Public Fields

 | Name | Description
public Field | mbsTaskName | Task add-in name.
public Field | mllShortTaskInfoFlags | Combination of EdmTaskFlags flags.
public Field | mlTaskID | Task add-in ID.
Top

See Also

EdmTaskInfo Structure
EPDM.Interop.epdm Namespace
Programming Tasks


mbsTaskName Field

mbsTaskName Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskInfo Structure : mbsTaskName Field

Task add-in name.

Syntax

Visual Basic
Public mbsTaskName As System.String
C#
public System.string mbsTaskName
C++/CLI
public:
System.String^ mbsTaskName

See Also

EdmTaskInfo Structure
EdmTaskInfo Members


mllShortTaskInfoFlags Field

mllShortTaskInfoFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskInfo Structure : mllShortTaskInfoFlags Field

Combination of EdmTaskFlags flags.

Syntax

Visual Basic
Public mllShortTaskInfoFlags As System.Long
C#
public System.long mllShortTaskInfoFlags
C++/CLI
public:
System.int64 mllShortTaskInfoFlags

See Also

EdmTaskInfo Structure
EdmTaskInfo Members


mlTaskID Field

mlTaskID Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskInfo Structure : mlTaskID Field

Task add-in ID.

Syntax

Visual Basic
Public mlTaskID As System.Integer
C#
public System.int mlTaskID
C++/CLI
public:
System.int mlTaskID

See Also

EdmTaskInfo Structure
EdmTaskInfo Members


EdmTaskMenuCmd Structure

EdmTaskMenuCmd Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmTaskMenuCmd Structure

Used by IEdmTaskProperties::SetMenuCmds when an add-in adds menu commands to launch a task.

Syntax

Visual Basic
Public Structure EdmTaskMenuCmd
   Inherits System.ValueType
C#
public struct EdmTaskMenuCmd : System.ValueType
C++/CLI
public value class EdmTaskMenuCmd : public System.ValueType

Example

struct EdmTaskMenuCmd{
  integer mlCmdID
  string mbsMenuString;
  integer mlEdmMenuFlags;
  string mbsStatusBarHelp;
};

Example

Create a Task that Finds Approved Files (VB.NET)
Create a Task that Finds Approved Files (C#)

See Also

EdmTaskMenuCmd Members
EPDM.Interop.epdm Namespace
Programming Tasks

Availability

SOLIDWORKS PDM Professional 2010


EdmTaskMenuCmd Structure Fields

EdmTaskMenuCmd Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskMenuCmd Structure

For a list of all members of this type, see EdmTaskMenuCmd members.

Public Fields

 | Name | Description
public Field | mbsMenuString | String to show in the menu.
public Field | mbsStatusBarHelp | Help string to show in the File Explorer status bar when the menu command is selected.
public Field | mlCmdID | Add-in defined ID of the command.
public Field | mlEdmMenuFlags | Combination of EdmMenuFlags flags.
Top

See Also

EdmTaskMenuCmd Structure
EPDM.Interop.epdm Namespace
Programming Tasks


EdmTaskMenuCmd Structure Members

EdmTaskMenuCmd Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskMenuCmd Structure

The following tables list the members exposed by EdmTaskMenuCmd.

Public Fields

 | Name | Description
public Field | mbsMenuString | String to show in the menu.
public Field | mbsStatusBarHelp | Help string to show in the File Explorer status bar when the menu command is selected.
public Field | mlCmdID | Add-in defined ID of the command.
public Field | mlEdmMenuFlags | Combination of EdmMenuFlags flags.
Top

See Also

EdmTaskMenuCmd Structure
EPDM.Interop.epdm Namespace
Programming Tasks


mbsMenuString Field

mbsMenuString Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskMenuCmd Structure : mbsMenuString Field

String to show in the menu.

Syntax

Visual Basic
Public mbsMenuString As System.String
C#
public System.string mbsMenuString
C++/CLI
public:
System.String^ mbsMenuString

See Also

EdmTaskMenuCmd Structure
EdmTaskMenuCmd Members


mbsStatusBarHelp Field

mbsStatusBarHelp Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskMenuCmd Structure : mbsStatusBarHelp Field

Help string to show in the File Explorer status bar when the menu command is selected.

Syntax

Visual Basic
Public mbsStatusBarHelp As System.String
C#
public System.string mbsStatusBarHelp
C++/CLI
public:
System.String^ mbsStatusBarHelp

See Also

EdmTaskMenuCmd Structure
EdmTaskMenuCmd Members


mlCmdID Field

mlCmdID Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskMenuCmd Structure : mlCmdID Field

Add-in defined ID of the command.

Syntax

Visual Basic
Public mlCmdID As System.Integer
C#
public System.int mlCmdID
C++/CLI
public:
System.int mlCmdID

See Also

EdmTaskMenuCmd Structure
EdmTaskMenuCmd Members


mlEdmMenuFlags Field

mlEdmMenuFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskMenuCmd Structure : mlEdmMenuFlags Field

Combination of EdmMenuFlags flags.

Syntax

Visual Basic
Public mlEdmMenuFlags As System.Integer
C#
public System.int mlEdmMenuFlags
C++/CLI
public:
System.int mlEdmMenuFlags

See Also

EdmTaskMenuCmd Structure
EdmTaskMenuCmd Members


EdmTaskSel Structure

EdmTaskSel Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmTaskSel Structure

Passed as argument to IEdmTaskProperties::SetSel.

Syntax

Visual Basic
Public Structure EdmTaskSel
   Inherits System.ValueType
C#
public struct EdmTaskSel : System.ValueType
C++/CLI
public value class EdmTaskSel : public System.ValueType

Example

struct EdmTaskSel{
  EdmObjectType meType;
  integer mlID;
  integer mlParentID;
  integer mlVersion;
  string mbsConfiguration;
};

Remarks

The struct contains a selected item that should be processed by the task.

See Also

EdmTaskSel Members
EPDM.Interop.epdm Namespace
Programming Tasks

Availability

SOLIDWORKS PDM Professional 2010


EdmTaskSel Structure Fields

EdmTaskSel Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskSel Structure

For a list of all members of this type, see EdmTaskSel members.

Public Fields

 | Name | Description
public Field | mbsConfiguration | Optional configuration name. Empty for folders and file types not supporting configurations.
public Field | meType | Type of object (EdmObjectType.EdmObject_File or EdmObjectType.EdmObject_Folder).
public Field | mlID | Database ID of file or folder.
public Field | mlParentID | Parent folder ID for files; 0 for folders.
public Field | mlVersion | File version; 0 for folders.
Top

See Also

EdmTaskSel Structure
EPDM.Interop.epdm Namespace
Programming Tasks


EdmTaskSel Structure Members

EdmTaskSel Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskSel Structure

The following tables list the members exposed by EdmTaskSel.

Public Fields

 | Name | Description
public Field | mbsConfiguration | Optional configuration name. Empty for folders and file types not supporting configurations.
public Field | meType | Type of object (EdmObjectType.EdmObject_File or EdmObjectType.EdmObject_Folder).
public Field | mlID | Database ID of file or folder.
public Field | mlParentID | Parent folder ID for files; 0 for folders.
public Field | mlVersion | File version; 0 for folders.
Top

See Also

EdmTaskSel Structure
EPDM.Interop.epdm Namespace
Programming Tasks


mbsConfiguration Field

mbsConfiguration Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSel Structure : mbsConfiguration Field

Optional configuration name. Empty for folders and file types not supporting configurations.

Syntax

Visual Basic
Public mbsConfiguration As System.String
C#
public System.string mbsConfiguration
C++/CLI
public:
System.String^ mbsConfiguration

Remarks

This field is empty for folders and file types not supporting configurations.

See Also

EdmTaskSel Structure
EdmTaskSel Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSel Structure : meType Field

Type of object (EdmObjectType.EdmObject_File or EdmObjectType.EdmObject_Folder).

Syntax

Visual Basic
Public meType As EdmObjectType
C#
public EdmObjectType meType
C++/CLI
public:
EdmObjectType meType

See Also

EdmTaskSel Structure
EdmTaskSel Members


mlID Field

mlID Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSel Structure : mlID Field

Database ID of file or folder.

Syntax

Visual Basic
Public mlID As System.Integer
C#
public System.int mlID
C++/CLI
public:
System.int mlID

See Also

EdmTaskSel Structure
EdmTaskSel Members


mlParentID Field

mlParentID Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSel Structure : mlParentID Field

Parent folder ID for files; 0 for folders.

Syntax

Visual Basic
Public mlParentID As System.Integer
C#
public System.int mlParentID
C++/CLI
public:
System.int mlParentID

See Also

EdmTaskSel Structure
EdmTaskSel Members


mlVersion Field

mlVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSel Structure : mlVersion Field

File version; 0 for folders.

Syntax

Visual Basic
Public mlVersion As System.Integer
C#
public System.int mlVersion
C++/CLI
public:
System.int mlVersion

See Also

EdmTaskSel Structure
EdmTaskSel Members


EdmTaskSetupPage Structure

EdmTaskSetupPage Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmTaskSetupPage Structure

Used by the method IEdmTaskProperties::SetSetupPages.

Syntax

Visual Basic
Public Structure EdmTaskSetupPage
   Inherits System.ValueType
C#
public struct EdmTaskSetupPage : System.ValueType
C++/CLI
public value class EdmTaskSetupPage : public System.ValueType

Example

struct EdmTaskSetupPage{
  string mbsPageName;
  integer mlPageHwnd;
  object mpoPageImpl;
};

Example

Create a Task that Finds Files in Workflow States (VB.NET)
Create a Task that Finds Files in Workflow States (C#)

Remarks

This structure defines a task add-in's setup page in the task properties dialog box.

See Also

EdmTaskSetupPage Members
EPDM.Interop.epdm Namespace
Programming Tasks

Availability

SOLIDWORKS PDM Professional 2010


EdmTaskSetupPage Structure Fields

EdmTaskSetupPage Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskSetupPage Structure

For a list of all members of this type, see EdmTaskSetupPage members.

Public Fields

 | Name | Description
public Field | mbsPageName | Name of the page to add.
public Field | mlPageHwnd | Window handle of the page.
public Field | mpoPageImpl | Interface that SOLIDWORKS PDM Professional keeps addressed while the page exists.
Top

See Also

EdmTaskSetupPage Structure
EPDM.Interop.epdm Namespace
Programming Tasks


EdmTaskSetupPage Structure Members

EdmTaskSetupPage Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmTaskSetupPage Structure

The following tables list the members exposed by EdmTaskSetupPage.

Public Fields

 | Name | Description
public Field | mbsPageName | Name of the page to add.
public Field | mlPageHwnd | Window handle of the page.
public Field | mpoPageImpl | Interface that SOLIDWORKS PDM Professional keeps addressed while the page exists.
Top

See Also

EdmTaskSetupPage Structure
EPDM.Interop.epdm Namespace
Programming Tasks


mbsPageName Field

mbsPageName Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSetupPage Structure : mbsPageName Field

Name of the page to add.

Syntax

Visual Basic
Public mbsPageName As System.String
C#
public System.string mbsPageName
C++/CLI
public:
System.String^ mbsPageName

Remarks

This name shows up as a link in the left-side pane in the task property dialog in the Administration tool.

See Also

EdmTaskSetupPage Structure
EdmTaskSetupPage Members


mlPageHwnd Field

mlPageHwnd Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSetupPage Structure : mlPageHwnd Field

Window handle of the page.

Syntax

Visual Basic
Public mlPageHwnd As System.Integer
C#
public System.int mlPageHwnd
C++/CLI
public:
System.int mlPageHwnd

See Also

EdmTaskSetupPage Structure
EdmTaskSetupPage Members


mpoPageImpl Field

mpoPageImpl Field
[image]
EPDM.Interop.epdm Namespace > EdmTaskSetupPage Structure : mpoPageImpl Field

Interface that SOLIDWORKS PDM Professional keeps addressed while the page exists.

Syntax

Visual Basic
Public mpoPageImpl As System.Object
C#
public System.object mpoPageImpl
C++/CLI
public:
System.Object^ mpoPageImpl

Remarks

This object typically points to the object implementing the window owning the handle in mlPageHwnd.

See Also

EdmTaskSetupPage Structure
EdmTaskSetupPage Members


EdmTransitionPermission Structure

EdmTransitionPermission Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmTransitionPermission Structure

Contains transition permission information.

Syntax

Visual Basic
Public Structure EdmTransitionPermission
   Inherits System.ValueType
C#
public struct EdmTransitionPermission : System.ValueType
C++/CLI
public value class EdmTransitionPermission : public System.ValueType

Example

struct EdmTransitionPermission
{
  enum EdmObjectType meOwnerType;
  integer mlOwnerID;
  integer mlTransitionID;
  integer mlEdmRightFlag;

};

Remarks

Used by IEdmUserMgr9::GetTransitionPermissions and IEdmUserMgr9::SetTransitionPermissions.

See Also

EdmTransitionPermission Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2017


EdmTransitionPermission Structure Fields

EdmTransitionPermission Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmTransitionPermission Structure

For a list of all members of this type, see EdmTransitionPermission members.

Public Fields

 | Name | Description
public Field | meOwnerType | Type of mlOwnerID.
public Field | mlEdmRightFlag | Transition rights.
public Field | mlOwnerID | ID of meOwnerType for whom to assign permissions.
public Field | mlTransitionID | ID of the transition to which these permissions apply.
Top

See Also

EdmTransitionPermission Structure
EPDM.Interop.epdm Namespace


EdmTransitionPermission Structure Members

EdmTransitionPermission Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmTransitionPermission Structure

The following tables list the members exposed by EdmTransitionPermission.

Public Fields

 | Name | Description
public Field | meOwnerType | Type of mlOwnerID.
public Field | mlEdmRightFlag | Transition rights.
public Field | mlOwnerID | ID of meOwnerType for whom to assign permissions.
public Field | mlTransitionID | ID of the transition to which these permissions apply.
Top

See Also

EdmTransitionPermission Structure
EPDM.Interop.epdm Namespace


meOwnerType Field

meOwnerType Field
[image]
EPDM.Interop.epdm Namespace > EdmTransitionPermission Structure : meOwnerType Field

Type of mlOwnerID.

Syntax

Visual Basic
Public meOwnerType As EdmObjectType
C#
public EdmObjectType meOwnerType
C++/CLI
public:
EdmObjectType meOwnerType

Field Value

EdmObjectType.EdmObject_User or EdmObjectType.EdmObject_UserGroup

See Also

EdmTransitionPermission Structure
EdmTransitionPermission Members


mlEdmRightFlag Field

mlEdmRightFlag Field
[image]
EPDM.Interop.epdm Namespace > EdmTransitionPermission Structure : mlEdmRightFlag Field

Transition rights.

Syntax

Visual Basic
Public mlEdmRightFlag As System.Integer
C#
public System.int mlEdmRightFlag
C++/CLI
public:
System.int mlEdmRightFlag

Field Value

Combination of EdmTransitionRightFlags bits

See Also

EdmTransitionPermission Structure
EdmTransitionPermission Members


mlOwnerID Field

mlOwnerID Field
[image]
EPDM.Interop.epdm Namespace > EdmTransitionPermission Structure : mlOwnerID Field

ID of meOwnerType for whom to assign permissions.

Syntax

Visual Basic
Public mlOwnerID As System.Integer
C#
public System.int mlOwnerID
C++/CLI
public:
System.int mlOwnerID

Field Value

Owner ID

See Also

EdmTransitionPermission Structure
EdmTransitionPermission Members


mlTransitionID Field

mlTransitionID Field
[image]
EPDM.Interop.epdm Namespace > EdmTransitionPermission Structure : mlTransitionID Field

ID of the transition to which these permissions apply.

Syntax

Visual Basic
Public mlTransitionID As System.Integer
C#
public System.int mlTransitionID
C++/CLI
public:
System.int mlTransitionID

Field Value

Transition ID

See Also

EdmTransitionPermission Structure
EdmTransitionPermission Members


EdmUnlockErrInfo Structure

EdmUnlockErrInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmUnlockErrInfo Structure

Contains extended information about an error message.

Syntax

Visual Basic
Public Structure EdmUnlockErrInfo
   Inherits System.ValueType
C#
public struct EdmUnlockErrInfo : System.ValueType
C++/CLI
public value class EdmUnlockErrInfo : public System.ValueType

Example

struct EdmUnlockErrInfo{
  integer mlDocID;
  string mbsConfigName;
  integer mlVarID;
  string mbsVarName;
};

Example

Prevent Admin from Checking In File (C#)
Prevent Admin from Checking In File (VB.NET)

Remarks

This struct is displayed with IEdmUnlockOpCallback::MsgBox.

See Also

EdmUnlockErrInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 6.3 of SOLIDWORKS PDM Professional


EdmUnlockErrInfo Structure Fields

EdmUnlockErrInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmUnlockErrInfo Structure

For a list of all members of this type, see EdmUnlockErrInfo members.

Public Fields

 | Name | Description
public Field | mbsConfigName | Name of configuration (layout) where the variable value that caused the error is stored.
public Field | mbsVarName | Name of the variable that caused the error.
public Field | mlDocID | Unique ID of the file that caused the error, which is the same ID you see in IEdmObject5::ID.
public Field | mlVarID | Unique ID of the variable that caused the error.
Top

See Also

EdmUnlockErrInfo Structure
EPDM.Interop.epdm Namespace


EdmUnlockErrInfo Structure Members

EdmUnlockErrInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmUnlockErrInfo Structure

The following tables list the members exposed by EdmUnlockErrInfo.

Public Fields

 | Name | Description
public Field | mbsConfigName | Name of configuration (layout) where the variable value that caused the error is stored.
public Field | mbsVarName | Name of the variable that caused the error.
public Field | mlDocID | Unique ID of the file that caused the error, which is the same ID you see in IEdmObject5::ID.
public Field | mlVarID | Unique ID of the variable that caused the error.
Top

See Also

EdmUnlockErrInfo Structure
EPDM.Interop.epdm Namespace


mbsConfigName Field

mbsConfigName Field
[image]
EPDM.Interop.epdm Namespace > EdmUnlockErrInfo Structure : mbsConfigName Field

Name of configuration (layout) where the variable value that caused the error is stored.

Syntax

Visual Basic
Public mbsConfigName As System.String
C#
public System.string mbsConfigName
C++/CLI
public:
System.String^ mbsConfigName

Example

See the EdmUnlockErrInfo examples.

See Also

EdmUnlockErrInfo Structure
EdmUnlockErrInfo Members


mbsVarName Field

mbsVarName Field
[image]
EPDM.Interop.epdm Namespace > EdmUnlockErrInfo Structure : mbsVarName Field

Name of the variable that caused the error.

Syntax

Visual Basic
Public mbsVarName As System.String
C#
public System.string mbsVarName
C++/CLI
public:
System.String^ mbsVarName

Example

See the EdmUnlockErrInfo examples.

See Also

EdmUnlockErrInfo Structure
EdmUnlockErrInfo Members


mlDocID Field

mlDocID Field
[image]
EPDM.Interop.epdm Namespace > EdmUnlockErrInfo Structure : mlDocID Field

Unique ID of the file that caused the error, which is the same ID you see in IEdmObject5::ID.

Syntax

Visual Basic
Public mlDocID As System.Integer
C#
public System.int mlDocID
C++/CLI
public:
System.int mlDocID

Example

See the EdmUnlockErrInfo examples.

See Also

EdmUnlockErrInfo Structure
EdmUnlockErrInfo Members


mlVarID Field

mlVarID Field
[image]
EPDM.Interop.epdm Namespace > EdmUnlockErrInfo Structure : mlVarID Field

Unique ID of the variable that caused the error.

Syntax

Visual Basic
Public mlVarID As System.Integer
C#
public System.int mlVarID
C++/CLI
public:
System.int mlVarID

Example

See the EdmUnlockErrInfo examples.

See Also

EdmUnlockErrInfo Structure
EdmUnlockErrInfo Members


EdmUpdatedRefPath Structure

EdmUpdatedRefPath Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmUpdatedRefPath Structure

Contains old and new path information for references that are moved or renamed by another client.

Syntax

Visual Basic
Public Structure EdmUpdatedRefPath
   Inherits System.ValueType
C#
public struct EdmUpdatedRefPath : System.ValueType
C++/CLI
public value class EdmUpdatedRefPath : public System.ValueType

Example

struct EdmUpdatedRefPath{
  string mbsRefOldPath;
  string mbsRefNewPath;
};

Remarks

This structure is returned by IEdmRefItem2::GetUpdatedPaths.

See Also

EdmUpdatedRefPath Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2021 SP04


EdmUpdatedRefPath Structure Fields

EdmUpdatedRefPath Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmUpdatedRefPath Structure

For a list of all members of this type, see EdmUpdatedRefPath members.

Public Fields

 | Name | Description
public Field | mbsRefNewPath | New reference path.
public Field | mbsRefOldPath | Old reference path.
Top

See Also

EdmUpdatedRefPath Structure
EPDM.Interop.epdm Namespace


EdmUpdatedRefPath Structure Members

EdmUpdatedRefPath Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmUpdatedRefPath Structure

The following tables list the members exposed by EdmUpdatedRefPath.

Public Fields

 | Name | Description
public Field | mbsRefNewPath | New reference path.
public Field | mbsRefOldPath | Old reference path.
Top

See Also

EdmUpdatedRefPath Structure
EPDM.Interop.epdm Namespace


mbsRefNewPath Field

mbsRefNewPath Field
[image]
EPDM.Interop.epdm Namespace > EdmUpdatedRefPath Structure : mbsRefNewPath Field

New reference path.

Syntax

Visual Basic
Public mbsRefNewPath As System.String
C#
public System.string mbsRefNewPath
C++/CLI
public:
System.String^ mbsRefNewPath

See Also

EdmUpdatedRefPath Structure
EdmUpdatedRefPath Members


mbsRefOldPath Field

mbsRefOldPath Field
[image]
EPDM.Interop.epdm Namespace > EdmUpdatedRefPath Structure : mbsRefOldPath Field

Old reference path.

Syntax

Visual Basic
Public mbsRefOldPath As System.String
C#
public System.string mbsRefOldPath
C++/CLI
public:
System.String^ mbsRefOldPath

See Also

EdmUpdatedRefPath Structure
EdmUpdatedRefPath Members


EdmUserData2 Structure

EdmUserData2 Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmUserData2 Structure

Contains information about a user to be created.

Syntax

Visual Basic
Public Structure EdmUserData2
   Inherits System.ValueType
C#
public struct EdmUserData2 : System.ValueType
C++/CLI
public value class EdmUserData2 : public System.ValueType

Example

struct EdmUserData2{
  string   mbsUserName;
  string   mbsInitials;
  string   mbsCompleteName;
  string   mbsUserData;
  string   mbsPassword;
  string   mbsEmail;
  integer   mlFlags;
  EdmSysPerm[] moSysPerms;
  string   mbsColumnView;
  integer   mlUserID;
  integer   mhStatus;
  IEdmUser6* mpoUser;
};

Example

Add Users (C#)
Add Users (VB.NET)
Add and Remove User and Group from Folder (C#)
Add and Remove User and Group from Folder (VB.NET)

See Also

EdmUserData2 Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2010


EdmUserData2 Structure Fields

EdmUserData2 Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmUserData2 Structure

For a list of all members of this type, see EdmUserData2 members.

Public Fields

 | Name | Description
public Field | mbsColumnView | Name of the column view that the user should see in File Explorer file listings.
public Field | mbsCompleteName | Complete user name.
public Field | mbsEmail | Email address.
public Field | mbsInitials | User's initials.
public Field | mbsPassword | User's password in SOLIDWORKS PDM Professional.
public Field | mbsUserData | Arbitrary text to associate with the user.
public Field | mbsUserName | User's login name in SOLIDWORKS PDM Professional.
public Field | mhStatus | HRESULT code containing the status of the creation of the user.
public Field | mlFlags | Combination of EdmUserDataFlags flags.
public Field | mlUserID | Database ID of the just-created user.
public Field | moSysPerms | User's system permissions.
public Field | mpoUser | User's interface if mlFlags contains the edmUserDataFlags.edmudf_GetInterface and mhStatus is S_OK (0), otherwise the pointer is null.
Top

See Also

EdmUserData2 Structure
EPDM.Interop.epdm Namespace


EdmUserData2 Structure Members

EdmUserData2 Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmUserData2 Structure

The following tables list the members exposed by EdmUserData2.

Public Fields

 | Name | Description
public Field | mbsColumnView | Name of the column view that the user should see in File Explorer file listings.
public Field | mbsCompleteName | Complete user name.
public Field | mbsEmail | Email address.
public Field | mbsInitials | User's initials.
public Field | mbsPassword | User's password in SOLIDWORKS PDM Professional.
public Field | mbsUserData | Arbitrary text to associate with the user.
public Field | mbsUserName | User's login name in SOLIDWORKS PDM Professional.
public Field | mhStatus | HRESULT code containing the status of the creation of the user.
public Field | mlFlags | Combination of EdmUserDataFlags flags.
public Field | mlUserID | Database ID of the just-created user.
public Field | moSysPerms | User's system permissions.
public Field | mpoUser | User's interface if mlFlags contains the edmUserDataFlags.edmudf_GetInterface and mhStatus is S_OK (0), otherwise the pointer is null.
Top

See Also

EdmUserData2 Structure
EPDM.Interop.epdm Namespace


mbsColumnView Field

mbsColumnView Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsColumnView Field

Name of the column view that the user should see in File Explorer file listings.

Syntax

Visual Basic
Public mbsColumnView As System.String
C#
public System.string mbsColumnView
C++/CLI
public:
System.String^ mbsColumnView

Remarks

This is an input value that you should leave empty or null to use the standard view.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mbsCompleteName Field

mbsCompleteName Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsCompleteName Field

Complete user name.

Syntax

Visual Basic
Public mbsCompleteName As System.String
C#
public System.string mbsCompleteName
C++/CLI
public:
System.String^ mbsCompleteName

Example

See the EdmUserData2 examples.

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mbsEmail Field

mbsEmail Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsEmail Field

Email address.

Syntax

Visual Basic
Public mbsEmail As System.String
C#
public System.string mbsEmail
C++/CLI
public:
System.String^ mbsEmail

Example

See the EdmUserData2 examples.

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mbsInitials Field

mbsInitials Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsInitials Field

User's initials.

Syntax

Visual Basic
Public mbsInitials As System.String
C#
public System.string mbsInitials
C++/CLI
public:
System.String^ mbsInitials

Example

See the EdmUserData2 examples.

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mbsPassword Field

mbsPassword Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsPassword Field

User's password in SOLIDWORKS PDM Professional.

Syntax

Visual Basic
Public mbsPassword As System.String
C#
public System.string mbsPassword
C++/CLI
public:
System.String^ mbsPassword

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mbsUserData Field

mbsUserData Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsUserData Field

Arbitrary text to associate with the user.

Syntax

Visual Basic
Public mbsUserData As System.String
C#
public System.string mbsUserData
C++/CLI
public:
System.String^ mbsUserData

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mbsUserName Field

mbsUserName Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mbsUserName Field

User's login name in SOLIDWORKS PDM Professional.

Syntax

Visual Basic
Public mbsUserName As System.String
C#
public System.string mbsUserName
C++/CLI
public:
System.String^ mbsUserName

Example

See the EdmUserData2 examples.

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mhStatus Field

mhStatus Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mhStatus Field

HRESULT code containing the status of the creation of the user.

Syntax

Visual Basic
Public mhStatus As System.Integer
C#
public System.int mhStatus
C++/CLI
public:
System.int mhStatus

Example

See the EdmUserData2 examples.

Remarks

Output value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mlFlags Field

mlFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mlFlags Field

Combination of EdmUserDataFlags flags.

Syntax

Visual Basic
Public mlFlags As System.Integer
C#
public System.int mlFlags
C++/CLI
public:
System.int mlFlags

Example

See the EdmUserData2 examples.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mlUserID Field

mlUserID Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mlUserID Field

Database ID of the just-created user.

Syntax

Visual Basic
Public mlUserID As System.Integer
C#
public System.int mlUserID
C++/CLI
public:
System.int mlUserID

Remarks

Output value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


moSysPerms Field

moSysPerms Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : moSysPerms Field

User's system permissions.

Syntax

Visual Basic
Public moSysPerms As EdmSysPerm()
C#
public EdmSysPerm[] moSysPerms
C++/CLI
public:
array<EdmSysPerm>^ moSysPerms

Example

See the EdmUserData2 examples.

Remarks

Input value.

See Also

EdmUserData2 Structure
EdmUserData2 Members


mpoUser Field

mpoUser Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData2 Structure : mpoUser Field

User's interface if mlFlags contains the edmUserDataFlags.edmudf_GetInterface and mhStatus is S_OK (0), otherwise the pointer is null.

Syntax

Visual Basic
Public mpoUser As IEdmUser6
C#
public IEdmUser6 mpoUser
C++/CLI
public:
IEdmUser6^ mpoUser

Example

See the EdmUserData2 examples.

See Also

EdmUserData2 Structure
EdmUserData2 Members


EdmUserDataEx Structure

EdmUserDataEx Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmUserDataEx Structure

Contains information about a user.

Syntax

Visual Basic
Public Structure EdmUserDataEx
   Inherits System.ValueType
C#
public struct EdmUserDataEx : System.ValueType
C++/CLI
public value class EdmUserDataEx : public System.ValueType

Example

struct EdmUserDataEx{
  integer mlUserID;
  integer mlEdmUserDataExFlags;
  string mbsInitials;
  string mbsCompleteName;
  string mbsUserData;
  string mbsEmail;
  string mbsPhone;
  string mbsCellPhone;
  string mbsPicturePath;
  string mbsWebSite1;
  string mbsWebSite2;
  string mbsWebSite3;
  string mbsWebSite4;
  string mbsPresenceNote;
};

Example

Find Users (VB.NET)
Find Users (C#)

Remarks

Used to read/write user properties via IEdmUser10::GetUserDataEx and IEdmUser10::SetUserDataEx.

The following image shows where the EdmUserDataEx struct fields are used in the user popup window when IEdmUserMgr8::ShowUserPopup is called after updating the properties with IEdmUser10::GetUserDataEx.

See Also

EdmUserDataEx Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2013


EdmUserDataEx Structure Fields

EdmUserDataEx Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmUserDataEx Structure

For a list of all members of this type, see EdmUserDataEx members.

Public Fields

 | Name | Description
public Field | mbsCellPhone | Cell phone number.
public Field | mbsCompleteName | Full user name.
public Field | mbsEmail | Email address.
public Field | mbsInitials | User's initials.
public Field | mbsPhone | Office phone number.
public Field | mbsPicturePath | Points to an image file (e.g., .jpg, .bmp, .png, etc.) that can be set using IEdmUser10::SetUserDataEx.
public Field | mbsPresenceNote | Presence (i.e., out of office) note.
public Field | mbsUserData | User's data string.
public Field | mbsWebSite1 | First website address.
public Field | mbsWebSite2 | Second website.
public Field | mbsWebSite3 | Third website.
public Field | mbsWebSite4 | Fourth website.
public Field | mlEdmUserDataExFlags | Combination of EdmUserDataExFlag flags telling which of the other members of this structure should be updated or retrieved.
public Field | mlUserID | ID of user to which the data belongs.
Top

See Also

EdmUserDataEx Structure
EPDM.Interop.epdm Namespace


EdmUserDataEx Structure Members

EdmUserDataEx Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmUserDataEx Structure

The following tables list the members exposed by EdmUserDataEx.

Public Fields

 | Name | Description
public Field | mbsCellPhone | Cell phone number.
public Field | mbsCompleteName | Full user name.
public Field | mbsEmail | Email address.
public Field | mbsInitials | User's initials.
public Field | mbsPhone | Office phone number.
public Field | mbsPicturePath | Points to an image file (e.g., .jpg, .bmp, .png, etc.) that can be set using IEdmUser10::SetUserDataEx.
public Field | mbsPresenceNote | Presence (i.e., out of office) note.
public Field | mbsUserData | User's data string.
public Field | mbsWebSite1 | First website address.
public Field | mbsWebSite2 | Second website.
public Field | mbsWebSite3 | Third website.
public Field | mbsWebSite4 | Fourth website.
public Field | mlEdmUserDataExFlags | Combination of EdmUserDataExFlag flags telling which of the other members of this structure should be updated or retrieved.
public Field | mlUserID | ID of user to which the data belongs.
Top

See Also

EdmUserDataEx Structure
EPDM.Interop.epdm Namespace


EdmVariableData Structure

EdmVariableData Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmVariableData Structure

Contains information about a variable created with IEdmVariableMgr6::AddVariables.

Syntax

Visual Basic
Public Structure EdmVariableData
   Inherits System.ValueType
C#
public struct EdmVariableData : System.ValueType
C++/CLI
public value class EdmVariableData : public System.ValueType

Example

struct EdmVariableData{
  string mbsVariableName;
  EdmVariableType meType;
  integer mlEdmVariableFlags;
  EdmAttributeData mpoAttributes;
  integer mlVariableID;
};

Example

Add Card Variables to Vault (VB.NET)
Add Card Variables to Vault (C#)

See Also

EdmVariableData Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmVariableData Structure Fields

EdmVariableData Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmVariableData Structure

For a list of all members of this type, see EdmVariableData members.

Public Fields

 | Name | Description
public Field | mbsVariableName | Name of variable.
public Field | meType | Variable type as defined in EdmVariableType.
public Field | mlEdmVariableFlags | Combination of EdmVariableFlags.
public Field | mlVariableID | ID of the variable.
public Field | mpoAttributes | EdmAttributeData to which this variable should be mapped.
Top

See Also

EdmVariableData Structure
EPDM.Interop.epdm Namespace


EdmVariableData Structure Members

EdmVariableData Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmVariableData Structure

The following tables list the members exposed by EdmVariableData.

Public Fields

 | Name | Description
public Field | mbsVariableName | Name of variable.
public Field | meType | Variable type as defined in EdmVariableType.
public Field | mlEdmVariableFlags | Combination of EdmVariableFlags.
public Field | mlVariableID | ID of the variable.
public Field | mpoAttributes | EdmAttributeData to which this variable should be mapped.
Top

See Also

EdmVariableData Structure
EPDM.Interop.epdm Namespace


mbsVariableName Field

mbsVariableName Field
[image]
EPDM.Interop.epdm Namespace > EdmVariableData Structure : mbsVariableName Field

Name of variable.

Syntax

Visual Basic
Public mbsVariableName As System.String
C#
public System.string mbsVariableName
C++/CLI
public:
System.String^ mbsVariableName

See Also

EdmVariableData Structure
EdmVariableData Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmVariableData Structure : meType Field

Variable type as defined in EdmVariableType.

Syntax

Visual Basic
Public meType As EdmVariableType
C#
public EdmVariableType meType
C++/CLI
public:
EdmVariableType meType

See Also

EdmVariableData Structure
EdmVariableData Members


mlEdmVariableFlags Field

mlEdmVariableFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmVariableData Structure : mlEdmVariableFlags Field

Combination of EdmVariableFlags.

Syntax

Visual Basic
Public mlEdmVariableFlags As System.Integer
C#
public System.int mlEdmVariableFlags
C++/CLI
public:
System.int mlEdmVariableFlags

See Also

EdmVariableData Structure
EdmVariableData Members


mlVariableID Field

mlVariableID Field
[image]
EPDM.Interop.epdm Namespace > EdmVariableData Structure : mlVariableID Field

ID of the variable.

Syntax

Visual Basic
Public mlVariableID As System.Integer
C#
public System.int mlVariableID
C++/CLI
public:
System.int mlVariableID

See Also

EdmVariableData Structure
EdmVariableData Members


mpoAttributes Field

mpoAttributes Field
[image]
EPDM.Interop.epdm Namespace > EdmVariableData Structure : mpoAttributes Field

EdmAttributeData to which this variable should be mapped.

Syntax

Visual Basic
Public mpoAttributes As EdmAttributeData()
C#
public EdmAttributeData[] mpoAttributes
C++/CLI
public:
array<EdmAttributeData>^ mpoAttributes

See Also

EdmVariableData Structure
EdmVariableData Members


EdmVarVal Structure

EdmVarVal Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmVarVal Structure

Passed to IEdmBatchItemGeneration2::AddSelection2 to update a variable value.

Syntax

Visual Basic
Public Structure EdmVarVal
   Inherits System.ValueType
C#
public struct EdmVarVal : System.ValueType
C++/CLI
public value class EdmVarVal : public System.ValueType

Example

struct EdmVarVal{
  integer mlEdmVarValFlags;
  object moVarIDorName;
  object moValue;
};

Example

Add Items (C#)
Add Items (VB.NET)

See Also

EdmVarVal Members
EPDM.Interop.epdm Namespace
Porgramming Items

Availability

SOLIDWORKS PDM Professional 2010


EdmVarVal Structure Fields

EdmVarVal Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmVarVal Structure

For a list of all members of this type, see EdmVarVal members.

Public Fields

 | Name | Description
public Field | mlEdmVarValFlags | Must be 0.
public Field | moValue | Value of variable.
public Field | moVarIDorName | Variable ID (integer) or name (string).
Top

See Also

EdmVarVal Structure
EPDM.Interop.epdm Namespace
Porgramming Items


EdmVarVal Structure Members

EdmVarVal Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmVarVal Structure

The following tables list the members exposed by EdmVarVal.

Public Fields

 | Name | Description
public Field | mlEdmVarValFlags | Must be 0.
public Field | moValue | Value of variable.
public Field | moVarIDorName | Variable ID (integer) or name (string).
Top

See Also

EdmVarVal Structure
EPDM.Interop.epdm Namespace
Porgramming Items


mlEdmVarValFlags Field

mlEdmVarValFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmVarVal Structure : mlEdmVarValFlags Field

Must be 0.

Syntax

Visual Basic
Public mlEdmVarValFlags As System.Integer
C#
public System.int mlEdmVarValFlags
C++/CLI
public:
System.int mlEdmVarValFlags

See Also

EdmVarVal Structure
EdmVarVal Members


moValue Field

moValue Field
[image]
EPDM.Interop.epdm Namespace > EdmVarVal Structure : moValue Field

Value of variable.

Syntax

Visual Basic
Public moValue As System.Object
C#
public System.object moValue
C++/CLI
public:
System.Object^ moValue

See Also

EdmVarVal Structure
EdmVarVal Members


moVarIDorName Field

moVarIDorName Field
[image]
EPDM.Interop.epdm Namespace > EdmVarVal Structure : moVarIDorName Field

Variable ID (integer) or name (string).

Syntax

Visual Basic
Public moVarIDorName As System.Object
C#
public System.object moVarIDorName
C++/CLI
public:
System.Object^ moVarIDorName

See Also

EdmVarVal Structure
EdmVarVal Members


EdmViewInfo Structure

EdmViewInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmViewInfo Structure

Contains information about a file vault view.

Syntax

Visual Basic
Public Structure EdmViewInfo
   Inherits System.ValueType
C#
public struct EdmViewInfo : System.ValueType
C++/CLI
public value class EdmViewInfo : public System.ValueType

Example

struct EdmViewInfo{
  string mbsVaultName;
  string mbsViewID;
  string mbsVaultID;
  string mbsPath;
  short mbLoggedIn;
};

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)
Add Items (C#)
Add Items (VB.NET)

Remarks

This structure is returned by IEdmVault8::GetVaultViews.

See Also

EdmViewInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmViewInfo Structure Fields

EdmViewInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmViewInfo Structure

For a list of all members of this type, see EdmViewInfo members.

Public Fields

 | Name | Description
public Field | mbLoggedIn | Ture if you are logged into the vault, false if not
public Field | mbsPath | Path to the view root folder.
public Field | mbsVaultID | Unique ID of the vault.
public Field | mbsVaultName | Name of the file vault.
public Field | mbsViewID | Unique ID of the view.
Top

See Also

EdmViewInfo Structure
EPDM.Interop.epdm Namespace


EdmViewInfo Structure Members

EdmViewInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmViewInfo Structure

The following tables list the members exposed by EdmViewInfo.

Public Fields

 | Name | Description
public Field | mbLoggedIn | Ture if you are logged into the vault, false if not
public Field | mbsPath | Path to the view root folder.
public Field | mbsVaultID | Unique ID of the vault.
public Field | mbsVaultName | Name of the file vault.
public Field | mbsViewID | Unique ID of the view.
Top

See Also

EdmViewInfo Structure
EPDM.Interop.epdm Namespace


mbLoggedIn Field

mbLoggedIn Field
[image]
EPDM.Interop.epdm Namespace > EdmViewInfo Structure : mbLoggedIn Field

Ture if you are logged into the vault, false if not

Syntax

Visual Basic
Public mbLoggedIn As System.Short
C#
public System.short mbLoggedIn
C++/CLI
public:
System.short mbLoggedIn

See Also

EdmViewInfo Structure
EdmViewInfo Members


mbsPath Field

mbsPath Field
[image]
EPDM.Interop.epdm Namespace > EdmViewInfo Structure : mbsPath Field

Path to the view root folder.

Syntax

Visual Basic
Public mbsPath As System.String
C#
public System.string mbsPath
C++/CLI
public:
System.String^ mbsPath

See Also

EdmViewInfo Structure
EdmViewInfo Members


mbsVaultID Field

mbsVaultID Field
[image]
EPDM.Interop.epdm Namespace > EdmViewInfo Structure : mbsVaultID Field

Unique ID of the vault.

Syntax

Visual Basic
Public mbsVaultID As System.String
C#
public System.string mbsVaultID
C++/CLI
public:
System.String^ mbsVaultID

See Also

EdmViewInfo Structure
EdmViewInfo Members


mbsVaultName Field

mbsVaultName Field
[image]
EPDM.Interop.epdm Namespace > EdmViewInfo Structure : mbsVaultName Field

Name of the file vault.

Syntax

Visual Basic
Public mbsVaultName As System.String
C#
public System.string mbsVaultName
C++/CLI
public:
System.String^ mbsVaultName

Example

Destroy Deleted Files in Vault (C#)
Destroy Deleted Files in Vault (VB.NET)

See Also

EdmViewInfo Structure
EdmViewInfo Members


mbsViewID Field

mbsViewID Field
[image]
EPDM.Interop.epdm Namespace > EdmViewInfo Structure : mbsViewID Field

Unique ID of the view.

Syntax

Visual Basic
Public mbsViewID As System.String
C#
public System.string mbsViewID
C++/CLI
public:
System.String^ mbsViewID

See Also

EdmViewInfo Structure
EdmViewInfo Members


EdmWorkflowInfo Structure

EdmWorkflowInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmWorkflowInfo Structure

Holds information about a file's workflow state.

Syntax

Visual Basic
Public Structure EdmWorkflowInfo
   Inherits System.ValueType
C#
public struct EdmWorkflowInfo : System.ValueType
C++/CLI
public value class EdmWorkflowInfo : public System.ValueType

Example

struct EdmWorkflowInfo
  string mbsStateName;
  string mbsStateIcon;
  string mbsWorkflowName;
};

Example

Get File References for a File (C#)
Get File References for a File (VB.NET)

Remarks

This structure is referenced in the EdmListFile2 structure.

See Also

EdmWorkflowInfo Members
EPDM.Interop.epdm Namespace

Availability

Version 6.4 of SOLIDWORKS PDM Professional


EdmWorkflowInfo Structure Fields

EdmWorkflowInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmWorkflowInfo Structure

For a list of all members of this type, see EdmWorkflowInfo members.

Public Fields

 | Name | Description
public Field | mbsStateIcon | Name of the icon resource associated with the state.
public Field | mbsStateName | Name of state.
public Field | mbsWorkflowName | Name of the worflow to which the state belongs.
Top

See Also

EdmWorkflowInfo Structure
EPDM.Interop.epdm Namespace


EdmWorkflowInfo Structure Members

EdmWorkflowInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmWorkflowInfo Structure

The following tables list the members exposed by EdmWorkflowInfo.

Public Fields

 | Name | Description
public Field | mbsStateIcon | Name of the icon resource associated with the state.
public Field | mbsStateName | Name of state.
public Field | mbsWorkflowName | Name of the worflow to which the state belongs.
Top

See Also

EdmWorkflowInfo Structure
EPDM.Interop.epdm Namespace


mbsStateIcon Field

mbsStateIcon Field
[image]
EPDM.Interop.epdm Namespace > EdmWorkflowInfo Structure : mbsStateIcon Field

Name of the icon resource associated with the state.

Syntax

Visual Basic
Public mbsStateIcon As System.String
C#
public System.string mbsStateIcon
C++/CLI
public:
System.String^ mbsStateIcon

Remarks

The state icons are stored in Wflcons.dll.

See Also

EdmWorkflowInfo Structure
EdmWorkflowInfo Members


mbsStateName Field

mbsStateName Field
[image]
EPDM.Interop.epdm Namespace > EdmWorkflowInfo Structure : mbsStateName Field

Name of state.

Syntax

Visual Basic
Public mbsStateName As System.String
C#
public System.string mbsStateName
C++/CLI
public:
System.String^ mbsStateName

See Also

EdmWorkflowInfo Structure
EdmWorkflowInfo Members


mbsWorkflowName Field

mbsWorkflowName Field
[image]
EPDM.Interop.epdm Namespace > EdmWorkflowInfo Structure : mbsWorkflowName Field

Name of the worflow to which the state belongs.

Syntax

Visual Basic
Public mbsWorkflowName As System.String
C#
public System.string mbsWorkflowName
C++/CLI
public:
System.String^ mbsWorkflowName

See Also

EdmWorkflowInfo Structure
EdmWorkflowInfo Members


EPDM.Interop.EPDMResultCode Namespace

EPDM.Interop.EPDMResultCode Namespace
See Also Inheritance Hierarchy
Success and error codes.

Enumerations

Enumeration | Description
EdmResultErrorCodes_e | Error codes. See EdmResultSuccessCodes_e for the success codes.
EdmResultSuccessCodes_e | Success codes. See EdmResultErrorCodes_e for error codes.

See Also

EPDM.Interop.EPDMResultCode Assembly


EPDM.Interop.EPDMResultCode Namespace Inheritance Hierarchy

EPDM.Interop.EPDMResultCode Namespace Inheritance Hierarchy

Inheritance Hierarchy

System.Object

See Also

EPDM.Interop.EPDMResultCode Assembly


EdmResultErrorCodes_e Enumeration

EdmResultErrorCodes_e Enumeration
[image]
EPDM.Interop.EPDMResultCode Namespace : EdmResultErrorCodes_e Enumeration

Error codes. See EdmResultSuccessCodes_e for the success codes.

Syntax

Visual Basic
Public Enum EdmResultErrorCodes_e
   Inherits System.Enum
C#
public enum EdmResultErrorCodes_e : System.Enum
C++/CLI
public enum class EdmResultErrorCodes_e : public System.Enum

Members

Member | Description
E_EDM_ADDIN_CANT_ACCESS_REGISTRY

0x800402D8 = Cannot redirect registry to retrieve add-in class ID

E_EDM_ADDIN_CLSID_ALREADY_USED | 0x800402CE = There is already an add-in using the CLSID that you are trying to add; class IDs must be unique
E_EDM_ADDIN_CLSID_NOT_FOUND | 0x800402DA = The add-in registration succeeded, but the add-in's class ID could not be found in the registry
E_EDM_ADDIN_FILE_NOT_FOUND | 0x800402D6 = The add-in file was not found
E_EDM_ADDIN_LOAD_CONFLICT | 0x800402DB = The add-in could not be loaded; this can happen if an attempt is made to register a new version of a .NET add-in that is already loaded; the situation can usually be resolved by closing the application and reattempting the operation
E_EDM_ADDIN_LOADCONFLICT | 0x80040284 = An older version of the add-in is already loaded in memory; restart the program to load the new version of the add-in
E_EDM_ADDIN_NAME_ALREADY_USED | 0x800402D1 = There is already an add-in with the same name as the one you are trying to add; the name must be unique
E_EDM_ADDIN_NOT_COM_DLL | 0x800402D7 = The specified add-in file is not a COM DLL
E_EDM_ADDIN_NOT_FOUND | 0x800402CF = The add-in cannot be found in the vault
E_EDM_ADDIN_NOT_MULTITHREADED | 0x800402AF = An attempt was made to add an add-in that is not a multithreaded COM-server
E_EDM_ADDIN_UNSUPPORTED_OS | 0x800402DC = The add-in does not support the operating system; you cannot load an 64-bit add-in in 32-bit Windows
E_EDM_ALIAS_USED_IN_EXPORT_SCRIPT | 0x800402AC = The alias set cannot be deleted because it is used in a data export rule
E_EDM_ALIAS_USED_IN_IMPORT_SCRIPT | 0x800402AD = The alias set cannot be deleted because it is used in a data import rule
E_EDM_ALL_GROUPS_NOT_VALIDATED | 0x80040298 = All groups were not validated
E_EDM_ALL_USERS_NOT_VALIDATED | 0x80040289 = All users were not validated
E_EDM_ALREADY_INITIALIZED | 0x8004021B = An attempt was made to initialize an object twice; you can only initialize an object one time
E_EDM_ALREADY_LOGGED_IN | 0x80040205 = You tried to log in twice
E_EDM_ARCHIVE_LOGIN_FAILED | 0x80040243 = Login failed because of an invalid user name or password
E_EDM_ARCHIVE_ROOT_FOLDER_DOES_NOT_EXIST | 0x800402C7 = Specified archive server root folder does not exist
E_EDM_ARCHIVE_SERVER_NOT_FOUND | 0x8004023F = The archive server is not found; try starting the archive server
E_EDM_ASSEMBLY_IN_LDR_MODE | 0x8004030B = The assembly is in Large Design Review mode
E_EDM_AUTO_LOGGED_OUT | 0x80040280 = You have been inactive for too long and have been logged out
E_EDM_BAD_LENGTH | 0x80040242 = The statement is out of bounds
E_EDM_BOM_NOT_FOUND | 0x800402A9 = The specified bill of materials could not be found
E_EDM_BOM_USED_IN_EXPORT_SCRIPT | 0x800402AB = The bill of materials cannot be deleted because it is used in a data export rule
E_EDM_CANCELLED_BY_USER | 0x80040226 = The operation was canceled by the user
E_EDM_CANT_MOVE_FOLDER_TO_SUBFOLDER | 0x8004029C = An attempt was made to move a folder to one of its subfolders
E_EDM_CANT_OPEN_DATABASE | 0x80040206 = Could not open database; this could happen if the network connection is broken or if the database has been removed
E_EDM_CANT_START_EDMSERVER | 0x8004025B = Could not start EdmServer.exe; please reinstall the program
E_EDM_CARD_NOT_FOUND | 0x8004027E = The specified card could not be found
E_EDM_CARDLIST_HAS_NO_NAME | 0x800402E1 = Not the latest version, when latest version is required
E_EDM_CIRCULAR_XREF | 0x8004022F = Detected cyclic file reference
E_EDM_COLD_STORAGE_SCHEMA_NOT_FOUND | 0x80040275 = The cold storage schema with the specified name was not found
E_EDM_COLD_STORE_SCHEMA_EXISTS | 0x80040277 = Saving the cold storage schema failed because the name is already used by another schema
E_EDM_COLUMN_VIEW_NOT_FOUND | 0x80040290 = The column view cannot be found
E_EDM_COMMENT_NOT_ENTERED | 0x800402F4 = Comment not entered
E_EDM_CONDITIONS_NOT_MET | 0x80040233 = Conditions for transition were not met
E_EDM_COPYTREE_ZIP_FAILED | 0x800402FB = Failed to create ZIP file during the file copy operation
E_EDM_COULD_NOT_CREATE_LOCAL_FOLDER | 0x8004021E = Could not create the folder in the local cache; the folder name might contain invalid characters
E_EDM_COULD_NOT_LAUNCH_TASKS | 0x800402CB = Cannot launch tasks with user interface in silent mode
E_EDM_COULD_NOT_OPEN_CLIPBOARD | 0x8004027A = Could not open the clipboard
E_EDM_DATABASE_ACCESS | 0x80040207 = Could not access the item in the database
E_EDM_DATABASE_ALREADY_EXISTS | 0x800402D0 = A database with the same name already exists on the server
E_EDM_DATABASE_LINK_FAILURE | 0x80040267 = A communication link failure occurred when accessing the database server; the database service might have been restarted, or the network might be down; please try the operation again and contact your system administrator if the problem persists
E_EDM_DATASOURCE_NOT_FOUND | 0x80040222 = The ODBC data source was not found
E_EDM_DISABLED | 0x8004023D = The command is disabled
E_EDM_DISK_FULL | 0x80040239 = The disk is full
E_EDM_DOCTYPE_EXISTS | 0x80040259 = A category with the specified name already exists
E_EDM_DOCTYPE_IN_USE | 0x80040258 = The category is currently associated with one or more documents and cannot be deleted
E_EDM_DONTSETMODIFIED_FLAG | 0x800402E5 = Do not set the modified flag
E_EDM_DOTNET_REGISTRATION_MODULE_MISSING | 0x800402D9 = The .NET registration module is missing
E_EDM_DRAWING_IN_DETAILING_MODE | 0x80040306 = The drawing is in detailing mode
E_EDM_DUPLICATE_GROUP_NAME | 0x80040268 = Saving the user group failed because the group name is already used by another group
E_EDM_DUPLICATE_SEARCH_FAVORITE_NAME | 0x8004024B = Could not save the search favorite with the specified name because the name is already used by another favorite and the names must be unique; if the other favorite is not visible in the program, it is probably because you do not have permission to see it
E_EDM_EMPTY_VALUE_FIELD | 0x80040301 = The value of one or more transiiton conditions cannot be empty
E_EDM_END_OF_LIST | 0x80040208 = You tried to get an element from a list where the cursor is off right
E_EDM_END_OF_REV_GEN_LIST_CONTINUE | 0x80040232 = You have reached the end of the revision generator list; please contact your system administrator to add more revision-generator entries in the workflow editor
E_EDM_END_OF_REV_GEN_LIST_STOP | 0x80040231 = You have reached the end of the revision generator list; please contact your system administrator to add more revision-generator entries in the workflow editor
E_EDM_END_OF_SN_FILE | 0x8004023A = You have reached the end of the serial number file
E_EDM_ERPMGR_ALIAS_DOES_NOT_EXIST | 0x8004029D = The alias does not exist
E_EDM_ERPMGR_EXPORT_SCRIPT_NOT_FOUND | 0x800402A8 = The specified export rule could not be found
E_EDM_ERPMGR_IMPORTBATCH_DOES_NOT_EXIST | 0x8004029E = The data import batch does not exist
E_EDM_ERPMGR_IMPORTSCRIPT_NAME_ALREADY_EXISTS | 0x8004029F = The name of the data import rule is already used
E_EDM_ERPMGR_INVALID_DATE_FORMAT | 0x800402A0 = The date format is invalid
E_EDM_ERPMGR_INVALID_FILENAME | 0x800402A1 = The file name is invalid
E_EDM_ERPMGR_ITEM_NOT_FOUND | 0x800402A2 = The data import/export item was not found in the database
E_EDM_ERPMGR_VALUE_TOO_LONG | 0x800402A3 = The value is too long
E_EDM_ERPMGR_VARALIASSET_ALREADY_EXISTS | 0x800402A4 = The specified alias set already exists
E_EDM_ERPMGR_VARALIASSET_DOES_NOT_EXIST | 0x800402A5 = The specified variable alias set does not exist
E_EDM_ERPMGR_VARIABLE_DOES_NOT_EXIST | 0x800402A6 = The specified variable does not exist
E_EDM_ERPMGR_VARIABLENAME_NOT_UNIQUE | 0x800402A7 = The variable name is not unique
E_EDM_EXCLUDED_FROM_PREVIEW | 0x8004023C = The file type is excluded from preview
E_EDM_FILE_ALREADY_OPEN | 0x80040281 = The file is already open
E_EDM_FILE_DELETED | 0x8004026D = The file has been deleted
E_EDM_FILE_FORMAT_UNSUPPORTED_BY_CONISIO_VERSION | 0x8004026A = The file format is not supported by your SOLIDWORKS PDM Professional license
E_EDM_FILE_IN_COLDSTORAGE | 0x80040278 = The file that you are trying to access is currently placed in cold storage and cannot be retrieved
E_EDM_FILE_IS_LOCKED | 0x80040211 = The operation is not permitted because the file is checked out
E_EDM_FILE_IS_REFERENCED | 0x8004022D = The file is referenced by another file
E_EDM_FILE_MIGRATED_TO_PLATFORM | 0x8004030C = The file cannot be moved as it is migrated to the 3DEXPERIENCE platform
E_EDM_FILE_NAME_NOT_GLOBALLY_UNIQUE | 0x80040286 = The file name, which needs to be unique in the file vault, has been used before
E_EDM_FILE_NOT_FOUND | 0x80040213 = The file could not be found
E_EDM_FILE_NOT_LOCKED_BY_YOU | 0x80040210 = The file is not checked out by you, which is required by the operation
E_EDM_FILE_NOT_OPEN | 0x80040282 = The file is not open
E_EDM_FILE_NOT_REGENERATED | 0x800402B3 = The file is not rebuilt
E_EDM_FILE_SHARE_ERROR | 0x8004020B = An attempt was made to access a file that is exclusively opened by another application
E_EDM_FILES_WERE_LOCKED | 0x80040257 = One or more documents have been checked out; these files have been deselected; click OK again if you still want to perform the operation on the remaining files
E_EDM_FOLDER_DESTROY_CONSTRAINT_FAILED | 0x8004030A = Failed to destroy one or more folders due to a constraint violation
E_EDM_FOLDER_NOT_EMPTY | 0x8004021F = The specified folder is not empty
E_EDM_FOLDER_NOT_FOUND | 0x80040214 = The folder could not be found
E_EDM_GET_EDMFORMATROUTER | 0x8004027D = The file format plug-in routes the call onto another plug-in; the file format manager will query the interface for the IEdmFormatRouter code to figure out which plug-in to use
E_EDM_GROUP_NAME_ALREADY_EXISTS | 0x80040297 = The group name already exists
E_EDM_GROUP_NAME_NOT_UNIQUE | 0x80040295 = The group name is not unique in the specified array of groups
E_EDM_GROUP_NOT_FOUND | 0x800402D4 = The group could not be found
E_EDM_HAS_NO_CARD | 0x80040227 = The file does not have a file data card
E_EDM_HAS_NO_PARENT | 0x80040202 = The folder does not have a parent
E_EDM_HAS_NO_PREVIEW | 0x80040223 = The file does not have a preview bitmap
E_EDM_INDEXER_NOT_STARTED | 0x8004027F = Indexing has not been set up for this file vault
E_EDM_INSUFFICIENT_SQL_PERMISSION | 0x80040283 = The SQL server user account associated with the vault has insufficient privileges; the administrator can solve this by running the following command in the SQL Server Query Analyzer: GRANT VIEW SERVER STATE TO user name
E_EDM_INVALID_BOM | 0x800402EA = Invalid BOM
E_EDM_INVALID_CATEGORY_ID | 0x80040263 = The specified category database ID is invalid
E_EDM_INVALID_COLUMN_VIEW | 0x80040291 = The column view is invalid
E_EDM_INVALID_COMPLETE_NAME | 0x8004028B = The complete name is invalid
E_EDM_INVALID_DATABASE_NAME | 0x800402C3 = The SQL database name is invalid
E_EDM_INVALID_DATE_FORMAT_CODE | 0x800402C5 = The SQL date format code is invalid
E_EDM_INVALID_EMAIL | 0x8004028C = The email is invalid
E_EDM_INVALID_FILE | 0x80040229 = The file format is not recognized
E_EDM_INVALID_FILE_ID | 0x80040264 = The specified file ID is invalid
E_EDM_INVALID_GROUP_DESCRIPTION | 0x80040296 = The group description is invalid
E_EDM_INVALID_GROUP_MEMBER_ID | 0x80040299 = A group member ID is invalid
E_EDM_INVALID_GROUP_NAME | 0x80040294 = The group name is invalid
E_EDM_INVALID_ID | 0x80040241 = The supplied object ID is not valid
E_EDM_INVALID_INITIALS | 0x8004028D = The initials are invalid
E_EDM_INVALID_NAME | 0x8004021D = The file/key name was invalid
E_EDM_INVALID_OUTLOOK_VERSION | 0x800402E2 = The specified version of Microsoft Outlook is invalid
E_EDM_INVALID_PASSWORD | 0x8004028F = The password is invalid
E_EDM_INVALID_QUERY | 0x80040230 = The search query is invalid
E_EDM_INVALID_REVISION_NUMBER | 0x80040224 = Specified revision number is invalid
E_EDM_INVALID_REVISION_NUMBER_COMPONENT_NAME | 0x8004029B = The revision number component name is invalid
E_EDM_INVALID_REVISION_NUMBER_GENERATOR_NAME | 0x8004029A = The revision number generator name is invalid
E_EDM_INVALID_SERIAL_NUMBER_NAME | 0x80040256 = Invalid serial number name
E_EDM_INVALID_TRANSITION_WEB | 0x80040274 = Could not change state because the transition would create a new document version, which is not supported by the web client
E_EDM_INVALID_TYPE | 0x80040225 = The object has an invalid type for the specified operation
E_EDM_INVALID_USER_DATA | 0x8004028E = The user data string is invalid
E_EDM_INVALID_USER_NAME | 0x80040287 = The user name is invalid
E_EDM_INVALID_VAULT_NAME | 0x800402C2 = The vault name is invalid
E_EDM_INVALID_WORKFLOW_ID | 0x80040260 = The specified workflow database ID is invalid
E_EDM_INVALID_WORKFLOW_STATE_ID | 0x80040262 = The specified workflow state database ID is invalid
E_EDM_INVALID_WORKFLOW_TRANSITION_ID | 0x80040261 = The specified workflow transition database ID is invalid
E_EDM_IO_ERROR | 0x80040228 = Error accessing the file
E_EDM_KEY_NOT_FOUND | 0x8004022B = The key you specified was not found in the collection
E_EDM_LABEL_ALREADY_EXIST | 0x80040302 = The label already exists
E_EDM_LOCAL_FILE_NOT_FOUND | 0x80040285 = The file is not present in the file vault cache folder on the client computer
E_EDM_LOCK_ERRORS | 0x80040266 = One or more documents could not be checked out
E_EDM_LOCKED | 0x800402B0 = The file is checked out
E_EDM_LOCKED_BY_ANOTHER_USER | 0x80040212 = The file is checked out by another user
E_EDM_LOCKED_IN_OTHER_FOLDER | 0x800402B0 = The file is checked out in another folder
E_EDM_LOCKED_ON_OTHER_COMPUTER | 0x80040215 = The file is checked out on another computer
E_EDM_LOGIN_FAILED | 0x80040200 = Login failed because of an invalid user name or password
E_EDM_LOGIN_LOCK | 0x8004024E = The system is locked due to maintenance
E_EDM_MAILSERVER_NOT_INSTALLED | 0x80040235 = SOLIDWORKS PDM Professional Database Server is not installed on the database server; please contact your system administrator for assistance
E_EDM_MAPPING_FOUND | 0x8004020E = Could not remove the attribute class because it is used by a control in a file data card
E_EDM_MISSING_ATTRIBUTE | 0x8004020C = An attempt was made to access an attribute that is not present in the file
E_EDM_MISSING_CONISIO_MODULE | 0x80040272 = A required SOLIDWORKS PDM Professional module is not installed
E_EDM_MISSING_LOCAL_VIEW | 0x800402D5 = The vault must have a local view
E_EDM_MISSING_MANDATORY_VALUE | 0x80040236 = An attempt was made to save an empty value for a mandatory variable
E_EDM_MISSING_PLUGIN_COMPONENT | 0x80040245 = The file format plug-in cannot handle this file because a component is missing
E_EDM_MISSING_PTID | 0x8004025A = The registry variable PTID is missing; please reinstall the program
E_EDM_MISSING_SEARCH_PROC | 0x8004024F = The search card's stored procedure is missing in the database
E_EDM_MISSING_URL_PARAM | 0x8004026E = A required URL parameter is missing
E_EDM_MISSING_VIEW_INFO | 0x8004024C = Could not find registry information for this view; you might have to attach to this vault again to repair the registry
E_EDM_MOVE_FILE_PERMISSION_DENIED | 0x800402E4 = The user does not have permission to move the file.
E_EDM_NAME_ALREADY_EXISTS | 0x8004020F = An attempt was made to create a new file or folder with the same name as an existing one
E_EDM_NEED_MIGRATING | 0x80040249 = The file needs to be migrated for the operation to succeed
E_EDM_NO_ACTIVE_COLDSTORAGE_OPERATION | 0x80040276 = There are currently no active cold storage operations belonging to the calling archive server
E_EDM_NO_DOCTYPE | 0x8004025C = The document does not meet the conditions of any category
E_EDM_NO_MATCHING_PLUGIN | 0x8004022A = There is no matching plug-in
E_EDM_NO_REVISION_GENERATOR | 0x80040247 = The file is not connected to a revision generator
E_EDM_NO_REVISION_ON_REFERENCE | 0x80040237 = Cannot set revision because not all referenced files have revisions on the attached versions
E_EDM_NO_SECPKG_FOUND | 0x80040254 = Could not negotiate a security package to use between the server and the client
E_EDM_NO_WORKFLOW | 0x8004025D = The document does not meet the conditions of any workflow
E_EDM_NOT_A_COM_DLL | 0x800402CC = The DLL is not a COM module
E_EDM_NOT_AN_ADDIN_DLL | 0x800402CD = The DLL is not an SOLIDWORKS PDM Professional add-in; i.e., the IEdmAddIn5 interface is not implemented
E_EDM_NOT_INITIALIZED | 0x80040201 = The program used an object without properly initializing it
E_EDM_NOT_LATEST_VERSION | 0x800402E0 = Item must be checked out to perform this operation
E_EDM_NOT_LOGGED_IN | 0x80040204 = You have not logged into the file vault
E_EDM_NOT_POWER_USER | 0x80040246 = You are not logged in on Windows as a Power User or Administrator, which is required to run SOLIDWORKS PDM Professional
E_EDM_NULL_VALUE | 0x80040240 = A null value was returned where it was not expected
E_EDM_OPERATION_REFUSED_BY_PLUGIN | 0x8004021A = The operation was not permitted by one of the installed add-ins
E_EDM_OPERATION_UNSUPPORTED_BY_CONISIO_VERSION | 0x8004026B = The operation is not supported by your SOLIDWORKS PDM Professional license
E_EDM_PARENT_LOCKED_ELSEWHERE | 0x800402B1 = The file is referenced by a file that is checked out on another computer
E_EDM_PARENT_LOCKED_ELSEWHERE_WITHFILE | 0x80040300 = The file is referenced by a file, file_name, that is checked out on another computer
E_EDM_PASSWORD_NOT_EMPTY | 0x80040293 = The current login type does not allow passwords to be set
E_EDM_PATH_TOO_LONG | 0x80040271 = The path is too long
E_EDM_PERMISSION_DENIED | 0x80040203 = You do not have permission to perform this action
E_EDM_PICTURE_TOO_BIG | 0x800402E3 = The specified image is too big
E_EDM_PREVIEW_NOT_AVAILABLE | 0x800402BF = Preview is not available
E_EDM_PRODUCT_TIMEOUT | 0x800402D2 = Your version of SOLIDWORKS PDM Professional has expired; contact your SOLIDWORKS representative for a newer version
E_EDM_PROGRAM_VERSION_MISMATCH | 0x80040270 = The server and client are not of the same version
E_EDM_RCE_ERROR | 0x80040209 = Error accessing the revision management system; check your network connection
E_EDM_REFERENCE_EXISTS | 0x8004027B = The reference already exists
E_EDM_REVGEN_EXISTS | 0x8004025E = A revision number component with the specified name already exists
E_EDM_REVGENERATOR_IN_USE | 0x80040250 = The revision number component is currently being used by one or more revision numbers and cannot be deleted
E_EDM_REVISION_CHANGED | 0x80040253 = The revision number has been changed by another user
E_EDM_REVISION_NO_VERSION | 0x80040251 = An attempt was made to set a revision on a version newer than the documents latest version
E_EDM_REVISION_ON_OLD_VERSION | 0x80040238 = Cannot set revision on old version
E_EDM_REVNUM_EXISTS | 0x8004025F = A revision number with the specified name already exists
E_EDM_REVNUMBER_IN_USE | 0x80040255 = The revision number is currently associated with one or more states and cannot be deleted
E_EDM_ROLLBACK_ERRORS | 0x800402F7 = Rollback errors
E_EDM_ROLLBACK_FOLDER | 0x800402F8
E_EDM_ROLLBACK_PAST_COLDSTORED | 0x80040279 = The rollback operation cannot be performed because one of the versions that you are trying to remove is placed in cold storage
E_EDM_SERIAL_NUMBER_NAME_ALREADY_EXISTS | 0x800402AE = The serial number name is already in use
E_EDM_SERNO_USED_AS_ITEM_GEN | 0x800402C0 = The serial number cannot be deleted because it is used as an item number generator
E_EDM_SERVER_NOT_FOUND | 0x80040220 = The server was not found
E_EDM_SKIP_FILE | 0x80040273 = The user selected to skip processing of the current file and go on to the next one
E_EDM_SN_FILE_NOT_FOUND | 0x8004023B = Serial number file or add-in could not be found
E_EDM_SN_TYPE_OBSOLETE | 0x800402B2 = Serial numbers read from files are no longer supported; please open the serial number in the Administration tool and resave it as a list serial number
E_EDM_SQLSERVER_CANNOT_CONNECT | 0x800402C6 = Cannot connect to specified SQL server
E_EDM_SQLSERVER_LOGIN_FAILED | 0x800402C4 = Login failed because of an invalid SQL user name or password
E_EDM_SQLSERVER_UNSUPPORTED_VERSION | 0x8004027C = The SQL Server version is not supported by SOLIDWORKS PDM Professional; supported versions are SQL Server 2005 SP1 or later
E_EDM_STANDARD_APINOTSUPPORTED | 0x800402F2 = The API is not supported in SOLIDWORKS PDM standard version
E_EDM_STANDARD_FEATURENOTSUPPORTED | 0x800402ED = This feature is not supported in SOLIDWORKS PDM standard version
E_EDM_STANDARD_FEATURENOTSUPPORTED_REFERLOG | 0x800402F9 = This feature is not supported in SOLIDWORKS PDM standard version; refer to the log file for more information
E_EDM_STANDARD_PROFLOGINNOTSUPPORTED | 0x800402F3 = Login not supported
E_EDM_STANDARD_SQLEDITIONMISMATCH | 0x800402EC = Mismatch between SOLIDWORKS PDM standard version and Microsoft SQL
E_EDM_STATE_MULTIPLE_BLOCKING_WARNINGS_FOUND | 0x80040305 = Multiple blocking warnings found
E_EDM_STATE_MULTIPLE_WARNINGS_FOUND | 0x80040304 = Multiple warnings found
E_EDM_STATE_NOT_FOUND | 0x80040216 = The specified state does not exist
E_EDM_STATE_REFERRING_CRS_CONDITION | 0x80040303 = The workflow cannot be deleted since it is used in transition conditions
E_EDM_SWDRW_SETTO_USE_INDEPENDENT_REV_TABLE | 0x800402FF = Independent type revision setting is used in the drawing
E_EDM_SWFILE_MISSING_XMLSTREAM | 0x800402F5 = SOLIDWORKS file missing XML stream
E_EDM_SWSEC_LICENSE_CHECKIN_FAILED | 0x800402E7 = The check-in failed
E_EDM_SWSEC_LICENSE_CHECKIN_FAILED_PRO | 0x800402EF = Check-in failed in SOLIDWORKS PDM Professional
E_EDM_SWSEC_LICENSE_CHECKIN_FAILED_STD | 0x800402F1 = Check-in failed in SOLIDWORKS PDM standard version
E_EDM_SWSEC_LICENSE_CHECKOUT_FAILED | 0x800402E6 = Check-out failed
E_EDM_SWSEC_LICENSE_CHECKOUT_FAILED_PRO | 0x800402EE = Check-out failed in SOLIDWORKS PDM Professional
E_EDM_SWSEC_LICENSE_CHECKOUT_FAILED_STD | 0x800402F0 = Check-out failed in SOLIDWORKS PDM standard version
E_EDM_SWSEC_LICENSE_CONNECTION_LOST | 0x800402E9 = The connection was lost
E_EDM_SWSEC_LICENSE_SERVERQUERY_FAILED | 0x800402E8 = The server query failed
E_EDM_TEMPLATE_IMPORT_WITHOUT_LOCAL_VIEW | 0x800402F6 = Template imported iwthout local view
E_EDM_TOO_MANY_USERS | 0x80040248 = The licensed maximum number of simultaneously logged-in users would be exceeded by this log-in; this log-in was refused
E_EDM_TOOLBOX_FILE_LOCATED_IN_NONTOOLBOX_FOLDER | 0x800402FA = Toolbox file must be located in a Toolbox folder
E_EDM_TRANSITION_ACTION_FAILED | 0x80040234 = An error occurred when trying to execute a transition action
E_EDM_UNC_PATH_ADDIN_NOT_SUPPORTED | 0x800402DD = Information cannot be retrieved from add-ins on a network drive; copy the file to the local hard disk and retry the operation
E_EDM_UNSUPPORTED_OS | 0x800402D3 = The version of the operating system is not supported
E_EDM_UNSUPPORTED_PROGRAM_VERSION | 0x8004023E = The program requires a higher version of SOLIDWORKS PDM Professional than the installed version
E_EDM_UNSUPPORTED_SN_TYPE | 0x8004026F = The serial number type is not supported
E_EDM_UPDATE_ATT_FAILED | 0x8004020D = Could not update attributes during check in
E_EDM_USER_BLOCKED | 0x80040265 = The administrator has blocked your login name in this file vault
E_EDM_USER_NAME_ALREADY_EXISTS | 0x8004028A = The user name already exists
E_EDM_USER_NAME_NOT_UNIQUE | 0x80040288 = The user name is not unique in the specified array of users
E_EDM_USER_NOT_FOUND_IN_ARCHIVE_SERVER | 0x80040292 = The user name does not exist in the archive server
E_EDM_VALUE_NOT_UNIQUE | 0x8004022C = An attempt was made to save a duplicate value when a unique value is required
E_EDM_VARIABLE_NOT_FOUND | 0x80040252 = The specified card variable is missing
E_EDM_VARIABLE_USED_IN_COLUMN | 0x80040244 = The variable cannot be deleted because it is used in a user-defined column
E_EDM_VARIABLE_USED_IN_EXPORT_SCRIPT | 0x800402AA = The variable cannot be deleted because it is used in a data export rule
E_EDM_VARIABLE_USED_IN_WORKFLOW_STATE | 0x800402EB = The variable cannot be deleted because it is used in a workflow state
E_EDM_VAULT_ALREADY_EXISTS | 0x8004024D = A vault with the same name already exists on the archive server
E_EDM_VERSION_MISMATCH | 0x8004022E = The versions of the program and the file vault are incompatible
E_EDM_WF_HAS_FILES | 0x8004024A = The workflow contains files and cannot be deleted
E_EDM_XREF_OUTSIDE_VAULT | 0x8004026C = One or more of the file's referenced files are outside the file vault
E_ITEM_CANNOT_COPY_ITEM | 0x800402BA = You have selected items to copy; the items cannot be copied because they must be unique within the system
E_ITEM_CYCLIC_REFERENCE | 0x800402CA = Operation aborted because it would create a cyclic reference between items
E_ITEM_ILLEGAL_MOVE_REFERENCED_BY_EXTERNAL | 0x800402C8 = The object cannot be moved because the object or a sub-object is referenced by a locked item
E_ITEM_ILLEGAL_RENAME_REFERENCED_BY_EXTERNAL | 0x800402C9 = The object cannot be renamed because the object or a sub-object is referenced by a locked item
E_ITEM_INVALID_ITEM_TYPE | 0x800402BB = Invalid object type; only Item, ItemFolder, and files are supported by Item Explorer
E_ITEM_INVALID_LINK_OPERATION | 0x800402B8 = This operation cannot be performed on the selected items
E_ITEM_INVALID_LINK_TYPE | 0x800402B7 = Invalid link type; only two link types are supported by Item Explorer, static and auto-update
E_ITEM_INVALID_OBJECT | 0x800402BD = Item object contains corrupted data
E_ITEM_INVALID_SOURCE | 0x800402B5 = The selection contains items that are not valid for this operation
E_ITEM_INVALID_TARGET | 0x800402B4 = The destination object is invalid for this operation
E_ITEM_LINK_DUPLICATED | 0x800402B9 = The file is already added to this item
E_ITEM_LOCKED_ELSEWHERE | 0x800402DF = Item is locked on another computer
E_ITEM_MANY_DYN_LINKS | 0x800402B6 = This item already has an auto-update link attached to it; items can have only one auto-update link at a time
E_ITEM_NO_ITEM_GEN_DEFINED

0x800402BC = No serial number generator has been set up to generate item numbers. Please do the following:

  1. Launch SOLIDWORKS PDM Professional Administration Tool.
  2. Create a serial number.
  3. Open the Items administration node and select the serial number.
E_ITEM_NOT_CONNECTED | 0x800402C1 = This item has no file linked or connected to it
E_ITEM_NOT_LOCKED | 0x800402DE = Item has to be checked out to perform this operation
E_ITEM_UP_TO_DATE | 0x800402BE = The item is up to date

Example

Client code can only access these return codes by handling the exception. For example, in C#:

try
{
    // Some SOLIDWORKS PDM Professional call that results in an exception
}
catch (System.Runtime.InteropServices.ComException comEx)
{
    switch (comEx.ErrorCode)
    {
        case E_EDM_xxx:
            // respond to xxx
            break;
        case E_EDM_yyy:
            // respond to yyy
            break;
        default:
            // Unexpected or cannot be handled silently
            // Use IEdmVault5::GetErrorString or IEdmVault11::GetErrorMessage to prepare a message for the user or log
            break;
    }
}

Remarks

HRESULT return codes are supported by the SOLIDWORKS PDM Professional API. You can pass the HRESULT code to the method IEdmVault11::GetErrorMessage to get information about the code.

NOTES:

  • Methods called from Visual Basic do not return the HRESULT code directly. Instead, the return codes are returned as an argument declared with the [retval] directive, if one exists. Visual Basic users can view the error codes returned by methods by implementing an error handler and checking the Number property of the Err object. The property is the HRESULT return code from the failing method.
  • The values shown in this topic are written in C++ style hexadecimal notation. In VB.NET, the value 0x80040200 is written as &H80040200.

See Also

EPDM.Interop.EPDMResultCode Namespace
IEdmVault5::GetErrorString Method ()
IEdmVault11::GetErrorName Method ()
Return Codes


EdmResultSuccessCodes_e Enumeration

EdmResultSuccessCodes_e Enumeration
[image]
EPDM.Interop.EPDMResultCode Namespace : EdmResultSuccessCodes_e Enumeration

Success codes. See EdmResultErrorCodes_e for error codes.

Syntax

Visual Basic
Public Enum EdmResultSuccessCodes_e
   Inherits System.Enum
C#
public enum EdmResultSuccessCodes_e : System.Enum
C++/CLI
public enum class EdmResultSuccessCodes_e : public System.Enum

Members

Member | Description
S_EDM_32BIT_ADDIN | 0x4023D = Retrieved information successfully from the 32-bit add-in
S_EDM_64BIT_ADDIN | 0x4023E = Retrieved information successfully from the 64-bit add-in
S_EDM_FILES_NOT_UNIQUE_GLOBALLY | 0x4023F = The vault has the Do not allow duplicate file names in the file vault or Do not allow duplicate file names with these extensions option selected, and a file with the same name or filename extension exists in the vault
S_EDM_INVALID_FILE | 0x4023C = The file was handled, but the file format is not recognized
S_EDM_MENU_ITEM_NOT_APPLICABLE | 0x40219 = Menu item not valid in this context due to flags set
S_EDM_REFRESH_LIST | 0x40201 = Success; refresh the entire list
S_EDM_REFRESH_MENU | 0x40218 = Administrated plug-ins successfully; you should now recreate the plug-in menu
S_EDM_REFRESH_TREE | 0x40202 = Success; refresh the tree
S_EDM_TRY_AGAIN | 0x40203 = Try the operation again

Example

Client code can only access these return codes by handling the exception. For example, in C#:

try
{
    // Some SOLIDWORKS PDM Professional call that results in an exception
}
catch (System.Runtime.InteropServices.ComException comEx)
{
    switch (comEx.ErrorCode)
    {
        case S_EDM_xxx:
            // respond to xxx
            break;
        case S_EDM_yyy:
            // respond to yyy
            break;
        default:
            // Unexpected or cannot be handled silently
            // Use IEdmVault5::GetErrorString or IEdmVault11::GetErrorMessage to prepare a message for the user or log
            break;
    }
}

Remarks

HRESULT return codes are supported by the SOLIDWORKS PDM Professional API. You can pass the HRESULT code to the method IEdmVault11::GetErrorMessage to get information about the code.

Client code can only access these success codes by handling the exception; i.e., via System.Runtime.InteropServices.ComException.

NOTES:

  • Methods called from Visual Basic do not return the HRESULT code directly. Instead, the return codes are returned as an argument declared with the [retval] directive, if one exists. Visual Basic users can view the error codes returned by methods by implementing an error handler and checking the Number property of the Err object. The property is the HRESULT return code from the failing method.
  • The values shown in this topic are written in C++ style hexadecimal notation. In VB.NET, the value 0x80040200 is written as &H80040200.

See Also

EPDM.Interop.EPDMResultCode Namespace
IEdmVault5::GetErrorString Method ()
IEdmVault11::GetErrorName Method ()
Return Codes


SOLIDWORKS PDM Professional API Help

Access Bill of Materials Example (C#)

This example shows how to access the Bill of Materials (BOM) of a file in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Application.
//    b. Type EdmBOM_CSharp in Project name.
//    c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e.
Select Framework.
//    f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
//    j. Add dependencies and
safely pass arrays of structures.
// 2. Ensure that the vault contains the BOM layout.
//    To inspect the
existing layouts:
//    a. Open the SOLIDWORKS PDM Professional
Administration tool.
//    b. Log into vault_name.
//    c. Expand vault_name
> Bills of Materials.
//    d. Verify that layout, BOM, exists.
// 3. Ensure that an assembly and its parts exist in the root folder of the
//    vault in default configuration, @.
// 4. Ensure that one or more named Bills of Materials exist for the assembly.
//    a. Open File Explorer on a vault_name view.
//    b. Click the assembly.
//    c. Click the Bill of Materials
tab.
//    d. Click BOM.
//    e. If a named Bill of Materials does not exist in the BOM
list:
//       1. Click Save > Save As in
the tab toolbar.
//       2. In the Save As dialog, click
Save.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Opens the Bill of Materials dialog box.
//    a. Select a vault_name view.
//    b. Click Select file.
//    c. In the Select File dialog:
//       1. Click the assembly specified in
Preconditions step 6.
//       2. Click Open.
//    d. Click Get BOM Info.
//       Displays message boxes containing:
//       * Information about all named BOMs of the
assembly.
//       * Version information for the named BOMs.
//       * Information about all BOM layouts in
the vault.
//       * Row and column information about a BOM
view in the BOM layout
//         for the selected assembly in
its @ configuration.
//    e. Click OK in each message box.
//    f. Click Save BOM
to CSV.
//       Saves the BOM to c:\temp\SavedBOM.csv.
// 2. Close the Bill of Materials dialog box.
// 3. Verify that c:\temp\SavedBOM.csv
is created.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Xml.Serialization;
using System.Windows.Forms;
using System.ComponentModel;
using EPDM.Interop.epdm;

namespace EdmBOM_CSharp
{
    public partial class Form1 : Form
    {
        private IEdmVault5 vault1 = null;
        IEdmFile7 aFile;
        IEdmBom bom;
        IEdmBomMgr2 bomMgr;
        IEdmBomView3 bomView;

        public Form1()
        {
            InitializeComponent();
        }
        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void SelectFiles_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                File1List.Items.Clear();

                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select File dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;

                //Show the Select File dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // do nothing
                }
                else
                {
                    IEdmFolder5 ppoRetParentFolder;
                    foreach (string FileName in OpenFileDialog1.FileNames)
                    {
                        File1List.Items.Add(FileName);
                        aFile = (IEdmFile7)vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
                    }
                }

GetBOM.Enabled = true;
SaveBOM.Enabled = false;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void GetBOM_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault11 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault11)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

if (aFile != null)
{
// Get named BOMs and their versions for the selected file
EdmBomInfo[] derivedBOMs = null;
aFile.GetDerivedBOMs(out derivedBOMs);

int arrSize = 0;
EdmBomVersion[] ppoVersions = null;
int i = 0;
int j = 0;
int id = 0;
string str = "";
string verstr = "";
int verArrSize = 0;
arrSize = derivedBOMs.Length;
int userID
= 0;
bool canSeeLayout = false;

userID = vault2.GetLoggedInWindowsUserID(vault2.Name);

while (i < arrSize)
{
id = derivedBOMs[i].mlBomID;
bom = (IEdmBom)vault2.GetObject(EdmObjectType.EdmObject_BOM, id);
str = "Named BOM: " + derivedBOMs[i].mbsBomName + "\r\n" + "Type
of BOM as defined in EdmBomType: " + derivedBOMs[i].meType
+ "\\n"
+ "Check-out user: " + bom.CheckOutUserID + "\r\n" + "Current state: " + bom.CurrentState.Name + "\r\n" + "Current version: " + bom.CurrentVersion + "\r\n" + "ID: " + bom.FileID + "\r\n" + "Is checked out: " + bom.IsCheckedOut;
MessageBox.Show(str);
bom.GetVersions(out ppoVersions);
verArrSize = ppoVersions.Length;
while (j < verArrSize)
{
verstr = "BOM version: " + "\r\n" + "Type as defined in EdmBomVersionType: " + ppoVersions[j].meType + "\r\n" + "Version number: " + ppoVersions[j].mlVersion + "\r\n" + "Date: " + ppoVersions[j].moDate + "\r\n" + "Label: " + ppoVersions[j].mbsTag + "\r\n" + "Comment: " + ppoVersions[j].mbsComment;
MessageBox.Show(verstr);
j = j + 1;
}
i = i + 1;
}

// Get a BOM view with the specified layout
bomMgr = (IEdmBomMgr2)vault2.CreateUtility(EdmUtility.EdmUtil_BomMgr);
EdmBomLayout2[] ppoRetLayouts = null;
EdmBomLayout2 ppoRetLayout = default(EdmBomLayout2);
bomMgr.GetBomLayouts2(out ppoRetLayouts);
i = 0;
arrSize = ppoRetLayouts.Length;
str = "";
while (i < arrSize)
{
ppoRetLayout = ppoRetLayouts[i];

canSeeLayout = bomMgr.CanSeeBomLayout(userID, ppoRetLayout.mlLayoutID);
str = "BOM Layout " + i + ": " + ppoRetLayout.mbsLayoutName + "\r\n" + "ID: " + ppoRetLayout.mlLayoutID;
str = str + "  Logged-in user can see this
layout? " + canSeeLayout;
if (ppoRetLayout.mbsLayoutName == "BOM")
{
bomView = (IEdmBomView3)aFile.GetComputedBOM(ppoRetLayout.mbsLayoutName, 0, "@", (int)EdmBomFlag.EdmBf_AsBuilt + (int)EdmBomFlag.EdmBf_ShowSelected);
}
MessageBox.Show(str);
i = i + 1;
}

// Display BOM view
row and column information
object[] ppoRows = null;
IEdmBomCell ppoRow = default(IEdmBomCell);
bomView.GetRows(out ppoRows);
i = 0;
arrSize = ppoRows.Length;
str = "";
while (i < arrSize)
{
ppoRow = (IEdmBomCell)ppoRows[i];
str = "BOM Row " + i + ": " + "\r\n" + "Item ID: " + ppoRow.GetItemID() + "\r\n" + "Path name: " + ppoRow.GetPathName() + "\r\n" + "Tree level: " + ppoRow.GetTreeLevel() + "\r\n" + " Is locked? " + ppoRow.IsLocked();
MessageBox.Show(str);
i = i + 1;
}

EdmBomColumn[] ppoColumns = null;
bomView.GetColumns(out ppoColumns);
i = 0;
arrSize = ppoColumns.Length;
str = "";
while (i < arrSize)
{
str = "BOM Column " + i + ": " + "\r\n" + "Header: " + ppoColumns[i].mbsCaption + "\r\n" + "Column type as defined in EdmBomColumnType: " + ppoColumns[i].meType + "\r\n" + "ID: " + ppoColumns[i].mlColumnID + "\r\n" + "Flags: " + ppoColumns[i].mlFlags + "\r\n" + "Variable ID: " + ppoColumns[i].mlVariableID + "\r\n" + "Variable type as defined in EdmVariableType: " + ppoColumns[i].mlVariableType + "\r\n" + "Column width: " + ppoColumns[i].mlWidth;
MessageBox.Show(str);
i = i + 1;
}

                SaveBOM.Enabled = true;

              }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        public void SaveBOM_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault9)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if ((aFile != null) & (bomView != null))
                {
                    bomView.SaveToCSV("c:\\temp\\SavedBOM.csv", false);

                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

    }
}

Back to top

//Form1.Designer.cs

namespace EdmBOM_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.GetBOM = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SaveBOM = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select file...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click += new System.EventHandler(this.SelectFiles_Click);
            //
            // File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            // GetBOM
            //
            this.GetBOM.Location = new System.Drawing.Point(40, 183);
            this.GetBOM.Name = "GetBOM";
            this.GetBOM.Size = new System.Drawing.Size(157, 23);
            this.GetBOM.TabIndex = 6;
            this.GetBOM.Text = "Get BOM";
            this.GetBOM.UseVisualStyleBackColor = true;
            this.GetBOM.Enabled = false;
            this.GetBOM.Click += new System.EventHandler(this.GetBOM_Click);
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            // SaveBOM
            //
            this.SaveBOM.Location = new System.Drawing.Point(40, 252);
            this.SaveBOM.Name = "SaveBOM";
            this.SaveBOM.Size = new System.Drawing.Size(157, 23);
            this.SaveBOM.TabIndex = 7;
            this.SaveBOM.Text = "Save BOM to CSV";
            this.SaveBOM.UseVisualStyleBackColor = true;
            this.SaveBOM.Enabled = false;
            this.SaveBOM.Click += new System.EventHandler(this.SaveBOM_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 363);
            this.Controls.Add(this.SaveBOM);
            this.Controls.Add(this.GetBOM);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Bill of Materials";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button GetBOM;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion

        private System.Windows.Forms.Button SaveBOM;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Access Bill of Materials Example (VB.NET)

This example shows how to access the Bill of Materials (BOM) of a file in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop  > Windows Forms Application.
'    b. Type EdmBOM in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'    d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
'    j. Add dependencies and safely pass arrays of structures.
' 2. Ensure that the vault contains the BOM layout.
'    To inspect the existing layouts:
'    a. Open the SOLIDWORKS PDM Professional Administration tool.
'    b. Log into vault_name.
'    c. Expand vault_name > Bills of Materials.
'    d. Verify that layout, BOM, exists.
' 3. Ensure that an assembly and its parts exist in the root folder of
'    the vault in default configuration, @.
' 4. Ensure that one or more named Bills of Materials exist for the assembly.
'    a. Open File Explorer on a vault_name view.
'    b. Click the assembly.
'    c. Click the Bill of Materials tab.
'    d. Click BOM.
'    e. If a named Bill of Materials does not exist in the BOM list:
'       1. Click Save > Save As in the tab toolbar.
'       2. In the Save As dialog, click Save.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Opens the Bill of Materials dialog box.
'    a. Select a vault_name view.
'    b. Click Select file.
'    c. In the Select File dialog:
'       1. Click the assembly specified in Preconditions step 5.
'       2. Click Open.
'    d. Click Get BOM Info.
'       Displays message boxes containing:
'       * Information about all named BOMs of the assembly.
'       * Version information for the named BOMs.
'       * Information about all BOM layouts in the vault.
'       * Row and column information about a BOM view in the BOM layout
'         for the selected assembly in its @ configuration.
'    e. Click OK in each message box.
'    f. Click Save BOM to CSV.
'       Saves the BOM to c:\temp\SavedBOM.csv.
' 2. Close the Bill of Materials dialog box.
' 3. Verify that c:\temp\SavedBOM.csv is created.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile7
    Dim bom As IEdmBom
    Dim bomMgr As IEdmBomMgr2
    Dim bomView As IEdmBomView3

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                Next
            End If

             GetBOM.Enabled = True
            SaveBOM.Enabled = False

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub GetBOM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetBOM.Click
Try

Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault11)
If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

If Not IsNothing(aFile)
Then

' Get named BOMs and their
versions for the selected file
Dim derivedBOMs() As EdmBomInfo = Nothing
aFile.GetDerivedBOMs(derivedBOMs)

Dim arrSize As Integer
Dim ppoVersions() As EdmBomVersion = Nothing
Dim i As Integer = 0
Dim j As Integer = 0
Dim id As Integer
Dim str As String = ""
Dim verstr As String = ""
Dim verArrSize As Integer
Dim canSeeLayout As Boolean
Dim userID As Integer

userID = vault2.GetLoggedInWindowsUserID(vault2.Name)

arrSize = derivedBOMs.Length

While i < arrSize
id = derivedBOMs(i).mlBomID
bom = vault2.GetObject(EdmObjectType.EdmObject_BOM, id)
str = "Named BOM: " & derivedBOMs(i).mbsBomName & vbLf &
"Type of BOM as defined in EdmBomType: " & vbLf
& derivedBOMs(i).meType & vbLf & "Check-out user: " & bom.CheckOutUserID & vbLf & "Current state: " & bom.CurrentState.Name & vbLf & "Current version: " & bom.CurrentVersion & vbLf & "ID: " & bom.FileID & vbLf & "Is checked out: " & bom.IsCheckedOut
MessageBox.Show(str)
bom.GetVersions(ppoVersions)
verArrSize = ppoVersions.Length
While j < verArrSize
verstr = "BOM version: " & vbLf & "Type as defined in EdmBomVersionType: " & ppoVersions(j).meType & vbLf & "Version number: " & ppoVersions(j).mlVersion & vbLf & "Date: " & ppoVersions(j).moDate & vbLf & "Label: " & ppoVersions(j).mbsTag & vbLf & "Comment: " & ppoVersions(j).mbsComment
MessageBox.Show(verstr)
j = j + 1
End While
i = i + 1
End While

' Get a BOM view
with the specified layout
bomMgr = vault2.CreateUtility(EdmUtility.EdmUtil_BomMgr)
Dim ppoRetLayouts() As EdmBomLayout2 = Nothing
Dim ppoRetLayout As EdmBomLayout2
bomMgr.GetBomLayouts2(ppoRetLayouts)

               i = 0
               arrSize = ppoRetLayouts.Length
               str = ""
               While i < arrSize
                ppoRetLayout = ppoRetLayouts(i)

canSeeLayout = bomMgr.CanSeeBomLayout(userID, ppoRetLayout.mlLayoutID)
str = "BOM Layout " & i & ": " & vbLf & ppoRetLayout.mbsLayoutName & vbLf & "ID: " & ppoRetLayout.mlLayoutID
str = str & " Logged-in user can see this layout? "
& canSeeLayout
If ppoRetLayout.mbsLayoutName = "BOM" Then
bomView = aFile.GetComputedBOM(ppoRetLayout.mbsLayoutName, 0, "@", EdmBomFlag.EdmBf_AsBuilt + EdmBomFlag.EdmBf_ShowSelected)
End If
MessageBox.Show(str)
i = i + 1
End While

' Display BOM view
row and column information
Dim ppoRows() As Object = Nothing
Dim ppoRow As IEdmBomCell
bomView.GetRows(ppoRows)
i = 0
arrSize = ppoRows.Length
str = ""
While i < arrSize
ppoRow = ppoRows(i)
str = "BOM Row " & i & ": " & vbLf & "Item ID: " & ppoRow.GetItemID & vbLf & "Path name: " & ppoRow.GetPathName & vbLf & "Tree level: " & ppoRow.GetTreeLevel & vbLf & " Is locked? " & ppoRow.IsLocked
MessageBox.Show(str)
i = i + 1
End While

Dim ppoColumns() As EdmBomColumn = Nothing
bomView.GetColumns(ppoColumns)
i = 0
arrSize = ppoColumns.Length
str = ""
While i < arrSize
str = "BOM Column " & i & ": " & vbLf & "Header: " & ppoColumns(i).mbsCaption & vbLf & "Column type as defined in EdmBomColumnType: " & ppoColumns(i).meType & vbLf & "ID: " & ppoColumns(i).mlColumnID & vbLf & "Flags: " & ppoColumns(i).mlFlags & vbLf & "Variable ID: " & ppoColumns(i).mlVariableID & vbLf & "Variable type as defined in EdmVariableType: " & ppoColumns(i).mlVariableType & vbLf & "Column width: " & ppoColumns(i).mlWidth
MessageBox.Show(str)
i = i + 1
End While

                SaveBOM.Enabled = True

         End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Public Sub SaveBOM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveBOM.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault9)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not IsNothing(aFile) And Not IsNothing(bomView) Then
                bomView.SaveToCSV("c:\temp\SavedBOM.csv", False)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

     End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.GetBOM = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SaveBOM = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select file..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'GetBOM
        '
        Me.GetBOM.Enabled = False
        Me.GetBOM.Location = New System.Drawing.Point(40, 183)
        Me.GetBOM.Name = "GetBOM"
        Me.GetBOM.Size = New System.Drawing.Size(157, 23)
        Me.GetBOM.TabIndex = 6
        Me.GetBOM.Text = "Get BOM Info"
        Me.GetBOM.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Title = "Select File"
        '
        'SaveBOM
        '
        Me.SaveBOM.Enabled = False
        Me.SaveBOM.Location = New System.Drawing.Point(40, 234)
        Me.SaveBOM.Name = "SaveBOM"
        Me.SaveBOM.Size = New System.Drawing.Size(157, 23)
        Me.SaveBOM.TabIndex = 7
        Me.SaveBOM.Text = "Save BOM to CSV"
        Me.SaveBOM.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 305)
        Me.Controls.Add(Me.SaveBOM)
        Me.Controls.Add(Me.GetBOM)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Bill of Materials"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents GetBOM As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents SaveBOM As Button
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Access Check-in Flags in Check in Dialog Example (C#)

This example shows how to access the check-in flags in the SOLIDWORKS PDM Professional Check in dialog.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//--------------------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#, Windows, Desktop > Windows Forms Application.
//     b. Type RefItemContainerCSharp in Project name.
//     c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//     f. Click Create.

//     g. Click Show All Files in the Solution Explorer
toolbar and expand

//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. To create the form, replace the code in Form1.Designer.cs with
//        this code.
//     j. To create the class for the callback:
//        1. Right-click RefItemContainerCSharp in the Solution Explorer.
//        2. Click Add > Class.
//        3. Type Callback.cs in Name and click Add.
//        4. Replace the code in Callback.cs with this code.
//  2. Add dependencies and safely pass arrays of structures.
//  3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Access Check-in Flags in Check in Dialog dialog box.
//  2. Select a vault view.
//  3. Click Select checked-out files to check in.
//     a. Displays the Select files dialog box.
//     b. Click one or more checked-out files to check in.
//     c. Click Open.
//  4. Click Create batch check-in.
//     a. At the end of an attempted check-in, displays three message
//        boxes containing ProgressEnd called. Three operations occur for an
//        attempted check-in.
//     b. Click OK to close each message box.
//     c. Displays either:
//        * Message box containing Batch check-in created. Click OK to
//          close the message box.
//          - or -
//        * Message box containing You did not select a file to check in. Please try
//          again. Click OK to close the message box, and repeat steps 3 and 4.
//  5. Click Update check-in flags.
//  6. Click OK to close the message box.
//  7. Click Check in files.
//  8. Displays the Check in dialog box.
//  9. Click Check in to check in the files or Cancel to cancel the check in.
// 10. Displays a message box containing ProgressEnd called. Click OK to close
//     the message box.
// 11. Examine the files in the vault to verify their checked-in or checked-out status.
// 12. Close the Access Check-in Flags in Check in Dialog dialog box.
//--------------------------------------------------------------------------------------

//Form1.cs
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace RefItemContainerCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmVault8 vault = null;
        EdmSelItem[] selFiles = null;
        IEdmBatchUnlock bUnlock = null;

        void Form1_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                vault1 = new EdmVault5();
                vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = { };

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void BrowseButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Display the Select file dialog for user to
                //select the files
                EdmStrLst5 pathList = default(EdmStrLst5);
                pathList = vault.BrowseForFile(this.Handle.ToInt32(),
        (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitMultipleSel +
        (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "SOLIDWORKS files " +
        "(*.sldprt; *.sldasm; *.slddrw)|" + "*.sldprt;*.sldasm;*.slddrw|" + "All Files (*.*)|*.*||", "",
        "", vault.RootFolderPath, "Select files");

                //Exit if the user clicks Cancel
                if (pathList == null)
                    return;

                //Traverse the selected files
                IEdmPos5 pos = default(IEdmPos5);
                pos = pathList.GetHeadPosition();

                //Convert the selected files to an
                //array of EdmSelItem structs
                int nbrFiles = 0;
                nbrFiles = pathList.Count;
                Array.Resize(ref selFiles, nbrFiles);

                int i = 0;
                while (!pos.IsNull)
                {
                    //Get each file path from the selected files list
                    string filePath = null;
                    IEdmFile5 file = default(IEdmFile5);
                    IEdmFolder5 retFolder = default(IEdmFolder5);
                    filePath = pathList.GetNext(pos);
                    file = vault.GetFileFromPath(filePath, out retFolder);
                    selFiles[i].mlDocID = file.ID;
                    selFiles[i].mlProjID = retFolder.ID;
                    i = i + 1;
                }

            }catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void CreateBatchCheckinButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmVault7 vault2 = (IEdmVault7)vault1;
                bUnlock = (IEdmBatchUnlock)vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock);
                bUnlock.AddSelection((EdmVault5)vault1, ref selFiles);
                bool tree = false;
           Callback myCallback = new Callback();
                tree = bUnlock.CreateTree(this.Handle.ToInt32(), (int)EdmUnlockBuildTreeFlags.Eubtf_MayUnlock, myCallback);
                if (tree == false)
                {
                    MessageBox.Show("You did not select a file to check in. Please try again.");
                    return;
                }

                MessageBox.Show("Batch check in created.");

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void UpdateBatchCheckInButton_Click(object sender, EventArgs e)
        {
             try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                    IEdmRefItemContainer container = null;
                    container = (IEdmRefItemContainer)bUnlock;
                    object[] items = null;
                    IEdmRefItem theItem = null;
                    container.GetItems(EdmRefItemType.Edmrit_All, out items);
                    int j = 0;
                    while (j < items.Length)
                    {
                        IEdmRefItem aItem = null;
                        theItem = (IEdmRefItem)items[j];
                        aItem = theItem;
                        object value = null;
                        aItem.SetProperty(EdmRefItemProperty.Edmrip_CheckKeepLocked, value);
                        j = j + 1;
                    }

                    MessageBox.Show("Check-in flags updated.");
             }

            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void CheckInButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if (bUnlock.ShowDlg(this.Handle.ToInt32()))
                {
                    Callback myCallback = new Callback();
                    bUnlock.UnlockFiles(this.Handle.ToInt32(), myCallback);
                }
            }

            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

     }
}
Back to top
//Form1.Designer.cs
namespace RefItemContainerCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.CreateBatchCheckinButton = new System.Windows.Forms.Button();
            this.UpdateBatchCheckInButton = new System.Windows.Forms.Button();
            this.CheckInButton = new System.Windows.Forms.Button();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(24, 29);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(27, 45);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(187, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // CreateBatchCheckinButton
            //
            this.CreateBatchCheckinButton.Location = new System.Drawing.Point(27, 122);
            this.CreateBatchCheckinButton.Name = "CreateBatchCheckinButton";
            this.CreateBatchCheckinButton.Size = new System.Drawing.Size(125, 23);
            this.CreateBatchCheckinButton.TabIndex = 4;
            this.CreateBatchCheckinButton.Text = "Create batch check-in";
            this.CreateBatchCheckinButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.CreateBatchCheckinButton.UseVisualStyleBackColor = true;
            this.CreateBatchCheckinButton.Click += new System.EventHandler(this.CreateBatchCheckinButton_Click);
            //
            // UpdateBatchCheckInButton
            //
            this.UpdateBatchCheckInButton.Location = new System.Drawing.Point(27, 164);
            this.UpdateBatchCheckInButton.Name = "UpdateBatchCheckInButton";
            this.UpdateBatchCheckInButton.Size = new System.Drawing.Size(125, 23);
            this.UpdateBatchCheckInButton.TabIndex = 5;
            this.UpdateBatchCheckInButton.Text = "Update check-in flags";
            this.UpdateBatchCheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.UpdateBatchCheckInButton.UseVisualStyleBackColor = true;
            this.UpdateBatchCheckInButton.Click += new System.EventHandler(this.UpdateBatchCheckInButton_Click);
            //
            // CheckInButton
            //
            this.CheckInButton.Location = new System.Drawing.Point(27, 209);
            this.CheckInButton.Name = "CheckInButton";
            this.CheckInButton.Size = new System.Drawing.Size(125, 23);
            this.CheckInButton.TabIndex = 6;
            this.CheckInButton.Text = "Check in files";
            this.CheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.CheckInButton.UseVisualStyleBackColor = true;
            this.CheckInButton.Click += new System.EventHandler(this.CheckInButton_Click);
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(27, 82);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(125, 23);
            this.BrowseButton.TabIndex = 7;
            this.BrowseButton.Text = "Select checked-out files to check in";
            this.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(384, 254);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.CheckInButton);
            this.Controls.Add(this.UpdateBatchCheckInButton);
            this.Controls.Add(this.CreateBatchCheckinButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Access Check-in Flags in Check in Dialog";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button CreateBatchCheckinButton;
        private System.Windows.Forms.Button UpdateBatchCheckInButton;
        private System.Windows.Forms.Button CheckInButton;
        private System.Windows.Forms.Button BrowseButton;
    }
}
Back to top
//Callback.cs
using EPDM.Interop.epdm;
using System.Windows.Forms;

namespace RefItemContainerCSharp
{
    class Callback : IEdmUnlockOpCallback
    {
        #region IEdmUnlockOpCallback Members
        public EdmUnlockOpReply MsgBox(EdmUnlockOpMsg mssge, int docId, int projID, string path, ref EdmUnlockErrInfo err)
        {
            return EdmUnlockOpReply.Euor_OK;
        }

        public void ProgressBegin(EdmProgressType type, EdmUnlockEvent events, int steps)
        {
            return;
        }

        public void ProgressEnd(EdmProgressType type)
        {
            //Demonstrates callback
            MessageBox.Show("ProgressEnd called.");
            return;
        }

        public bool ProgressStep(EdmProgressType type, string msgText, int progressPos)
        {
            return true;
        }

        public bool ProgressStepEvent(EdmProgressType type, EdmUnlockEventMsg opText, int progressPos)
        {
            return true;
        }

        #endregion

    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Access Check-in Flags in Check in Dialog Example (VB.NET)

This example shows how to access the check-in flags in the SOLIDWORKS PDM Check in dialog.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'--------------------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type RefItemContainerVBNET in Project name.
'     c. For Location, click ... and navigate to the folder where to
create the project.
'     d. Click Next.
'     e. Select Framework.
'     f. Click Create.

'     g. Click Show All Files in the Solution Explorer toolbar and expand

'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'     j. To create the class for the callback:
'        1. Right-click RefItemContainerVBNET in the Solution Explorer.
'        2. Click Add > Class.
'        3. Type Callback.vb in Name and click Add.
'        4. Replace the code in Callback.vb with this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Access Check-in Flags in Check in Dialog dialog box.
'  2. Select a vault view.
'  3. Click Select checked-out files to check in.
'     a. Displays the Select files dialog box.
'     b. Click one or more checked-out files to check in.
'     c. Click Open.
'  4. Click Create batch check-in.
'     a. At the end of an attempted check-in, displays three message
'        boxes containing ProgressEnd called. Three operations occur for an
'        attempted check-in.
'     b. Click OK to close each message box.
'     c. Displays either:
'        * Message box containing Batch check-in created. Click OK to
'          close the message box.
'          - or -
'        * Message box containing You did not select a file to check in. Please try
'          again. Click OK to close the message box, and repeat steps 3 and 4.
'  5. Click Update check-in flags.
'  6. Click OK to close the message box.
'  7. Click Check in files.
'  8. Displays the Check in dialog box.
'  9. Click Check in to check in the files or Cancel to cancel the check in.
' 10. Displays a message box containing ProgressEnd called. Click OK to close
'     the message box.
' 11. Examine the files in the vault to verify their checked-in or checked-out status.
' 12. Close the Access Check-in Flags in Check in Dialog dialog box.
'--------------------------------------------------------------------------------------

'Form1.vb
Imports System.Windows.Forms
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Private vault As IEdmVault8 = Nothing
    Private selFiles As EdmSelItem() = Nothing
    Private bUnlock As IEdmBatchUnlock = Nothing
    Private pathList As EdmStrLst5 = Nothing
    Private pos As IEdmPos5 = Nothing
    Private UnlockCallback As MyCallback

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault1 = New EdmVault5()
            vault = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = {}

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub BrowseButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BrowseButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Display the Select file dialog for user to
            'select the files
            Dim pathList As EdmStrLst5 = Nothing
            pathList = vault.BrowseForFile(Me.Handle.ToInt32(), _
                        CInt(EdmBrowseFlag.EdmBws_ForOpen) + CInt(EdmBrowseFlag.EdmBws_PermitMultipleSel) + _
                        CInt(EdmBrowseFlag.EdmBws_PermitVaultFiles), "SOLIDWORKS files " + _
                        "(*.sldprt; *.sldasm; *.slddrw)|" + "*.sldprt;*.sldasm;*.slddrw|" + _
                        "All Files (*.*)|*.*||", "", "", vault.RootFolderPath, _
             "Select files")

            'Exit if the user clicks Cancel
            If pathList Is Nothing Then
                Return
            End If

            'Traverse the selected files
            Dim pos As IEdmPos5 = Nothing
            pos = pathList.GetHeadPosition()

            'Convert the selected files to an
            'array of EdmSelItem structs
            Dim nbrFiles As Integer = 0
            nbrFiles = pathList.Count
            Array.Resize(selFiles, nbrFiles)

            Dim i As Integer = 0
            While Not pos.IsNull
                'Get each file path from the selected files list
                Dim filePath As String = Nothing
                Dim file As IEdmFile5 = Nothing
                Dim retFolder As IEdmFolder5 = Nothing
                filePath = pathList.GetNext(pos)
                file = vault.GetFileFromPath(filePath, retFolder)
                selFiles(i).mlDocID = file.ID
                selFiles(i).mlProjID = retFolder.ID
                i = i + 1

            End While
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub CreateBatchCheckinButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CreateBatchCheckinButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim vault2 As IEdmVault7 = DirectCast(vault1, IEdmVault7)
            bUnlock = DirectCast(vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock), IEdmBatchUnlock)
            bUnlock.AddSelection(DirectCast(vault1, EdmVault5), selFiles)
            Dim tree As Boolean = False
            Dim UnlockCallback = New MyCallback
            tree = bUnlock.CreateTree(Me.Handle.ToInt32(), CInt(EdmUnlockBuildTreeFlags.Eubtf_MayUnlock), _
                    UnlockCallback)
            If tree = False Then
                MessageBox.Show("You did not select a file to check in. Please try again.")
                Return
            End If

            MessageBox.Show("Batch check in created.")
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub UpdateBatchCheckInButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles UpdateBatchCheckInButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            Dim container As IEdmRefItemContainer = Nothing
            container = DirectCast(bUnlock, IEdmRefItemContainer)
            Dim items As Object() = Nothing
            Dim theItem As IEdmRefItem = Nothing
            container.GetItems(EdmRefItemType.Edmrit_All, items)
            Dim j As Integer = 0
            While j < items.Length
                Dim aItem As IEdmRefItem = Nothing
                theItem = DirectCast(items(j), IEdmRefItem)
                aItem = theItem
                Dim value As Object = Nothing
                aItem.SetProperty(EdmRefItemProperty.Edmrip_CheckKeepLocked, value)
                j = j + 1
            End While

            MessageBox.Show("Check-in flags updated.")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub CheckInButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CheckInButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            Dim UnlockCallback = New MyCallback
            If bUnlock.ShowDlg(Me.Handle.ToInt32()) Then
                bUnlock.UnlockFiles(Me.Handle.ToInt32(), UnlockCallback)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Desgner.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.CreateBatchCheckinButton = New System.Windows.Forms.Button()
        Me.UpdateBatchCheckInButton = New System.Windows.Forms.Button()
        Me.CheckInButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(22, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select view vault:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(25, 54)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(199, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(25, 81)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(199, 23)
        Me.BrowseButton.TabIndex = 2
        Me.BrowseButton.Text = "Select checked-out files to check in"
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'CreateBatchCheckinButton
        '
        Me.CreateBatchCheckinButton.Location = New System.Drawing.Point(25, 110)
        Me.CreateBatchCheckinButton.Name = "CreateBatchCheckinButton"
        Me.CreateBatchCheckinButton.Size = New System.Drawing.Size(199, 23)
        Me.CreateBatchCheckinButton.TabIndex = 3
        Me.CreateBatchCheckinButton.Text = "Create batch check-in"
        Me.CreateBatchCheckinButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.CreateBatchCheckinButton.UseVisualStyleBackColor = True
        '
        'UpdateBatchCheckInButton
        '
        Me.UpdateBatchCheckInButton.Location = New System.Drawing.Point(25, 139)
        Me.UpdateBatchCheckInButton.Name = "UpdateBatchCheckInButton"
        Me.UpdateBatchCheckInButton.Size = New System.Drawing.Size(199, 23)
        Me.UpdateBatchCheckInButton.TabIndex = 4
        Me.UpdateBatchCheckInButton.Text = "Update check-in flags"
        Me.UpdateBatchCheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.UpdateBatchCheckInButton.UseVisualStyleBackColor = True
        '
        'CheckInButton
        '
        Me.CheckInButton.Location = New System.Drawing.Point(25, 168)
        Me.CheckInButton.Name = "CheckInButton"
        Me.CheckInButton.Size = New System.Drawing.Size(199, 23)
        Me.CheckInButton.TabIndex = 5
        Me.CheckInButton.Text = "Check in files"
        Me.CheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.CheckInButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(355, 222)
        Me.Controls.Add(Me.CheckInButton)
        Me.Controls.Add(Me.UpdateBatchCheckInButton)
        Me.Controls.Add(Me.CreateBatchCheckinButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Access Check-in Flags in Check in Dialog"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents CreateBatchCheckinButton As System.Windows.Forms.Button
    Friend WithEvents UpdateBatchCheckInButton As System.Windows.Forms.Button
    Friend WithEvents CheckInButton As System.Windows.Forms.Button

End Class
Back to top
'Callback.vb
Imports EPDM.Interop.epdm

Public Class MyCallback
    Implements IEdmUnlockOpCallback

    Public Function MsgBox(ByVal eMsg As EPDM.Interop.epdm.EdmUnlockOpMsg, ByVal lDocID As Integer, ByVal lProjID As Integer, ByVal bsPath As String, ByRef poError As EPDM.Interop.epdm.EdmUnlockErrInfo) As EPDM.Interop.epdm.EdmUnlockOpReply Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.MsgBox
        Return EdmUnlockOpReply.Euor_OK
    End Function

    Public Sub ProgressBegin(ByVal eType As EPDM.Interop.epdm.EdmProgressType, ByVal eEvent As EPDM.Interop.epdm.EdmUnlockEvent, ByVal lSteps As Integer) Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressBegin

    End Sub

    Public Sub ProgressEnd(ByVal eType As EPDM.Interop.epdm.EdmProgressType) Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressEnd
        'Demonstrates callback
        MessageBox.Show("ProgressEnd called.")
        Return
    End Sub

    Public Function ProgressStep(ByVal eType As EPDM.Interop.epdm.EdmProgressType, ByVal bsText As String, ByVal lProgressPos As Integer) As Boolean Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressStep
        Return True
    End Function

    Public Function ProgressStepEvent(ByVal eType As EPDM.Interop.epdm.EdmProgressType, ByVal eText As EPDM.Interop.epdm.EdmUnlockEventMsg, ByVal lProgressPos As Integer) As Boolean Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressStepEvent
        Return True
    End Function
End Class
Back to top


SOLIDWORKS PDM Professional API Help

Access Custom File References Example (C#)

This example shows how to access custom file references.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Desktop, Windows > Windows Forms Application.
//    b. Type AccessCustRef_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d.
Click Next.
//    e. Select Framework.
//
f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    f. Replace the code in Form1.cs with this code.
//    g. To create the form,
replace the code in Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and safely pass arrays of structures.
// 3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays
the Add custom file reference dialog box.
//
a. Select a vault view.
//
b. Click Browse for two files.
//
1. Locate and click two files in the root
folder of the vault.
//
2. Click Open.
//       3. Checks out the first file.
//    c. Click Add custom file reference.
//    d. Click OK to close each
message box.
// 2. Close the Add custom file reference dialog.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace AccessCustRefs_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;
IEdmEnumeratorCustomReference7 addCustRefs;
IEdmFile5 file1 = null;
IEdmFile5 file2 = null;

IEdmFolder5 parentFolder = null;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BrowseButton_Click(System.Object sender, System.EventArgs e)
{
try
{
CustRefListBox.Items.Clear();

if (vault1 == null)
{
vault1 = new EdmVault5();
}
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Open dialog
CustRefOpenFileDialog.InitialDirectory = vault1.RootFolderPath;
//Show the Open dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = CustRefOpenFileDialog.ShowDialog();
//If the user didn't click Open, exit
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

foreach (string FileName in CustRefOpenFileDialog.FileNames)
{
CustRefListBox.Items.Add(FileName);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void AddCustomFileReference_Click(System.Object sender, System.EventArgs e)
{
try
{

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Get the two selected files
file1 = vault2.GetFileFromPath(CustRefListBox.Items[0].ToString(), out parentFolder);
file2 = vault2.GetFileFromPath(CustRefListBox.Items[1].ToString(), out parentFolder);

//Check out the first file
if (!file1.IsLocked)
{
file1.LockFile(parentFolder.ID, this.Handle.ToInt32(), Convert.ToInt32(EdmLockFlag.EdmLock_Simple));
}

//Add the second file as a custom reference to the first
file
addCustRefs = (IEdmEnumeratorCustomReference7)file1;
addCustRefs.AddReference3(file2.ID, parentFolder.ID, 1, true);
MessageBox.Show(file2.Name + " added as reference to " + file1.Name);
bool shownInBOM;
shownInBOM = addCustRefs.GetShowInBOM(file2.ID, parentFolder.ID);
MessageBox.Show(file2.Name
+ " shown in BOM? " + shownInBOM);

//Check in the first file
file1.UnlockFile(this.Handle.ToInt32(), "Custom reference added");

//Display all of the custom references of the first file
ShowFileRefs();

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void ShowFileRefs()
{
try
{
IEdmEnumeratorCustomReference6 enumRef = default(IEdmEnumeratorCustomReference6);
enumRef = (IEdmEnumeratorCustomReference6)file1;
IEdmPos5 pos = default(IEdmPos5);
pos = enumRef.GetFirstRefPosition();
int fileID = 0;
int folderID = 0;
string message = null;
int quant = 1;
string pbsRetPath = "";
message = "Custom references of " + file1.Name + ":" + "\r\n";
while (!pos.IsNull)
{
enumRef.GetNextRef2(pos, out fileID, out folderID, out pbsRetPath, out quant);
message = message + pbsRetPath + " (fileID=" + fileID.ToString() + ", folderID=" + folderID.ToString() + ", quantity=" + quant.ToString() + ")" + "\r\n";
}
MessageBox.Show(message);
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\r\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Back to top

//Form1.Designer.cs

namespace AccessCustRefs_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.CustRefListBox = new System.Windows.Forms.ListBox();
            this.AddCustomFileReference = new System.Windows.Forms.Button();
            this.CustRefOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 78);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(146, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse for two files...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click +=new System.EventHandler(BrowseButton_Click);
            //
            //CustRefListBox
            //
            this.CustRefListBox.FormattingEnabled = true;
            this.CustRefListBox.HorizontalScrollbar = true;
            this.CustRefListBox.Location = new System.Drawing.Point(16, 107);
            this.CustRefListBox.Name = "CustRefListBox";
            this.CustRefListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.CustRefListBox.Size = new System.Drawing.Size(259, 56);
            this.CustRefListBox.TabIndex = 4;
            //
            //AddCustomFileReference
            //
            this.AddCustomFileReference.Location = new System.Drawing.Point(68, 175);
            this.AddCustomFileReference.Name = "AddCustomFileReference";
            this.AddCustomFileReference.Size = new System.Drawing.Size(150, 23);
            this.AddCustomFileReference.TabIndex = 5;
            this.AddCustomFileReference.Text = "Add custom file reference";
            this.AddCustomFileReference.UseVisualStyleBackColor = true;
            this.AddCustomFileReference.Click +=new System.EventHandler(AddCustomFileReference_Click);
            //
            //CustRefOpenFileDialog
            //
            this.CustRefOpenFileDialog.Multiselect = true;
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(287, 222);
            this.Controls.Add(this.AddCustomFileReference);
            this.Controls.Add(this.CustRefListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add custom file reference";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox CustRefListBox;
        internal System.Windows.Forms.Button AddCustomFileReference;
        internal System.Windows.Forms.OpenFileDialog CustRefOpenFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Access Custom File References Example (VB.NET)

This example shows how to access custom file references.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type AccessCustRef in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Add custom file reference dialog box.
'    a. Select a vault view.
'    b. Click Browse for two files.
'       1. Locate and click two files in the root folder of the vault.
'       2. Click Open.
'       3. Checks out the first file.
'    c. Click Add custom file reference.
'    d. Click OK to close each message box.
' 2. Close the Add custom file reference dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim addCustRefs As IEdmEnumeratorCustomReference7
    Dim file1 As IEdmFile5 = Nothing
    Dim file2 As IEdmFile5 = Nothing
    Dim parentFolder As IEdmFolder5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            CustRefListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Open dialog
            CustRefOpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = CustRefOpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In CustRefOpenFileDialog.FileNames
                CustRefListBox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddCustomFileReference_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddCustomFileReference.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Get the two selected files
            file1 = vault2.GetFileFromPath(CustRefListBox.Items(0), parentFolder)
            file2 = vault2.GetFileFromPath(CustRefListBox.Items(1), parentFolder)

            'Check out the first file
            If Not file1.IsLocked Then
                file1.LockFile(parentFolder.ID, Me.Handle.ToInt32(), CInt(EdmLockFlag.EdmLock_Simple))
            End If

            'Add the second file as a custom reference to the first file
            addCustRefs = file1
            addCustRefs.AddReference3(file2.ID, parentFolder.ID, 1, True)
            MessageBox.Show(file2.Name & " added as reference to " & file1.Name)
            Dim shownInBOM As Boolean
            shownInBOM = addCustRefs.GetShowInBOM(file2.ID, parentFolder.ID)
            MessageBox.Show(file2.Name & " shown in BOM? " & shownInBOM

            'Check in the first file
            file1.UnlockFile(Me.Handle.ToInt32(), "Custom reference added")

            'Display all of the custom references of the first file
            ShowFileRefs()

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub ShowFileRefs()
        Try
            Dim enumRef As IEdmEnumeratorCustomReference6
            enumRef = file1
            Dim pos As IEdmPos5
            pos = enumRef.GetFirstRefPosition
            Dim fileID As Integer
            Dim folderID As Integer
            Dim message As String
            Dim quant As Integer = 1
            Dim pbsRetPath As String = ""
            message = "Custom references of " + file1.Name + ":" + vbLf
            While Not pos.IsNull
                enumRef.GetNextRef2(pos, fileID, folderID, pbsRetPath, quant)
                message = message + pbsRetPath + " (fileID=" + Str(fileID) + ", folderID=" + Str(folderID) + ", quantity=" + Str(quant) + ")" + vbLf
            End While
            MsgBox(message)
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    Private components As System.ComponentModel.IContainer = Nothing

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.CustRefListBox = New System.Windows.Forms.ListBox()
        Me.AddCustomFileReference = New System.Windows.Forms.Button()
        Me.CustRefOpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 78)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(146, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse for two files..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'CustRefListBox
        '
        Me.CustRefListBox.FormattingEnabled = True
        Me.CustRefListBox.HorizontalScrollbar = True
        Me.CustRefListBox.Location = New System.Drawing.Point(16, 107)
        Me.CustRefListBox.Name = "CustRefListBox"
        Me.CustRefListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.CustRefListBox.Size = New System.Drawing.Size(259, 56)
        Me.CustRefListBox.TabIndex = 4
        '
        'AddCustomFileReference
        '
        Me.AddCustomFileReference.Location = New System.Drawing.Point(68, 175)
        Me.AddCustomFileReference.Name = "AddCustomFileReference"
        Me.AddCustomFileReference.Size = New System.Drawing.Size(150, 23)
        Me.AddCustomFileReference.TabIndex = 5
        Me.AddCustomFileReference.Text = "Add custom file reference"
        Me.AddCustomFileReference.UseVisualStyleBackColor = True
        '
        'CustRefOpenFileDialog
        '
        Me.CustRefOpenFileDialog.Multiselect = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(287, 222)
        Me.Controls.Add(Me.AddCustomFileReference)
        Me.Controls.Add(Me.CustRefListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add custom file reference"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents CustRefListBox As System.Windows.Forms.ListBox
    Friend WithEvents AddCustomFileReference As System.Windows.Forms.Button
    Friend WithEvents CustRefOpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Access File Card Variables Example (C#)

This example shows how to access file card variables.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > Visual
C#, Desktop, Windows > Windows Forms Application.
//    b. Type CardVars_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d.
Click Next.
//    e. Select Framework.
//
f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1.
Displays the Access file variables dialog box.
//
a. Select a vault view.
//
b. Click Browse.
//
1. Locate and click a file in the vault.
//       2. Click Open.
//    c. Click Get variables.
//       1. Checks out the selected file to the
root folder of the vault.
//       2. Displays a message box with all of the
card variables that can be
//          updated for the selected file
in configuration, @.
//    d. Click OK.
//    e. Undoes the check-out of the selected
file.
// 2. Close the Access
file variables dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CardVars_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ListBox.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Open dialog
                OpenFileDialog.InitialDirectory = vault1.RootFolderPath;
                //Show the Open dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog.ShowDialog();
                //If the user didn't click Open, exit
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                foreach (string FileName in OpenFileDialog.FileNames)
                {
                    ListBox.Items.Add(FileName);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetVars_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmFile5 aFile = default(IEdmFile5);
                IEdmFolder5 ppoRetParentFolder = null;
                aFile = vault2.GetFileFromPath(ListBox.Items[0].ToString(), out ppoRetParentFolder);

                //Get card variables only from a file checked into the vault
                if (!aFile.IsLocked)
                {
                    aFile.LockFile(ppoRetParentFolder.ID, this.Handle.ToInt32(), (int)EdmLockFlag.EdmLock_Simple);

                    IEdmEnumeratorVariable5 varEnum = default(IEdmEnumeratorVariable5);
                    varEnum = aFile.GetEnumeratorVariable();

                    object[] valueList = null;
                    varEnum.GetUpdateVars(aFile.LockedInFolderID, out valueList);

                    int idx = 0;
                    idx = Information.LBound(valueList);
                    int upper = 0;
                    upper = Information.UBound(valueList);

                    string msg = null;
                    msg = "Card variables for " + aFile.Name + " in configuration, @:" + "\n" + "\n";

                    IEdmVariableMgr5 varMgr = default(IEdmVariableMgr5);
                    varMgr = (IEdmVariableMgr5)aFile.Vault;

                    IEdmVariable5 var = default(IEdmVariable5);
                    IEdmVariableValue6 value = default(IEdmVariableValue6);
                    while (idx <= upper)
                    {
                        value = (IEdmVariableValue6)valueList[idx];
                        idx = idx + 1;
                        var = varMgr.GetVariable(value.VariableID);
                        msg = msg + value.VariableName + " = > " + value.GetValue("@").ToString() + "\n";
                        msg = msg + "EdmVariableFlags: " + var.Flags + ", EdmVariableType: " + var.VariableType + "\n" + "\n";

                    }

                    MessageBox.Show(msg);

                    aFile.UndoLockFile(this.Handle.ToInt32());
                }
                else
                {
                    //User selected a checked-out file
                    MessageBox.Show("Please select a checked-in file.");
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace CardVars_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.GetVars = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 85);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(98, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.Size = new System.Drawing.Size(259, 43);
            this.ListBox.TabIndex = 4;
            //
            // GetVars
            //
            this.GetVars.Location = new System.Drawing.Point(84, 178);
            this.GetVars.Name = "GetVars";
            this.GetVars.Size = new System.Drawing.Size(98, 23);
            this.GetVars.TabIndex = 5;
            this.GetVars.Text = "Get variables";
            this.GetVars.UseVisualStyleBackColor = true;
            this.GetVars.Click +=new System.EventHandler(GetVars_Click);
            //
            // OpenFileDialog
            //
            this.OpenFileDialog.Title = "Open";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 215);
            this.Controls.Add(this.GetVars);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Access file variables";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button GetVars;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Access File Card Variables Example (VB.NET)

This example shows how to access file card variables.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Desktop, Windows > Windows Forms Application.
'    b. Type CardVars in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Access file variables dialog box.
'    a. Select a vault view.
'    b. Click Browse.
'       1. Locate and click a file in the vault.
'       2. Click Open.
'    c. Click Get variables.
'       1. Checks out the selected file in the root folder of the vault.
'       2. Displays a message box with all of the card variables that can be
'          updated for the selected file in configuration, @.
'    d. Click OK.
'    e. Undoes the check-out of the selected file.
' 2. Close the Access file variables dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            ListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Open dialog
            OpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In OpenFileDialog.FileNames
                ListBox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetVars_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetVars.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

Dim parentFolder As
IEdmFolder5 = Nothing
Dim aFile As IEdmFile5
= Nothing
aFile = vault2.GetFileFromPath(ListBox.Items(0).ToString(),
parentFolder)

'Get card variables only from a file checked into the vault
If Not aFile.IsLocked Then
aFile.LockFile(parentFolder.ID, Me.Handle.ToInt32(), EdmLockFlag.EdmLock_Simple)

Dim varEnum As IEdmEnumeratorVariable5
varEnum = aFile.GetEnumeratorVariable

Dim valueList() As Object = Nothing
varEnum.GetUpdateVars(aFile.LockedInFolderID, valueList)

Dim idx As Integer
idx = LBound(valueList)
Dim upper As Integer
upper = UBound(valueList)

Dim msg As String
msg = "Card variables for " & aFile.Name & " in configuration, @:" & vbLf & vbLf

Dim varMgr As IEdmVariableMgr5
varMgr = aFile.Vault

Dim var As IEdmVariable5
Dim value As IEdmVariableValue6
While idx <= upper
value = valueList(idx)
idx = idx + 1
var = varMgr.GetVariable(value.VariableID)
msg = msg & value.VariableName & " = > " & value.GetValue("@").ToString() & vbLf
msg = msg & "EdmVariableFlags: " & var.Flags & ", EdmVariableType: " & var.VariableType & vbLf & vbLf
'msg = msg & "EdmVariableFlags: " & value.VariableFlags & ", EdmVariableType: " & value.VariableType & vbLf & vbLf
End While

MessageBox.Show(msg)

aFile.UndoLockFile(Me.Handle.ToInt32())
Else
'User selected a checked-out file
MessageBox.Show("Please select a checked-in file.")
End If

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.GetVars = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 85)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(98, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.Size = New System.Drawing.Size(259, 43)
        Me.ListBox.TabIndex = 4
        '
        'GetVars
        '
        Me.GetVars.Location = New System.Drawing.Point(84, 178)
        Me.GetVars.Name = "GetVars"
        Me.GetVars.Size = New System.Drawing.Size(98, 23)
        Me.GetVars.TabIndex = 5
        Me.GetVars.Text = "Get variables"
        Me.GetVars.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Title = "Open"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 215)
        Me.Controls.Add(Me.GetVars)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Access file variables"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents GetVars As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Add and Remove User and Group from Folder Example (C#)

This example shows how to:
  • add and remove users to and from a vault.
  • add a user of a group to a folder in a vault.
  • remove a user of a group from a folder and from a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//--------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#, Desktop, Windows > Windows Forms Application.
//     b. Type AddRemoveUsersGroupsCSharp in Project name.
//     c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//     f. Click Create.

//     g. Click Show All Files in the Solution Explorer
toolbar and expand

//       Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. To create the form, replace the code in Form1.Designer.cs with
//        this code.
//  2. Add dependencies and safely pass arrays of structures.
//  3. Ensure that the following folder and group exist in the targeted vault:
//     * Folder in the vault root named Test.
//     * Group named Management.
//  4. Click Debug > Start Debugging or press F5.
//
//Postconditions:
// 1. Displays a dialog.
// 2. Select a vault.
// 3. Perform these user actions. Click OK to close each message box.
//    a. Click Traverse users.
//       Displays a message box showing the users in the vault.
//    b. Click Add users.
//       Displays a message box informing you that rrabbit
//       and efudd were added as users to the vault.
//    c. Click Traverse users to verify that rrabbit and efudd
//       were added to the vault.
//       Displays a message box showing the users in the vault.
//    d. Click Remove user.
//       Displays a message box informing you that rrabbit was
//       removed from the vault.
//    e. Click Traverse users to verify that rrabbit was removed
//       from the vault.
//       Displays a message box showing the users in the vault.
// 4. Perform these group actions. Click OK to close each message box.
//    a. Click Traverse groups.
//       Displays a message box showing the groups in the vault.
//    b. Click Traverse group members.
//       Displays a message box showing the users in the groups
//       in the vault.
//    c. Click Add group member.
//       Displays a message box informing you that efudd
//       was added to the Management group.
//    d. Click Traverse group members to verify that
//       efudd is shown in the Management group.
//       Displays a message box showing the users in the groups
//       in the vault.
//    e. Click Add group member to folder.
//       Displays a message box informing you that efudd in
//       the Management group was added to the Test folder.
//    f. To verify the previous step:
//       1. Open a File Explorer window.
//       2. Right-click the Test folder in the selected vault
//          and click Properties to open the Test Properties
//          dialog box.
//       3. Click Group Memberships.
//       4. Click Management to verify that efudd is selected.
//       5. Click OK to close the Test Properties dialog box.
//    g. Click Remove group member and user.
//       Displays a message box informing you that efudd was
//       removed from the vault.
//    h. Click Traverse group members to verify that
//       efudd was removed from the Management group.
//       Displays a message box showing the users in the
//       groups in the vault.
//    i. Click Traverse users to verify that efudd was
//       removed as a user from the vault.
//       Displays a message box showing the users in the vault.
// 5. Close the dialog.
//    Sends two SOLIDWORKS PDM Professional messages
//    to logged-in users and group members who have
//    permission to update users and groups.
// 6. To open these messages, click:
//    * the SOLIDWORKS PDM Professional tray icon.
//     - or -
//    * Tools > Inbox in File Explorer.
//--------------------------------------------------------------------
//Form1.cs

using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace AddRemoveUsersGroupsCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
            IEdmVault8 vault;
            EdmVault5 vault1;
            EdmUserData2[] UserData = new EdmUserData2[2];
            IEdmUserMgr10 UsrMgr;
            IEdmUser9 user;
            IEdmUserGroup8 mngmtGroup;
            EdmMemberFolder[] folderMembers = new EdmMemberFolder[1];

    private void AddRemoveUsersGroupsCSharp_Load(System.Object sender, System.EventArgs e)
    {

        vault1 = new EdmVault5();
        vault = (IEdmVault8)vault1;
        EdmViewInfo[] Views = {};

        vault.GetVaultViews(out Views, false);
        VaultsComboBox.Items.Clear();
        foreach (EdmViewInfo View in Views) {
            VaultsComboBox.Items.Add(View.mbsVaultName);
        }
        if (VaultsComboBox.Items.Count > 0) {
            VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
        }
    }

    private void TraverseUsersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {

            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            UsrMgr = (IEdmUserMgr10)vault;

            //Traverse users
            string Users = "";
            IEdmPos5 UserPos = default(IEdmPos5);
            UserPos = UsrMgr.GetFirstUserPosition();
            while (!UserPos.IsNull) {
                user = (IEdmUser9)UsrMgr.GetNextUser(UserPos);
                Users = Users + user.Name + "\n";
            }
            MessageBox.Show(Users, vault.Name + " Vault Users", MessageBoxButtons.OK, MessageBoxIcon.Information);

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

    private void TraverseGroupsButton_Click(System.Object sender, System.EventArgs e)
    {
        try {

            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            UsrMgr = (IEdmUserMgr10)vault;

            //Traverse groups
            string Groups = "";
            IEdmPos5 UserGroupPos = default(IEdmPos5);
            UserGroupPos = UsrMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull) {
                mngmtGroup = (IEdmUserGroup8)UsrMgr.GetNextUserGroup(UserGroupPos);
                Groups = Groups + mngmtGroup.Name + "\n";
            }
            MessageBox.Show(Groups, vault.Name + " Vault Groups", MessageBoxButtons.OK, MessageBoxIcon.Information);

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

    private void TraverseGroupMembersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {

            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            UsrMgr = (IEdmUserMgr10)vault;

            //Traverse group members
            string Groups = "";
            IEdmPos5 UserGroupPos = default(IEdmPos5);
            UserGroupPos = UsrMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull)
            {
                mngmtGroup = (IEdmUserGroup8)UsrMgr.GetNextUserGroup(UserGroupPos);
                Groups = Groups + mngmtGroup.Name + " Members:" + "\n";
                Groups = Groups + GetMembers(mngmtGroup);
            }
            MessageBox.Show(Groups, vault.Name + " Vault Group Users", MessageBoxButtons.OK, MessageBoxIcon.Information);

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

    private string GetMembers(IEdmUserGroup8 UserGroup)
    {
        string functionReturnValue = null;
        try {

            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            //Get group members
            functionReturnValue = "";
            string Users = "";
            IEdmPos5 UserPos = default(IEdmPos5);
            UserPos = UserGroup.GetFirstUserPosition();
            while (!UserPos.IsNull) {
                user = (IEdmUser9)UserGroup.GetNextUser(UserPos);
                Users = Users + " " + user.Name + "\n";
            }
            functionReturnValue = Users;

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
        return functionReturnValue;

    }

    private void AddUsersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {
            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            UsrMgr = (IEdmUserMgr10)vault;

            //Add users to EdmUserData2
            UserData[0].mbsCompleteName = "Roger Rabbit";
            UserData[0].mbsEmail = "rrabbit@animatedcharacters.com";
            UserData[0].mbsInitials = "RR";
            UserData[0].mbsUserName = "rrabbit";

            UserData[1].mbsCompleteName = "Elmer J. Fudd";
            UserData[1].mbsEmail = "efudd@animatedcharacters.com";
            UserData[1].mbsInitials = "EJF";
            UserData[1].mbsUserName = "efudd";

            //Return user's interface in mpoUser
            UserData[0].mlFlags = (int)EdmUserDataFlags.Edmudf_GetInterface;
            UserData[1].mlFlags = (int)EdmUserDataFlags.Edmudf_GetInterface;

            //Add these users even if other users in the array cannot be added
            UserData[0].mlFlags += (int)EdmUserDataFlags.Edmudf_ForceAdd;
            UserData[1].mlFlags += (int)EdmUserDataFlags.Edmudf_ForceAdd;

            //Set permissions
            EdmSysPerm[] perms = new EdmSysPerm[2];
            perms[0] = EdmSysPerm.EdmSysPerm_EditReportQuery;
            perms[1] = EdmSysPerm.EdmSysPerm_MandatoryVersionComments;
            UserData[0].moSysPerms = perms;
            UserData[1].moSysPerms = perms;

            //Add the users to the vault
            UsrMgr.AddUsers3(ref UserData, (int)EdmUserType.EdmUser_PDM);

            string msg = "";
            foreach (EdmUserData2 usr in UserData) {
                if (usr.mhStatus == 0) {
                    msg += "Added user " + usr.mpoUser.Name + ". ID = " + usr.mpoUser.ID.ToString() + "." + "\n";
                } else {
                    IEdmVault11 vault3 = (IEdmVault11)vault;
                    msg += "Error adding user " + usr.mbsUserName + ". " + vault3.GetErrorMessage(usr.mhStatus) + "\n";
                }
            }

            MessageBox.Show(msg);

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }

    }

    private void RemoveUsersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {
            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            //Remove the rrabbit from the vault
            UsrMgr = (IEdmUserMgr10)vault1.CreateUtility(EdmUtility.EdmUtil_UserMgr);
            user = (IEdmUser9)UsrMgr.GetUser("rrabbit");
            if ((user == null)) {
                MessageBox.Show("No user set to remove. Click Add users.");
                return;
            }

            int[] users = new int[1];
            users[0] = user.ID;
            UsrMgr.RemoveUsers(users);

            MessageBox.Show("User " + user.Name + " removed.");

            //Send message to all users with permission
            //to update users and groups
            IEdmPos5 UserPos = default(IEdmPos5);
            UserPos = UsrMgr.GetFirstUserPosition();
            while (!UserPos.IsNull) {
                IEdmUser9 userWithPerm = default(IEdmUser9);
                userWithPerm = (IEdmUser9)UsrMgr.GetNextUser(UserPos);
                if (userWithPerm.IsLoggedIn) {
                    if (userWithPerm.HasSysRightEx(EdmSysPerm.EdmSysPerm_EditUserMgr)) {
                        userWithPerm.SendMsg("ALERT: user removed", "User " + user.Name + " removed.");
                    }
                }
            }

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

    private void RemoveGroupMembersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {
            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            if ((mngmtGroup == null)) {
                MessageBox.Show("No group set from which to remove group member. Click Add group member.");
                return;
            }

            //Remove user efudd from Test folder, Management group, and vault
            mngmtGroup.RemoveMembers(folderMembers);
            user = (IEdmUser9)UsrMgr.GetUser("efudd");

            if ((user == null)) {
                MessageBox.Show("No user set to remove from group. Click Add users.");
                return;
            }

            int[] users = new int[1];
            users[0] = user.ID;
            UsrMgr.RemoveUsers(users);

            MessageBox.Show("User " + user.Name + " removed from group and vault.");

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

    private void AddGroupMembersWithFoldersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {
            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            UsrMgr = (IEdmUserMgr10)vault;

            //Add efudd to Test folder
            IEdmFolder6 folder = default(IEdmFolder6);
            folder = (IEdmFolder6)vault.RootFolder.GetSubFolder("Test");

            //Get user interface for user efudd
            user = (IEdmUser9)UsrMgr.GetUser("efudd");

            if ((user == null)) {
                MessageBox.Show("No user set to add to group. Click Add users.");
                return;
            }

            //Get the group interface for Management
            mngmtGroup = (IEdmUserGroup8)UsrMgr.GetUserGroup("Management");

            //Find out if the Management user group has
            //permission to update users and groups
            if (mngmtGroup.HasSysRightEx(EdmSysPerm.EdmSysPerm_EditUserMgr)) {
                mngmtGroup.SendMsg("PERMISSIONS INFO", "Management group has permission to update groups and users.", false);
            } else {
                mngmtGroup.SendMsg("PERMISSIONS INFO", "Management group does not have permission to update groups and users.", false);
                return;
            }

            //Add efudd as member of Management for Test folder
            EdmMemberFolder[] folderMembers = new EdmMemberFolder[1];
            folderMembers[0].mlFolderID = folder.ID;
            folderMembers[0].mlUserID = user.ID;
            mngmtGroup.AddMembersWithFolders(folderMembers);

            //Verify that efudd in Management group was added to
            //Test folder
            object[] groups = null;
            IEdmUserGroup8 groupName = null;
            groups = user.GetGroupMembershipsInFolder(folder.ID);
            int i = 0;
            i = groups.GetUpperBound(0);
            int j = 0;

            groupName = (IEdmUserGroup8)groups[i];

            IEdmPos5 UserGroupPos = default(IEdmPos5);
            UserGroupPos = UsrMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull) {
                mngmtGroup = (IEdmUserGroup8)UsrMgr.GetNextUserGroup(UserGroupPos);
                if ((mngmtGroup.Name == groupName.Name))
                {
                    if (j <= i)
                    {
                        MessageBox.Show("User " + user.Name + " in the " + mngmtGroup.Name + " group was added to the " + folder.Name + " folder.");
                        j = j + 1;
                    }
                }
            }

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

    private void AddGroupMembersButton_Click(System.Object sender, System.EventArgs e)
    {
        try {
            if (!vault.IsLoggedIn) {
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            UsrMgr = (IEdmUserMgr10)vault;

            //Add efudd to Management group
            mngmtGroup = (IEdmUserGroup8)UsrMgr.GetUserGroup("Management");

            if ((mngmtGroup == null)) {
                MessageBox.Show("Management group does not exist. Create a Management group.");
                return;
            }

            user = (IEdmUser9)UsrMgr.GetUser("efudd");

            if ((user == null)) {
                MessageBox.Show("No user set to add to group. Click Add users.");
                return;
            }

            int[] groupMbrIDs = new int[1];
            groupMbrIDs[0] = user.ID;
            mngmtGroup.AddMembers(groupMbrIDs);

            MessageBox.Show("User " + user.Name + " added to " + mngmtGroup.Name + " group.");

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);

        }
    }

     }
}
Back to top

//Form1.Designer.cs

namespace AddRemoveUsersGroupsCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
                this.VaultsComboBox = new System.Windows.Forms.ComboBox();
                this.VaultsLabel = new System.Windows.Forms.Label();
                this.TraverseUsersButton = new System.Windows.Forms.Button();
                this.TraverseGroupsButton = new System.Windows.Forms.Button();
                this.TraverseGroupMembersButton = new System.Windows.Forms.Button();
                this.AddUsersButton = new System.Windows.Forms.Button();
                this.RemoveUsersButton = new System.Windows.Forms.Button();
                this.AddGroupMembersButton = new System.Windows.Forms.Button();
                this.RemoveGroupMembersButton = new System.Windows.Forms.Button();
                this.UserActionLabel = new System.Windows.Forms.Label();
                this.GroupActionLabel = new System.Windows.Forms.Label();
                this.AddGroupMembersWithFoldersButton = new System.Windows.Forms.Button();
                this.SuspendLayout();
                //
                //VaultsComboBox
                //
                this.VaultsComboBox.FormattingEnabled = true;
                this.VaultsComboBox.Location = new System.Drawing.Point(121, 11);
                this.VaultsComboBox.Margin = new System.Windows.Forms.Padding(2);
                this.VaultsComboBox.Name = "VaultsComboBox";
                this.VaultsComboBox.Size = new System.Drawing.Size(176, 21);
                this.VaultsComboBox.TabIndex = 10;
                //
                //VaultsLabel
                //
                this.VaultsLabel.AutoSize = true;
                this.VaultsLabel.Location = new System.Drawing.Point(12, 9);
                this.VaultsLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
                this.VaultsLabel.Name = "VaultsLabel";
                this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
                this.VaultsLabel.TabIndex = 11;
                this.VaultsLabel.Text = "Select vault view:";
                //
                //TraverseUsersButton
                //
                this.TraverseUsersButton.Location = new System.Drawing.Point(124, 59);
                this.TraverseUsersButton.Margin = new System.Windows.Forms.Padding(2);
                this.TraverseUsersButton.Name = "TraverseUsersButton";
                this.TraverseUsersButton.Size = new System.Drawing.Size(173, 25);
                this.TraverseUsersButton.TabIndex = 15;
                this.TraverseUsersButton.Text = "Traverse users";
                this.TraverseUsersButton.UseVisualStyleBackColor = true;
                            this.TraverseUsersButton.Click += new System.EventHandler(TraverseUsersButton_Click);
                //
                //TraverseGroupsButton
                //
                this.TraverseGroupsButton.Location = new System.Drawing.Point(121, 166);
                this.TraverseGroupsButton.Margin = new System.Windows.Forms.Padding(2);
                this.TraverseGroupsButton.Name = "TraverseGroupsButton";
                this.TraverseGroupsButton.Size = new System.Drawing.Size(176, 25);
                this.TraverseGroupsButton.TabIndex = 16;
                this.TraverseGroupsButton.Text = "Traverse groups";
                this.TraverseGroupsButton.UseVisualStyleBackColor = true;
                            this.TraverseGroupsButton.Click += new System.EventHandler(TraverseGroupsButton_Click);
                //
                //TraverseGroupMembersButton
                //
                this.TraverseGroupMembersButton.Location = new System.Drawing.Point(121, 197);
                this.TraverseGroupMembersButton.Margin = new System.Windows.Forms.Padding(2);
                this.TraverseGroupMembersButton.Name = "TraverseGroupMembersButton";
                this.TraverseGroupMembersButton.Size = new System.Drawing.Size(176, 27);
                this.TraverseGroupMembersButton.TabIndex = 17;
                this.TraverseGroupMembersButton.Text = "Traverse group members";
                this.TraverseGroupMembersButton.UseVisualStyleBackColor = true;
                            this.TraverseGroupMembersButton.Click += new System.EventHandler(TraverseGroupMembersButton_Click);
                //
                //AddUsersButton
                //
                this.AddUsersButton.Location = new System.Drawing.Point(124, 89);
                this.AddUsersButton.Name = "AddUsersButton";
                this.AddUsersButton.Size = new System.Drawing.Size(173, 23);
                this.AddUsersButton.TabIndex = 18;
                this.AddUsersButton.Text = "Add users";
                this.AddUsersButton.UseVisualStyleBackColor = true;
                            this.AddUsersButton.Click += new System.EventHandler(AddUsersButton_Click);
                //
                //RemoveUsersButton
                //
                this.RemoveUsersButton.Location = new System.Drawing.Point(124, 118);
                this.RemoveUsersButton.Name = "RemoveUsersButton";
                this.RemoveUsersButton.Size = new System.Drawing.Size(173, 24);
                this.RemoveUsersButton.TabIndex = 19;
                this.RemoveUsersButton.Text = "Remove user";
                this.RemoveUsersButton.UseVisualStyleBackColor = true;
                            this.RemoveUsersButton.Click += new System.EventHandler(RemoveUsersButton_Click);
                //
                //AddGroupMembersButton
                //
                this.AddGroupMembersButton.Location = new System.Drawing.Point(121, 229);
                this.AddGroupMembersButton.Name = "AddGroupMembersButton";
                this.AddGroupMembersButton.Size = new System.Drawing.Size(176, 23);
                this.AddGroupMembersButton.TabIndex = 20;
                this.AddGroupMembersButton.Text = "Add group member";
                this.AddGroupMembersButton.UseVisualStyleBackColor = true;
                            this.AddGroupMembersButton.Click += new System.EventHandler(AddGroupMembersButton_Click);
                //
                //RemoveGroupMembersButton
                //
                this.RemoveGroupMembersButton.Location = new System.Drawing.Point(121, 287);
                this.RemoveGroupMembersButton.Name = "RemoveGroupMembersButton";
                this.RemoveGroupMembersButton.Size = new System.Drawing.Size(176, 25);
                this.RemoveGroupMembersButton.TabIndex = 21;
                this.RemoveGroupMembersButton.Text = "Remove group member and user";
                this.RemoveGroupMembersButton.UseVisualStyleBackColor = true;
                            this.RemoveGroupMembersButton.Click += new System.EventHandler(RemoveGroupMembersButton_Click);
                //
                //UserActionLabel
                //
                this.UserActionLabel.AutoSize = true;
                this.UserActionLabel.Location = new System.Drawing.Point(12, 59);
                this.UserActionLabel.Name = "UserActionLabel";
                this.UserActionLabel.Size = new System.Drawing.Size(69, 13);
                this.UserActionLabel.TabIndex = 22;
                this.UserActionLabel.Text = "User actions:";
                //
                //GroupActionLabel
                //
                this.GroupActionLabel.AutoSize = true;
                this.GroupActionLabel.Location = new System.Drawing.Point(12, 166);
                this.GroupActionLabel.Name = "GroupActionLabel";
                this.GroupActionLabel.Size = new System.Drawing.Size(76, 13);
                this.GroupActionLabel.TabIndex = 23;
                this.GroupActionLabel.Text = "Group actions:";
                //
                //AddGroupMembersWithFoldersButton
                //
                this.AddGroupMembersWithFoldersButton.Location = new System.Drawing.Point(121, 258);
                this.AddGroupMembersWithFoldersButton.Name = "AddGroupMembersWithFoldersButton";
                this.AddGroupMembersWithFoldersButton.Size = new System.Drawing.Size(176, 23);
                this.AddGroupMembersWithFoldersButton.TabIndex = 24;
                this.AddGroupMembersWithFoldersButton.Text = "Add group member to folder";
                this.AddGroupMembersWithFoldersButton.UseVisualStyleBackColor = true;
                            this.AddGroupMembersWithFoldersButton.Click += new System.EventHandler(AddGroupMembersWithFoldersButton_Click);
                //
                //Form1
                //
                this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(333, 329);
                this.Controls.Add(this.AddGroupMembersWithFoldersButton);
                this.Controls.Add(this.GroupActionLabel);
                this.Controls.Add(this.UserActionLabel);
                this.Controls.Add(this.RemoveGroupMembersButton);
                this.Controls.Add(this.AddGroupMembersButton);
                this.Controls.Add(this.RemoveUsersButton);
                this.Controls.Add(this.AddUsersButton);
                this.Controls.Add(this.TraverseGroupMembersButton);
                this.Controls.Add(this.TraverseGroupsButton);
                this.Controls.Add(this.TraverseUsersButton);
                this.Controls.Add(this.VaultsComboBox);
                this.Controls.Add(this.VaultsLabel);
                this.Margin = new System.Windows.Forms.Padding(2);
                this.Name = "Form1";
                            this.Load += new System.EventHandler(AddRemoveUsersGroupsCSharp_Load);
                this.Text = "Add and remove users and groups";
                this.ResumeLayout(false);
                this.PerformLayout();

            }

            #endregion

            internal System.Windows.Forms.ComboBox VaultsComboBox;
            internal System.Windows.Forms.Label VaultsLabel;
            internal System.Windows.Forms.Button TraverseUsersButton;
            internal System.Windows.Forms.Button TraverseGroupsButton;
            internal System.Windows.Forms.Button TraverseGroupMembersButton;
            internal System.Windows.Forms.Button AddUsersButton;
            internal System.Windows.Forms.Button RemoveUsersButton;
            internal System.Windows.Forms.Button AddGroupMembersButton;
            internal System.Windows.Forms.Button RemoveGroupMembersButton;
            internal System.Windows.Forms.Label UserActionLabel;
            internal System.Windows.Forms.Label GroupActionLabel;
            internal System.Windows.Forms.Button AddGroupMembersWithFoldersButton;

        }

}

Back to top


SOLIDWORKS PDM Professional API Help

Add and Remove User and Group from Folder Example (VB.NET)

This example shows how to:
  • add and remove users to and from a vault.
  • add a user of a group to a folder in a vault.
  • remove a user of a group from a folder and from a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'--------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type AddRemoveUsersGroupsVBNET in Project name.
'     c. For Location, click ... and navigate to the folder where to
create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Ensure that the following folder and group exist in the targeted vault:
'     * Folder in the vault root named Test.
'     * Group named Management.
'  4. Click Debug > Start Debugging or press F5.
'
'Postconditions:
' 1. Displays a dialog.
' 2. Select a vault.
' 3. Perform these user actions. Click OK to close each message box.
'    a. Click Traverse users.
'       Displays a message box showing the users in the vault.
'    b. Click Add users.
'       Displays a message box informing you that rrabbit
'       and efudd were added as users to the vault.
'    c. Click Traverse users to verify that rrabbit and efudd
'       were added to the vault.
'       Displays a message box showing the users in the vault.
'    d. Click Remove user.
'       Displays a message box informing you that rrabbit was
'       removed from the vault.
'    e. Click Traverse users to verify that rrabbit was removed
'       from the vault.
'       Displays a message box showing the users in the vault.
' 4. Perform these group actions. Click OK to close each message box.
'    a. Click Traverse groups.
'       Displays a message box showing the groups in the vault.
'    b. Click Traverse group members.
'       Displays a message box showing the users in the groups
'       in the vault.
'    c. Click Add group member.
'       Displays a message box informing you that efudd
'       was added to the Management group.
'    d. Click Traverse group members to verify that
'       efudd is shown in the Management group.
'       Displays a message box showing the users in the
'       groups in the vault.
'    e. Click Add group member to folder.
'       Displays a message box informing you that efudd in
'       the Management group was added to the Test folder.
'    f. To verify the previous step:
'       1. Open a File Explorer window.
'       2. Right-click the Test folder in the selected vault
'          and click Properties to open the Test Properties
'          dialog box.
'       3. Click Group Memberships.
'       4. Click Management to verify that efudd is selected.
'       5. Click OK to close the Test Properties dialog box.
'    g. Click Remove group member and user.
'       Displays a message box informing you that efudd was
'       removed from the vault.
'    h. Click Traverse group members to verify that
'       efudd was removed from the Management group.
'       Displays a message box showing the users in the
'       groups in the vault.
'    i. Click Traverse users to verify that efudd was
'       removed as a user from the vault.
'       Displays a message box showing the users in the vault.
' 5. Close the dialog.
'    Sends two SOLIDWORKS PDM Professional messages
'    to logged-in users and group members who have
'    permission to update users and groups.
' 6. To open these messages, click:
'    * the SOLIDWORKS PDM Professional tray icon.
'     - or -
'    * Tools > Inbox in File Explorer.
'--------------------------------------------------------------------
'Form1.vb

Imports EPDM.Interop.epdm

Public Class Form1

    Dim vault As IEdmVault8
    Dim vault1 As EdmVault5
    Dim UserData(1) As EdmUserData2
    Dim UsrMgr As IEdmUserMgr10
    Dim user As IEdmUser9
    Dim mngmtGroup As IEdmUserGroup8
    Dim folderMembers(0) As EdmMemberFolder

    Private Sub AddRemoveUsersGroupsVBNET_Load(ByVal sender As  _
          System.Object, ByVal e As System.EventArgs) _
          Handles MyBase.Load

        vault1 = New EdmVault5()
        vault = DirectCast(vault1, IEdmVault8)
        Dim Views() As EdmViewInfo = {}

        vault.GetVaultViews(Views, False)
        VaultsComboBox.Items.Clear()
        For Each View As EdmViewInfo In Views
            VaultsComboBox.Items.Add(View.mbsVaultName)
        Next
        If VaultsComboBox.Items.Count > 0 Then
            VaultsComboBox.Text = VaultsComboBox.Items(0)
        End If
    End Sub

    Private Sub TraverseUsersButton_Click(ByVal sender As  _
          System.Object, ByVal e As System.EventArgs) _
          Handles TraverseUsersButton.Click
        Try

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            UsrMgr = vault

            'Traverse users
            Dim Users As String = vbNullString
            Dim UserPos As IEdmPos5
            UserPos = UsrMgr.GetFirstUserPosition()
            While Not UserPos.IsNull
                user = UsrMgr.GetNextUser(UserPos)
                Users = Users + user.Name + vbCrLf
            End While
            MessageBox.Show(Users, vault.Name + _
               " Vault Users", MessageBoxButtons.OK, _
               MessageBoxIcon.Information)

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

    Private Sub TraverseGroupsButton_Click(ByVal sender _
          As System.Object, ByVal e As System.EventArgs) _
          Handles TraverseGroupsButton.Click
        Try

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            UsrMgr = vault

            'Traverse groups
            Dim Groups As String = vbNullString
            Dim UserGroupPos As IEdmPos5
            UserGroupPos = UsrMgr.GetFirstUserGroupPosition()
            While Not UserGroupPos.IsNull
                mngmtGroup = UsrMgr.GetNextUserGroup _
                   (UserGroupPos)
                Groups = Groups + mngmtGroup.Name + vbCrLf
            End While
            MessageBox.Show(Groups, vault.Name + _
               " Vault Groups", MessageBoxButtons.OK, _
               MessageBoxIcon.Information)

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

    Private Sub TraverseGroupMembersButton_Click( _
          ByVal sender As System.Object, _
          ByVal e As System.EventArgs) _
          Handles TraverseGroupMembersButton.Click
        Try

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            UsrMgr = vault

            'Traverse group members
            Dim Groups As String = vbNullString
            Dim UserGroupPos As IEdmPos5
            UserGroupPos = UsrMgr.GetFirstUserGroupPosition()
            While Not UserGroupPos.IsNull
                mngmtGroup = UsrMgr.GetNextUserGroup _
                   (UserGroupPos)
                Groups = Groups + mngmtGroup.Name + " Members:" _
                   + vbCrLf
                Groups = Groups + GetMembers(mngmtGroup)
            End While
            MessageBox.Show(Groups, vault.Name + _
               " Vault Group Users", _
            MessageBoxButtons.OK, MessageBoxIcon.Information)

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

    Private Function GetMembers(ByVal UserGroup _
          As IEdmUserGroup8) As String
        Try

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            'Get group members
            GetMembers = vbNullString
            Dim Users As String = vbNullString
            Dim UserPos As IEdmPos5
            UserPos = UserGroup.GetFirstUserPosition()
            While Not UserPos.IsNull
                user = UserGroup.GetNextUser(UserPos)
                Users = Users + " " + user.Name + vbCrLf
            End While
            GetMembers = Users

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Function

    Private Sub AddUsersButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddUsersButton.Click
        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            UsrMgr = vault

            'Add users
            UserData(0).mbsCompleteName = "Roger Rabbit"
            UserData(0).mbsEmail = "rrabbit@animatedcharacters.com"
            UserData(0).mbsInitials = "RR"
            UserData(0).mbsUserName = "rrabbit"

            UserData(1).mbsCompleteName = "Elmer J. Fudd"
            UserData(1).mbsEmail = "efudd@animatedcharacters.com"
            UserData(1).mbsInitials = "EJF"
            UserData(1).mbsUserName = "efudd"

            'Return user's interface in mpoUser
            UserData(0).mlFlags = EdmUserDataFlags.Edmudf_GetInterface
            UserData(1).mlFlags = EdmUserDataFlags.Edmudf_GetInterface

            'Add these users even if other users in the array cannot be added
            UserData(0).mlFlags += EdmUserDataFlags.Edmudf_ForceAdd
            UserData(1).mlFlags += EdmUserDataFlags.Edmudf_ForceAdd

            'Set permissions
            Dim perms(1) As EdmSysPerm
            perms(0) = EdmSysPerm.EdmSysPerm_EditReportQuery
            perms(1) = EdmSysPerm.EdmSysPerm_MandatoryVersionComments
            UserData(0).moSysPerms = perms
            UserData(1).moSysPerms = perms

            'Add users to the vault
            UsrMgr.AddUsers3(UserData, EdmUserType.Edmuser_PDM)

            Dim msg As String = ""
            For Each usr As EdmUserData2 In UserData
                If usr.mhStatus = 0 Then
                    msg += "Added user " + usr.mpoUser.Name _
                        + ". ID = " _
                        + usr.mpoUser.ID.ToString() + "." + vbCrLf
                Else
                    msg += "Error adding user " _
                        + usr.mbsUserName + ". " _
                        + vault.GetErrormessage(usr.mhStatus) + vbCrLf
                End If
            Next

            MessageBox.Show(msg)

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try

    End Sub

    Private Sub RemoveUsersButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveUsersButton.Click
        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            'Remove rrabbit from the vault
            UsrMgr = vault1.CreateUtility(EdmUtility.EdmUtil_UserMgr)
            user = UsrMgr.GetUser("rrabbit")
            If IsNothing(user) Then
                MessageBox.Show("No user set to remove. Click Add users.")
                Exit Sub
            End If

            Dim users(0) As Integer
            users(0) = user.ID
            UsrMgr.RemoveUsers(users)

            MessageBox.Show("User " + user.Name + " removed.")

            'Send message to all users with permission
            'to update users and groups
            Dim UserPos As IEdmPos5
            UserPos = UsrMgr.GetFirstUserPosition()
            While Not UserPos.IsNull
                Dim userWithPerm As IEdmUser9
                userWithPerm = UsrMgr.GetNextUser(UserPos)
                If userWithPerm.IsLoggedIn Then
                    If userWithPerm.HasSysRightEx(EdmSysPerm. _
                      EdmSysPerm_EditUserMgr) _
                      Then
                        userWithPerm.SendMsg("ALERT: user removed", "User " + user.Name + " removed.")
                    End If
                End If
            End While

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

    Private Sub RemoveGroupMembersButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveGroupMembersButton.Click
        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            If IsNothing(mngmtGroup) Then
                MessageBox.Show("No group set from which to remove group member. Click Add group member.")
                Exit Sub
            End If

            'Remove user efudd from Test folder, Management group, and vault
            mngmtGroup.RemoveMembers(folderMembers)
            user = UsrMgr.GetUser("efudd")

            If IsNothing(user) Then
                MessageBox.Show("No user set to remove from group. Click Add users.")
                Exit Sub
            End If

            Dim users(0) As Integer
            users(0) = user.ID
            UsrMgr.RemoveUsers(users)

            MessageBox.Show("User " + user.Name + " removed from group and vault.")

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

    Private Sub AddGroupMembersWithFoldersButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddGroupMembersWithFoldersButton.Click
        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            UsrMgr = vault

            'Add efudd to Test folder
            Dim folder As IEdmFolder6
            folder = vault.RootFolder.GetSubFolder("Test")

            'Get user interface for user efudd
            user = UsrMgr.GetUser("efudd")

            If IsNothing(user) Then
                MessageBox.Show("No user set to add to group. Click Add users.")
                Exit Sub
            End If

            'Get the group interface for Management
            mngmtGroup = UsrMgr.GetUserGroup("Management")

            'Find out if the Management user group has
            'permission to update users and groups
            If mngmtGroup.HasSysRightEx(EdmSysPerm.EdmSysPerm_EditUserMgr) Then
                mngmtGroup.SendMsg("PERMISSIONS INFO", "Management group has permission to update groups and users.", False)
            Else
                mngmtGroup.SendMsg("PERMISSIONS INFO", "Management group does not have permission to update groups and users.", False)
                Exit Sub
            End If

            'Add efudd as member of Management to Test folder
            Dim folderMembers(0) As EdmMemberFolder
            folderMembers(0).mlFolderID = folder.ID
            folderMembers(0).mlUserID = user.ID
            mngmtGroup.AddMembersWithFolders(folderMembers)

            'Verify that efudd in Management was added to
            'Test folder
            Dim groups() As Object
            groups = user.GetGroupMembershipsInFolder(folder.ID)
            Dim i As Integer = 0
            i = groups.GetUpperBound(0)
            Dim j As Integer = 0

            Dim UserGroupPos As IEdmPos5
            UserGroupPos = UsrMgr.GetFirstUserGroupPosition()
            While Not UserGroupPos.IsNull
                mngmtGroup = UsrMgr.GetNextUserGroup(UserGroupPos)
                If (mngmtGroup.Name = groups(i).Name) Then
                    If j <= i Then
                        MessageBox.Show("User " + user.Name + " in the " + mngmtGroup.Name + " group was added to the " + folder.Name + " folder.")
                        j = j + 1
                    End If
                End If
            End While

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub

    Private Sub AddGroupMembersButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddGroupMembersButton.Click
        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If

            UsrMgr = vault

            'Add efudd to Management group
            mngmtGroup = UsrMgr.GetUserGroup("Management")

            If IsNothing(mngmtGroup) Then
                MessageBox.Show("Management group does not exist. Create a Management group.")
                Exit Sub
            End If

            user = UsrMgr.GetUser("efudd")

            If IsNothing(user) Then
                MessageBox.Show("No user set to add to group. Click Add users.")
                Exit Sub
            End If

            Dim groupMbrIDs(0) As Integer
            groupMbrIDs(0) = user.ID
            mngmtGroup.AddMembers(groupMbrIDs)

            MessageBox.Show("User " + user.Name + " added to " + mngmtGroup.Name + " group.")

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
    End Sub
End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.TraverseUsersButton = New System.Windows.Forms.Button()
        Me.TraverseGroupsButton = New System.Windows.Forms.Button()
        Me.TraverseGroupMembersButton = New System.Windows.Forms.Button()
        Me.AddUsersButton = New System.Windows.Forms.Button()
        Me.RemoveUsersButton = New System.Windows.Forms.Button()
        Me.AddGroupMembersButton = New System.Windows.Forms.Button()
        Me.RemoveGroupMembersButton = New System.Windows.Forms.Button()
        Me.UserActionLabel = New System.Windows.Forms.Label()
        Me.GroupActionLabel = New System.Windows.Forms.Label()
        Me.AddGroupMembersWithFoldersButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(121, 11)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(176, 21)
        Me.VaultsComboBox.TabIndex = 10
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(12, 9)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 11
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'TraverseUsersButton
        '
        Me.TraverseUsersButton.Location = New System.Drawing.Point(124, 59)
        Me.TraverseUsersButton.Margin = New System.Windows.Forms.Padding(2)
        Me.TraverseUsersButton.Name = "TraverseUsersButton"
        Me.TraverseUsersButton.Size = New System.Drawing.Size(173, 25)
        Me.TraverseUsersButton.TabIndex = 15
        Me.TraverseUsersButton.Text = "Traverse users"
        Me.TraverseUsersButton.UseVisualStyleBackColor = True
        '
        'TraverseGroupsButton
        '
        Me.TraverseGroupsButton.Location = New System.Drawing.Point(121, 166)
        Me.TraverseGroupsButton.Margin = New System.Windows.Forms.Padding(2)
        Me.TraverseGroupsButton.Name = "TraverseGroupsButton"
        Me.TraverseGroupsButton.Size = New System.Drawing.Size(176, 25)
        Me.TraverseGroupsButton.TabIndex = 16
        Me.TraverseGroupsButton.Text = "Traverse groups"
        Me.TraverseGroupsButton.UseVisualStyleBackColor = True
        '
        'TraverseGroupMembersButton
        '
        Me.TraverseGroupMembersButton.Location = New System.Drawing.Point(121, 197)
        Me.TraverseGroupMembersButton.Margin = New System.Windows.Forms.Padding(2)
        Me.TraverseGroupMembersButton.Name = "TraverseGroupMembersButton"
        Me.TraverseGroupMembersButton.Size = New System.Drawing.Size(176, 27)
        Me.TraverseGroupMembersButton.TabIndex = 17
        Me.TraverseGroupMembersButton.Text = "Traverse group members"
        Me.TraverseGroupMembersButton.UseVisualStyleBackColor = True
        '
        'AddUsersButton
        '
        Me.AddUsersButton.Location = New System.Drawing.Point(124, 89)
        Me.AddUsersButton.Name = "AddUsersButton"
        Me.AddUsersButton.Size = New System.Drawing.Size(173, 23)
        Me.AddUsersButton.TabIndex = 18
        Me.AddUsersButton.Text = "Add users"
        Me.AddUsersButton.UseVisualStyleBackColor = True
        '
        'RemoveUsersButton
        '
        Me.RemoveUsersButton.Location = New System.Drawing.Point(124, 118)
        Me.RemoveUsersButton.Name = "RemoveUsersButton"
        Me.RemoveUsersButton.Size = New System.Drawing.Size(173, 24)
        Me.RemoveUsersButton.TabIndex = 19
        Me.RemoveUsersButton.Text = "Remove user"
        Me.RemoveUsersButton.UseVisualStyleBackColor = True
        '
        'AddGroupMembersButton
        '
        Me.AddGroupMembersButton.Location = New System.Drawing.Point(121, 229)
        Me.AddGroupMembersButton.Name = "AddGroupMembersButton"
        Me.AddGroupMembersButton.Size = New System.Drawing.Size(176, 23)
        Me.AddGroupMembersButton.TabIndex = 20
        Me.AddGroupMembersButton.Text = "Add group member"
        Me.AddGroupMembersButton.UseVisualStyleBackColor = True
        '
        'RemoveGroupMembersButton
        '
        Me.RemoveGroupMembersButton.Location = New System.Drawing.Point(121, 287)
        Me.RemoveGroupMembersButton.Name = "RemoveGroupMembersButton"
        Me.RemoveGroupMembersButton.Size = New System.Drawing.Size(176, 25)
        Me.RemoveGroupMembersButton.TabIndex = 21
        Me.RemoveGroupMembersButton.Text = "Remove group member and user"
        Me.RemoveGroupMembersButton.UseVisualStyleBackColor = True
        '
        'UserActionLabel
        '
        Me.UserActionLabel.AutoSize = True
        Me.UserActionLabel.Location = New System.Drawing.Point(12, 59)
        Me.UserActionLabel.Name = "UserActionLabel"
        Me.UserActionLabel.Size = New System.Drawing.Size(69, 13)
        Me.UserActionLabel.TabIndex = 22
        Me.UserActionLabel.Text = "User actions:"
        '
        'GroupActionLabel
        '
        Me.GroupActionLabel.AutoSize = True
        Me.GroupActionLabel.Location = New System.Drawing.Point(12, 166)
        Me.GroupActionLabel.Name = "GroupActionLabel"
        Me.GroupActionLabel.Size = New System.Drawing.Size(76, 13)
        Me.GroupActionLabel.TabIndex = 23
        Me.GroupActionLabel.Text = "Group actions:"
        '
        'AddGroupMembersWithFoldersButton
        '
        Me.AddGroupMembersWithFoldersButton.Location = New System.Drawing.Point(121, 258)
        Me.AddGroupMembersWithFoldersButton.Name = "AddGroupMembersWithFoldersButton"
        Me.AddGroupMembersWithFoldersButton.Size = New System.Drawing.Size(176, 23)
        Me.AddGroupMembersWithFoldersButton.TabIndex = 24
        Me.AddGroupMembersWithFoldersButton.Text = "Add group member to folder"
        Me.AddGroupMembersWithFoldersButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(333, 329)
        Me.Controls.Add(Me.AddGroupMembersWithFoldersButton)
        Me.Controls.Add(Me.GroupActionLabel)
        Me.Controls.Add(Me.UserActionLabel)
        Me.Controls.Add(Me.RemoveGroupMembersButton)
        Me.Controls.Add(Me.AddGroupMembersButton)
        Me.Controls.Add(Me.RemoveUsersButton)
        Me.Controls.Add(Me.AddUsersButton)
        Me.Controls.Add(Me.TraverseGroupMembersButton)
        Me.Controls.Add(Me.TraverseGroupsButton)
        Me.Controls.Add(Me.TraverseUsersButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "Form1"
        Me.Text = "Add and remove users and groups"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents TraverseUsersButton As System.Windows.Forms.Button
    Friend WithEvents TraverseGroupsButton As System.Windows.Forms.Button
    Friend WithEvents TraverseGroupMembersButton As System.Windows.Forms.Button
    Friend WithEvents AddUsersButton As System.Windows.Forms.Button
    Friend WithEvents RemoveUsersButton As System.Windows.Forms.Button
    Friend WithEvents AddGroupMembersButton As System.Windows.Forms.Button
    Friend WithEvents RemoveGroupMembersButton As System.Windows.Forms.Button
    Friend WithEvents UserActionLabel As System.Windows.Forms.Label
    Friend WithEvents GroupActionLabel As System.Windows.Forms.Label
    Friend WithEvents AddGroupMembersWithFoldersButton As System.Windows.Forms.Button

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Add Custom File Reference Example (C#)

This example shows how to add a custom file reference to a file in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//    b. Type CustRefCSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d.
Click Next.
//    e. Select Framework.
//
f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. Replace the code in Form1.Designer.cs with this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Add custom references dialog displays.
// 2. Select a vault.
// 3. Click Browse for file to which to add custom reference,
//    locate and click a file in the vault, and click Open.
//    The file is checked out.
// 4. In a view of the selected vault, right-click a file and click Copy.
// 5. In the
Add custom references dialog, click Add custom file reference.
//    The file that was copied to the clipboard is added as a custom
//    reference to the checked-out file.
// 6. In the Create File References dialog, click OK.
//    The file is checked in.
// 7. In the Edit User-Defined File References dialog, click OK.
// 8. Close the Add custom references dialog.
//----------------------------------------------------------------------------

//Form1.cs
using System.IO;
using System.Xml.Serialization;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using EPDM.Interop.epdm;

namespace CustRefCSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

IEdmVault5 vault1 = null;

public void FileReferencesCSharp_Load(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BrowseButton_Click(System.Object sender, System.EventArgs e)
{
try
{
CustRefListBox.Items.Clear();

//Only create a new vault object
//if one hasn't been created yet
if (vault1 == null)
vault1 = new EdmVault5();
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the File Open dialog
CustRefOpenFileDialog.InitialDirectory = vault1.RootFolderPath;
//Show the File Open dialog
System.Windows.Forms.DialogResult DialogResult = default(System.Windows.Forms.DialogResult);
DialogResult = CustRefOpenFileDialog.ShowDialog();
//If the user didn't click Open, exit the sub
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
return;

foreach (string FileName in CustRefOpenFileDialog.FileNames)
{
CustRefListBox.Items.Add(FileName);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void AddCustomFileReference_Click(System.Object sender, System.EventArgs e)
{
try
{
//Only create a new vault object
//if one hasn't been created yet
IEdmVault7 vault2 = null;
if (vault1 == null)
vault1 = new EdmVault5();
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmAddCustomRefs addCustRefs = (IEdmAddCustomRefs)vault2.CreateUtility(EdmUtility.EdmUtil_AddCustomRefs);
Int32[] ppoFileIdArray = new Int32[CustRefListBox.Items.Count];
IEdmFile5 file = null;
IEdmFolder5 parentFolder = null;
int i = 0;
foreach (string FileName in CustRefListBox.Items)
{
file = vault2.GetFileFromPath(FileName, out parentFolder);
if (!file.IsLocked) {
file.LockFile(parentFolder.ID, this.Handle.ToInt32(), (int)EdmLockFlag.EdmLock_Simple);
}
ppoFileIdArray[i] = file.ID;
i++;
}
Boolean retCode = false;

//Add the file that is copied to the clipboard as a custom reference to the selected file
foreach (int ID in ppoFileIdArray)
{
addCustRefs.AddReferencesClipboard(ID);
addCustRefs.CreateTree((int)EdmCreateReferenceFlags.Ecrf_Nothing);
addCustRefs.ShowDlg(this.Handle.ToInt32());
retCode = addCustRefs.CreateReferences();
}

// Check in the file
file.UnlockFile(this.Handle.ToInt32(), "Custom reference added");

//Display current custom file references
retCode = addCustRefs.ShowEditReferencesDlg(ref ppoFileIdArray, this.Handle.ToInt32());

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

}
}

Back to top

//Form1.Designer.cs

namespace CustRefCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.CustRefListBox = new System.Windows.Forms.ListBox();
            this.AddCustomFileReference = new System.Windows.Forms.Button();
            this.CustRefOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(244, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Copy a file to the clipboard, then select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 59);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 98);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(271, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse for file to which to add a custom reference...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // CustRefListBox
            //
            this.CustRefListBox.FormattingEnabled = true;
            this.CustRefListBox.Location = new System.Drawing.Point(16, 150);
            this.CustRefListBox.Name = "CustRefListBox";
            this.CustRefListBox.Size = new System.Drawing.Size(259, 95);
            this.CustRefListBox.TabIndex = 4;
            //
            // AddCustomFileReference
            //
            this.AddCustomFileReference.Location = new System.Drawing.Point(16, 273);
            this.AddCustomFileReference.Name = "AddCustomFileReference";
            this.AddCustomFileReference.Size = new System.Drawing.Size(259, 23);
            this.AddCustomFileReference.TabIndex = 5;
            this.AddCustomFileReference.Text = "Add custom file reference";
            this.AddCustomFileReference.UseVisualStyleBackColor = true;
            this.AddCustomFileReference.Click += new System.EventHandler(this.AddCustomFileReference_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 308);
            this.Controls.Add(this.AddCustomFileReference);
            this.Controls.Add(this.CustRefListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add custom file references";
            this.Load += new System.EventHandler(this.FileReferencesCSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.ListBox CustRefListBox;
        private System.Windows.Forms.Button AddCustomFileReference;
        private System.Windows.Forms.OpenFileDialog CustRefOpenFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Add Custom File Reference Example (VB.NET)

This example shows how to add a custom file reference to a file in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type CustRef in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. Replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. The Add custom references dialog displays.
' 2. Select a vault.
' 3. Click Browse for file to which to add custom reference,
'    locate and click a file in the vault, and click Open.
'    The file is checked out.
' 4. In a view of the selected vault, right-click a file and click Copy.
' 5. In the Add custom references dialog, click Add custom file reference.
'    The file that was copied to the clipboard is added as a custom
'    reference to the checked-out file.
' 6. In the Create File References dialog, click OK.
'    The file is checked in.
' 7. In the Edit User-Defined File References dialog, click OK.
' 8. Close the Add custom references dialog.
'----------------------------------------------------------------------------

'Form1.vb
Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            CustRefListBox.Items.Clear()

            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the File Open dialog
            CustRefOpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the File Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = CustRefOpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit the sub
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In CustRefOpenFileDialog.FileNames
                CustRefListBox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddCustomFileReference_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddCustomFileReference.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim addCustRefs As IEdmAddCustomRefs = DirectCast(vault2.CreateUtility(EdmUtility.EdmUtil_AddCustomRefs), IEdmAddCustomRefs)
            Dim ppoFileIdArray As Int32() = New Int32(CustRefListBox.Items.Count - 1) {}
            Dim file As IEdmFile5 = Nothing
            Dim parentFolder As IEdmFolder5 = Nothing
            Dim i As Integer = 0
            For Each FileName As String In CustRefListBox.Items
                file = vault2.GetFileFromPath(FileName, parentFolder)
                If Not file.IsLocked Then
                    file.LockFile(parentFolder.ID, Me.Handle.ToInt32(), CInt(EdmLockFlag.EdmLock_Simple))
                End If
                ppoFileIdArray(i) = file.ID
                i += 1
            Next
            Dim retCode As [Boolean] = False

            'Add the file that is copied to the clipboard as a custom reference to the selected file
            For Each ID As Integer In ppoFileIdArray
                addCustRefs.AddReferencesClipboard(ID)
                addCustRefs.CreateTree(CInt(EdmCreateReferenceFlags.Ecrf_Nothing))
                addCustRefs.ShowDlg(Me.Handle.ToInt32())
                retCode = addCustRefs.CreateReferences()
            Next

            ' Check in the file
            file.UnlockFile(Me.Handle.ToInt32(), "Custom reference added")

            'Display current custom file references

            retCode = addCustRefs.ShowEditReferencesDlg(ppoFileIdArray, Me.Handle.ToInt32())
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.CustRefListBox = New System.Windows.Forms.ListBox()
        Me.AddCustomFileReference = New System.Windows.Forms.Button()
        Me.CustRefOpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(244, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Copy a file to the clipboard, then select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 59)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 98)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(271, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse for file to which to add a custom reference..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'CustRefListBox
        '
        Me.CustRefListBox.FormattingEnabled = True
        Me.CustRefListBox.Location = New System.Drawing.Point(16, 150)
        Me.CustRefListBox.Name = "CustRefListBox"
        Me.CustRefListBox.Size = New System.Drawing.Size(259, 95)
        Me.CustRefListBox.TabIndex = 4
        '
        'AddCustomFileReference
        '
        Me.AddCustomFileReference.Location = New System.Drawing.Point(16, 273)
        Me.AddCustomFileReference.Name = "AddCustomFileReference"
        Me.AddCustomFileReference.Size = New System.Drawing.Size(259, 23)
        Me.AddCustomFileReference.TabIndex = 5
        Me.AddCustomFileReference.Text = "Add custom file reference"
        Me.AddCustomFileReference.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 308)
        Me.Controls.Add(Me.AddCustomFileReference)
        Me.Controls.Add(Me.CustRefListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add custom file references"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents CustRefListBox As System.Windows.Forms.ListBox
    Friend WithEvents AddCustomFileReference As System.Windows.Forms.Button
    Friend WithEvents CustRefOpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Add File Example (C#)

This example shows how to add a file outside the vault to the vault root.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows, Desktop > Windows Forms Application.
//    b. Type AddFiles in Project name.
//    c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click Create.

//    g. Click Show All Files in the Solution Explorer
toolbar and expand

//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form, replace the code in Form1.Designer.cs with this code.
// 2. Add dependencies and safely pass arrays of structures.
// 3. Run the Administration tool, log in as admin, expand the vault,
//    right-click File Types, click Duplicate file name settings, and
//    click Do not allow duplicate files names in this file vault.
// 4. Ensure that at least one file exists in a subfolder in the vault and
//    the same-named file exists outside the vault.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Add file to vault root dialog box.
//    a. Select a vault view.
//    b. Click Browse to a file outside the vault.
//       1. Locate a file outside the vault that exists in
//          a subfolder in the vault.
//       2. Click Open.
//    c. Click Add file to vault root to add the selected file to the
//       root folder of the vault.
//    d. Displays a message box warning you that the selected file is not
//       unique in the vault, but that the file will be added to the vault root.
//    e. Click OK.
// 2. Close the Add file to vault root dialog box.
// 3. Examine the vault root.
//----------------------------------------------------------------------------
//Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;
using EPDM.Interop.EPDMResultCode;

namespace AddFiles_CSharp
{
    public partial class Form1 : Form, IEdmCallback6
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ListBox.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Open dialog
                OpenFileDialog.InitialDirectory = vault1.RootFolderPath;
                //Show the Open dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog.ShowDialog();
                //If the user didn't click Open, exit
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                foreach (string FileName in OpenFileDialog.FileNames)
                {
                    ListBox.Items.Add(FileName);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddFiles_Click(System.Object sender, System.EventArgs e)
    {

        try {
            IEdmVault7 vault2 = null;
            if (vault1 == null) {
                vault1 = new EdmVault5();
            }
            vault2 = (IEdmVault7)vault1;
            if (!vault1.IsLoggedIn) {
                //Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            if (!(ListBox.Items.Count == 1)) {
                MessageBox.Show("Please browse to a file outside the vault.");
                return;
            }

            // Add selected file to the root folder of the vault
            IEdmFolder8 Folder = default(IEdmFolder8);
            Folder = (IEdmFolder8)vault2.RootFolder;

            EdmAddFileInfo[] Files = new EdmAddFileInfo[1];

            string[] FileNames = new string[1];
            int Index = 0;
            string fileStr = "";
            foreach ( Object FileName_loopVariable in ListBox.Items) {
                fileStr = FileName_loopVariable.ToString();
                FileNames[Index] = fileStr.Substring(fileStr.LastIndexOf("\\"));
                Index = Index + 1;
            }

            string Path = "";
            int addFileStatus;
            Index = 0;
            foreach (Object FileName_loopVariable in ListBox.Items) {
                Path = FileName_loopVariable.ToString();
                Files[Index].mbsPath = Path;
                Files[Index].mlEdmAddFlags = (int)EdmAddFlag.EdmAdd_Simple;
                Files[Index].mlFileID = 0;
                Files[Index].mlSrcDocumentID = 0;
                Files[Index].mlSrcProjectID = 0;
                Files[Index].mbsNewName = "";
                Folder.AddFile2(this.Handle.ToInt32(), Files[Index].mbsPath, out addFileStatus, "", Files[Index].mlEdmAddFlags);
                switch (addFileStatus)
                {
                    case (int)EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY:
                        MessageBox.Show("WARNING: File is not unique in the vault, but the file will be added to the vault root.");
                        break;
                    case 0:
                        MessageBox.Show("SUCCESS: File will be added to the vault root.");
                        break;
                }
                Index = Index + 1;
            }

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
    }

        private EdmMBoxResult IEdmCallback6_MsgBox(int lParentWnd, int lMsgID, string bsMsg, EdmMBoxType eType = 0L)
        {
            MessageBox.Show(bsMsg);
            return EdmMBoxResult.EdmMbr_OK;
        }
        EdmMBoxResult IEdmCallback6.MsgBox(int lParentWnd, int lMsgID, string bsMsg, EdmMBoxType eType )
        {
            return IEdmCallback6_MsgBox(lParentWnd, lMsgID, bsMsg, eType);
        }

        private void IEdmCallback6_Resolve(int lParentWnd, ref EdmCmdData[] ppoItems)
        {
        }
        void IEdmCallback6.Resolve(int lParentWnd, ref EdmCmdData[] ppoItems)
        {
            IEdmCallback6_Resolve(lParentWnd, ref ppoItems);
        }

        private bool IEdmCallback6_SetProgress(int lBarIndex, int lPos, string bsMsg)
        {
            return true;
        }
        bool IEdmCallback6.SetProgress(int lBarIndex, int lPos, string bsMsg)
        {
            return IEdmCallback6_SetProgress(lBarIndex, lPos, bsMsg);
        }

        private void IEdmCallback6_SetProgressRange(int lBarIndex, int lMax)
        {
        }
        void IEdmCallback6.SetProgressRange(int lBarIndex, int lMax)
        {
            IEdmCallback6_SetProgressRange(lBarIndex, lMax);
        }

        private void IEdmCallback6_SetStatusMessage(int lBarIndex, string bsMessage)
        {
        }
        void IEdmCallback6.SetStatusMessage(int lBarIndex, string bsMessage)
        {
            IEdmCallback6_SetStatusMessage(lBarIndex, bsMessage);
        }
    }
}
//Form1.Designer.cs

namespace AddFiles_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.AddFiles = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // BrowseButton
            //
            this.BrowseButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.Location = new System.Drawing.Point(16, 69);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(259, 39);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse to a file outside the vault:";
            this.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.ListBox.Size = new System.Drawing.Size(259, 43);
            this.ListBox.TabIndex = 4;
            //
            // AddFiles
            //
            this.AddFiles.Location = new System.Drawing.Point(16, 163);
            this.AddFiles.Name = "AddFiles";
            this.AddFiles.Size = new System.Drawing.Size(121, 23);
            this.AddFiles.TabIndex = 5;
            this.AddFiles.Text = "Add file to vault root";
            this.AddFiles.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.AddFiles.UseVisualStyleBackColor = true;
            this.AddFiles.Click += new System.EventHandler(this.AddFiles_Click);
            //
            // OpenFileDialog
            //
            this.OpenFileDialog.Multiselect = true;
            this.OpenFileDialog.Title = "Open";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 215);
            this.Controls.Add(this.AddFiles);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add file to vault root";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button AddFiles;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
    }
}


SOLIDWORKS PDM Professional API Help

Add File Example (VB.NET)

This example shows how to add a file outside the vault to the vault root.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type AddFiles in Project name.
'    c. For Location, click ... and navigate to the folder where to
create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Run the Administration tool, log in as admin, expand the vault,
'    right-click File Types, click Duplicate file name settings, and
'    click Do not allow duplicate files names in this file vault.
' 4. Ensure that at least one file exists in a subfolder in the vault and
'    the same-named file exists outside the vault.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Add file to vault root dialog box.
'    a. Select a vault view.
'    b. Click Browse to a file outside the vault.
'       1. Locate a file outside the vault that exists in
'          a subfolder in the vault.
'       2. Click Open.
'    c. Click Add file to vault root to add the selected file to the
'       root folder of the vault.
'    d. Displays a message box warning you that the selected file is not
'       unique in the vault, but that the file will be added to the vault root.
'    e. Click OK.
' 2. Close the Add file to vault root dialog box.
' 3. Examine the vault root.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm
Imports EPDM.Interop.EPDMResultCode

Public Class Form1
    Implements IEdmCallback6

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            ListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Open dialog
            OpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In OpenFileDialog.FileNames
                ListBox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddFiles.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not ListBox.Items.Count = 1 Then
                MessageBox.Show("Please browse to a file outside the vault.")
                Exit Sub
            End If

            'Add file to the root folder of the vault
            Dim Folder1 As IEdmFolder5 = Nothing
            Dim Folder As IEdmFolder8 = DirectCast(Folder1, IEdmFolder5)

            Folder = vault2.RootFolder

            Dim Files() As EdmAddFileInfo
            ReDim Files(ListBox.Items.Count - 1)

            Dim FileNames(0) As String
            Dim Index As Integer = 0
            Dim fileStr = ""
            For Each FileName In ListBox.Items
                fileStr = FileName.ToString()
                FileNames(Index) = fileStr.Substring(fileStr.LastIndexOf("\"))
                Index = Index + 1
            Next

            Dim Path As String
            Dim addFileStatus As Integer
            Index = 0
            For Each FileName In ListBox.Items
                Path = FileName
                Files(Index).mbsPath = Path
                Files(Index).mlEdmAddFlags = EdmAddFlag.EdmAdd_Simple
                Files(Index).mlFileID = 0
                Files(Index).mlSrcDocumentID = 0
                Files(Index).mlSrcProjectID = 0
                Files(Index).mbsNewName = ""
                Folder.AddFile2(Me.Handle.ToInt32(), Files(Index).mbsPath, addFileStatus, "", Files(Index).mlEdmAddFlags)
                Select Case addFileStatus
                    Case EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY
                        MessageBox.Show("WARNING: File is not unique in the vault, but the file will be added to the vault root.")
                    Case Else
                        MessageBox.Show("SUCCESS: File will be added to the vault root.")
                End Select
                Index = Index + 1
            Next

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Function IEdmCallback6_MsgBox(ByVal lParentWnd As Integer, ByVal lMsgID As Integer, ByVal bsMsg As String, Optional ByVal eType As EdmMBoxType = 0&) As EdmMBoxResult Implements IEdmCallback6.MsgBox

        MsgBox(bsMsg)
        IEdmCallback6_MsgBox = EdmMBoxResult.EdmMbr_OK

    End Function

    Private Sub IEdmCallback6_Resolve(ByVal lParentWnd As Integer, ByRef ppoItems() As EdmCmdData) Implements IEdmCallback6.Resolve

    End Sub

    Private Function IEdmCallback6_SetProgress(ByVal lBarIndex As Integer, ByVal lPos As Integer, ByVal bsMsg As String) As Boolean Implements IEdmCallback6.SetProgress

        IEdmCallback6_SetProgress = True

    End Function

    Private Sub IEdmCallback6_SetProgressRange(ByVal lBarIndex As Integer, ByVal lMax As Integer) Implements IEdmCallback6.SetProgressRange

    End Sub

    Private Sub IEdmCallback6_SetStatusMessage(ByVal lBarIndex As Integer, ByVal bsMessage As String) Implements IEdmCallback6.SetStatusMessage

    End Sub

End Class
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.AddFiles = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        Me.VaultsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 69)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(259, 39)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse to a file outside the vault:"
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.ListBox.Size = New System.Drawing.Size(259, 43)
        Me.ListBox.TabIndex = 4
        '
        'AddFiles
        '
        Me.AddFiles.Location = New System.Drawing.Point(16, 180)
        Me.AddFiles.Name = "AddFiles"
        Me.AddFiles.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.AddFiles.Size = New System.Drawing.Size(121, 23)
        Me.AddFiles.TabIndex = 5
        Me.AddFiles.Text = "Add file to vault root"
        Me.AddFiles.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.AddFiles.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Multiselect = True
        Me.OpenFileDialog.Title = "Open"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 215)
        Me.Controls.Add(Me.AddFiles)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add file to vault root"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents AddFiles As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class


SOLIDWORKS PDM Professional API Help

Add Files to Vault Example (C#)

This example shows how to add files to a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//    b. Type AddFiles_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d.
Click Next.
//    e. Select Framework.
//
f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2.

Add dependencies and
safely pass arrays of structures.
//
3. Ensure that
the vault workflow contains the Waiting for Approval state.
// 4. Ensure that the vault workflow contains the Submit for Approval
transition
//    to the Waiting for Approval state.
// 5. Ensure that the logged-in PDM user has permission to move files.
// 6. Modify password in
IEdmFile13::ChangeState3 to
//    match the password of your logged-in PDM user.
// 7. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Add
files to vault dialog box.
//    a. Select a vault view.
//    b. Click Browse.
//
1. Locate and click three files outside the vault.
//       2. Click Open.
//    c. Click
Add files.
//       1.
Adds the selected files to the root
folder of the vault.
//
2. Checks in the files.
//
3. Creates path \temp\files in the root folder.
//
4. Moves one of the files to subfolder \temp\files.
//
5. Copies one of the files to subfolder \temp.
//
6. Changes the state of one of the files in the root folder to
//
Waiting for Approval.
// 2. Click OK to close each message box.
// 3. Examine the vault.
// 4. Close the Add
files to vault dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace AddFiles_CSharp
{
    public partial class Form1 : Form, IEdmCallback6
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ListBox.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Open dialog
                OpenFileDialog.InitialDirectory = vault1.RootFolderPath;
                //Show the Open dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog.ShowDialog();
                //If the user didn't click Open, exit
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                foreach (string FileName in OpenFileDialog.FileNames)
                {
                    ListBox.Items.Add(FileName);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddFiles_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault16 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault16)vault1;
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

if (!(ListBox.Items.Count == 3))
{
MessageBox.Show("Please click three files that are not in the vault.");
return;
}

//MessageBox.Show("Vault type as defined in EdmVaultType: " + vault2.GetVaultType().ToString());

IEdmFile13 aFile = default(IEdmFile13);

// Add selected files to the root folder of the vault
IEdmFolder9 Folder = default(IEdmFolder9);
Folder = (IEdmFolder9)vault2.RootFolder;

EdmAddFileInfo[] Files = new EdmAddFileInfo[3];

string[] FileNames = new string[3];
int Index = 0;
string fileStr = "";
foreach (Object FileName_loopVariable in ListBox.Items)
{
fileStr = FileName_loopVariable.ToString();
FileNames[Index] = fileStr.Substring(fileStr.LastIndexOf("\\"));
Index = Index + 1;
}

string Path = "";
Index = 0;
foreach (Object FileName_loopVariable in ListBox.Items)
{
Path = FileName_loopVariable.ToString();
Files[Index].mbsPath = Path;
Files[Index].mlEdmAddFlags = (int)EdmAddFlag.EdmAdd_Simple;
Files[Index].mlFileID = 0;
Files[Index].mlSrcDocumentID = 0;
Files[Index].mlSrcProjectID = 0;
Files[Index].mbsNewName = "";
Index = Index + 1;
}

Folder.AddFiles(this.Handle.ToInt32(), ref Files, this);

// Check in the files
IEdmFile13[] arrFiles = new IEdmFile13[3];
Index = 0;
fileStr = "";
IEdmFolder5 ppoRetParentFolder;
foreach (Object FileName_loopVariable in FileNames)
{
fileStr = FileName_loopVariable.ToString();
aFile = (IEdmFile13)vault2.GetFileFromPath(Folder.LocalPath + "\\" + fileStr, out ppoRetParentFolder);
//MessageBox.Show("User can rename " + aFile.Name + " in this folder? " + Folder.HasRenameRights(this.Handle.ToInt32(), aFile.ID, fileStr, "new",
true).ToString());
//MessageBox.Show(aFile.Name + " is in a private state? " + aFile.PrivateStateFile.ToString());

                    int ID;
                    string fName;
                    string vaultName;
                    IEdmVault5 vaultObject;
                    ID = aFile.ID;
                    fName = aFile.Name;
                    vaultObject = aFile.Vault;
                    vaultName = vaultObject.Name;
                    MessageBox.Show("Database ID: " + ID.ToString() + "; Vault name: " + vaultName + "; Folder name: " + fName);

aFile.UnlockFile(this.Handle.ToInt32(), "");
arrFiles[Index] = aFile;
Index = Index + 1;
}

// Create \temp\files subfolder under the root folder
Folder.CreateFolderPath("\\temp\\files", this.Handle.ToInt32());

// Move one of the files to the \temp\files subfolder
IEdmFolder5 dest = default(IEdmFolder5);
dest = vault2.GetFolderFromPath(Folder.LocalPath + "\\temp\\files");
aFile = arrFiles[0];
aFile.Move(this.Handle.ToInt32(), Folder.ID, dest.ID, 0);

// Copy one of the files to the \temp subfolder
aFile = arrFiles[1];
aFile.GetFileCopy(this.Handle.ToInt32(), "", Folder.LocalPath + "\\temp\\");

// Change the state of one of the files to Waiting for Approval
aFile = arrFiles[2];
aFile.ChangeState3("Waiting for Approval", "Submit
for Approval", Folder.ID, "The file is waiting for approval.", this.Handle.ToInt32(), (int)EdmStateFlags.EdmState_Simple,
"password");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

        private EdmMBoxResult IEdmCallback6_MsgBox(int lParentWnd, int lMsgID, string bsMsg, EdmMBoxType eType = 0L)
        {
            MessageBox.Show(bsMsg);
            return EdmMBoxResult.EdmMbr_OK;
        }
        EdmMBoxResult IEdmCallback6.MsgBox(int lParentWnd, int lMsgID, string bsMsg, EdmMBoxType eType )
        {
            return IEdmCallback6_MsgBox(lParentWnd, lMsgID, bsMsg, eType);
        }

        private void IEdmCallback6_Resolve(int lParentWnd, ref EdmCmdData[] ppoItems)
        {
        }
        void IEdmCallback6.Resolve(int lParentWnd, ref EdmCmdData[] ppoItems)
        {
            IEdmCallback6_Resolve(lParentWnd, ref ppoItems);
        }

        private bool IEdmCallback6_SetProgress(int lBarIndex, int lPos, string bsMsg)
        {
            return true;
        }
        bool IEdmCallback6.SetProgress(int lBarIndex, int lPos, string bsMsg)
        {
            return IEdmCallback6_SetProgress(lBarIndex, lPos, bsMsg);
        }

        private void IEdmCallback6_SetProgressRange(int lBarIndex, int lMax)
        {
        }
        void IEdmCallback6.SetProgressRange(int lBarIndex, int lMax)
        {
            IEdmCallback6_SetProgressRange(lBarIndex, lMax);
        }

        private void IEdmCallback6_SetStatusMessage(int lBarIndex, string bsMessage)
        {
        }
        void IEdmCallback6.SetStatusMessage(int lBarIndex, string bsMessage)
        {
            IEdmCallback6_SetStatusMessage(lBarIndex, bsMessage);
        }
    }
}

Back to top

//Form1.Designer.cs

namespace AddFiles_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.AddFiles = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 85);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(98, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click +=new System.EventHandler(BrowseButton_Click);
            //
            //ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.ListBox.Size = new System.Drawing.Size(259, 43);
            this.ListBox.TabIndex = 4;
            //
            //AddFiles
            //
            this.AddFiles.Location = new System.Drawing.Point(84, 178);
            this.AddFiles.Name = "AddFiles";
            this.AddFiles.Size = new System.Drawing.Size(98, 23);
            this.AddFiles.TabIndex = 5;
            this.AddFiles.Text = "Add files";
            this.AddFiles.UseVisualStyleBackColor = true;
            this.AddFiles.Click +=new System.EventHandler(AddFiles_Click);
            //
            //OpenFileDialog
            //
            this.OpenFileDialog.Multiselect = true;
            this.OpenFileDialog.Title = "Open";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 215);
            this.Controls.Add(this.AddFiles);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add files to vault";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button AddFiles;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Add Files to Vault Example (VB.NET)

This example shows how to add files to a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type AddFiles in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Ensure that the vault workflow contains the Waiting for Approval state.
' 4. Ensure that the vault workflow contains the Submit for Approval transition
'    to the Waiting for Approval state.
' 5. Ensure that the logged-in PDM user has permission to move files.
 ' 6. Modify password in IEdmFile13::ChangeState3 to
'    match the password of your logged-in PDM user.
' 7. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Add files to vault dialog box.
'    a. Select a vault view.
'    b. Click Browse.
'       1. Locate and click three files outside the vault.
'       2. Click Open.
'    c. Click Add files.
'       1. Adds the selected files to the root folder of the vault.
'       2. Checks in the files.
'       3. Creates path \temp\files in the root folder.
'       4. Moves one of the files to subfolder \temp\files.
'       5. Copies one of the files to subfolder \temp.
'       6. Changes the state of one of the files in the root folder to
'          Waiting for Approval.
' 2. Click OK to close each message box.
' 3. Examine the vault.
' 4. Close the Add files to vault dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Implements IEdmCallback6

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            ListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Open dialog
            OpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In OpenFileDialog.FileNames
                ListBox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddFiles.Click
        Try

            Dim vault2 As IEdmVault16 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault16)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not ListBox.Items.Count = 3 Then
                MessageBox.Show("Please click three files that are not in the vault.")
                Exit Sub
            End If

            'MessageBox.Show("Vault type as defined in EdmVaultType: " + vault2.GetVaultType().ToString())

            Dim aFile As IEdmFile13

            ' Add selected files to the root folder of the vault
            Dim Folder As IEdmFolder9
            Folder = vault2.RootFolder

            Dim Files() As EdmAddFileInfo
            ReDim Files(ListBox.Items.Count - 1)

            Dim FileNames(2) As String
            Dim Index As Integer = 0
            Dim fileStr = ""
            For Each FileName In ListBox.Items
                fileStr = FileName.ToString()
                FileNames(Index) = fileStr.Substring(fileStr.LastIndexOf("\"))
                Index = Index + 1
            Next

            Dim Path As String
            Index = 0
            For Each FileName In ListBox.Items
                Path = FileName
                Files(Index).mbsPath = Path
                Files(Index).mlEdmAddFlags = EdmAddFlag.EdmAdd_Simple
                Files(Index).mlFileID = 0
                Files(Index).mlSrcDocumentID = 0
                Files(Index).mlSrcProjectID = 0
                Files(Index).mbsNewName = ""

                Index = Index + 1
            Next

            Folder.AddFiles(Me.Handle.ToInt32(), Files, Me)

            ' Check in the files
            Dim arrFiles(3) As IEdmFile13
            Index = 0
            For Each FileName In FileNames
                aFile = vault2.GetFileFromPath(Folder.LocalPath + "\" + FileName)
                'MessageBox.Show("User can rename " + aFile.Name + " in this folder? " + Folder.HasRenameRights(Me.Handle.ToInt32(), aFile.ID, FileName, "new", True).ToString())
                'MessageBox.Show(aFile.Name + " is in a private state? " + aFile.PrivateStateFile.ToString())

        Dim ID As Integer
        Dim fName As String
        Dim vaultName As String
        Dim vaultObject As IEdmVault5
        ID = aFile.ID
        fName = aFile.Name
        vaultObject = aFile.Vault
        vaultName = vaultObject.Name
        MessageBox.Show("Database ID: " + ID.ToString() + "; Vault name: " + vaultName + "; File name: " + fName)

                aFile.UnlockFile(Me.Handle.ToInt32(), "")
                arrFiles(Index) = aFile

                Dim thumb As Object
                thumb = aFile.GetThumbnail

                Index = Index + 1
            Next

            ' Create \temp\files path in the root folder
            Folder.CreateFolderPath("\temp\files", Me.Handle.ToInt32())

            ' Move one of the files to the \temp\files subfolder
            Dim dest As IEdmFolder5
            dest = vault2.GetFolderFromPath(Folder.LocalPath + "\temp\files")
            aFile = arrFiles(0)
            aFile.Move(Me.Handle.ToInt32(), Folder.ID, dest.ID, 0)

            ' Copy one of the files to the temp subfolder
            aFile = arrFiles(1)
            aFile.GetFileCopy(Me.Handle.ToInt32(), "", Folder.LocalPath + "\temp\")

            ' Change the state of one of the files to Waiting for Approval
            aFile = arrFiles(2)
            aFile.ChangeState3("Waiting for Approval", "Submit for Approval", Folder.ID, "The file is waiting for approval.", Me.Handle.ToInt32(), EdmStateFlags.EdmState_Simple, "password")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Function IEdmCallback6_MsgBox(ByVal lParentWnd As Integer, ByVal lMsgID As Integer, ByVal bsMsg As String, Optional ByVal eType As EdmMBoxType = 0&) As EdmMBoxResult Implements IEdmCallback6.MsgBox

        MsgBox(bsMsg)
        IEdmCallback6_MsgBox = EdmMBoxResult.EdmMbr_OK

    End Function

    Private Sub IEdmCallback6_Resolve(ByVal lParentWnd As Integer, ByRef ppoItems() As EdmCmdData) Implements IEdmCallback6.Resolve

    End Sub

    Private Function IEdmCallback6_SetProgress(ByVal lBarIndex As Integer, ByVal lPos As Integer, ByVal bsMsg As String) As Boolean Implements IEdmCallback6.SetProgress

        IEdmCallback6_SetProgress = True

    End Function

    Private Sub IEdmCallback6_SetProgressRange(ByVal lBarIndex As Integer, ByVal lMax As Integer) Implements IEdmCallback6.SetProgressRange

    End Sub

    Private Sub IEdmCallback6_SetStatusMessage(ByVal lBarIndex As Integer, ByVal bsMessage As String) Implements IEdmCallback6.SetStatusMessage

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.AddFiles = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 85)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(98, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.ListBox.Size = New System.Drawing.Size(259, 43)
        Me.ListBox.TabIndex = 4
        '
        'AddFiles
        '
        Me.AddFiles.Location = New System.Drawing.Point(84, 178)
        Me.AddFiles.Name = "AddFiles"
        Me.AddFiles.Size = New System.Drawing.Size(98, 23)
        Me.AddFiles.TabIndex = 5
        Me.AddFiles.Text = "Add files"
        Me.AddFiles.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Multiselect = True
        Me.OpenFileDialog.Title = "Open"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 215)
        Me.Controls.Add(Me.AddFiles)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add files to vault"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents AddFiles As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Add Folder Example (C#)

This example shows how to create a folder and set its data card and permissions.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//    b. Type AddFolder_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d.
Click Next.
//    e. Select Framework.
//
f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add
dependencies and safely pass arrays of structures.
//
3. Ensure that the vault has user, Engineer1, and group,
//    Administrators.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Add
folder dialog box.
//    a. Select a vault view.
//    b. Click Browse
for parent folder.
//       1. Locate and click a
folder
in the vault.
//       2. Click OK.
//    c. Click
Add folder.
//
1.  Creates an IEdmFolderData5 object with:
//
* Folder user permissions for user, Engineer1.
//
* Folder group permissions for group, Administrators.
//
* File data card for .doc files.
//
2. Displays a message that folder, Temp, is added as a subfolder to
//
the folder clicked in Postconditions 1b1.
//
3. Click OK.
// 2. Close the Add
folder dialog box.
//
3. Open File Explorer on a vault view and observe the new sub-folder,
//
Temp.
//
4. Open the Administration tool.
//    a. Log in to the vault selected in step 1a.
//    b. Expand Groups and double-click Administrators.
//    c. Click Folder Permissions.
//    d. Inspect the folder permissions for Temp and click
OK.
//    e. Expand Users and double-click Engineer1.
//    f. Repeat steps 4c and 4d.
// 5. Exit the Administration tool.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace AddFolder_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BrowseButton_Click(System.Object sender, System.EventArgs e)
{
try
{
ListBox.Items.Clear();

if (vault1 == null)
{
vault1 = new EdmVault5();
}
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Show the Browse
For Folder dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = FolderBrowserDialog1.ShowDialog();
//If the user didn't click OK, exit
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

ListBox.Items.Add(FolderBrowserDialog1.SelectedPath);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void AddFolder_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmFolder5 parentFolder = default(IEdmFolder5);
parentFolder = vault2.GetFolderFromPath(ListBox.Items[0].ToString());

dynamic folderName = "Temp";
IEdmUserMgr5 usrMgr = default(IEdmUserMgr5);
usrMgr = (IEdmUserMgr5)parentFolder.Vault;

EdmFolderData data = default(EdmFolderData);
data = new EdmFolderData();

data.SetUserRights(usrMgr.GetUser("Engineer1").ID, (int)EdmRightFlags.EdmRight_Read | (int)EdmRightFlags.EdmRight_Lock);
data.SetGroupRights(usrMgr.GetUserGroup("Administrators").ID, (int)EdmRightFlags.EdmRight_All);

IEdmCard5 card = default(IEdmCard5);
card = parentFolder.Vault.RootFolder.GetCard("doc");
data.SetCardSource(card.ID, "doc");

IEdmFolder5 folder = default(IEdmFolder5);
folder = parentFolder.AddFolder(this.Handle.ToInt32(), folderName, data);
MessageBox.Show("Created " + folderName + " successfully with ID, " + Conversion.Str(folder.ID) + ", in " + parentFolder.Name);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Back to top

//Form1.Designer.cs

namespace AddFolder_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.AddFolder = new System.Windows.Forms.Button();
            this.FolderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 85);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(186, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse for parent folder...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click +=new System.EventHandler(BrowseButton_Click);
            //
            //ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.Size = new System.Drawing.Size(259, 43);
            this.ListBox.TabIndex = 4;
            //
            //AddFolder
            //
            this.AddFolder.Location = new System.Drawing.Point(84, 178);
            this.AddFolder.Name = "AddFolder";
            this.AddFolder.Size = new System.Drawing.Size(98, 23);
            this.AddFolder.TabIndex = 5;
            this.AddFolder.Text = "Add folder";
            this.AddFolder.UseVisualStyleBackColor = true;
            this.AddFolder.Click +=new System.EventHandler(AddFolder_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 215);
            this.Controls.Add(this.AddFolder);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add folder";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button AddFolder;
        internal System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Add Folder Example (VB.NET)

This example shows how to create a folder and set its data card and permissions.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type AddFolder in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Ensure that the vault has user, Engineer1, and group,
'    Administrators.
' 4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Add folder dialog box.
'    a. Select a vault view.
'    b. Click Browse for parent folder.
'       1. Locate and click a folder in the vault.
'       2. Click OK.
'    c. Click Add folder.
'       1.  Creates an IEdmFolderData5 object with:
'           * Folder user permissions for user, Engineer1.
'           * Folder group permissions for group, Administrators.
'           * File data card for .doc files.
 '       2. Displays a message that folder, Temp, is added as a subfolder to
'          the folder clicked in Postconditions 1b1.
'       3. Click OK.
' 2. Close the Add folder dialog box.
' 3. Open File Explorer on a vault view and observe the new sub-folder,
'    Temp.
' 4. Open the Administration tool.
'    a. Log in to the vault selected in step 1a.
'    b. Expand Groups and double-click Administrators.
'    c. Click Folder Permissions.
'    d. Inspect the folder permissions for Temp and click OK.
'    e. Expand Users and double-click Engineer1.
'    f. Repeat steps 4c and 4d.
' 5. Exit the Administration tool.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            ListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Show the Browse For Folder dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = FolderBrowserDialog1.ShowDialog()
            'If the user didn't click OK, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            ListBox.Items.Add(FolderBrowserDialog1.SelectedPath)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddFolder.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim parentFolder As IEdmFolder5
            parentFolder = vault2.GetFolderFromPath(ListBox.Items(0).ToString())

            Dim folderName = "Temp"
            Dim usrMgr As IEdmUserMgr5
            usrMgr = parentFolder.vault

            Dim data As EdmFolderData
            data = New EdmFolderData

            data.SetUserRights(usrMgr.GetUser("Engineer1").ID, EdmRightFlags.EdmRight_Read Or EdmRightFlags.EdmRight_Lock)
            data.SetGroupRights(usrMgr.GetUserGroup("Administrators").ID, EdmRightFlags.EdmRight_All)

            Dim card As IEdmCard5
            card = parentFolder.Vault.RootFolder.GetCard("doc")
            data.SetCardSource(card.ID, "doc;xls")

            Dim folder As IEdmFolder5
            folder = parentFolder.AddFolder(Me.Handle.ToInt32(), folderName, data)
            MsgBox("Created " + folderName + " successfully with ID, " + Str(folder.ID) + ", in " + parentFolder.Name)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.AddFolder = New System.Windows.Forms.Button()
        Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 85)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(186, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse for parent folder..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.Size = New System.Drawing.Size(259, 43)
        Me.ListBox.TabIndex = 4
        '
        'AddFolder
        '
        Me.AddFolder.Location = New System.Drawing.Point(84, 178)
        Me.AddFolder.Name = "AddFolder"
        Me.AddFolder.Size = New System.Drawing.Size(98, 23)
        Me.AddFolder.TabIndex = 5
        Me.AddFolder.Text = "Add folder"
        Me.AddFolder.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 215)
        Me.Controls.Add(Me.AddFolder)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add folder"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents AddFolder As System.Windows.Forms.Button
    Friend WithEvents FolderBrowserDialog1 As System.Windows.Forms.FolderBrowserDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Add Items Example (C#)

This example shows how to add items to a vault. The data for the items is imported from an XML file, which is read by the .NET XmlReader.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Create an XML file for this example.
//     a. Open a text editor like Notepad and copy and paste this code
//        into the editor.
//     b. Save the file as Items.xml and remember where you save the file.
//  2. Open the SOLIDWORKS PDM Professional Administration tool.
//  3. Log into the vault where to add a new serial number.
//     a. Right-click Serial Numbers and click New Serial Number.
//        1. Type AddItems in Name.
//        2. For Format string, click the right-arrow button and select Counter value > 00001.
//        3. Click OK.
//     b. Right-click Items and select Open.
//        1. Click AddItems in Item Serial Number.
//        2. Click OK.
//  4. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#, Windows, Desktop > Windows Forms Application.
//     b. Type AddItems in Project name.
//     c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//     f. Click Create.

//     g. Click Show All Files in the Solution Explorer
toolbar and expand

//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. Replace the code in Form1.Designer.cs with this code.
//     j. Right-click the AddItemsCSharp project name in the Solution Explorer.
//        1. Click Add > Class > Class.
//        2. Type EdmVaultSingleton.cs in Name.
//        3. Click Add.
//        4. Replace the code in EdmVaultSingleton.cs with this code.
//     k. Right-click the AddItems project name in the Solution Explorer.
//        1. Click Add > Class > Class.
//        2. Type NewItem.cs in Name.
//        3. Click Add.
//        4. Replace the code in NewItem.cs with this code.
//  5. Add dependencies and safely pass arrays of structures.
//  6. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click the Browse button, locate and select Items.xml, and click Open.
//  4. Click the Add items button.
//     The new items are printed in the dialog's list.
//  5. Close the dialog.
//  6. Open the SOLIDWORKS PDM Professional Item Explorer tool.
//     (In Windows 7, click Start > All Programs > SOLIDWORKS PDM Professional >
//     Item Explorer.)
//  7. Expand the vault where the new items were added.
//     The new items are listed below the name of the expanded vault.
//----------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <anyType xsi:type="Item">
    <Description>First Item</Description>
    <ProjectName>Project 1</ProjectName>
    <ProjectNumber>1</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 1</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Second Item</Description>
    <ProjectName>Project 2</ProjectName>
    <ProjectNumber>2</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 2</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Third Item</Description>
    <ProjectName>Project 3</ProjectName>
    <ProjectNumber>3</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 3</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Fourth Item</Description>
    <ProjectName>Project 4</ProjectName>
    <ProjectNumber>4</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 4</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Fifth Item</Description>
    <ProjectName>Project 5</ProjectName>
    <ProjectNumber>5</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 5</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Sixth Item</Description>
    <ProjectName>Project 6</ProjectName>
    <ProjectNumber>6</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 6</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Seventh Item</Description>
    <ProjectName>Project 7</ProjectName>
    <ProjectNumber>7</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 7</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Eighth Item</Description>
    <ProjectName>Project 8</ProjectName>
    <ProjectNumber>8</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 8</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Ninth Item</Description>
    <ProjectName>Project 9</ProjectName>
    <ProjectNumber>9</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 9</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Tenth Item</Description>
    <ProjectName>Project 10</ProjectName>
    <ProjectNumber>10</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 10</ItemName>
  </anyType>
</ArrayOfAnyType>
Back to top
//Form1.cs
using System;
using System.IO;
using EPDM.Interop.epdm;
using System.Collections;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace AddItemsCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                DialogResult dlgResult = XmlOpenFileDialog.ShowDialog();
                if (dlgResult == DialogResult.Cancel)
                {
                    return;
                }
                XmlTextBox.Text = XmlOpenFileDialog.FileName;
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddItemsButton_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                ItemsListBox.Items.Clear();
                ArrayList NewItems = new ArrayList();

                using (System.Xml.XmlReader XmlReader = System.Xml.XmlReader.Create(XmlTextBox.Text))
                {

                    XmlReader.Read();
                    XmlReader.ReadToNextSibling("ArrayOfAnyType");
                    XmlReader.ReadToDescendant("anyType");
                    do
                    {
                        NewItem CurItem = new NewItem();
                        XmlReader.ReadToDescendant("Description");
                        CurItem.Description = XmlReader.ReadString();
                        XmlReader.ReadToNextSibling("ProjectName");
                        CurItem.ProjectName = XmlReader.ReadString();
                        XmlReader.ReadToNextSibling("ProjectNumber");
                        CurItem.ProjectNumber = XmlReader.ReadString();
                        XmlReader.ReadToNextSibling("PartType");
                        CurItem.PartType = XmlReader.ReadString();
                        XmlReader.ReadToNextSibling("ItemName");
                        CurItem.ItemName = XmlReader.ReadString();
                        NewItems.Add(CurItem);
                    } while (XmlReader.ReadToFollowing("anyType"));
                }

                //Obtain the only instance of the IEdmVault5 object
                IEdmVault5 vault = EdmVaultSingleton.Instance;

                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Create the batch interface
                IEdmBatchItemGeneration2 BatchItemGen = default(IEdmBatchItemGeneration2);

                IEdmVault7 vault1 = (IEdmVault7)vault;
                BatchItemGen = (IEdmBatchItemGeneration2)vault1.CreateUtility(EdmUtility.EdmUtil_BatchItemGeneration);
                EdmVarVal[] VarVals = new EdmVarVal[4];
                VarVals[0].mlEdmVarValFlags = 0;
                VarVals[0].moVarIDorName = "Description";
                VarVals[1].mlEdmVarValFlags = 0;
                VarVals[1].moVarIDorName = "Project Name";
                VarVals[2].mlEdmVarValFlags = 0;
                VarVals[2].moVarIDorName = "Project number";
                VarVals[3].mlEdmVarValFlags = 0;
                VarVals[3].moVarIDorName = "Part Type";
                for (int i = 0; i <= NewItems.Count - 1; i++)
                {
                    VarVals[0].moValue = (NewItems[i] as NewItem).Description;
                    VarVals[1].moValue = (NewItems[i] as NewItem).ProjectName;
                    VarVals[2].moValue = (NewItems[i] as NewItem).ProjectNumber;
                    VarVals[3].moValue = (NewItems[i] as NewItem).PartType;
                    BatchItemGen.AddSelection2((EdmVault5)vault, VarVals, ((NewItems[i] as NewItem).ItemName),0, 0, 0,"", (int)EdmRefFlags.EdmRef_Dynamic);

                }

                //Build the item tree
                bool CreateSuccess = false;
                CreateSuccess = BatchItemGen.CreateTree(((int)(this.Handle.ToInt32())), (int)EdmItemGenerationFlags.Eigcf_Nothing);
                if ((CreateSuccess == false))
                    return;

                //Generate the items
                EdmGenItemInfo[] ReturnedItems = null;
                bool bOpenExplorer = false;
                BatchItemGen.GenerateItems(this.Handle.ToInt32(), out ReturnedItems, out bOpenExplorer, null);

                //Display the new item information in the list box
                string msg = "";
                if (ReturnedItems.Length == 0)
                {
                    msg = "No items were added.";
                    ItemsListBox.Items.Add("No items were added.");
                }
                else
                {
                    foreach (EdmGenItemInfo ItemInfo in ReturnedItems)
                    {

                        ItemsListBox.Items.Add("Item name: " + ItemInfo.mbsItemName);
                        ItemsListBox.Items.Add("Alternate name: " + ItemInfo.mbsItemAlternativeName);

                        IEdmVault11 vault2 = (IEdmVault11)vault;
                        ItemsListBox.Items.Add("Status: " + vault2.GetErrorMessage(ItemInfo.mhResult));
                        ItemsListBox.Items.Add("");
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddItems_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Obtain the only instance of the IEdmVault object
                IEdmVault8 vault = (IEdmVault8)EdmVaultSingleton.Instance;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
Back to top
//Form1.Designer.cs
namespace AddItemsCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.XmlLabel = new System.Windows.Forms.Label();
            this.XmlTextBox = new System.Windows.Forms.TextBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.AddItemsButton = new System.Windows.Forms.Button();
            this.ItemsListBox = new System.Windows.Forms.ListBox();
            this.XmlOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //XmlOpenFileDialog
            //
            this.XmlOpenFileDialog.Filter = "XML files|*.XML";
            //

            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(22, 22);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(25, 38);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(174, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // XmlLabel
            //
            this.XmlLabel.AutoSize = true;
            this.XmlLabel.Location = new System.Drawing.Point(25, 91);
            this.XmlLabel.Name = "XmlLabel";
            this.XmlLabel.Size = new System.Drawing.Size(172, 13);
            this.XmlLabel.TabIndex = 2;
            this.XmlLabel.Text = "XML file from which to import items:";
            //
            // XmlTextBox
            //
            this.XmlTextBox.Location = new System.Drawing.Point(28, 107);
            this.XmlTextBox.Name = "XmlTextBox";
            this.XmlTextBox.Size = new System.Drawing.Size(171, 20);
            this.XmlTextBox.TabIndex = 3;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(216, 107);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(75, 23);
            this.BrowseButton.TabIndex = 4;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // AddItemsButton
            //
            this.AddItemsButton.Location = new System.Drawing.Point(28, 149);
            this.AddItemsButton.Name = "AddItemsButton";
            this.AddItemsButton.Size = new System.Drawing.Size(75, 23);
            this.AddItemsButton.TabIndex = 5;
            this.AddItemsButton.Text = "Add items";
            this.AddItemsButton.UseVisualStyleBackColor = true;
            this.AddItemsButton.Click += new System.EventHandler(this.AddItemsButton_Click);
            //
            // ItemListBox
            //
            this.ItemsListBox.FormattingEnabled = true;
            this.ItemsListBox.Location = new System.Drawing.Point(28, 196);
            this.ItemsListBox.Name = "ItemsListBox";
            this.ItemsListBox.Size = new System.Drawing.Size(263, 95);
            this.ItemsListBox.TabIndex = 6;

            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(334, 311);
            this.Controls.Add(this.ItemsListBox);
            this.Controls.Add(this.AddItemsButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.XmlTextBox);
            this.Controls.Add(this.XmlLabel);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add new items";
            this.Load  += new System.EventHandler(this.AddItems_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Label XmlLabel;
        private System.Windows.Forms.TextBox XmlTextBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.Button AddItemsButton;
        private System.Windows.Forms.ListBox ItemsListBox;
        private System.Windows.Forms.OpenFileDialog XmlOpenFileDialog;
    }
}
Back to top
//EdmVaultSingleton.cs
using System;
using System.Collections;
using System.Diagnostics;
using System.Threading;
using EPDM.Interop.epdm;

namespace AddItemsCSharp
{
    public class EdmVaultSingleton
    {
        private static EdmVault5 mInstance = null;
        private static object mLockObj = new object();

        private EdmVaultSingleton()
        {

        }

        public static EdmVault5 Instance
        {
            get
            {
                try
                {
                    if (mInstance == null)
                    {
                        Monitor.Enter(mLockObj);
                        if (mInstance == null)
                        {
                            mInstance = new EdmVault5();
                        }
                        Monitor.Exit(mLockObj);
                    }
                }
                catch (Exception ex)
                {
                    Monitor.Exit(mLockObj);
                }

                return mInstance;

            }
        }

    }
}
Back to top

//NewItem.cs
using System;
using System.Collections;
using System.Diagnostics;

namespace AddItemsCSharp
{
    public class NewItem
    {
        //Value of "Description" variable
        private string mDescription;
        //Value of "Project Name" variable
        private string mProjectName;
        //Value of "Project number" variable
        private string mProjectNumber;
        //Value of "Part Type" variable
        private string mPartType;
        //Item name
        private string mItemName;

        public NewItem()
        {

        }

        public string Description
        {
            get { return mDescription; }
            set { mDescription = value; }
        }

        public string ProjectName
        {
            get { return mProjectName; }
            set { mProjectName = value; }
        }

        public string ProjectNumber
        {
            get { return mProjectNumber; }
            set { mProjectNumber = value; }
        }

        public string PartType
        {
            get { return mPartType; }
            set { mPartType = value; }
        }

        public string ItemName
        {
            get { return mItemName; }
            set { mItemName = value; }
        }

    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Add Items Example (VB.NET)

This example shows how to add items to a vault. The data for the items is imported from an XML file, which is read by the .NET XmlReader.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Create an XML file for this example.
'     a. Open a text editor like Notepad and copy and paste this code
'        into the editor.
'     b. Save the file as Items.xml and remember where you save the file.
'  2. Open the SOLIDWORKS PDM Professional Administration tool.
'  3. Log into the vault where to add a new serial number.
'     a. Right-click Serial Numbers and click New Serial Number.
'        1. Type AddItems in Name.
'        2. For Format string, click the right-arrow button and select Counter value > 00001.
'        3. Click OK.
'     b. Right-click Items and select Open.
'        1. Click AddItems in Item Serial Number.
'        2. Click OK.
'  4. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type AddItems in Project name.
'     c. For Location, click ... and navigate to the folder where to
create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. Replace the code in Form1.Designer.vb with this code.
'     j. Right-click the AddItems project name in the Solution Explorer.
'        1. Click Add > Class > Class.
'        2. Type EdmVaultSingleton.vb in Name.
'        3. Click Add.
'        4. Replace the code in EdmVaultSingleton.vb with this code.
'     k. Right-click the AddItems project name in the Solution Explorer.
'        1. Click Add > Class > Class.
'        2. Type NewItem.vb in Name.
'        3. Click Add.
'        4. Replace the code in NewItem.vb with this code.
'  5. Add dependencies and safely pass arrays of structures.
'  6. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click the Browse button, locate and click Items.xml, and click Open.
'  4. Click the Add items button.
'     The new items are printed in the dialog's list.
'  5. Close the dialog.
'  6. Open the SOLIDWORKS PDM Professional Item Explorer tool.
'     (In Windows 7, click Start > All Programs > SOLIDWORKS PDM Professional >
'     Item Explorer.)
'  7. Expand the vault where the new items were added.
'     The new items are listed below the name of the expanded vault.
'----------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <anyType xsi:type="Item">
    <Description>First Item</Description>
    <ProjectName>Project 1</ProjectName>
    <ProjectNumber>1</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 1</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Second Item</Description>
    <ProjectName>Project 2</ProjectName>
    <ProjectNumber>2</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 2</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Third Item</Description>
    <ProjectName>Project 3</ProjectName>
    <ProjectNumber>3</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 3</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Fourth Item</Description>
    <ProjectName>Project 4</ProjectName>
    <ProjectNumber>4</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 4</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Fifth Item</Description>
    <ProjectName>Project 5</ProjectName>
    <ProjectNumber>5</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 5</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Sixth Item</Description>
    <ProjectName>Project 6</ProjectName>
    <ProjectNumber>6</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 6</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Seventh Item</Description>
    <ProjectName>Project 7</ProjectName>
    <ProjectNumber>7</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 7</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Eighth Item</Description>
    <ProjectName>Project 8</ProjectName>
    <ProjectNumber>8</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 8</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Ninth Item</Description>
    <ProjectName>Project 9</ProjectName>
    <ProjectNumber>9</ProjectNumber>
    <PartType>Purchased</PartType>
    <ItemName>Item 9</ItemName>
  </anyType>
  <anyType xsi:type="Item">
    <Description>Tenth Item</Description>
    <ProjectName>Project 10</ProjectName>
    <ProjectNumber>10</ProjectNumber>
    <PartType>Built</PartType>
    <ItemName>Item 10</ItemName>
  </anyType>
</ArrayOfAnyType>
Back to top

'Form1.vb
Imports System.IO
Imports EPDM.Interop.epdm
Imports System.Xml
Imports System.Windows.Forms

Public Class AddItems

  Private Sub BrowseButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles BrowseButton.Click

    Try
      Dim dlgResult As DialogResult = XmlOpenFileDialog.ShowDialog()
      If dlgResult = Windows.Forms.DialogResult.Cancel Then
        Exit Sub
      End If
      XmlTextBox.Text = XmlOpenFileDialog.FileName
    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub AddItemsButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles AddItemsButton.Click

    Try
      ItemsListBox.Items.Clear()
      Dim NewItems As ArrayList = New ArrayList

      Using XmlReader As Xml.XmlReader = _
        Xml.XmlReader.Create(XmlTextBox.Text)

        XmlReader.Read()
        XmlReader.ReadToNextSibling("ArrayOfAnyType")
        XmlReader.ReadToDescendant("anyType")
        Do
          Dim CurItem As New NewItem
          XmlReader.ReadToDescendant("Description")
          CurItem.Description = XmlReader.ReadString()
          XmlReader.ReadToNextSibling("ProjectName")
          CurItem.ProjectName = XmlReader.ReadString()
          XmlReader.ReadToNextSibling("ProjectNumber")
          CurItem.ProjectNumber = XmlReader.ReadString()
          XmlReader.ReadToNextSibling("PartType")
          CurItem.PartType = XmlReader.ReadString()
          XmlReader.ReadToNextSibling("ItemName")
          CurItem.ItemName = XmlReader.ReadString()
          NewItems.Add(CurItem)
        Loop While XmlReader.ReadToFollowing("anyType")
      End Using

      'Obtain the only instance of the IEdmVault5 object
      Dim vault As IEdmVault5 = EdmVaultSingleton.Instance

      If Not vault.IsLoggedIn Then
        'Log into selected vault as the current user
        vault.LoginAuto(VaultsComboBox.Text, _
          Me.Handle.ToInt32())
      End If

      'Create the batch interface
      Dim BatchItemGen As IEdmBatchItemGeneration2
      BatchItemGen = vault.CreateUtility( _
        EdmUtility.EdmUtil_BatchItemGeneration)
      Dim VarVals(3) As EdmVarVal
      VarVals(0).mlEdmVarValFlags = 0
      VarVals(0).moVarIDorName = "Description"
      VarVals(1).mlEdmVarValFlags = 0
      VarVals(1).moVarIDorName = "Project Name"
      VarVals(2).mlEdmVarValFlags = 0
      VarVals(2).moVarIDorName = "Project number"
      VarVals(3).mlEdmVarValFlags = 0
      VarVals(3).moVarIDorName = "Part Type"
      For i As Integer = 0 To NewItems.Count - 1
        VarVals(0).moValue = NewItems(i).Description
        VarVals(1).moValue = NewItems(i).ProjectName
        VarVals(2).moValue = NewItems(i).ProjectNumber
        VarVals(3).moValue = NewItems(i).PartType
        BatchItemGen.AddSelection2(vault, VarVals, _
          NewItems(i).ItemName)
      Next i

      'Build the item tree
      Dim CreateSuccess As Boolean
      CreateSuccess = BatchItemGen.CreateTree( _
        Me.Handle.ToInt32, _
        EdmItemGenerationFlags.Eigcf_Nothing)
            If (CreateSuccess = False) Then Exit Sub

      'Generate the items
      Dim ReturnedItems() As EdmGenItemInfo = Nothing
      Dim bOpenExplorer As Boolean = False
      BatchItemGen.GenerateItems(Me.Handle.ToInt32, _
        ReturnedItems, bOpenExplorer, Nothing)

      'Display the new item information in the list box
      Dim msg As String = ""
      If ReturnedItems.Length = 0 Then
        msg = "No items were added."
        ItemsListBox.Items.Add("No items were added.")
      Else
        For Each ItemInfo As EdmGenItemInfo _
          In ReturnedItems

          ItemsListBox.Items.Add("Item name: " + _
            ItemInfo.mbsItemName)
          ItemsListBox.Items.Add("Alternate name: " + _
            ItemInfo.mbsItemAlternativeName)
          ItemsListBox.Items.Add("Status: " + _
            vault.GetErrorMessage(ItemInfo.mhResult))
          ItemsListBox.Items.Add("")
        Next ItemInfo
      End If
    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub AddItems_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Try
      'Obtain the only instance of the IEdmVault object
      Dim vault As IEdmVault8 = EdmVaultSingleton.Instance
      Dim Views() As EdmViewInfo = Nothing

      vault.GetVaultViews(Views, False)
      VaultsComboBox.Items.Clear()
      For Each View As EdmViewInfo In Views
        VaultsComboBox.Items.Add(View.mbsVaultName)
      Next
      If VaultsComboBox.Items.Count > 0 Then
        VaultsComboBox.Text = VaultsComboBox.Items(0)
      End If
    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub
End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class AddItems
   Inherits System.Windows.Forms.Form

   'Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.XmlTextBox = New System.Windows.Forms.TextBox()
        Me.XmlLabel = New System.Windows.Forms.Label()
        Me.XmlOpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.AddItemsButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.ItemsListBox = New System.Windows.Forms.ListBox()
        Me.SuspendLayout()
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(222, 94)
        Me.BrowseButton.Margin = New System.Windows.Forms.Padding(2)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(59, 26)
        Me.BrowseButton.TabIndex = 0
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'XmlTextBox
        '
        Me.XmlTextBox.Location = New System.Drawing.Point(24, 94)
        Me.XmlTextBox.Margin = New System.Windows.Forms.Padding(2)
        Me.XmlTextBox.Name = "XmlTextBox"
        Me.XmlTextBox.Size = New System.Drawing.Size(182, 20)
        Me.XmlTextBox.TabIndex = 1
        '
        'XmlLabel
        '
        Me.XmlLabel.AutoSize = True
        Me.XmlLabel.Location = New System.Drawing.Point(22, 78)
        Me.XmlLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.XmlLabel.Name = "XmlLabel"
        Me.XmlLabel.Size = New System.Drawing.Size(172, 13)
        Me.XmlLabel.TabIndex = 2
        Me.XmlLabel.Text = "XML file from which to import items:"
        '
        'XmlOpenFileDialog
        '
        Me.XmlOpenFileDialog.Filter = "XML files|*.xml"
        '
        'AddItemsButton
        '
        Me.AddItemsButton.Location = New System.Drawing.Point(29, 139)
        Me.AddItemsButton.Margin = New System.Windows.Forms.Padding(2)
        Me.AddItemsButton.Name = "AddItemsButton"
        Me.AddItemsButton.Size = New System.Drawing.Size(87, 24)
        Me.AddItemsButton.TabIndex = 3
        Me.AddItemsButton.Text = "Add items"
        Me.AddItemsButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(22, 40)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(184, 21)
        Me.VaultsComboBox.TabIndex = 12
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(22, 24)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 13
        Me.VaultsLabel.Text = "Select vault  view:"
        '
        'ItemsListBox
        '
        Me.ItemsListBox.FormattingEnabled = True
        Me.ItemsListBox.Location = New System.Drawing.Point(29, 175)
        Me.ItemsListBox.Margin = New System.Windows.Forms.Padding(2)
        Me.ItemsListBox.Name = "ItemsListBox"
        Me.ItemsListBox.Size = New System.Drawing.Size(253, 121)
        Me.ItemsListBox.TabIndex = 14
        '
        'AddItems
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(299, 320)
        Me.Controls.Add(Me.ItemsListBox)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Controls.Add(Me.AddItemsButton)
        Me.Controls.Add(Me.XmlLabel)
        Me.Controls.Add(Me.XmlTextBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "AddItems"
        Me.Text = "Add New Items"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
   Friend WithEvents BrowseButton As System.Windows.Forms.Button
   Friend WithEvents XmlTextBox As System.Windows.Forms.TextBox
   Friend WithEvents XmlLabel As System.Windows.Forms.Label
   Friend WithEvents XmlOpenFileDialog As System.Windows.Forms.OpenFileDialog
   Friend WithEvents AddItemsButton As System.Windows.Forms.Button
   Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents VaultsLabel As System.Windows.Forms.Label
   Friend WithEvents ItemsListBox As System.Windows.Forms.ListBox

End Class
Back to top
'EdmVaultSingleton.vb

Imports System.Threading
Imports EPDM.Interop.epdm

Public NotInheritable Class EdmVaultSingleton
  Private Shared mInstance As EdmVault5 = Nothing
  Private Shared mLockObj As New Object()

  Private Sub New()

  End Sub

  Public Shared ReadOnly Property Instance() As EdmVault5
    Get
      Try
        If mInstance Is Nothing Then
          Monitor.Enter(mLockObj)
          If mInstance Is Nothing Then
            mInstance = New EdmVault5()
          End If
          Monitor.Exit(mLockObj)
        End If
      Catch ex As Exception
        Monitor.Exit(mLockObj)
      End Try

      Return mInstance

    End Get
  End Property

End Class
Back to top
'NewItem.vb
Public Class NewItem
    'Value of "Description" variable
    Private mDescription As String
    'Value of "Project Name" variable
    Private mProjectName As String
    'Value of "Project number" variable
    Private mProjectNumber As String
    'Value of "Part Type" variable
    Private mPartType As String
    'Item name
    Private mItemName As String

    Public Sub New()

    End Sub

    Public Property Description() As String
        Get
            Description = mDescription
        End Get
        Set(ByVal Value As String)
            mDescription = Value
        End Set
    End Property

    Public Property ProjectName() As String
        Get
            ProjectName = mProjectName
        End Get
        Set(ByVal Value As String)
            mProjectName = Value
        End Set
    End Property

    Public Property ProjectNumber() As String
        Get
            ProjectNumber = mProjectNumber
        End Get
        Set(ByVal Value As String)
            mProjectNumber = Value
        End Set
    End Property

    Public Property PartType() As String
        Get
            PartType = mPartType
        End Get
        Set(ByVal Value As String)
            mPartType = Value
        End Set
    End Property

    Public Property ItemName() As String
        Get
            ItemName = mItemName
        End Get
        Set(ByVal Value As String)
            mItemName = Value
        End Set
    End Property

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Add Row to Bill of Materials Example (C#)

This example shows how to add a row to the named Bill of Materials (BOM) of a file in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Application.
//    b. Type EdmBOM_CSharp in Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and
safely pass arrays of structures.
// 3. Ensure that the vault contains the BOM layout.
//    To inspect the
existing layouts:
//    a. Open the SOLIDWORKS PDM Professional
Administration tool.
//    b. Log into vault_name.
//    c. Expand vault_name
> Bills of Materials.
//    d. Verify that layout, BOM, exists.
//
4. Ensure that an assembly and its parts exist in a folder of
//    the vault.
// 5. Check in a text file named "temp" in the assembly directory.
// 6. Modify the path to "temp" in the code.
// 7. Ensure that a named Bill of Materials exists for the assembly.
//    a. Open File Explorer on a vault_name view.
//    b. Click the assembly.
//    c. Click the Bill of Materials
tab.
//    d. Click BOM.
//    e. If a named Bill of Materials does not exist in the BOM
list:
//       1. Click Save > Save As in
the tab toolbar.
//       2. In the Save As dialog, click
Save.
// 8. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Bill of Materials dialog box displays.
//    a. Select a vault_name view.
//    b. Click Select file.
//    c. In the Select File dialog:
//       1. Click the assembly specified in
Preconditions step 6.
//       2. Click Open.
//    d. Click Get BOM.
//       Displays message boxes containing:
//       * Version information for the named BOM.
//       * Row and column information about a BOM
view in the BOM layout
//         for the selected assembly.
//    e. Click OK in each message box.
// 2. Inserts a row for "temp" after the first row in the BOM.
// 3. Close the Bill of Materials dialog box.
// 4. Verify the new row in the named BOM of the assembly in vault_name
view.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Xml.Serialization;
using System.Windows.Forms;
using System.ComponentModel;
using EPDM.Interop.epdm;

namespace EdmBOM_CSharp
{
    public partial class Form1 : Form
    {
        private IEdmVault5 vault1 = null;
        IEdmFile7 aFile;
        IEdmBom bom;
        IEdmBomMgr bomMgr;
        IEdmBomView2 bomView;

        public Form1()
        {
            InitializeComponent();
        }
        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void SelectFiles_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                File1List.Items.Clear();

                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select File dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;

                //Show the Select File dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // do nothing
                }
                else
                {
                    IEdmFolder5 ppoRetParentFolder;
                    foreach (string FileName in OpenFileDialog1.FileNames)
                    {
                        File1List.Items.Add(FileName);
                        aFile = (IEdmFile7)vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetBOM_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault9)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if (aFile != null)
                {

                    bomMgr = (IEdmBomMgr)vault2.CreateUtility(EdmUtility.EdmUtil_BomMgr);
                    EdmBomInfo[] derivedBOMs;
                    aFile.GetDerivedBOMs(out derivedBOMs);
                    int i = 0;
                    int arrSize = derivedBOMs.Length;
                    string str = "";
                    int id;
                    while (i < arrSize)
                    {
                        id = derivedBOMs[i].mlBomID;
                        bom = (IEdmBom)vault2.GetObject(EdmObjectType.EdmObject_BOM, id);
                        str = "Derived BOM: " + derivedBOMs[i].mbsBomName + " " + bom.CheckOutUserID + " " + bom.CurrentState.Name + " " + bom.CurrentVersion + " " + bom.FileID + " " + bom.IsCheckedOut;

                        MessageBox.Show(str);
                        i = i + 1;
                    }

                    bomView = (IEdmBomView2)bom.GetView(0);

                    // Display BOM view row and column information
                    object[] ppoRows = null;
                    IEdmBomCell ppoRow = default(IEdmBomCell);
                    bomView.GetRows(out ppoRows);
                    i = 0;
                    arrSize = ppoRows.Length;
                    str = "";
                    while (i < arrSize)
                    {
                        ppoRow = (IEdmBomCell)ppoRows[i];
                        str = "BOM Row " + i + ": " + "\n" + "Item ID: " + ppoRow.GetItemID() + "\n" + "Path name: " + ppoRow.GetPathName() + "\n" + "Tree level: " + ppoRow.GetTreeLevel() + "\n" + " Is locked? " + ppoRow.IsLocked();
                        MessageBox.Show(str);
                        i = i + 1;
                    }

                    EdmBomColumn[] ppoColumns = null;
                    bomView.GetColumns(out ppoColumns);
                    i = 0;
                    arrSize = ppoColumns.Length;
                    str = "";
                    while (i < arrSize)
                    {
                        str = "BOM Column " + i + ": " + "\n" + "Header: " + ppoColumns[i].mbsCaption + "\n" + "Column type as defined in EdmBomColumnType: " + ppoColumns[i].meType + "\n" + "ID: " + ppoColumns[i].mlColumnID + "\n" + "Flags: " + ppoColumns[i].mlFlags + "\n" + "Variable ID: " + ppoColumns[i].mlVariableID + "\n" + "Variable type as defined in EdmVariableType: " + ppoColumns[i].mlVariableType + "\n" + "Column width: " + ppoColumns[i].mlWidth;
                        MessageBox.Show(str);
                        i = i + 1;
                    }

                    EdmBomCell ppoNewRow = default(EdmBomCell);
                    string errMsg = "";
                    //object poValue = null;
                    //object poComputedValue = null;
                    //string pbsConfiguration = "";
                    //bool pbReadOnly = false;
                    int plFocusNode = 0;
                    bomView.InsertRow((EdmBomCell)ppoRows[0], EdmBomInsertRowOption.EdmBomInsertRowOption_BelowRow, out ppoNewRow);
                    ppoNewRow.SetVar(ppoColumns[0].mlVariableID, ppoColumns[0].meType, "vault_name\\temp", "", EdmBomSetVarOption.EdmBomSetVarOption_Both, out errMsg);
                    //ppoNewRow.GetVar(ppoColumns[0].mlVariableID, ppoColumns[0].meType, poValue, poComputedValue, pbsConfiguration, pbReadOnly)
                    //MessageBox.Show(poValue.ToString)
                    //MessageBox.Show(poComputedValue.ToString)
                    //MessageBox.Show(pbsConfiguration)
                    //MessageBox.Show(pbReadOnly.ToString)

                    bomView.Commit("", out errMsg, out plFocusNode);

                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

Back to top

//Form1.Designer.cs

namespace EdmBOM_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.GetBOM = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select file...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click += new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //GetBOM
            //
            this.GetBOM.Location = new System.Drawing.Point(40, 183);
            this.GetBOM.Name = "GetBOM";
            this.GetBOM.Size = new System.Drawing.Size(157, 23);
            this.GetBOM.TabIndex = 6;
            this.GetBOM.Text = "Get BOM";
            this.GetBOM.UseVisualStyleBackColor = true;
            this.GetBOM.Click += new System.EventHandler(this.GetBOM_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.GetBOM);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Bill of Materials";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button GetBOM;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Add Row to Bill of Materials Example (VB.NET)

This example shows how to add a row to the named Bill of Materials (BOM) of a file in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type EdmBOM in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Ensure that the vault contains the BOM layout.
'    To inspect the existing layouts:
'    a. Open the SOLIDWORKS PDM Professional Administration tool.
'    b. Log into vault_name.
'    c. Expand vault_name > Bills of Materials.
'    d. Verify that layout, BOM, exists.
' 4. Ensure that an assembly and its parts exist in a folder of
'    the vault.
' 5. Check in a text file named "temp" in the assembly directory.
' 6. Modify the path to "temp" in the code.
' 7. Ensure that a named Bill of Materials exists for the assembly.
'    a. Open File Explorer on a vault_name view.
'    b. Click the assembly.
'    c. Click the Bill of Materials tab.
'    d. Click BOM.
'    e. If a named Bill of Materials does not exist in the BOM list:
'       1. Click Save > Save As in the tab toolbar.
'       2. In the Save As dialog, click Save.
' 8. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. The Bill of Materials dialog box displays.
'    a. Select a vault_name view.
'    b. Click Select file.
'    c. In the Select File dialog:
'       1. Click the assembly specified in Preconditions step 5.
'       2. Click Open.
'    d. Click Get BOM.
'       Displays message boxes containing:
'       * Version information for the named BOM.
'       * Row and column information about a BOM view in the BOM layout
'         for the selected assembly.
'    e. Click OK in each message box.
' 2. Inserts a row for "temp" after the first row in the BOM.
' 3. Close the Bill of Materials dialog box.
' 4. Verify the new row in the named BOM of the assembly in vault_name view.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile7
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim bom As IEdmBom
    Dim bomCell As IEdmBomCell
    Dim bomMgr As IEdmBomMgr
    Dim bomView As IEdmBomView2
    Dim retVal As Boolean
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                    aPos = aFile.GetFirstFolderPosition
                    aFolder = aFile.GetNextFolder(aPos)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetBOM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetBOM.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault9)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            bomMgr = vault2.CreateUtility(EdmUtility.EdmUtil_BomMgr)
            Dim ppoRetLayouts() As EdmBomLayout
            bomMgr.GetBomLayouts(ppoRetLayouts)

            Dim derivedBOMs() As EdmBomInfo
            aFile.GetDerivedBOMs(derivedBOMs)

            Dim arrSize As Integer
            Dim i As Integer = 0
            Dim id As Integer
            Dim str As String = ""
            arrSize = derivedBOMs.Length

            While i < arrSize
                id = derivedBOMs(i).mlBomID
                bom = vault2.GetObject(EdmObjectType.EdmObject_BOM, id)
                str = "Derived BOM: " + derivedBOMs(i).mbsBomName & " " & bom.CheckOutUserID & " " & bom.CurrentState.Name & " " & bom.CurrentVersion & " " & bom.FileID & " " & bom.IsCheckedOut
                MessageBox.Show(str)
                i = i + 1
            End While

            bomView = bom.GetView(0)

            Dim ppoRows() As Object
            Dim ppoRow As IEdmBomCell
            bomView.GetRows(ppoRows)
            i = 0
            arrSize = ppoRows.Length
            str = ""
            While i < arrSize
                ppoRow = ppoRows(i)
                str = "Row " & i & ": " & ppoRow.GetItemID & " " & ppoRow.GetPathName & " " & ppoRow.GetTreeLevel & " " & ppoRow.IsLocked
                MessageBox.Show(str)
                i = i + 1
            End While

            Dim ppoColumns() As EdmBomColumn
            bomView.GetColumns(ppoColumns)
            i = 0
            arrSize = ppoColumns.Length
            str = ""
            While i < arrSize
                str = "Column " & i & ": " & ppoColumns(i).mbsCaption & " " & ppoColumns(i).meType & " " & ppoColumns(i).mlColumnID & " " & ppoColumns(i).mlFlags & " " & ppoColumns(i).mlVariableID & " " & ppoColumns(i).mlVariableType & " " & ppoColumns(i).mlWidth
                MessageBox.Show(str)
                i = i + 1
            End While

            Dim ppoNewRow As IEdmBomCell
            Dim errMsg As String = ""
            'Dim poValue As Object = Nothing
            'Dim poComputedValue As Object = Nothing
            'Dim pbsConfiguration As String = ""
            'Dim pbReadOnly As Boolean
            Dim plFocusNode As Integer
            bomView.InsertRow(ppoRows(0), EdmBomInsertRowOption.EdmBomInsertRowOption_BelowRow, ppoNewRow)
            ppoNewRow.SetVar(ppoColumns(0).mlVariableID, ppoColumns(0).meType, "vault_name\temp", "", EdmBomSetVarOption.EdmBomSetVarOption_Both, errMsg)
            'ppoNewRow.GetVar(ppoColumns(0).mlVariableID, ppoColumns(0).meType, poValue, poComputedValue, pbsConfiguration, pbReadOnly)
            'MessageBox.Show(poValue.ToString)
            'MessageBox.Show(poComputedValue.ToString)
            'MessageBox.Show(pbsConfiguration)
            'MessageBox.Show(pbReadOnly.ToString)

            bomView.Commit("", errMsg, plFocusNode)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.GetBOM = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select file for which to get a BOM..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'GetBOM
        '
        Me.GetBOM.Location = New System.Drawing.Point(40, 183)
        Me.GetBOM.Name = "GetBOM"
        Me.GetBOM.Size = New System.Drawing.Size(157, 23)
        Me.GetBOM.TabIndex = 6
        Me.GetBOM.Text = "Get BOM"
        Me.GetBOM.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = False
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.GetBOM)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Bill of Materials"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents GetBOM As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Add Users Example (C#)

This example shows how to add users to a vault by deserializing an XML file containing user data.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//---------------------------------------------------------------------------
// Preconditions:
//  1. Create an XML file for this example.
//     a. Open a text editor like Notepad and copy and paste this code
//        into the editor.
//     b. Save the file as User.xml and remember where you save the file.
//  2. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#, Windows, Desktop > Windows Forms Application.
//     b. Type AddUsersCSharp in Project name.
//     c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//     f. Click Create.

//     g. Click Show All Files in the Solution Explorer
toolbar and expand

//       Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. Replace the code in Form1.Designer.cs with this code.
//     j. Right-click the AddUsersCSharp project name in the Solution Explorer.
//        1. Click Add > Class > Class.
//        2. Type EdmVaultSingleton.cs in Name.
//        3. Click Add.
//        4. Replace the code in EdmVaultSingleton.cs with this code.
//     k. Right-click the AddUsersCSharp project name in the Solution Explorer.
//        1. Click Add > Class > Class.
//        2. Type User.cs in Name.
//        3. Click Add.
//        4. Replace the code in User.cs with this code.
//  3. Add dependencies and safely pass arrays of structures.
//  4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click Browse, locate and select User.xml, and click Open.
//  4. Click Add users.
//     A message box is displayed showing the names of the new users added
//     to the vault.
//  5. Click OK to close the message box.
//  6. Close the dialog.
//  7. Start and log into the SOLIDWORKS PDM Professional Administration
//     tool as Admin.
//  8. Expand the vault where the new users were added.
//  9. Expand Users to see the names of the new users.
// 10. Double-click jdoe.
//     a. Examine the properties.
//     b. Click Administrative Permissions and examine the permissions.
//     c. Click OK.
// 11. Double-click jsmith and repeat steps 10a - 10c.
//----------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <anyType xsi:type="User">
      <sn>Doe</sn>
      <givenName>John</givenName>
      <title>Designer</title>
      <cn>John Doe</cn>
      <username>jdoe@yourcompany.com</username>
  </anyType>
  <anyType xsi:type="User">
      <sn>Smith</sn>
      <givenName>Jane</givenName>
      <title>Manager</title>
      <cn>Jane Smith</cn>
      <username>jsmith@yourcompany.com</username>
  </anyType>
</ArrayOfAnyType>
Back to top
//Form1.cs
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Xml.Serialization;
using System.Windows.Forms;
using EPDM.Interop.epdm;
using System.Xml;
using System.Runtime.InteropServices;

namespace AddUsersCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                DialogResult dlgResult = XmlOpenFileDialog.ShowDialog();
                if (dlgResult == DialogResult.Cancel)
                {
                    return;
                }
                XmlTextBox.Text = XmlOpenFileDialog.FileName;
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddUsersButton_Click(System.Object sender, System.EventArgs e)
        {
            StreamReader StrReader = null;

            try
            {
                //Deserialize users from an XML file
                Type[] ExtraTypes = { Type.GetType("AddUsersCSharp.User") };
                XmlSerializer XmlSer = new XmlSerializer(Type.GetType("System.Collections.ArrayList"), ExtraTypes);
                StrReader = new StreamReader(XmlTextBox.Text);
                ArrayList NewUsers = (ArrayList)XmlSer.Deserialize(StrReader);

                //Obtain the only instance of the IEdmVaultObject
                IEdmVault5 vault = EdmVaultSingleton.Instance;

                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Assign IEdmVault object to the IEdmUserMgr7 object
                IEdmUserMgr7 UsrMgr = (IEdmUserMgr7)vault;

                //Declare EdmUserData array to hold new user data
                EdmUserData2[] UserData = new EdmUserData2[NewUsers.Count];

                //Set the EdmUserData members for each new user
                for (int i = 0; i <= NewUsers.Count - 1; i++)
                {
                    if (NewUsers[i] != null)
                    {
                        UserData[i].mbsCompleteName = (NewUsers[i] as User).cn;
                        UserData[i].mbsEmail = (NewUsers[i] as User).username;
                        UserData[i].mbsInitials = (NewUsers[i] as User).givenName.Substring(0, 1) + (NewUsers[i] as User).sn.Substring(0, 1);
                        UserData[i].mbsUserName = (NewUsers[i] as User).username.Split('@')[0];
                        //Return user's IEdmUser6 interface in mpoUser
                        UserData[i].mlFlags = (int)EdmUserDataFlags.Edmudf_GetInterface;
                        //Add this user even if others cannot be added
                        UserData[i].mlFlags += (int)EdmUserDataFlags.Edmudf_ForceAdd;

                        //Set permissions
                        EdmSysPerm[] perms = new EdmSysPerm[3];
                        perms[0] = EdmSysPerm.EdmSysPerm_EditUserMgr;
                        perms[1] = EdmSysPerm.EdmSysPerm_EditReportQuery;
                        perms[2] = EdmSysPerm.EdmSysPerm_MandatoryVersionComments;
                        UserData[i].moSysPerms = perms;
                    }
                }

                //Add the users to the vault
                UsrMgr.AddUsers2(ref UserData);

                string msg = "";
                foreach (EdmUserData2 usr in UserData)
                {
                    if (usr.mhStatus == 0)

                    {
                        msg += "Created user \"" + usr.mpoUser.Name + "\" successfully. ID = " + usr.mpoUser.ID.ToString() + "\n";

                    }
                    else
                    {
                        IEdmVault11 vault2 = (IEdmVault11)vault;
                        msg += "Error creating user \"" + usr.mbsUserName + "\" - " + vault2.GetErrorMessage(usr.mhStatus) + "\n";
                    }
                }
                MessageBox.Show(msg);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if ((StrReader != null))
                {
                    StrReader.Close();
                }
            }
        }

        public void AddUsers_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
              //Obtain the only instance of the IEdmVault object
              IEdmVault8 vault = (IEdmVault8)EdmVaultSingleton.Instance;

                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}
Back to top
//Form1.Designer.cs
namespace AddUsersCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.XmlLabel = new System.Windows.Forms.Label();
            this.XmlTextBox = new System.Windows.Forms.TextBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.AddUsersButton = new System.Windows.Forms.Button();
            this.XmlOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();

            //
            //XmlOpenFileDialog
            //
            this.XmlOpenFileDialog.Filter = "XML files|*.XML";
            //

            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(23, 34);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(26, 62);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(171, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // XmlLabel
            //
            this.XmlLabel.AutoSize = true;
            this.XmlLabel.Location = new System.Drawing.Point(26, 111);
            this.XmlLabel.Name = "XmlLabel";
            this.XmlLabel.Size = new System.Drawing.Size(173, 13);
            this.XmlLabel.TabIndex = 2;
            this.XmlLabel.Text = "XML file from which to import users:";
            //
            // XmlTextBox
            //
            this.XmlTextBox.Location = new System.Drawing.Point(26, 139);
            this.XmlTextBox.Name = "XmlTextBox";
            this.XmlTextBox.Size = new System.Drawing.Size(171, 20);
            this.XmlTextBox.TabIndex = 3;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(203, 135);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(75, 23);
            this.BrowseButton.TabIndex = 4;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(BrowseButton_Click);
            //
            // AddUsersButton
            //
            this.AddUsersButton.Location = new System.Drawing.Point(29, 189);
            this.AddUsersButton.Name = "AddUsersButton";
            this.AddUsersButton.Size = new System.Drawing.Size(75, 23);
            this.AddUsersButton.TabIndex = 5;
            this.AddUsersButton.Text = "Add users";
            this.AddUsersButton.UseVisualStyleBackColor = true;
            this.AddUsersButton.Click += new System.EventHandler(this.AddUsersButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Controls.Add(this.AddUsersButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.XmlTextBox);
            this.Controls.Add(this.XmlLabel);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add new users";
            this.Load += new System.EventHandler(this.AddUsers_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Label XmlLabel;
        private System.Windows.Forms.TextBox XmlTextBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.Button AddUsersButton;
        private System.Windows.Forms.OpenFileDialog XmlOpenFileDialog;
    }
}

Back to top
//EdmVaultSingleton.cs
using System;
using System.Collections;
using System.Diagnostics;
using System.Threading;
using EPDM.Interop.epdm;

namespace AddUsersCSharp
{
    public class EdmVaultSingleton
    {
        private static EdmVault5 mInstance = null;
        private static object mLockObj = new object();

        private EdmVaultSingleton()
        {

        }

        public static EdmVault5 Instance
        {
            get
            {
                try
                {
                    if (mInstance == null)
                    {
                        Monitor.Enter(mLockObj);
                        if (mInstance == null)
                        {
                            mInstance = new EdmVault5();
                        }
                        Monitor.Exit(mLockObj);
                    }
                }
                catch (Exception ex)
                {
                    Monitor.Exit(mLockObj);
                }

                return mInstance;

            }
        }

    }
}
Back to top
//User.cs
using System;
using System.Collections;
using System.Diagnostics;

namespace AddUsersCSharp
{
    public class User
    {
        //First name
        private string mSn;
        //Last name
        private string mGivenName;
        //Title
        private string mTitle;
        //Complete name
        private string mCn;
        //Email address
        private string mUsername;

        public User()
        {

        }

        public string sn
        {
            get { return mSn; }
            set { mSn = value; }
        }

        public string givenName
        {
            get { return mGivenName; }
            set { mGivenName = value; }
        }

        public string title
        {
            get { return mTitle; }
            set { mTitle = value; }
        }

        public string cn
        {
            get { return mCn; }
            set { mCn = value; }
        }

        public string username
        {
            get { return mUsername; }
            set { mUsername = value; }
        }
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Add Users Example (VB.NET)

This example shows how to add users to a vault by deserializing an XML file containing user data.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Create an XML file for this example.
'     a. Open a text editor like Notepad and copy and paste this code
'        into the editor.
'     b. Save the file as User.xml and remember where you save the file.
'  2. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type AddUsers in Project name.
'     c. For Location, click ... and navigate to the folder where to
create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. Replace the code in Form1.Designer.vb with this code.
'     j. Right-click the AddUsers project name in the Solution Explorer.
'        1. Click Add > Class > Class.
'        2. Type EdmVaultSingleton.vb in Name.
'        3. Click Add.
'        4. Replace the code in EdmVaultSingleton.vb with this code.
'     k. Right-click the AddUsers project name in the Solution Explorer.
'        1. Click Add > Class > Class.
'        2. Type User.vb in Name.
'        3. Click Add.
'        4. Replace the code in User.vb with this code.
'  3. Add dependencies and safely pass arrays of structures.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click Browse, locate and click User.xml, and click Open.
'  4. Click Add users.
'     A message box is displayed showing the names and IDs of the new users added
'     to the vault.
'  5. Click OK to close the message box.
'  6. Close the dialog.
'  7. Start and log into the SOLIDWORKS PDM Professional Administration
'     tool as Admin.
'  8. Expand the vault where the new users were added.
'  9. Expand Users to see the names of the new users.
' 10. Double-click jdoe.
'     a. Examine the properties.
'     b. Click Administrative Permissions and examine the permissions.
'     c. Click OK.
' 11. Double-click jsmith and repeat steps 10a - 10c.
'----------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <anyType xsi:type="User">
      <sn>Doe</sn>
      <givenName>John</givenName>
      <title>Designer</title>
      <cn>John Doe</cn>
      <username>jdoe@yourcompany.com</username>
  </anyType>
  <anyType xsi:type="User">
      <sn>Smith</sn>
      <givenName>Jane</givenName>
      <title>Manager</title>
      <cn>Jane Smith</cn>
      <username>jsmith@yourcompany.com</username>
  </anyType>
</ArrayOfAnyType>
Back to top
'Form1.vb
Imports System.IO
Imports System.Xml.Serialization
Imports EPDM.Interop.epdm

Public Class AddUsers

  Private Sub BrowseButton_Click( _
     ByVal sender As System.Object, _
     ByVal e As System.EventArgs) _
     Handles BrowseButton.Click
    Try
      Dim dlgResult As DialogResult = XmlOpenFileDialog.ShowDialog()
      If dlgResult = Windows.Forms.DialogResult.Cancel Then
        Exit Sub
      End If
      XmlTextBox.Text = XmlOpenFileDialog.FileName
    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
      ex.ErrorCode.ToString("X") + vbCrLf + _
      ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

    Private Sub AddUsersButton_Click( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles AddUsersButton.Click

        Dim StrReader As StreamReader = Nothing

        Try
            'Deserialize users from an XML file
            Dim ExtraTypes() As Type = {Type.GetType("AddUsers.User")}
            Dim XmlSer As New XmlSerializer( _
                Type.GetType("System.Collections.ArrayList"), _
                ExtraTypes)
            StrReader = New StreamReader(XmlTextBox.Text)
            Dim NewUsers As ArrayList = _
                XmlSer.Deserialize(StrReader)

            'Obtain the only instance of the IEdmVaultObject
            Dim vault As IEdmVault5 = EdmVaultSingleton.Instance

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                                Me.Handle.ToInt32())
            End If
            'Assign IEdmVault object to the IEdmUserMgr7 object
            Dim UsrMgr As IEdmUserMgr7 = vault

            'Declare EdmUserData array to hold new user data
            Dim UserData(NewUsers.Count - 1) As EdmUserData2
            'Set the EdmUserData members for each new user
            For i As Integer = 0 To NewUsers.Count - 1
                If Not NewUsers(i) Is Nothing Then
                    UserData(i).mbsCompleteName = NewUsers(i).cn
                    UserData(i).mbsEmail = NewUsers(i).username
                    UserData(i).mbsInitials = _
                        NewUsers(i).givenName.Substring(0, 1) + _
                        NewUsers(i).sn.SubString(0, 1)
                    UserData(i).mbsUserName = _
                        NewUsers(i).username.Split("@")(0)
                    'Return user's IEdmUser6 interface in mpoUser
                    UserData(i).mlFlags = _
                        EdmUserDataFlags.Edmudf_GetInterface
                    'Add this user even if others cannot be added
                    UserData(i).mlFlags += _
                        EdmUserDataFlags.Edmudf_ForceAdd
                    'Set permissions
                    Dim perms(2) As EdmSysPerm
                    perms(0) = EdmSysPerm.EdmSysPerm_EditUserMgr
                    perms(1) = EdmSysPerm.EdmSysPerm_EditReportQuery
                    perms(2) = EdmSysPerm.EdmSysPerm_MandatoryVersionComments
                    UserData(i).moSysPerms = perms

                End If
            Next i

            'Add the users to the vault
            UsrMgr.AddUsers2(UserData)

            Dim msg As String = ""
            For Each usr As EdmUserData2 In UserData
                If usr.mhStatus = 0 Then
                    msg += "Created user """ + usr.mpoUser.Name _
                        + """ successfully. ID = " _
                        + usr.mpoUser.ID.ToString() + vbCrLf
                Else
                    msg += "Error creating user """ _
                        + usr.mbsUserName + """ - " _
                        + vault.GetErrormessage(usr.mhStatus) + vbCrLf
                End If
            Next
            MessageBox.Show(msg)

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            If Not StrReader Is Nothing Then
                StrReader.Close()
            End If
        End Try
    End Sub

    Private Sub AddUsers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try

            'Obtain the only instance of the IEdmVault object
            Dim vault As IEdmVault8 = EdmVaultSingleton.Instance
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class AddUsers
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer.
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.XmlTextBox = New System.Windows.Forms.TextBox()
        Me.XmlLabel = New System.Windows.Forms.Label()
        Me.XmlOpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.AddUsersButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(227, 94)
        Me.BrowseButton.Margin = New System.Windows.Forms.Padding(2)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(59, 26)
        Me.BrowseButton.TabIndex = 0
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'XmlTextBox
        '
        Me.XmlTextBox.Location = New System.Drawing.Point(24, 94)
        Me.XmlTextBox.Margin = New System.Windows.Forms.Padding(2)
        Me.XmlTextBox.Name = "XmlTextBox"
        Me.XmlTextBox.Size = New System.Drawing.Size(182, 20)
        Me.XmlTextBox.TabIndex = 1
        '
        'XmlLabel
        '
        Me.XmlLabel.AutoSize = True
        Me.XmlLabel.Location = New System.Drawing.Point(22, 78)
        Me.XmlLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.XmlLabel.Name = "XmlLabel"
        Me.XmlLabel.Size = New System.Drawing.Size(173, 13)
        Me.XmlLabel.TabIndex = 2
        Me.XmlLabel.Text = "XML file from which to import users:"
        '
        'XmlOpenFileDialog
        '
        Me.XmlOpenFileDialog.Filter = "XML files|*.xml"
        '
        'AddUsersButton
        '
        Me.AddUsersButton.Location = New System.Drawing.Point(24, 137)
        Me.AddUsersButton.Margin = New System.Windows.Forms.Padding(2)
        Me.AddUsersButton.Name = "AddUsersButton"
        Me.AddUsersButton.Size = New System.Drawing.Size(87, 24)
        Me.AddUsersButton.TabIndex = 3
        Me.AddUsersButton.Text = "Add users"
        Me.AddUsersButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(22, 40)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(136, 21)
        Me.VaultsComboBox.TabIndex = 12
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(22, 24)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 13
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'AddUsers
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(304, 237)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Controls.Add(Me.AddUsersButton)
        Me.Controls.Add(Me.XmlLabel)
        Me.Controls.Add(Me.XmlTextBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "AddUsers"
        Me.Text = "Add new users"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents XmlTextBox As System.Windows.Forms.TextBox
    Friend WithEvents XmlLabel As System.Windows.Forms.Label
    Friend WithEvents XmlOpenFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents AddUsersButton As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label

End Class
Back to top
'EdmVaultSingleton.vb

Imports System.Threading

Imports EPDM.Interop.epdm

Public NotInheritable Class EdmVaultSingleton
  Private Shared mInstance As EdmVault5 = Nothing
  Private Shared mLockObj As New Object()

  Private Sub New()

  End Sub

  Public Shared ReadOnly Property Instance() As EdmVault5
    Get
      Try
        If mInstance Is Nothing Then
          Monitor.Enter(mLockObj)
          If mInstance Is Nothing Then
            mInstance = New EdmVault5()
          End If
          Monitor.Exit(mLockObj)
        End If
      Catch ex As Exception
        Monitor.Exit(mLockObj)
      End Try

      Return mInstance

    End Get
  End Property

End Class
Back to top
'User.vb

Public Class User
   Private mSn As String         'First name
   Private mGivenName As String  'Last name
   Private mTitle As String      'Title
   Private mCn As String         'Complete name
   Private mUsername As String   'Email address

   Public Sub New()

   End Sub

   Public Property sn() As String
      Get
         sn = mSn
      End Get
      Set(ByVal Value As String)
         mSn = Value
      End Set
   End Property

   Public Property givenName() As String
      Get
         givenName = mGivenName
      End Get
      Set(ByVal Value As String)
         mGivenName = Value
      End Set
   End Property

   Public Property title() As String
      Get
         title = mTitle
      End Get
      Set(ByVal Value As String)
         mTitle = Value
      End Set
   End Property

   Public Property cn() As String
      Get
         cn = mCn
      End Get
      Set(ByVal Value As String)
         mCn = Value
      End Set
   End Property

   Public Property username() As String
      Get
         username = mUsername
      End Get
      Set(ByVal Value As String)
         mUsername = Value
      End Set
   End Property

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Add Card Variables to Vault Example (C#)

This example shows how to add card variables to a vault and edit them.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Desktop, Windows > Windows Forms Application.
//    b. Type AddEditVars_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d.
Click Next.
//    e. Select Framework.
//
f. Click Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Add
variables to vault dialog box.
// 2. Select a vault view.
// 3. Click Add
card variables.
//
a. Adds two card variables, MyNewVar and MySecondVar, to the vault.
//    b. Displays a message box with the IDs of the new
variables.
//    c. Click OK.
// 4. Click Edit card variables.
//    a. Displays the Edit Variables dialog box.
//    b. Click OK.
//    c. Displays a message box.
//    d. Click OK.
// 5. Close the Add
variables to vault dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace AddEditVars_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmItem item;

        IEdmFile8 fileInt;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

                Button1.Enabled = false;

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddVaultVars_Click(System.Object sender, System.EventArgs e)
        {
            //Add card variables to vault
            try
            {
                IEdmVault11 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault11)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmVariableMgr6 poVarMgr = default(IEdmVariableMgr6);
                poVarMgr = (IEdmVariableMgr6)vault2.CreateUtility(EdmUtility.EdmUtil_VariableMgr);

                EdmVariableData[] aoNewVars = new EdmVariableData[2];

                //Set some properties for the first variable
                aoNewVars[0].mbsVariableName = "MyNewVar";
                aoNewVars[0].meType = EdmVariableType.EdmVarType_Text;
                aoNewVars[0].mlEdmVariableFlags = (int)EdmVariableFlags.EdmVar_Mandatory;
                EdmAttributeData[] aoAttributes = new EdmAttributeData[1];
                aoAttributes[0].mbsBlockName = "DrawingBorder";
                aoAttributes[0].mbsAttribName = "PartNumber";
                aoAttributes[0].mbsExtensions = "DWG,DXF";
                aoNewVars[0].mpoAttributes = aoAttributes;

                //Set some properties for the second variable
                aoNewVars[1].mbsVariableName = "MySecondVar";
                aoNewVars[1].meType = EdmVariableType.EdmVarType_Date;

                //Add the variables
                poVarMgr.AddVariables(ref aoNewVars);

                //Show the IDs of the new variables
                string sMsg = null;
                sMsg = "";

                int iIdx = 0;
                iIdx = aoNewVars.GetLowerBound(0);

                while (iIdx <= aoNewVars.GetUpperBound(0))
                {
                    sMsg = sMsg + aoNewVars[iIdx].mbsVariableName + " has ID " + (aoNewVars[iIdx].mlVariableID).ToString() + "\n";
                    iIdx = iIdx + 1;
                }

                MessageBox.Show(sMsg);

                Button1.Enabled = true;

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            //Edit card variables
            try
            {
                IEdmVault11 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault11)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmVariableMgr5 varMgr = default(IEdmVariableMgr5);
                varMgr = (IEdmVariableMgr5)vault2;
                if (varMgr.EditVariables(this.Handle.ToInt32()))
                {
                    MessageBox.Show("An update was made!");
                }
                else
                {
                    MessageBox.Show("No changes were made.");
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace AddEditVars_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.AddVaultVars = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.Button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //AddVaultVars
            //
            this.AddVaultVars.Location = new System.Drawing.Point(16, 86);
            this.AddVaultVars.Name = "AddVaultVars";
            this.AddVaultVars.Size = new System.Drawing.Size(139, 23);
            this.AddVaultVars.TabIndex = 5;
            this.AddVaultVars.Text = "Add card variables";
            this.AddVaultVars.UseVisualStyleBackColor = true;
            this.AddVaultVars.Click +=new System.EventHandler(AddVaultVars_Click);
            //
            //OpenFileDialog
            //
            this.OpenFileDialog.Title = "Open";
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(16, 127);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(139, 23);
            this.Button1.TabIndex = 6;
            this.Button1.Text = "Edit card variables";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click +=new System.EventHandler(Button1_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(243, 185);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.AddVaultVars);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add variables to vault";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button AddVaultVars;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
        internal System.Windows.Forms.Button Button1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Add Card Variables to Vault Example (VB.NET)

This example shows how to add card variables to a vault and edit them.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type AddEditVars in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'    f. Replace the code in Form1.vb with this code.
'    g. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Add variables to vault dialog box.
' 2. Select a vault view.
' 3. Click Add card variables.
'    a. Adds two card variables, MyNewVar and MySecondVar, to the vault.
'    b. Displays a message box with the IDs of the new variables.
'    c. Click OK.
' 4. Click Edit card variables.
'    a. Displays the Edit Variables dialog box.
'    b. Click OK.
'    c. Displays a message box.
'    d. Click OK.
' 5. Close the Add variables to vault dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim item As IEdmItem
    Dim fileInt As IEdmFile8

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If

            Button1.Enabled = False

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddVaultVars_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddVaultVars.Click
        'Add card variables to vault
        Try
            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim poVarMgr As IEdmVariableMgr6
            poVarMgr = vault2.CreateUtility(EdmUtility.EdmUtil_VariableMgr)

            Dim aoNewVars(1) As EdmVariableData 'Array with 2 variables

            'Set some properties for the first variable
            aoNewVars(0).mbsVariableName = "MyNewVar"
            aoNewVars(0).meType = EdmVariableType.EdmVarType_Text
            aoNewVars(0).mlEdmVariableFlags = EdmVariableFlags.EdmVar_Mandatory
            Dim aoAttributes(0) As EdmAttributeData
            aoAttributes(0).mbsBlockName = "DrawingBorder"
            aoAttributes(0).mbsAttribName = "PartNumber"
            aoAttributes(0).mbsExtensions = "DWG,DXF"
            aoNewVars(0).mpoAttributes = aoAttributes

            'Set some properties for the second variable
            aoNewVars(1).mbsVariableName = "MySecondVar"
            aoNewVars(1).meType = EdmVariableType.EdmVarType_Date

            'Add the variables
            poVarMgr.AddVariables(aoNewVars)

            'Show the IDs of the new variables
            Dim sMsg As String
            sMsg = ""

            Dim iIdx As Integer
            iIdx = LBound(aoNewVars)

            While iIdx <= UBound(aoNewVars)
                sMsg = sMsg + aoNewVars(iIdx).mbsVariableName + " has ID " + CStr(aoNewVars(iIdx).mlVariableID) + vbLf
                iIdx = iIdx + 1
            End While

            MessageBox.Show(sMsg)

            Button1.Enabled = True

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Edit card variables
        Try
            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim varMgr As IEdmVariableMgr5
            varMgr = vault2
            If varMgr.EditVariables(Me.Handle.ToInt32()) Then
                MessageBox.Show("An update was made!")
            Else
                MessageBox.Show("No changes were made.")
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.AddVaultVars = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'AddVaultVars
        '
        Me.AddVaultVars.Location = New System.Drawing.Point(16, 86)
        Me.AddVaultVars.Name = "AddVaultVars"
        Me.AddVaultVars.Size = New System.Drawing.Size(139, 23)
        Me.AddVaultVars.TabIndex = 5
        Me.AddVaultVars.Text = "Add card variables"
        Me.AddVaultVars.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Title = "Open"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 127)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(139, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Edit card variables"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(243, 185)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.AddVaultVars)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add variables to vault"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents AddVaultVars As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Button1 As System.Windows.Forms.Button
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Add Dependencies and Safely Pass Arrays of Structures

Add references EPDM.Interop.epdm.dll and EPDM.Interop.EPDMResultCode.dll by:

  1. Right-clicking the project name in the Solution Explorer.
  2. Selecting Add > Reference or Add > Project Reference (depending on the project template you selected).
  3. Clicking Browse tab > Browse... and navigating to the top folder of your SOLIDWORKS PDM Professional installation.
  4. Locating and selecting EPDM.Interop.epdm.dll.
  5. Clicking Add and OK.
  6. Repeating step 3.
  7. Locating and selecting EPDM.Interop.EPDMResultCode.dll.
  8. Repeating step 5.

Prevent failures when calling methods that pass arrays of structures by:
  1. Right-clicking References > EPDM.Interop.epdm or Dependencies > Assemblies > EPDM.Interop.epdm (depending on the project template you selected) in the Solution Explorer and selecting Properties.
  2. Setting Embed Interop Types to No.
  3. Right-clicking References > EPDM.Interop.EPDMResultCode or Dependencies > Assemblies > EPDM.Inerop.EPDMResultCode (depending on the project template you selected) in the Solution Explorer and selecting Properties.
  4. Setting Embed Interop Types to No.
  5. Initializing arrays of structures in your code to:
    • VB.NET: Nothing
    • C#: null


SOLIDWORKS PDM Professional API Help

Administration Menu for Add-ins

An add-in often contains commands intended both for end users and the administrator of the system. You can add these commands as menu items using the IEdmCmdMgr5::AddCmd method. The downside to this is that the administrator commands are displayed in the File Explorer and, unless you check the logged-in user, all users are able to run the administrator commands.

In SOLIDWORKS PDM Professional 6.4, a new flag is added to IEdmCmdMgr5::AddCmd, EdmMenuFlags::EdmMenu_Administration, which controls whether a menu command is hidden in the File Explorer. When the flag is set, the command is displayed only in SOLIDWORKS PDM Professional’s Administration tool when you right-click the add-in.


SOLIDWORKS PDM Professional API Help

Add-in Applications

Add-ins in SOLIDWORKS PDM Professional are:

  • DLLs that implement the COM interface, IEdmAddIn5.
  • Added to a file vault through the Add-in Properties dialog.
  • Notified about SOLIDWORKS PDM Professional user actions:
    • IEdmAddIn5::GetAddInInfo is called when the add-in is added to a file vault.
    • SOLIDWORKS PDM Professional calls IEdmAddIn5::OnCmd when a user performs an action that the add-in wants to be notified about, e.g., when a menu item is selected, a file is created, or a file is checked in or out.
  • Programmed with hooks (EdmCmdType) into SOLIDWORKS PDM Professional. All hooks are handled through the IEdmAddIn5 interface.

The following samples show how to create a basic add-in written in:

  • VB.NET
  • Visual C#
  • Visual C++

After you create the basic add-in using the examples, see how to add hooks:

  • Add a menu item and toolbar button in File Explorer using:
    • VB.NET
    • Visual C#
    • Visual C++

  • Add hooks that get called when a file is checked in or out using:
    • VB.NET
    • Visual C#
    • Visual C++

  • Hook up a button in a file data card using VB.NET
  • Create serial numbers using an add-in written in VB.NET


Administrate Add-ins Dialog Box

SOLIDWORKS PDM Professional API Help

Add-in Properties Dialog Box

After creating an add-in DLL, you need to add it to the file vault. The permission to add or remove an add-in is configured in the User Manager of the SOLIDWORKS PDM Administration tool. The add-in properties are set in the Properties dialog box that appears when you right-click an add-in in the Administration Tool and select Open.

Read the SOLIDWORKS PDM Administration Guide to learn more about adding and removing add-ins to and from file vaults.

Read more about creating add-ins in Getting Started.


SOLIDWORKS PDM Professional API Help

Assign Columnset to Folder before Browsing Add-in Example (VB.NET)

This example shows how to create an add-in that triggers a pre-browse event and assigns a columnset to a folder before it is browsed.

'--------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio as Administrator.
' 2. Click File > New > Project > Visual Basic, Windows, Library > Class Library (.NET Framework).
' 3. Select .NET Framework 4.5 or later in the dropdown.
' 4. Type ClassLibrary1 in Project name.
' 5. For Location, click ... and navigate to the folder where to create the project.
' 6. Click Create.
' 7. Add dependencies and safely pass arrays of structures.
' 8. Right-click the project name in the Solution Explorer and click Properties.
' 9. In the Properties window:
'    a. On the Application tab, click Assembly Information....
'    b. De-select Make assembly COM-Visible.
'    c. On the Compile tab, select x64 in the Target CPU dropdown, de-select Prefer 32-bit, and select Register for COM interop.
'10. Save the project.
'11. Copy the code below to your project's Class1.vb.
'12. To populate the GUID attribute, click Tools > Create GUID in the IDE,
'    select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with
'    the copied string.
 '13. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
'    and log in as Admin.
'14. Under vault_name, right-click Add-ins, and click New Add-in.
'    a. Navigate to the bin directory of your built project.
'    b. Select ClassLibrary1.dll.
'    c. Click Open.
'    d. Click OK.
 '15. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
'16. Expand Columns under the vault_name in the Admin Tool.
'17. Right click File List Columns and select New Column Set.
'18. Change the order of existing columns or add a custom column and name the new column set.
'19. Click OK.
'20. Change the ID parameter in SetColumnSetID of the code to match your new column set ID. As none of the other folders and column sets exist, the code will only execute the Case Else section.
'21. Save the project.
'22. Select Release in the Solution Configurations dropdown and x64 in the Solution Platforms dropdown.
'23. Click Build > Build Solution.
'
' Postconditions:
' 1. Open File Explorer on a view of vault_name and log in as Admin.
' 2. This add-in triggers a pre-browse event before the root folder is browsed.
' 3. Click OK on each dialog as it appears.
' 4. This add-in registers and loads a user's column set into the root folder before it is browsed.
'---------------------------------------------------------------------------------------

Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("")>
<ComVisible(True)>

Public Class APIs

    Implements IEdmAddIn5

    Public vault As IEdmVault22

    Dim ppocolumnset As EdmColumnSet

    Dim ppocolumnsets As EdmColumnSet()

    Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

        Try

            poInfo.mbsAddInName = "VB.NET Add-In"

            poInfo.mbsCompany = "Dassault Systemes"

            poInfo.mbsDescription = "Responding to folder browse events"

            poInfo.mlAddInVersion = Now.ToString("yyyyMMdd")

            poInfo.mlRequiredVersionMajor = 29

            poInfo.mlRequiredVersionMinor = 0

            poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreBrowseFolder)

        Catch ex As Runtime.InteropServices.COMException

            MsgBox("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbCrLf + ex.Message)

        Catch ex As Exception

            MsgBox(ex.Message)

        End Try

    End Sub

    Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData()) Implements IEdmAddIn5.OnCmd

        Dim FolderID As Integer

        Dim AffectedFile As EdmCmdData

        Dim ID As Integer

        Dim Name As String

        Name = " "

        MsgBox("poCmd.meCmdType = " + poCmd.meCmdType.ToString)

        If poCmd.meCmdType = EdmCmdType.EdmCmd_PreBrowseFolder Then

            vault = poCmd.mpoVault

            Getcolumnsets(ID, Name)

            vault.SetColumnSetID(ID)

            For Each AffectedFile In ppoData

                FolderID = AffectedFile.mlObjectID1

                'Set the column set for the folder to be browsed

                Select Case FolderID

                    Case 3

                        'vault.SetColumnSetID(5)

                        'GetCurrentColumnSet(ID, Name)

                        'MsgBox("Browsing Folder ID=3")

                    Case 4

                        'vault.SetColumnSetID(6)

                        'MsgBox("Browsing Folder ID=4")

                    Case 5

                        'vault.SetColumnSetID(7)

                        'GetCurrentColumnSet(ID, Name)

                        'MsgBox("Browsing Folder ID=5")

                    Case 6

                        'vault.SetColumnSetID(8)

                        'MsgBox("Browsing Folder ID=6")

                    Case 7

                        'vault.SetColumnSetID(9)

                        'GetCurrentColumnSet(ID, Name)

                        'MsgBox("Browsing Folder ID=7")

                    Case 8

                        'vault.SetColumnSetID(10)

                        'MsgBox("Browsing Folder ID=8")

                    Case Else

                        GetCurrentColumnSet(ID, Name)

                        MsgBox("Browsing Folder ID=" + FolderID.ToString())

                End Select

            Next

        End If

    End Sub

    Public Sub GetCurrentColumnSet(ByRef ColumnID As Integer, ByRef ColumnName As String)

        vault.GetCurrentColumnSet(ppocolumnset)

        ColumnName = ppocolumnset.mbsColumnSetName

        ColumnID = ppocolumnset.mlColumnSetID

        MsgBox("Current column set ID = " + ColumnID.ToString + " Current column set name = " + ColumnName)

    End Sub

    Public Sub Getcolumnsets(ByRef ColumnID As Integer, ByRef ColumnName As String)

        vault.GetColumnSets(ppocolumnsets)

        Dim item As EdmColumnSet

        For Each item In ppocolumnsets

            ColumnName = item.mbsColumnSetName

            ColumnID = item.mlColumnSetID

            MsgBox("User's column set ID = " + ColumnID.ToString + " User's column set name = " + ColumnName)

        Next

    End Sub

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Add Item References Example (C#)

This example shows how to add item references in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Application.
//    b. Type BatchAddItemRefs_CSharp in Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and
safely pass arrays of structures.
// 3.
Open Start > All Programs >
SOLIDWORKS PDM Professional >
//    Item Explorer.
//    a. Click the vault to which to add new items.
//    b. Click New Item on the toolbar to add

00000004 and 00000005.
//    c. Keep the Item Explorer open.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. The Add Item Reference dialog box displays.
//     a. Select a vault view.
//     b. Click Add
item reference.
//  2. Click
OK in the BatchAddItemRefs dialog box.
//  3. In
the Item Explorer:
//     a. Click 00000004 under New Item Folder.
//     b. Observe that item 00000005 is linked to item
00000004.
//  4. Close the Add Item Reference dialog box and the Item Explorer.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchAddItemRefs_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddItemRefs_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                AddItemReference((IEdmVault11)vault1);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddItemReference(IEdmVault11 vault)
        {
            //Set up the search interface to find items
            IEdmSearchResult5 res = default(IEdmSearchResult5);
            IEdmSearch7 search = default(IEdmSearch7);
            search = (IEdmSearch7)vault.CreateUtility(EdmUtility.EdmUtil_Search);
            search.StartFolderID = vault.ItemRootFolderID;
            search.SetToken(EdmSearchToken.Edmstok_FindFolders, false);
            search.SetToken(EdmSearchToken.Edmstok_FindFiles, true);
            search.SetToken(EdmSearchToken.Edmstok_FindItems, true);
            search.SetToken(EdmSearchToken.Edmstok_Recursive, true);

            //Get the database ID of item number 00000004
            search.FileName = "00000004.<item>";
            res = search.GetFirstResult();
            if (res == null)
                return;
            int item4ID = 0;
            item4ID = res.ID;

            //Get the database ID of item number 00000005
            search.FileName = "00000005.<item>";
            res = search.GetFirstResult();
            if (res == null)
                return;
            int item5ID = 0;
            item5ID = res.ID;

            //Add item number 00000005 as a reference to item number 00000004
            EdmItemRef[] addRefs = new EdmItemRef[1];
            addRefs[0].moParentNamePathOrItemID = item4ID;
            addRefs[0].moNamePathOrID = item5ID;
            addRefs[0].mlEdmRefFlags = (int)EdmRefFlags.EdmRef_Item;

            //No item references to remove
            EdmItemRef[] removeRefs = null;
            removeRefs = null;

            IEdmBatchItemReferenceUpdate batch = default(IEdmBatchItemReferenceUpdate);
            batch = (IEdmBatchItemReferenceUpdate)vault.CreateUtility(EdmUtility.EdmUtil_BatchItemReferenceUpdate);
            batch.UpdateReferences(addRefs, removeRefs);
            MessageBox.Show("Result of operation: " + "\n" + vault.GetErrorMessage(addRefs[0].mhResult));

        }
    }
}

Back to top

//Form1.Designer.cs

namespace BatchAddItemRefs_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.AddItemRefs = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //AddItemRefs
            //
            this.AddItemRefs.Location = new System.Drawing.Point(39, 84);
            this.AddItemRefs.Name = "AddItemRefs";
            this.AddItemRefs.Size = new System.Drawing.Size(157, 23);
            this.AddItemRefs.TabIndex = 6;
            this.AddItemRefs.Text = "Add item reference";
            this.AddItemRefs.UseVisualStyleBackColor = true;
            this.AddItemRefs.Click += new System.EventHandler(AddItemRefs_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 147);
            this.Controls.Add(this.AddItemRefs);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add Item Reference";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button AddItemRefs;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Add Item References Example (VB.NET)

This example shows how to add item references in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchGetFiles in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Open Start > All Programs > SOLIDWORKS PDM Professional >
'     Item Explorer.
'     a. Click the vault to which to add new items.
'     b. Click New Item on the toolbar to add 00000004 and 00000005.
'     c. Keep the Item Explorer open.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Add Item Reference dialog box displays.
'     a. Select a vault view.
'     b. Click Add item reference.
'  2. Click OK in the BatchAddItemRefs dialog box.
'  3. In the Item Explorer:
'     a. Click 00000004 under New Item Folder.
'     b. Observe that item 00000005 is linked to item 00000004.
'  4. Close the Add Item Reference dialog box and the Item Explorer.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault1 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddItemRefs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddItemRefs.Click
        Try

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            AddItemReference(vault1)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub AddItemReference(ByVal vault As IEdmVault11)

        'Set up the search interface to find items
        Dim res As IEdmSearchResult5
        Dim search As IEdmSearch7
        search = vault.CreateUtility(EdmUtility.EdmUtil_Search)
        search.StartFolderID = vault.ItemRootFolderID
        search.SetToken(EdmSearchToken.Edmstok_FindFolders, False)
        search.SetToken(EdmSearchToken.Edmstok_FindFiles, True)
        search.SetToken(EdmSearchToken.Edmstok_FindItems, True)
        search.SetToken(EdmSearchToken.Edmstok_Recursive, True)

        'Get the database ID of item number 00000004
        search.FileName = "00000004.<item>"
        res = search.GetFirstResult
        If res Is Nothing Then Exit Sub
        Dim item4ID As Integer
        item4ID = res.ID

        'Get the database ID of item number 00000005
        search.FileName = "00000005.<item>"
        res = search.GetFirstResult
        If res Is Nothing Then Exit Sub
        Dim item5ID As Integer
        item5ID = res.ID

        'Add item number 00000005 as a reference to item number 00000004
        Dim addRefs(0) As EdmItemRef
        addRefs(0).moParentNamePathOrItemID = item4ID
        addRefs(0).moNamePathOrID = item5ID
        addRefs(0).mlEdmRefFlags = EdmRefFlags.EdmRef_Item

        'No item references to remove
        Dim removeRefs() As EdmItemRef
        removeRefs = Nothing

        Dim batch As IEdmBatchItemReferenceUpdate
        batch = vault.CreateUtility(EdmUtility.EdmUtil_BatchItemReferenceUpdate)
        batch.UpdateReferences(addRefs, removeRefs)
        MsgBox("Result of operation: " + vbLf + vault.GetErrorMessage(addRefs(0).mhResult))

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.AddItemRefs = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'AddItemRefs
        '
        Me.AddItemRefs.Location = New System.Drawing.Point(39, 84)
        Me.AddItemRefs.Name = "AddItemRefs"
        Me.AddItemRefs.Size = New System.Drawing.Size(157, 23)
        Me.AddItemRefs.TabIndex = 6
        Me.AddItemRefs.Text = "Add item reference"
        Me.AddItemRefs.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 147)
        Me.Controls.Add(Me.AddItemRefs)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add Item Reference"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents AddItemRefs As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Add Files and Folders to Vault Example (C#)

This example shows how to add several files and folders to the vault in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//     b. Type BatchAddFiles_CSharp in Project
name.
//     c. For
Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//
f. Click Create.
//     g. Click Show All Files in the Solution Explorer
toolbar and expand
//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. To create the
form, replace the code in Form1.Designer.cs with
//        this code.
//  2. Add
dependencies and safely pass arrays of structures.
//  3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. The Batch
add files to vault dialog box displays.
//     a. Select a vault view.
//     b. Click Select file outside vault to copy to vault.
//     c. In the Select File dialog:
//        1. Click a file
outside the vault.
//        2. Click Open.
//     d. Click Select file inside vault to copy to vault.
//     e. In the Select File dialog:
//        1. Click a file in the vault.
//        2. Click Open.
//     f. Click Commit all files to vault.
//  2. Click Add in the Batch Items dialog box.
//  3. Click OK to close the
message box.
//     Two new folders, Folder1 and Folder2,
are created in the vault's
//     root directory. The first selected file is copied to
Folder1.
//     The second selected file is copied to Folder2.
//  4. Close the Batch add files to vault dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchAddFiles_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;
IEdmBatchAdd2 batchAdder;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void CopyToVault_Click(System.Object sender, System.EventArgs e)
{
try
{
FileList1.Items.Clear();

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
SelectFileDialog.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = SelectFileDialog.ShowDialog();
//If the user did
not click Open, exit this subroutine
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

batchAdder = (IEdmBatchAdd2)vault2.CreateUtility(EdmUtility.EdmUtil_BatchAdd);

// Add Folder1 to the batch
string newFolder = vault1.RootFolderPath + "\\Folder1";
batchAdder.AddFolderPath(newFolder, 0, (int)EdmBatchAddFolderFlag.Ebaff_Nothing);

foreach (string FileName in SelectFileDialog.FileNames)
{
FileList1.Items.Add(FileName);

// Add each selected file
to the batch
batchAdder.AddFileFromPathToPath(FileName, newFolder, 0);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void CopyFromVault_Click(System.Object sender, System.EventArgs e)
{
try
{
FileList2.Items.Clear();

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
SelectFileDialog.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = SelectFileDialog.ShowDialog();
//If the user didn't click Open, exit this subroutine
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

// Add Folder2 to the batch
batchAdder.AddFolder(vault1.RootFolderID, "Folder2", 0, (int)EdmBatchAddFolderFlag.Ebaff_Nothing);

IEdmFile5 aFile = default(IEdmFile5);
IEdmFolder5 aFolder = default(IEdmFolder5);
IEdmPos5 aPos = default(IEdmPos5);
IEdmFolder5 ppoRetParentFolder = default(IEdmFolder5);
foreach (string FileName in SelectFileDialog.FileNames)
{
FileList2.Items.Add(FileName);

aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
aPos = aFile.GetFirstFolderPosition();
aFolder = aFile.GetNextFolder(aPos);

// Add each selected file to the
batch
batchAdder.AddFileFromVaultToPath(aFile.ID, aFolder.ID, vault1.RootFolderPath + "\\Folder2");
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BatchAdd_Click(System.Object sender, System.EventArgs e)
{
try
{

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

// Show all of the items in the batch
batchAdder.ShowDlg(this.Handle.ToInt32(), (int)EdmAddFileDlgFlag.Eafdf_Nothing, "Files and folders in the batch:", "Batch Items");

EdmFileInfo[] ppoAddedFiles = new EdmFileInfo[10];

// Commit all of the items in the batch to the vault
batchAdder.CommitAdd(this.Handle.ToInt32(), ref ppoAddedFiles);

//Display the returned information in a message box

int idx;
idx = ppoAddedFiles.GetLowerBound(0);
string msg = "";

while (idx <= ppoAddedFiles.GetUpperBound(0))
{
string row = null;
row = "(" + ppoAddedFiles[idx].mbsPath + ") arg = " + (ppoAddedFiles[idx].mlArg).ToString();

if (ppoAddedFiles[idx].mhResult == 0)
{
row = row + " status = OK ";
}
else
{
string oErrName = "";
string oErrDesc = "";

vault1.GetErrorString(ppoAddedFiles[idx].mhResult, out oErrName, out oErrDesc);
row = row + " status = " + oErrName;
}

idx = idx + 1;
msg = msg + "\n" + row;

}

MessageBox.Show(msg);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}
}
}

Back to top

//Form1.Designer.cs

namespace BatchAddFiles_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BatchAdd = new System.Windows.Forms.Button();
            this.CopyToVault = new System.Windows.Forms.Button();
            this.FileList1 = new System.Windows.Forms.ListBox();
            this.CopyFromVault = new System.Windows.Forms.Button();
            this.FileList2 = new System.Windows.Forms.ListBox();
            this.SelectFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(12, 27);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(12, 43);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BatchAdd
            //
            this.BatchAdd.Location = new System.Drawing.Point(67, 236);
            this.BatchAdd.Name = "BatchAdd";
            this.BatchAdd.Size = new System.Drawing.Size(123, 23);
            this.BatchAdd.TabIndex = 2;
            this.BatchAdd.Text = "Commit all files to vault";
            this.BatchAdd.UseVisualStyleBackColor = true;
            this.BatchAdd.Click += new System.EventHandler(this.BatchAdd_Click);
            //
            //CopyToVault
            //
            this.CopyToVault.Location = new System.Drawing.Point(12, 80);
            this.CopyToVault.Name = "CopyToVault";
            this.CopyToVault.Size = new System.Drawing.Size(239, 23);
            this.CopyToVault.TabIndex = 3;
            this.CopyToVault.Text = "Select file outside vault to copy to vault...";
            this.CopyToVault.UseVisualStyleBackColor = true;
            this.CopyToVault.Click += new System.EventHandler(this.CopyToVault_Click);
            //
            //FileList1
            //
            this.FileList1.FormattingEnabled = true;
            this.FileList1.Location = new System.Drawing.Point(12, 109);
            this.FileList1.Name = "FileList1";
            this.FileList1.Size = new System.Drawing.Size(239, 30);
            this.FileList1.TabIndex = 4;
            //
            //CopyFromVault
            //
            this.CopyFromVault.Location = new System.Drawing.Point(12, 160);
            this.CopyFromVault.Name = "CopyFromVault";
            this.CopyFromVault.Size = new System.Drawing.Size(239, 23);
            this.CopyFromVault.TabIndex = 5;
            this.CopyFromVault.Text = "Select file inside vault to copy to vault...";
            this.CopyFromVault.UseVisualStyleBackColor = true;
            this.CopyFromVault.Click += new System.EventHandler(this.CopyFromVault_Click);
            //
            //FileList2
            //
            this.FileList2.FormattingEnabled = true;
            this.FileList2.Location = new System.Drawing.Point(12, 189);
            this.FileList2.Name = "FileList2";
            this.FileList2.Size = new System.Drawing.Size(239, 30);
            this.FileList2.TabIndex = 6;
            //
            //SelectFileDialog
            //
            this.SelectFileDialog.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 291);
            this.Controls.Add(this.FileList2);
            this.Controls.Add(this.CopyFromVault);
            this.Controls.Add(this.FileList1);
            this.Controls.Add(this.CopyToVault);
            this.Controls.Add(this.BatchAdd);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Batch add files to vault";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button BatchAdd;
        private System.Windows.Forms.Button CopyToVault;
        private System.Windows.Forms.ListBox FileList1;
        private System.Windows.Forms.Button CopyFromVault;
        private System.Windows.Forms.ListBox FileList2;
        private System.Windows.Forms.OpenFileDialog SelectFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Add Files and Folders to Vault Example (VB.NET)

This example shows how to add several files and folders to the vault in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchAddFiles in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Batch add files to vault dialog box displays.
'     a. Select a vault view.
'     b. Click Select file outside vault to copy to vault.
'     c. In the Select File dialog:
'        1. Click a file outside the vault.
'        2. Click Open.
'     d. Click Select file inside vault to copy to vault.
'     e. In the Select File dialog:
'        1. Click a file in the vault.
'        2. Click Open.
'     f. Click Commit all files to vault.
'  2. Click Add in the Batch Items dialog box.
'  3. Click OK to close the message box.
'     Two new folders, Folder1 and Folder2, are created in the vault's
'     root directory. The first selected file is copied to Folder1.
'     The second selected file is copied to Folder2.
'  4. Close the Batch add files to vault dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchAdder As IEdmBatchAdd2
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub CopyToVault_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToVault.Click
        Try
            FileList1.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            SelectFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = SelectFileDialog.ShowDialog()
            'If the user did not click Open, exit this subroutine
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            batchAdder = vault2.CreateUtility(EdmUtility.EdmUtil_BatchAdd)

            ' Add Folder1 to the batch
            Dim newFolder As String = vault1.RootFolderPath + "\Folder1"
            batchAdder.AddFolderPath(newFolder, 0, EdmBatchAddFolderFlag.Ebaff_Nothing)

            For Each FileName As String In SelectFileDialog.FileNames

                FileList1.Items.Add(FileName)

                ' Add each selected file to the batch
                batchAdder.AddFileFromPathToPath(FileName, newFolder, 0)

            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    Public Sub CopyFromVault_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyFromVault.Click
        Try
            FileList2.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            SelectFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = SelectFileDialog.ShowDialog()
            'If the user didn't click Open, exit this subroutine
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            ' Add Folder2 to the batch
            batchAdder.AddFolder(vault1.RootFolderID, "Folder2", 0, EdmBatchAddFolderFlag.Ebaff_Nothing)

            Dim aFile As IEdmFile5
            Dim aFolder As IEdmFolder5
            Dim aPos As IEdmPos5
            For Each FileName As String In SelectFileDialog.FileNames

                FileList2.Items.Add(FileName)

                aFile = vault1.GetFileFromPath(FileName)
                aPos = aFile.GetFirstFolderPosition
                aFolder = aFile.GetNextFolder(aPos)

                ' Add each selected file to the batch
                batchAdder.AddFileFromVaultToPath(aFile.ID, aFolder.ID, vault1.RootFolderPath + "\Folder2")

            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BatchAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchAdd.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            ' Show all of the items in the batch
            batchAdder.ShowDlg(Me.Handle.ToInt32(), EdmAddFileDlgFlag.Eafdf_Nothing, "Files and folders in the batch:", "Batch Items")

            Dim ppoAddedFiles() As EdmFileInfo = Nothing

            ' Commit all of the items in the batch to the vault
            batchAdder.CommitAdd(Me.Handle.ToInt32(), ppoAddedFiles)

            'Display the returned information in a message box
            Dim idx As Integer
            idx = LBound(ppoAddedFiles)
            Dim msg As String = ""

            While idx <= UBound(ppoAddedFiles)

                Dim row As String
                row = "(" + ppoAddedFiles(idx).mbsPath + ") arg = " + CStr(ppoAddedFiles(idx).mlArg)

                If ppoAddedFiles(idx).mhResult = 0 Then
                    row = row + " status = OK "
                Else
                    Dim oErrName As String = ""
                    Dim oErrDesc As String = ""

                    vault1.GetErrorString(ppoAddedFiles(idx).mhResult, oErrName, oErrDesc)
                    row = row + " status = " + oErrName
                End If

                idx = idx + 1
                msg = msg + vbLf + row

            End While

            MsgBox(msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BatchAdd = New System.Windows.Forms.Button()
        Me.CopyToVault = New System.Windows.Forms.Button()
        Me.FileList1 = New System.Windows.Forms.ListBox()
        Me.CopyFromVault = New System.Windows.Forms.Button()
        Me.FileList2 = New System.Windows.Forms.ListBox()
        Me.SelectFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(12, 27)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(12, 43)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BatchAdd
        '
        Me.BatchAdd.Location = New System.Drawing.Point(67, 236)
        Me.BatchAdd.Name = "BatchAdd"
        Me.BatchAdd.Size = New System.Drawing.Size(123, 23)
        Me.BatchAdd.TabIndex = 2
        Me.BatchAdd.Text = "Commit all files to vault"
        Me.BatchAdd.UseVisualStyleBackColor = True
        '
        'CopyToVault
        '
        Me.CopyToVault.Location = New System.Drawing.Point(12, 80)
        Me.CopyToVault.Name = "CopyToVault"
        Me.CopyToVault.Size = New System.Drawing.Size(239, 23)
        Me.CopyToVault.TabIndex = 3
        Me.CopyToVault.Text = "Select file outside vault to copy to vault..."
        Me.CopyToVault.UseVisualStyleBackColor = True
        '
        'FileList1
        '
        Me.FileList1.FormattingEnabled = True
        Me.FileList1.Location = New System.Drawing.Point(12, 109)
        Me.FileList1.Name = "FileList1"
        Me.FileList1.Size = New System.Drawing.Size(239, 30)
        Me.FileList1.TabIndex = 4
        '
        'CopyFromVault
        '
        Me.CopyFromVault.Location = New System.Drawing.Point(12, 160)
        Me.CopyFromVault.Name = "CopyFromVault"
        Me.CopyFromVault.Size = New System.Drawing.Size(239, 23)
        Me.CopyFromVault.TabIndex = 5
        Me.CopyFromVault.Text = "Select file inside vault to copy to vault..."
        Me.CopyFromVault.UseVisualStyleBackColor = True
        '
        'FileList2
        '
        Me.FileList2.FormattingEnabled = True
        Me.FileList2.Location = New System.Drawing.Point(12, 189)
        Me.FileList2.Name = "FileList2"
        Me.FileList2.Size = New System.Drawing.Size(239, 30)
        Me.FileList2.TabIndex = 6
        '
        'SelectFileDialog
        '
        Me.SelectFileDialog.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 291)
        Me.Controls.Add(Me.FileList2)
        Me.Controls.Add(Me.CopyFromVault)
        Me.Controls.Add(Me.FileList1)
        Me.Controls.Add(Me.CopyToVault)
        Me.Controls.Add(Me.BatchAdd)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Batch add files to vault"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BatchAdd As System.Windows.Forms.Button
    Friend WithEvents CopyToVault As System.Windows.Forms.Button
    Friend WithEvents FileList1 As System.Windows.Forms.ListBox
    Friend WithEvents CopyFromVault As System.Windows.Forms.Button
    Friend WithEvents FileList2 As System.Windows.Forms.ListBox
    Friend WithEvents SelectFileDialog As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Add Folders Example (C#)

This example shows how to create several folders in the vault at once.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//    b. Type BatchAddFolders_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Add
folders dialog box.
//    a. Select a vault view.
//    b.
Type the name of a new folder to create in the root folder
//       of the vault.
//    c. Click
Add folder to the batch.
//
1. Displays a message that the folder is added to the batch.
//
2. Click OK.
// 2. Repeat
steps 1b-c repeatedly to add more folders to the batch.
// 3. Click Create folders.
//    a. Displays a message that the folder is created.
//    b. Click OK in each message box.
// 4. Close the Add folders dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchAddFolders_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmBatchAddFolders batchAddFolders;
        EdmFolderInfo[] ppoRetFolders = null;

        int i;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddFolders_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if (batchAddFolders == null)
                {
                    batchAddFolders = (IEdmBatchAddFolders)vault2.CreateUtility(EdmUtility.EdmUtil_BatchAddFolders);
                }

                batchAddFolders.AddFolder(vault2.RootFolderID, TextBox1.Text, i, (int)EdmBatchAddFolderFlag.Ebaff_GetInterface, null, 0);
                i = i + 1;

                MessageBox.Show(TextBox1.Text + " added to the batch.");
                TextBox1.Clear();

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        public void CreateFolders_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                batchAddFolders.Create(this.Handle.ToInt32(), ref ppoRetFolders, (int)EdmBatchCreateFolderFlag.Ebcf_Nothing);

                foreach (EdmFolderInfo FoldName in ppoRetFolders)
                {
                    MessageBox.Show("Created " + FoldName.mbsPath + " successfully" + " in " + vault2.RootFolder.Name);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace BatchAddFolders_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.AddFolders = new System.Windows.Forms.Button();
            this.CreateFolders = new System.Windows.Forms.Button();
            this.TextBox1 = new System.Windows.Forms.TextBox();
            this.Label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //AddFolders
            //
            this.AddFolders.Location = new System.Drawing.Point(16, 112);
            this.AddFolders.Name = "AddFolders";
            this.AddFolders.Size = new System.Drawing.Size(145, 23);
            this.AddFolders.TabIndex = 3;
            this.AddFolders.Text = "Add folder to the batch...";
            this.AddFolders.UseVisualStyleBackColor = true;
            this.AddFolders.Click +=new System.EventHandler(AddFolders_Click);
            //
            //CreateFolders
            //
            this.CreateFolders.Location = new System.Drawing.Point(111, 156);
            this.CreateFolders.Name = "CreateFolders";
            this.CreateFolders.Size = new System.Drawing.Size(98, 23);
            this.CreateFolders.TabIndex = 5;
            this.CreateFolders.Text = "Create folders";
            this.CreateFolders.UseVisualStyleBackColor = true;
            this.CreateFolders.Click +=new System.EventHandler(CreateFolders_Click);
            //
            //TextBox1
            //
            this.TextBox1.Location = new System.Drawing.Point(16, 88);
            this.TextBox1.Name = "TextBox1";
            this.TextBox1.Size = new System.Drawing.Size(289, 20);
            this.TextBox1.TabIndex = 6;
            //
            //Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(13, 72);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(237, 13);
            this.Label1.TabIndex = 7;
            this.Label1.Text = "Type name of new folder to add to the vault root:";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 208);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.TextBox1);
            this.Controls.Add(this.CreateFolders);
            this.Controls.Add(this.AddFolders);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Add folders";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button AddFolders;
        internal System.Windows.Forms.Button CreateFolders;
        internal System.Windows.Forms.TextBox TextBox1;
        internal System.Windows.Forms.Label Label1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Add Folders Example (VB.NET)

This example shows how to create several folders in the vault at once.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type AddFolder in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Add folders dialog box.
'    a. Select a vault view.
'    b. Type the name of a new folder to create in the root folder
'       of the vault.
'    c. Click Add folder to the batch.
'       1. Displays a message that the folder is added to the batch.
'       2. Click OK.
' 2. Repeat steps 1b-c repeatedly to add more folders to the batch.
' 3. Click Create folders.
'    a. Displays a message that the folder is created.
'    b. Click OK in each message box.
' 4. Close the Add folders dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchAddFolders As IEdmBatchAddFolders
    Dim ppoRetFolders() As EdmFolderInfo = Nothing
    Dim i As Integer

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub AddFolders_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddFolders.Click

        Try
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If batchAddFolders Is Nothing Then
                batchAddFolders = vault1.CreateUtility(EdmUtility.EdmUtil_BatchAddFolders)
            End If

            batchAddFolders.AddFolder(vault2.RootFolderID, TextBox1.Text, i, EdmBatchAddFolderFlag.Ebaff_GetInterface, Nothing, 0)
            i = i + 1

            MsgBox(TextBox1.Text & " added to the batch.")
            TextBox1.Clear()

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Public Sub CreateFolders_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateFolders.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            batchAddFolders.Create(Me.Handle.ToInt32, ppoRetFolders, EdmBatchCreateFolderFlag.Ebcf_Nothing)

            For Each FoldName As EdmFolderInfo In ppoRetFolders
                MsgBox("Created " & FoldName.mbsPath & " successfully" & " in " + vault2.RootFolder.Name)
            Next

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.AddFolders = New System.Windows.Forms.Button()
        Me.CreateFolders = New System.Windows.Forms.Button()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'AddFolders
        '
        Me.AddFolders.Location = New System.Drawing.Point(16, 112)
        Me.AddFolders.Name = "AddFolders"
        Me.AddFolders.Size = New System.Drawing.Size(145, 23)
        Me.AddFolders.TabIndex = 3
        Me.AddFolders.Text = "Add folder to the batch..."
        Me.AddFolders.UseVisualStyleBackColor = True
        '
        'CreateFolders
        '
        Me.CreateFolders.Location = New System.Drawing.Point(111, 156)
        Me.CreateFolders.Name = "CreateFolders"
        Me.CreateFolders.Size = New System.Drawing.Size(98, 23)
        Me.CreateFolders.TabIndex = 5
        Me.CreateFolders.Text = "Create folders"
        Me.CreateFolders.UseVisualStyleBackColor = True
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(16, 88)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(289, 20)
        Me.TextBox1.TabIndex = 6
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(13, 72)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(237, 13)
        Me.Label1.TabIndex = 7
        Me.Label1.Text = "Type name of new folder to add to the vault root:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 208)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.CreateFolders)
        Me.Controls.Add(Me.AddFolders)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Add folders"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents AddFolders As System.Windows.Forms.Button
    Friend WithEvents CreateFolders As System.Windows.Forms.Button
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Change States of Files As User Example (C#)

This example shows how to change the states of several files in one batch using other credentials.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//    b. Type BatchChangeFileStates_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the
form, replace the code in Form1.Designer.cs with
//       this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. In the Admin Tool ensure that a workflow exists with:
//    a. A Waiting for Approval state.
//    b. An Approved state.
//    c. A Passed Approval transition from the Waiting for Approval state to
//       the Approved state.
//    d. One or more vault files in the Waiting for Approval state.
//
4.
If you want to change states as
another user, modify the RunAsUser credentials to match a user in your vault.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Approve Files dialog box displays.
//    a. Select a vault view.
//    b. Click Select files to approve.
//    c. In the Select File dialog:
//       1. Select vault files in the Waiting for Approval state.
//       2. Click Open.
//    d. Click Approve all files.
// 2. Click OK in the Do Transition dialog box.
//    The selected files change to the Approved state using the Passed Approval
//    transition.
// 3. Close the Approve Files dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchChangeFileStates_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private IEdmVault5 vault1 = null;
IEdmBatchChangeState6 batchChanger;
IEdmFile5 aFile;
IEdmFolder5 aFolder;
IEdmPos5 aPos;
bool retVal;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void Transition_Click(System.Object sender, System.EventArgs e)
{
try
{
//File1List.Items.Clear()

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();
//If the user didn't click Open, exit this subroutine
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

batchChanger = (IEdmBatchChangeState4)vault2.CreateUtility(EdmUtility.EdmUtil_BatchChangeState);
IEdmFolder5 ppoRetParentFolder;
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
aPos = aFile.GetFirstFolderPosition();
aFolder = aFile.GetNextFolder(aPos);
// Add each file selected to the batch
batchChanger.AddFile(aFile.ID, aFolder.ID);
}

batchChanger.Comment = "Transition to Approved state.";

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BatchChange_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

// Get the available transitions
EdmChangeStateTransitionInfo[] ppoTransitions = null;
batchChanger.GetAvailableTransitionList(out ppoTransitions);

int i = 0;
string str = "";
while (i <= ppoTransitions.GetUpperBound(0))
{
if (i == 0)
{
str = ppoTransitions[i].moName;
}
else
{
str = str + ", " + ppoTransitions[i].moName;
}
i = i + 1;
}

//MsgBox("Transitions available: " & str)

// Get list of files affected by the state transition
IEdmSelectionList6 selList = default(IEdmSelectionList6);
selList = (IEdmSelectionList6)batchChanger.GetFileList((int)EdmChangeStateFileListFlag.Ecsflf_GetActionUpdated + (int)EdmChangeStateFileListFlag.Ecsflf_GetChanged + (int)EdmChangeStateFileListFlag.Ecsflf_GetUnprocessed);

EdmSelectionObject selObject = new EdmSelectionObject();

aPos = selList.GetHeadPosition();
str = "Files affected by this state transition: ";
i = 0;
while (i < selList.Count)
{
selList.GetNext2(aPos, out selObject);
str = str + selObject.mbsPath;
i = i + 1;
}

//MsgBox(str)

// Create the file reference tree and verify allowed transitions

//'''''''''''''''''''''''''''''''''''''RunAsUser
API''''''''''''''''''''''''''''''''''''''''''''
// Admin is the logged in user here, but if you uncomment the next line
(batchChanger.RunAsUser),
// you will do a state change using the admin_jeda user.
// Change the username and password to match a user that exists in your vault.
// CreateTree, ShowDlg, and ChangeState2 should all be called after RunAsUser.

//batchChanger.RunAsUser(Me.Handle.ToInt32(), "Admin_jeda",
"abc")
retVal = batchChanger.CreateTree("Passed Approval");

bool retVal2 = false;
if ((retVal))
{
// Show all of the items in the batch
retVal2 = batchChanger.ShowDlg(this.Handle.ToInt32());

if ((retVal2))
{
// User clicked OK; commit all of the items in the batch to the vault
batchChanger.ChangeState2(this.Handle.ToInt32(),
"");
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

}
}

Back to top

//Form1.Designer.cs

namespace BatchChangeFileStates_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Transition = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.BatchChange = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //Transition
            //
            this.Transition.Location = new System.Drawing.Point(39, 85);
            this.Transition.Name = "Transition";
            this.Transition.Size = new System.Drawing.Size(158, 23);
            this.Transition.TabIndex = 2;
            this.Transition.Text = "Select files to approve...";
            this.Transition.UseVisualStyleBackColor = true;
            this.Transition.Click += new System.EventHandler(this.Transition_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //BatchChange
            //
            this.BatchChange.Location = new System.Drawing.Point(40, 183);
            this.BatchChange.Name = "BatchChange";
            this.BatchChange.Size = new System.Drawing.Size(157, 23);
            this.BatchChange.TabIndex = 6;
            this.BatchChange.Text = "Approve all files";
            this.BatchChange.UseVisualStyleBackColor = true;
            this.BatchChange.Click += new System.EventHandler(this.BatchChange_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.BatchChange);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.Transition);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Approve Files";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button Transition;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button BatchChange;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Change States of Files As User Example (VB.NET)

This example shows how to change the states of several files in one batch using other credentials.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type BatchChangeFileStates in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. In the Admin Tool, ensure that a workflow exists with:
'    a. A Waiting for Approval state.
'    b. An Approved state.
'    c. A Passed Approval transition from the Waiting for Approval state to
'       the Approved state.
'    d. One or more vault files in the Waiting for Approval state.
' 4. If you want to change states as another user, modify the RunAsUser credentials to match a user in your vault.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. The Approve Files dialog box displays.
'    a. Select a vault view.
'    b. Click Select files to approve.
'    c. In the Select File dialog:
'       1. Select vault files in the Waiting for Approval state.
'       2. Click Open.
'    d. Click Approve all files.
' 2. Click OK in the Do Transition dialog box.
'    The selected files change to the Approved state using the Passed Approval
'    transition.
' 3. Close the Approve Files dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchChanger As IEdmBatchChangeState6
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim retVal As Boolean
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub Transition_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Transition.Click
        Try
            'File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()
            'If the user didn't click Open, exit this subroutine
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            batchChanger = vault2.CreateUtility(EdmUtility.EdmUtil_BatchChangeState)

            For Each FileName As String In OpenFileDialog1.FileNames
                File1List.Items.Add(FileName)
                aFile = vault1.GetFileFromPath(FileName)
                aPos = aFile.GetFirstFolderPosition
                aFolder = aFile.GetNextFolder(aPos)
                ' Add each file selected to the batch
                batchChanger.AddFile(aFile.ID, aFolder.ID)
            Next

            batchChanger.Comment = "Transition to Approved state."

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BatchChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchChange.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            ' Get the available transitions
            Dim ppoTransitions() As EdmChangeStateTransitionInfo = Nothing
            batchChanger.GetAvailableTransitionList(ppoTransitions)

            Dim i As Integer = 0
            Dim str As String = ""
            While i <= ppoTransitions.GetUpperBound(0)
                If i = 0 Then
                    str = ppoTransitions(i).moName
                Else
                    str = str + ", " + ppoTransitions(i).moName
                End If
                i = i + 1
            End While

            'MsgBox("Transitions available: " & str)

            ' Get list of files affected by the state transition
            Dim selList As IEdmSelectionList6
            selList = batchChanger.GetFileList(EdmChangeStateFileListFlag.Ecsflf_GetActionUpdated + EdmChangeStateFileListFlag.Ecsflf_GetChanged + EdmChangeStateFileListFlag.Ecsflf_GetUnprocessed)

            Dim selObject As EdmSelectionObject = New EdmSelectionObject()

            aPos = selList.GetHeadPosition()
            str = "Files affected by this state transition: "
            i = 0
            While i < selList.Count
                selList.GetNext2(aPos, selObject)
                str = str + selObject.mbsPath
                i = i + 1
            End While

            'MsgBox(str)

            ' Create the file reference tree and verify allowed transitions

'''''''''''''''''''''''''''''''''''''RunAsUser API''''''''''''''''''''''''''''''''''''''''''''
' Admin is the logged in user here, but if you uncomment the next line (batchChanger.RunAsUser),
' you will do a state change using the admin_jeda user.
' Change the username and password to match a user that exists in your vault.
' CreateTree, ShowDlg, and ChangeState2 should all be called after RunAsUser.

            'batchChanger.RunAsUser(Me.Handle.ToInt32(), "Admin_jeda", "abc")
            retVal = batchChanger.CreateTree("Passed Approval")

            Dim retVal2 As Boolean
            If (retVal) Then
                ' Show all of the items in the batch
                retVal2 = batchChanger.ShowDlg(Me.Handle.ToInt32())

                If (retVal2) Then
                    ' User clicked OK; commit all of the items in the batch to the vault
                    batchChanger.ChangeState2(Me.Handle.ToInt32(), "")
                End If
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Transition = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.BatchChange = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Transition
        '
        Me.Transition.Location = New System.Drawing.Point(39, 85)
        Me.Transition.Name = "Transition"
        Me.Transition.Size = New System.Drawing.Size(158, 23)
        Me.Transition.TabIndex = 2
        Me.Transition.Text = "Select files to approve..."
        Me.Transition.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'BatchChange
        '
        Me.BatchChange.Location = New System.Drawing.Point(40, 183)
        Me.BatchChange.Name = "BatchChange"
        Me.BatchChange.Size = New System.Drawing.Size(157, 23)
        Me.BatchChange.TabIndex = 6
        Me.BatchChange.Text = "Approve all files"
        Me.BatchChange.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.BatchChange)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.Transition)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Approve Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Transition As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents BatchChange As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Change States of Files Example (C#)

This example shows how to change the states of several files in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//    b. Type BatchChangeFileStates_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the
form, replace the code in Form1.Designer.cs with
//       this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. Ensure that a workflow exists with:
//    a. A Waiting for Approval state.
//    b. An Approved state.
//    c. A Passed Approval transition from the Waiting for Approval state to
//       the Approved state.
//    d. One or more vault files in the Waiting for Approval state.
//
4. Modify the bsPasswd parameter in IEdmBatchChangeState4::ChangeState2 to
//    match the password of your logged-in PDM user.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Approve Files dialog box displays.
//    a. Select a vault view.
//    b. Click Select files to approve.
//    c. In the Select File dialog:
//       1. Select vault files in the Waiting for Approval state.
//       2. Click Open.
//    d. Click Approve all files.
// 2. Click OK in the Do Transition dialog box.
//    The selected files change to the Approved state using the Passed Approval
//    transition.
// 3. Close the Approve Files dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchChangeFileStates_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private IEdmVault5 vault1 = null;
IEdmBatchChangeState4 batchChanger;
IEdmFile5 aFile;
IEdmFolder5 aFolder;
IEdmPos5 aPos;
bool retVal;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void Transition_Click(System.Object sender, System.EventArgs e)
{
try
{
//File1List.Items.Clear()

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();
//If the user didn't click Open, exit this subroutine
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

batchChanger = (IEdmBatchChangeState4)vault2.CreateUtility(EdmUtility.EdmUtil_BatchChangeState);
IEdmFolder5 ppoRetParentFolder;
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
aPos = aFile.GetFirstFolderPosition();
aFolder = aFile.GetNextFolder(aPos);
// Add each file selected to the batch
batchChanger.AddFile(aFile.ID, aFolder.ID);
}

batchChanger.Comment = "Transition to Approved state.";

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BatchChange_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

// Get the available transitions
EdmChangeStateTransitionInfo[] ppoTransitions = null;
batchChanger.GetAvailableTransitionList(out ppoTransitions);

int i = 0;
string str = "";
while (i <= ppoTransitions.GetUpperBound(0))
{
if (i == 0)
{
str = ppoTransitions[i].moName;
}
else
{
str = str + ", " + ppoTransitions[i].moName;
}
i = i + 1;
}

//MsgBox("Transitions available: " & str)

// Get list of files affected by the state transition
IEdmSelectionList6 selList = default(IEdmSelectionList6);
selList = (IEdmSelectionList6)batchChanger.GetFileList((int)EdmChangeStateFileListFlag.Ecsflf_GetActionUpdated + (int)EdmChangeStateFileListFlag.Ecsflf_GetChanged + (int)EdmChangeStateFileListFlag.Ecsflf_GetUnprocessed);

EdmSelectionObject selObject = new EdmSelectionObject();

aPos = selList.GetHeadPosition();
str = "Files affected by this state transition: ";
i = 0;
while (i < selList.Count)
{
selList.GetNext2(aPos, out selObject);
str = str + selObject.mbsPath;
i = i + 1;
}

//MsgBox(str)

// Create the file reference tree and verify allowed transitions
retVal = batchChanger.CreateTree("Passed Approval");

bool retVal2 = false;
if ((retVal))
{
// Show all of the items in the batch
retVal2 = batchChanger.ShowDlg(this.Handle.ToInt32());

if ((retVal2))
{
// User clicked OK; commit all of the items in the batch to the vault
batchChanger.ChangeState2(this.Handle.ToInt32(),
"password");
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

}
}

Back to top

//Form1.Designer.cs

namespace BatchChangeFileStates_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Transition = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.BatchChange = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //Transition
            //
            this.Transition.Location = new System.Drawing.Point(39, 85);
            this.Transition.Name = "Transition";
            this.Transition.Size = new System.Drawing.Size(158, 23);
            this.Transition.TabIndex = 2;
            this.Transition.Text = "Select files to approve...";
            this.Transition.UseVisualStyleBackColor = true;
            this.Transition.Click += new System.EventHandler(this.Transition_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //BatchChange
            //
            this.BatchChange.Location = new System.Drawing.Point(40, 183);
            this.BatchChange.Name = "BatchChange";
            this.BatchChange.Size = new System.Drawing.Size(157, 23);
            this.BatchChange.TabIndex = 6;
            this.BatchChange.Text = "Approve all files";
            this.BatchChange.UseVisualStyleBackColor = true;
            this.BatchChange.Click += new System.EventHandler(this.BatchChange_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.BatchChange);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.Transition);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Approve Files";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button Transition;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button BatchChange;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Change States of Files Example (VB.NET)

This example shows how to change the states of several files in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'    b. Type BatchChangeFileStates in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Ensure that a workflow exists with:
'    a. A Waiting for Approval state.
'    b. An Approved state.
'    c. A Passed Approval transition from the Waiting for Approval state to
'       the Approved state.
'    d. One or more vault files in the Waiting for Approval state.
' 4. Modify the bsPasswd parameter in IEdmBatchChangeState4::ChangeState2 to
'    match the password of your logged-in PDM user.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. The Approve Files dialog box displays.
'    a. Select a vault view.
'    b. Click Select files to approve.
'    c. In the Select File dialog:
'       1. Select vault files in the Waiting for Approval state.
'       2. Click Open.
'    d. Click Approve all files.
' 2. Click OK in the Do Transition dialog box.
'    The selected files change to the Approved state using the Passed Approval
'    transition.
' 3. Close the Approve Files dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchChanger As IEdmBatchChangeState4
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim retVal As Boolean
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub Transition_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Transition.Click
        Try
            'File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()
            'If the user didn't click Open, exit this subroutine
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            batchChanger = vault2.CreateUtility(EdmUtility.EdmUtil_BatchChangeState)

            For Each FileName As String In OpenFileDialog1.FileNames
                File1List.Items.Add(FileName)
                aFile = vault1.GetFileFromPath(FileName)
                aPos = aFile.GetFirstFolderPosition
                aFolder = aFile.GetNextFolder(aPos)
                ' Add each file selected to the batch
                batchChanger.AddFile(aFile.ID, aFolder.ID)
            Next

            batchChanger.Comment = "Transition to Approved state."

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BatchChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchChange.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            ' Get the available transitions
            Dim ppoTransitions() As EdmChangeStateTransitionInfo = Nothing
            batchChanger.GetAvailableTransitionList(ppoTransitions)

            Dim i As Integer = 0
            Dim str As String = ""
            While i <= ppoTransitions.GetUpperBound(0)
                If i = 0 Then
                    str = ppoTransitions(i).moName
                Else
                    str = str + ", " + ppoTransitions(i).moName
                End If
                i = i + 1
            End While

            'MsgBox("Transitions available: " & str)

            ' Get list of files affected by the state transition
            Dim selList As IEdmSelectionList6
            selList = batchChanger.GetFileList(EdmChangeStateFileListFlag.Ecsflf_GetActionUpdated + EdmChangeStateFileListFlag.Ecsflf_GetChanged + EdmChangeStateFileListFlag.Ecsflf_GetUnprocessed)

            Dim selObject As EdmSelectionObject = New EdmSelectionObject()

            aPos = selList.GetHeadPosition()
            str = "Files affected by this state transition: "
            i = 0
            While i < selList.Count
                selList.GetNext2(aPos, selObject)
                str = str + selObject.mbsPath
                i = i + 1
            End While

            'MsgBox(str)

            ' Create the file reference tree and verify allowed transitions
            retVal = batchChanger.CreateTree("Passed Approval")

            Dim retVal2 As Boolean
            If (retVal) Then
                ' Show all of the items in the batch
                retVal2 = batchChanger.ShowDlg(Me.Handle.ToInt32())

                If (retVal2) Then
                    ' User clicked OK; commit all of the items in the batch to the vault
                    batchChanger.ChangeState2(Me.Handle.ToInt32(), "password")
                End If
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Transition = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.BatchChange = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Transition
        '
        Me.Transition.Location = New System.Drawing.Point(39, 85)
        Me.Transition.Name = "Transition"
        Me.Transition.Size = New System.Drawing.Size(158, 23)
        Me.Transition.TabIndex = 2
        Me.Transition.Text = "Select files to approve..."
        Me.Transition.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'BatchChange
        '
        Me.BatchChange.Location = New System.Drawing.Point(40, 183)
        Me.BatchChange.Name = "BatchChange"
        Me.BatchChange.Size = New System.Drawing.Size(157, 23)
        Me.BatchChange.TabIndex = 6
        Me.BatchChange.Text = "Approve all files"
        Me.BatchChange.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.BatchChange)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.Transition)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Approve Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Transition As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents BatchChange As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Delete Files and Folders from Vault Example (C#)

This example shows how to delete several files and a folder from the vault in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Application.
//    b. Type BatchDeleteFiles_CSharp in Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and
safely pass arrays of structures.
// 3. Ensure that the root folder of the vault contains an empty Folder1 and at
//    least one file.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Delete Files dialog box displays.
//    a. Select a vault view.
//    b. Click Select files to delete from vault.
//    c. In the Select File dialog:
//       1. Click a file inside the vault.
//       2. Click Open.
//    d. Click Delete files from vault.
// 2. Click Delete in the Confirm Multiple File Delete dialog box.
//    a. If no errors occur, the selected file and Folder1
are moved
//       from the vault to the SOLIDWORKS PDM
recycling bin.
(To see the
//       SOLIDWORKS PDM recycling bin, right-click
your vault, click
//       Properties, and click Deleted
Items.)
//    b. If an error dialog box pops up, click OK to close
it.
// 3. Close the Delete Files dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchDeleteFiles_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private IEdmVault5 vault1 = null;
IEdmBatchDelete3 batchDeleter;
IEdmFile5 aFile;
IEdmFolder5 aFolder;
IEdmPos5 aPos;
bool retVal;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFiles_Click(System.Object sender, System.EventArgs e)
{
try
{
//File1List.Items.Clear()

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();

batchDeleter = (IEdmBatchDelete3)vault2.CreateUtility(EdmUtility.EdmUtil_BatchDelete);

if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
// do nothing
}
else
{
IEdmFolder5 ppoRetParentFolder;
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
aPos = aFile.GetFirstFolderPosition();
aFolder = aFile.GetNextFolder(aPos);
// Add selected file to the batch
batchDeleter.AddFileByPath(FileName);
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BatchDelete_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

if ((batchDeleter != null))
{
// Add Folder1 to the batch of items to be deleted
batchDeleter.AddFolder(vault1.RootFolderPath + "\\Folder1");

// Move files and folder to the Recycle Bin
retVal = batchDeleter.ComputePermissions(false, null);

if ((!retVal))
{
batchDeleter.ShowWarningDlg2(this.Handle.ToInt32(), true);
}

retVal = batchDeleter.CommitDelete(this.Handle.ToInt32(), null);

EdmBatchDelErrInfo[] ppoDelErrors = null;
if ((!retVal))
{
batchDeleter.ShowCommitErrorsDlg(this.Handle.ToInt32());
batchDeleter.GetCommitErrors(ppoDelErrors);
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}
}
}

Back to top

//Form1.Designer.cs

namespace BatchDeleteFiles_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.BatchDelete = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select files to delete from vault...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click += new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //BatchDelete
            //
            this.BatchDelete.Location = new System.Drawing.Point(40, 183);
            this.BatchDelete.Name = "BatchDelete";
            this.BatchDelete.Size = new System.Drawing.Size(157, 23);
            this.BatchDelete.TabIndex = 6;
            this.BatchDelete.Text = "Delete files from vault";
            this.BatchDelete.UseVisualStyleBackColor = true;
            this.BatchDelete.Click += new System.EventHandler(this.BatchDelete_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.BatchDelete);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Delete Files";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button BatchDelete;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Delete Files and Folders from Vault Example (VB.NET)

This example shows how to delete several files and a folder from the vault in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchDeleteFiles in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Ensure that the root folder of the vault contains an empty Folder1 and at
'     least one file.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Delete Files dialog box displays.
'     a. Select a vault view.
'     b. Click Select files to delete from vault.
'     c. In the Select File dialog:
'        1. Click a file inside the vault.
'        2. Click Open.
'     d. Click Delete files from vault.
'  2. Click Delete in the Confirm Multiple File Delete dialog box.
'     a. If no errors occur, the selected file and Folder1 are moved
'        from the vault to the SOLIDWORKS PDM recycling bin. (To see the
'        SOLIDWORKS PDM recycling bin, right-click your vault, click
'        Properties, and click Deleted Items.)
'     b. If an error dialog box pops up, click OK to close it.
'  3. Close the Delete Files dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchDeleter As IEdmBatchDelete3
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim retVal As Boolean
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            'File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            batchDeleter = vault2.CreateUtility(EdmUtility.EdmUtil_BatchDelete)

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                    aPos = aFile.GetFirstFolderPosition
                    aFolder = aFile.GetNextFolder(aPos)
                    ' Add selected file to the batch
                    batchDeleter.AddFileByPath(FileName)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BatchDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchDelete.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not IsNothing(batchDeleter) Then
                ' Add Folder1 to the batch of items to be deleted
                batchDeleter.AddFolder(vault1.RootFolderPath + "\Folder1")

                ' Move files and folder to the Recycle Bin
                retVal = batchDeleter.ComputePermissions(False, Nothing)

                If (Not retVal) Then
                    batchDeleter.ShowWarningDlg2(Me.Handle.ToInt32(), True)
                End If

                retVal = batchDeleter.CommitDelete(Me.Handle.ToInt32(), Nothing)

                Dim ppoDelErrors() As EdmBatchDelErrInfo = Nothing
                If (Not retVal) Then
                    batchDeleter.ShowCommitErrorsDlg(Me.Handle.ToInt32())
                    batchDeleter.GetCommitErrors(ppoDelErrors)
                End If
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.BatchDelete = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select files to delete from vault..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'BatchDelete
        '
        Me.BatchDelete.Location = New System.Drawing.Point(40, 183)
        Me.BatchDelete.Name = "BatchDelete"
        Me.BatchDelete.Size = New System.Drawing.Size(157, 23)
        Me.BatchDelete.TabIndex = 6
        Me.BatchDelete.Text = "Delete files from vault"
        Me.BatchDelete.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.BatchDelete)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Delete Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents BatchDelete As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Get and Set Reference Variables Example (C#)

This example shows how to get and set reference variables in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#,
Windows, Desktop > Windows
Forms Application.
//     b. Type BatchGetSetRefVariables_CSharp in
Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//
f. Click Create.
//     g. Click Show All Files in the Solution Explorer
toolbar and expand
//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with
this code.
//     i. To create the form, replace the code in
Form1.Designer.cs with
//        this code.
//  2.

Add dependencies and
safely pass arrays of structures.
//  3. Open the Administration tool.
//     a. Log into a vault.
//     b. Double-click Bill of Materials > BOM.
//     c. Click Description in the Columns list.
//     d. Select Look for variable in reference specific
values.
//     e. Click OK.
//  4. Open File Explorer on a vault view.
//  5. Ensure that an assembly and its referenced parts reside in the
vault.
//  6. Check out the assembly.
//  7. Click the Bill of Materials tab in the vault view.
//  8. Select Latest in the Reference Version dropdown.
//  9. Select @ in the Configuration dropdown.
// 10. Type a description in Description for each part in the assembly.
// 11. Click Save on the Bill of Materials toolbar and close the vault
view.
// 12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. The Batch Reference Variables dialog box displays.
//     a. Select a vault view.
//     b. Click Show
all reference variables.
//        1. In the Select Parent File
dialog, select the assembly file identified
//           in Preconditions
step 8 and click Open.
//        2. In the Select
Child File dialog, select a part file referenced by the
//           assembly file and click Open.
//
Displays all of the reference variables for all
configurations.
//
3. Click OK in the dialog box.
//
c. Click Get Description reference variable.
//
1. In the Select Parent File dialog, select
the assembly file identified
//           in Preconditions
step 8 and click Open.
//        2.
In the Select
Child File dialog, select a part file referenced by the
//           assembly file and click Open.
//
Displays the current value of reference variable,
Description.
//
3. Click OK in the dialog box.
//     d. Click Update Description reference variable.
//
1. In the Select Parent File dialog, select
the assembly file identified
//           in Preconditions
step 8 and click Open.
//        2.
In the Select
Child File dialog, select a part file referenced by the
//           assembly file and click Open.
//
//  2. Close the Batch Reference Variables dialog box.
//  3. Open the vault view and click the assembly.
//  4. Click the Bill of Materials tab.
//  5. Select @ in the
Configuration dropdown.
//  6. Observe the text in the Description column for the updated
part.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchGetSetRefVariables_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private IEdmVault5 vault = null;
        IEdmFolder5 ppoRetParentFolder;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault = new EdmVault5();
                IEdmVault8 vault1 = (IEdmVault8)vault;
                EdmViewInfo[] Views = null;

                vault1.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void Button1_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ShowRefVars((IEdmVault11)vault);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void Button2_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ShowRefDescription((IEdmVault11)vault);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void Button3_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                UpdateRefDescription((IEdmVault11)vault);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void ShowRefVars(IEdmVault11 vault)
        {
            if (vault == null)
            {
                vault = (IEdmVault11)new EdmVault5();
            }

            if (!vault.IsLoggedIn)
            {
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            //Let the user select the parent file
            IEdmStrLst5 pathList = default(IEdmStrLst5);
            pathList = (IEdmStrLst5)vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Parent File:");
            if (pathList == null)
                return;

            IEdmFile8 parent = default(IEdmFile8);

            parent = (IEdmFile8)vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out ppoRetParentFolder);

            //Let the user select the child file
            pathList = vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Child File:");
            if (pathList == null)
                return;

            IEdmFile8 child = default(IEdmFile8);
            child = (IEdmFile8)vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out ppoRetParentFolder);

            //Get reference variables in the latest version
            IEdmBatchRefVars batch = default(IEdmBatchRefVars);
            batch = (IEdmBatchRefVars)vault.CreateUtility(EdmUtility.EdmUtil_BatchRefVars);
            EdmRefVar[] vars = null;
            batch.GetAllRefVars(out vars, parent.ID, 0, child.ID);

            //Show the result
            string msg = null;
            msg = "Reference variables:" + "\n" + "\n";
            int idx = 0;
            idx = vars.GetLowerBound(0);
            while (idx <= vars.GetUpperBound(0))
            {
                msg = msg + "Parent ID: " + (vars[idx].mlParentFileID).ToString() + "\n";
                msg = msg + "Parent cfg: " + vars[idx].mbsParentCfgName + "\n";
                msg = msg + "Child ID: " + (vars[idx].mlChildFileID).ToString() + "\n";
                msg = msg + "Child cfg: " + vars[idx].mbsChildCfgName + "\n";
                msg = msg + "Status: " + vault.GetErrorMessage(vars[idx].mhResult) + "\n";
                msg = msg + "Variable ID: " + (vars[idx].mlVarID).ToString() + "\n";
                msg = msg + "Value: " + (vars[idx].moValue).ToString() + "\n";
                msg = msg + "\n";
                idx = idx + 1;
            }

            MessageBox.Show(msg);
        }

        private void ShowRefDescription(IEdmVault11 vault)
        {
            if (vault == null)
            {
                vault = (IEdmVault11)new EdmVault5();
            }

            if (!vault.IsLoggedIn)
            {
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            //Let the user select the parent file
            IEdmStrLst5 pathList = default(IEdmStrLst5);
            pathList = vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Parent File:");
            if (pathList == null)
                return;

            IEdmFile8 parent = default(IEdmFile8);
            parent = (IEdmFile8)vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out ppoRetParentFolder);

            //Let the user select the child file
            pathList = vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Child File:");
            if (pathList == null)
                return;

            IEdmFile8 child = default(IEdmFile8);
            child = (IEdmFile8)vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out ppoRetParentFolder);

            //Get the Description variable
            IEdmVariableMgr6 varMgr = default(IEdmVariableMgr6);
            varMgr = (IEdmVariableMgr6)vault.CreateUtility(EdmUtility.EdmUtil_VariableMgr);
            IEdmVariable5 desc = default(IEdmVariable5);
            desc = varMgr.GetVariable("Description");
            if (desc == null)
                return;

            //Get reference variables in the latest version
            IEdmBatchRefVars batch = default(IEdmBatchRefVars);
            batch = (IEdmBatchRefVars)vault.CreateUtility(EdmUtility.EdmUtil_BatchRefVars);

            EdmRefVar[] vars = new EdmRefVar[1];
            vars[0].mlParentFileID = parent.ID;
            vars[0].mlChildFileID = child.ID;
            vars[0].mbsChildCfgName = "@";
            vars[0].mbsParentCfgName = "@";
            vars[0].mlParentVersion = 0;
            vars[0].mlVarID = desc.ID;

            batch.GetRefVars(ref vars);

            //Show the result to the caller
            string msg = null;
            msg = "Reference variable: " + "Description" + "\n" + "\n";
            msg = msg + "Status: " + vault.GetErrorMessage(vars[0].mhResult) + "\n";
            msg = msg + "Value: " + (vars[0].moValue).ToString();

MessageBox.Show(msg);

}

private void UpdateRefDescription(IEdmVault11 vault)
{
if (vault == null)
{
vault = (IEdmVault11)new EdmVault5();
}

if (!vault.IsLoggedIn)
{
vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Let the user select the parent file
IEdmStrLst5 pathList = default(IEdmStrLst5);
pathList = vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Parent File:");
if (pathList == null)
return;

IEdmFile8 parent = default(IEdmFile8);
parent = (IEdmFile8)vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out ppoRetParentFolder);

//Let the user select the child file
pathList = vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Child File:");
if (pathList == null)
return;

IEdmFile8 child = default(IEdmFile8);
child = (IEdmFile8)vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out ppoRetParentFolder);

//Get the Description variable
IEdmVariableMgr6 varMgr = default(IEdmVariableMgr6);
varMgr = (IEdmVariableMgr6)vault.CreateUtility(EdmUtility.EdmUtil_VariableMgr);
IEdmVariable5 desc = default(IEdmVariable5);
desc = varMgr.GetVariable("Description");
if (desc == null)
return;

//Get reference variables in the latest version
IEdmBatchRefVars batch = default(IEdmBatchRefVars);
batch = (IEdmBatchRefVars)vault.CreateUtility(EdmUtility.EdmUtil_BatchRefVars);

EdmRefVar[] vars = new EdmRefVar[1];
vars[0].mlParentFileID = parent.ID;
vars[0].mlChildFileID = child.ID;
vars[0].mbsChildCfgName = "@";
vars[0].mbsParentCfgName = "@";
vars[0].mlParentVersion = 0;
vars[0].mlVarID = desc.ID;

batch.GetRefVars(ref vars);

//Change the Description variable
vars[0].moValue = "New
description";

//Store the value back in the reference
batch.SetRefVars(ref vars);

            MessageBox.Show(vault.GetErrorMessage(vars[0].mhResult));
        }
    }
}

Back to top

//Form1.Designer.cs

namespace BatchGetSetRefVariables_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.Button1 = new System.Windows.Forms.Button();
            this.Button2 = new System.Windows.Forms.Button();
            this.Button3 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(33, 43);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 0;
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(30, 18);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(100, 13);
            this.VaultsLabel.TabIndex = 1;
            this.VaultsLabel.Text = "Select a vault view:";
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(33, 84);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(187, 23);
            this.Button1.TabIndex = 2;
            this.Button1.Text = "Show all reference variables...";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click += new System.EventHandler(Button1_Click);
            //
            //Button2
            //
            this.Button2.Location = new System.Drawing.Point(33, 138);
            this.Button2.Name = "Button2";
            this.Button2.Size = new System.Drawing.Size(187, 24);
            this.Button2.TabIndex = 3;
            this.Button2.Text = "Get Description reference variable...";
            this.Button2.UseVisualStyleBackColor = true;
            this.Button2.Click += new System.EventHandler(Button2_Click);
            //
            //Button3
            //
            this.Button3.Location = new System.Drawing.Point(33, 190);
            this.Button3.Name = "Button3";
            this.Button3.Size = new System.Drawing.Size(208, 23);
            this.Button3.TabIndex = 4;
            this.Button3.Text = "Update Description reference variable...";
            this.Button3.UseVisualStyleBackColor = true;
            this.Button3.Click += new System.EventHandler(Button3_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Controls.Add(this.Button3);
            this.Controls.Add(this.Button2);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.VaultsLabel);
            this.Controls.Add(this.VaultsComboBox);
            this.Name = "Form1";
            this.Text = "Batch Reference Variables";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.Button Button1;
        internal System.Windows.Forms.Button Button2;
        internal System.Windows.Forms.Button Button3;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Get and Set Reference Variables Example (VB.NET)

This example shows how to get and set reference variables in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchGetSetRefVariables in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Open the Administration tool.
'     a. Log into a vault.
'     b. Double-click Bill of Materials > BOM.
'     c. Click Description in the Columns list.
'     d. Select Look for variable in reference specific values.
'     e. Click OK.
'  4. Open File Explorer on a vault view.
'  5. Ensure that an assembly and its referenced parts reside in the vault.
'  6. Check out the assembly.
'  7. Click the Bill of Materials tab in the vault view.
'  8. Select Latest in the Reference Version dropdown.
'  9. Select @ in the Configuration dropdown.
' 10. Type a description in Description for each part in the assembly.
' 11. Click Save on the Bill of Materials toolbar and close the vault view.
' 12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Batch Reference Variables dialog box displays.
'     a. Select a vault view.
'     b. Click Show all reference variables.
'        1. In the Select Parent File dialog, select the assembly file identified
'           in Preconditions step 5 and click Open.
'        2. In the Select Child File dialog, select a part file referenced by the
'           assembly file and click Open.
'           Displays all of the reference variables for all configurations.
'        3. Click OK in the dialog box.
'     c. Click Get Description reference variable.
'        1. In the Select Parent File dialog, select the assembly file identified
'           in Preconditions step 5 and click Open.
'        2. In the Select Child File dialog, select a part file referenced by the
'           assembly file and click Open.
'           Displays the current value of reference variable, Description.
'        3. Click OK in the dialog box.
'     d. Click Update Description reference variable.
'        1. In the Select Parent File dialog, select the assembly file identified
'           in Preconditions step 5 and click Open.
'        2. In the Select Child File dialog, select a part file referenced by the
'           assembly file and click Open.
'        3. Type a new description and click OK.
'        4. Click OK in the dialog box.
'  2. Close the Batch Reference Variables dialog box.
'  3. Open the vault view and click the assembly.
'  4. Click the Bill of Materials tab.
'  5. Select @ in the Configuration dropdown.
'  6. Observe the text in the Description column for the updated part.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault = New EdmVault5()
            Dim vault1 As IEdmVault8 = DirectCast(vault, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault1.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ShowRefVars(vault)
    End Sub

    Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ShowRefDescription(vault)
    End Sub

    Public Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        UpdateRefDescription(vault)
    End Sub

    Private Sub ShowRefVars(ByVal vault As IEdmVault11)

        If vault Is Nothing Then
            vault = New EdmVault5()
        End If

        If Not vault.IsLoggedIn Then
            vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
        End If

        'Let the user select the parent file
        Dim pathList As IEdmStrLst5
        pathList = vault.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Parent File:")
        If pathList Is Nothing Then Exit Sub

        Dim parent As IEdmFile8
        parent = vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition))

        'Let the user select the child file
        pathList = vault.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Child File:")
        If pathList Is Nothing Then Exit Sub

        Dim child As IEdmFile8
        child = vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition))

        'Get reference variables in the latest version
        Dim batch As IEdmBatchRefVars
        batch = vault.CreateUtility(EdmUtility.EdmUtil_BatchRefVars)
        Dim vars() As EdmRefVar
        vars = Nothing
        batch.GetAllRefVars(vars, parent.ID, 0, child.ID)

        'Show the result
        Dim msg As String
        msg = "Reference variables:" + vbLf + vbLf
        Dim idx As Integer
        idx = LBound(vars)
        While idx <= UBound(vars)
            msg = msg + "Parent ID: " + CStr(vars(idx).mlParentFileID) + vbLf
            msg = msg + "Parent cfg: " + vars(idx).mbsParentCfgName + vbLf
            msg = msg + "Child ID: " + CStr(vars(idx).mlChildFileID) + vbLf
            msg = msg + "Child cfg: " + vars(idx).mbsChildCfgName + vbLf
            msg = msg + "Status: " + vault.GetErrorMessage(vars(idx).mhResult) + vbLf
            msg = msg + "Variable ID: " + CStr(vars(idx).mlVarID) + vbLf
            msg = msg + "Value: " + CStr(vars(idx).moValue) + vbLf
            msg = msg + vbLf
            idx = idx + 1
        End While

        MsgBox(msg)
    End Sub

    Private Sub ShowRefDescription(ByVal vault As IEdmVault11)

        If vault Is Nothing Then
            vault = New EdmVault5()
        End If

        If Not vault.IsLoggedIn Then
            vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
        End If

        'Let the user select the parent file
        Dim pathList As IEdmStrLst5
        pathList = vault.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Parent File:")
        If pathList Is Nothing Then Exit Sub

        Dim parent As IEdmFile8
        parent = vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition))

        'Let the user select the child file
        pathList = vault.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Child File:")
        If pathList Is Nothing Then Exit Sub

        Dim child As IEdmFile8
        child = vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition))

        'Get the Description variable
        Dim varMgr As IEdmVariableMgr6
        varMgr = vault.CreateUtility(EdmUtility.EdmUtil_VariableMgr)
        Dim desc As IEdmVariable5
        desc = varMgr.GetVariable("Description")
        If desc Is Nothing Then Exit Sub

        'Get reference variables in the latest version
        Dim batch As IEdmBatchRefVars
        batch = vault.CreateUtility(EdmUtility.EdmUtil_BatchRefVars)
        Dim vars(0) As EdmRefVar
        vars(0).mlParentFileID = parent.ID
        vars(0).mlChildFileID = child.ID
        vars(0).mbsChildCfgName = "@"
        vars(0).mbsParentCfgName = "@"
        vars(0).mlParentVersion = 0
        vars(0).mlVarID = desc.ID
        batch.GetRefVars(vars)

        'Show the result to the caller
        Dim msg As String
        msg = "Reference variable: " + "Description" + vbLf + vbLf
        msg = msg + "Status: " + vault.GetErrorMessage(vars(0).mhResult) + vbLf
        msg = msg + "Value: " + CStr(vars(0).moValue)
        MsgBox(msg)

    End Sub

    Private Sub UpdateRefDescription(ByVal vault As IEdmVault11)

        If vault Is Nothing Then
            vault = New EdmVault5()
        End If

        If Not vault.IsLoggedIn Then
            vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
        End If

        'Let the user select the parent file
        Dim pathList As IEdmStrLst5
        pathList = vault.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Parent File:")
        If pathList Is Nothing Then Exit Sub

        Dim parent As IEdmFile8
        parent = vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition))

        'Let the user select the child file
        pathList = vault.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles, "All Files (*.*)|*.*||", "", "", "", "Select Child File:")
        If pathList Is Nothing Then Exit Sub

        Dim child As IEdmFile8
        child = vault.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition))

        'Get the Description variable
        Dim varMgr As IEdmVariableMgr6
        varMgr = vault.CreateUtility(EdmUtility.EdmUtil_VariableMgr)
        Dim desc As IEdmVariable5
        desc = varMgr.GetVariable("Description")
        If desc Is Nothing Then Exit Sub

        'Get reference variables in the latest version
        Dim batch As IEdmBatchRefVars
        batch = vault.CreateUtility(EdmUtility.EdmUtil_BatchRefVars)
        Dim vars(0) As EdmRefVar
        vars(0).mlParentFileID = parent.ID
        vars(0).mlChildFileID = child.ID
        vars(0).mbsChildCfgName = "@"
        vars(0).mbsParentCfgName = "@"
        vars(0).mlParentVersion = 0
        vars(0).mlVarID = desc.ID
        batch.GetRefVars(vars)

        'Let the user edit the Description variable
        vars(0).moValue = InputBox("Enter new description:", "Update Reference Variable", vars(0).moValue)

        'Store the value back in the reference
        batch.SetRefVars(vars)
        MsgBox(vault.GetErrorMessage(vars(0).mhResult))
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.Button3 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(33, 43)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 0
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(30, 18)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(100, 13)
        Me.VaultsLabel.TabIndex = 1
        Me.VaultsLabel.Text = "Select a vault view:"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(33, 84)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(187, 23)
        Me.Button1.TabIndex = 2
        Me.Button1.Text = "Show all reference variables..."
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(33, 138)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(187, 24)
        Me.Button2.TabIndex = 3
        Me.Button2.Text = "Get Description reference variable..."
        Me.Button2.UseVisualStyleBackColor = True
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(33, 190)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(208, 23)
        Me.Button3.TabIndex = 4
        Me.Button3.Text = "Update Description reference variable..."
        Me.Button3.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 262)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Name = "Form1"
        Me.Text = "Batch Reference Variables"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Check Out Files Example (C#)

This example shows how to check out several files from the vault in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Application.
//    b. Type BatchGetFiles_CSharp in Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and
safely pass arrays of structures.
// 3. Ensure that the vault contains at least one checked-in file.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. The Check Out Files dialog box displays.
//     a. Select a vault view.
//     b. Click Select files to check out from vault.
//     c. In the Select File dialog:
//        1. Click a
couple of files inside the vault.
//        2. Click Open.
//     d. Click Check out files from vault.
//  2. Click Check Out in the Check Out dialog box.
//  3. Close the Check Out Files dialog box.
//  4. Observe that the selected files are checked out of the selected vault.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchGetFiles_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;
IEdmBatchGet batchGetter;
IEdmSelectionList6 fileList = null;
EdmSelectionObject poSel;
EdmSelItem[] ppoSelection = null;
int fileCount = 0;
IEdmFile5 aFile;
IEdmFolder5 aFolder;
IEdmFolder5 ppoRetParentFolder;
IEdmPos5 aPos;
string str;
bool retVal;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFiles_Click(System.Object sender, System.EventArgs e)
{
try
{
//File1List.Items.Clear()

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();

batchGetter = (IEdmBatchGet)vault2.CreateUtility(EdmUtility.EdmUtil_BatchGet);

//Convert the selected files to an
//array of EdmSelItem structs
int nbrFiles = 0;
nbrFiles = OpenFileDialog1.Filenames.Count;
Array.Resize(ref ppoSelection, nbrFiles);

//If the user didn't click Open, no files were selected
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
// do nothing
}
else
{
int i = 0;
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
aPos = aFile.GetFirstFolderPosition();
aFolder = aFile.GetNextFolder(aPos);
ppoSelection[i] = new EdmSelItem();
ppoSelection[i].mlDocID = aFile.ID;
ppoSelection[i].mlProjID = aFolder.ID;
i = i + 1;
}
// Add selections to the batch of files to check out
batchGetter.AddSelection((EdmVault5)vault1, ref ppoSelection);
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BatchGet_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

if ((batchGetter != null))
{
batchGetter.CreateTree(this.Handle.ToInt32(), (int)EdmGetCmdFlags.Egcf_Lock);

fileCount = batchGetter.FileCount;
fileList = (IEdmSelectionList6)batchGetter.GetFileList((int)EdmGetFileListFlag.Egflf_GetLocked + (int)EdmGetFileListFlag.Egflf_GetFailed + (int)EdmGetFileListFlag.Egflf_GetRetrieved + (int)EdmGetFileListFlag.Egflf_GetUnprocessed);

aPos = fileList.GetHeadPosition();

str = "Getting " + fileCount + " files: ";
while (!(aPos.IsNull))
{
fileList.GetNext2(aPos, out poSel);
str = str + "\r\n" + poSel.mbsPath;
}

//MessageBox.Show(str)

retVal = batchGetter.ShowDlg(this.Handle.ToInt32());
// No dialog if checking out only one file

if ((retVal))
{
batchGetter.GetFiles(this.Handle.ToInt32(), null);
}

}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}
}
}

Back to top

//Form1.Designer.cs

namespace BatchGetFiles_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.BatchGet = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select files to check out from vault...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click += new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //BatchGet
            //
            this.BatchGet.Location = new System.Drawing.Point(40, 183);
            this.BatchGet.Name = "BatchGet";
            this.BatchGet.Size = new System.Drawing.Size(157, 23);
            this.BatchGet.TabIndex = 6;
            this.BatchGet.Text = "Check out files from vault";
            this.BatchGet.UseVisualStyleBackColor = true;
            this.BatchGet.Click += new System.EventHandler(this.BatchGet_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.BatchGet);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Check Out Files";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button BatchGet;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Check Out Files Example (VB.NET)

This example shows how to check out several files from the vault in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchGetFiles in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Ensure that the vault contains at least one checked-in file.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Check Out Files dialog box displays.
'     a. Select a vault view.
'     b. Click Select files to check out from vault.
'     c. In the Select File dialog:
'        1. Click a couple of files inside the vault.
'        2. Click Open.
'     d. Click Check out files from vault.
'  2. Click Check Out in the Check Out dialog box.
'  3. Close the Check Out Files dialog box.
'  4. Observe that the selected files are checked out of the selected vault.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchGetter As IEdmBatchGet
    Dim fileList As IEdmSelectionList6 = Nothing
    Dim poSel As EdmSelectionObject = Nothing
    Dim ppoSelection() As EdmSelItem
    Dim fileCount As Integer = 0
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim str As String
    Dim retVal As Boolean

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            'File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            batchGetter = vault2.CreateUtility(EdmUtility.EdmUtil_BatchGet)

            Dim nbrFiles As Integer = 0
            nbrFiles = OpenFileDialog1.FileNames.Count()
            Array.Resize(ppoSelection, nbrFiles)

            'If the user didn't click Open, no files were selected
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                Dim i As Integer = 0
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                    aPos = aFile.GetFirstFolderPosition
                    aFolder = aFile.GetNextFolder(aPos)
                    ppoSelection(i) = New EdmSelItem
                    ppoSelection(i).mlDocID = aFile.ID
                    ppoSelection(i).mlProjID = aFolder.ID
                    i = i + 1
                Next
                ' Add selections to the batch of files to check out
                batchGetter.AddSelection(vault1, ppoSelection)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BatchGet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchGet.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not IsNothing(batchGetter) Then

                batchGetter.CreateTree(Me.Handle.ToInt32(), EdmGetCmdFlags.Egcf_Lock)

                fileCount = batchGetter.FileCount
                fileList = batchGetter.GetFileList(EdmGetFileListFlag.Egflf_GetLocked & EdmGetFileListFlag.Egflf_GetFailed & EdmGetFileListFlag.Egflf_GetRetrieved & EdmGetFileListFlag.Egflf_GetUnprocessed)

                aPos = fileList.GetHeadPosition()

                str = "Getting " & fileCount & " files: "
                While Not (aPos.IsNull())
                    fileList.GetNext2(aPos, poSel)
                    str = str + vbLf + poSel.mbsPath
                End While

                'MsgBox(str)

                retVal = batchGetter.ShowDlg(Me.Handle.ToInt32()) ' No dialog if checking out only one file

                If (retVal) Then
                    batchGetter.GetFiles(Me.Handle.ToInt32(), Nothing)
                End If

            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.BatchGet = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select files to check out from vault..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'BatchGet
        '
        Me.BatchGet.Location = New System.Drawing.Point(40, 183)
        Me.BatchGet.Name = "BatchGet"
        Me.BatchGet.Size = New System.Drawing.Size(157, 23)
        Me.BatchGet.TabIndex = 6
        Me.BatchGet.Text = "Check out files from vault"
        Me.BatchGet.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.BatchGet)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Check Out Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents BatchGet As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Revoke State Transitions of Files Example (C#)

This example shows how to revoke the state transitions of several files in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms Application.
//     b. Type BatchChangeFileStates_CSharp in Project
name.
//     c. For
Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//
f. Click Create.
//     g. Click Show All Files in the Solution Explorer
toolbar and expand
//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. To create the
form, replace the code in Form1.Designer.cs with
//        this code.
//  2. Add
dependencies and safely pass arrays of structures.
//
3. Ensure that:
//     a. A workflow exists with
a No
Approval Required transition.
//     b. One or more vault files are
transitioned to the Approved state using the
//        No Approval Required transition.
//  4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. The Revoke
state transitions dialog box displays.
//     a. Select a vault view.
//     b. Click Select files for
which to revoke transitions.
//     c. In the Select File dialog:
//        1. Select a
file that transitioned to the Approved state using the
//           No Approval
Required transition.
//        2. Click Open.
//  2. Click Revoke
transitions.
//  3. Click OK in the Revoke Transition dialog box.
//     The selected file's No Approval Required transition
is revoked.
//  4. Close the Revoke
state transitions dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchRevokeTransitions_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmBatchChangeState3 batchChanger;
        IEdmFile5 aFile;
        IEdmFolder5 aFolder;
        IEdmPos5 aPos;
        bool retVal;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void SelectFiles_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                File1List.Items.Clear();

                IEdmVault11 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault11)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select File dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select File dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();
                //If the user didn't click Open, exit this subroutine
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                batchChanger = (IEdmBatchChangeState3)vault2.CreateUtility(EdmUtility.EdmUtil_BatchChangeState);
                IEdmFolder5 ppoRetParentFolder = null;
                foreach (string FileName in OpenFileDialog1.FileNames)
                {
                    File1List.Items.Add(FileName);
                    aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
                    aPos = aFile.GetFirstFolderPosition();
                    aFolder = aFile.GetNextFolder(aPos);
                    // Add each file selected to the batch
                    batchChanger.AddFile(aFile.ID, aFolder.ID);
                }

                batchChanger.Comment = "Revoke transitions.";
                batchChanger.AllowAdminToRevoke(true);
                //batchChanger.SetRevokeUserID(vault2.GetLoggedInWindowsUserID(vault2.Name))

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void RevokeTransitions_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                // Get list of files affected by the transition revocation
                IEdmSelectionList6 selList = default(IEdmSelectionList6);
                selList = (IEdmSelectionList6)batchChanger.GetFileList((int)EdmChangeStateFileListFlag.Ecsflf_GetChanged);

                EdmSelectionObject selObject = new EdmSelectionObject();

                string str = null;
                int i = 0;
                aPos = selList.GetHeadPosition();
                str = "Files affected by this transition revocation: ";
                i = 0;
                while (i < selList.Count)
                {
                    selList.GetNext2(aPos, out selObject);
                    str = str + selObject.mbsPath;
                    i = i + 1;
                }

                //MessageBox.Show(str)

                // Create the file reference tree and verify transition revocation
                retVal = batchChanger.CreateTreeForRevoke("No Approval Required");

                bool retVal2 = false;
                if ((retVal))
                {
                    // Show all of the items in the batch
                    retVal2 = batchChanger.ShowDlg(this.Handle.ToInt32());

                    if ((retVal2))
                    {
                        // Commit all of the items in the batch to the vault
                        batchChanger.ChangeState(this.Handle.ToInt32());
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

Back to top

//Form1.Designer.cs

namespace BatchRevokeTransitions_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.RevokeTransitions = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(12, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(15, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(15, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(233, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select files for which to revoke transitions...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click +=new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(15, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(257, 43);
            this.File1List.TabIndex = 4;
            //
            //RevokeTransitions
            //
            this.RevokeTransitions.Location = new System.Drawing.Point(40, 183);
            this.RevokeTransitions.Name = "RevokeTransitions";
            this.RevokeTransitions.Size = new System.Drawing.Size(157, 23);
            this.RevokeTransitions.TabIndex = 6;
            this.RevokeTransitions.Text = "Revoke transitions";
            this.RevokeTransitions.UseVisualStyleBackColor = true;
            this.RevokeTransitions.Click +=new System.EventHandler(RevokeTransitions_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = false;
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.RevokeTransitions);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Revoke state transitions";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button RevokeTransitions;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Revoke State Transitions of Files Example (VB.NET)

This example shows how to revoke the state transitions of several files in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchChangeFileStates in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Ensure that:
'     a. A workflow exists with a No Approval Required transition.
'     b. One or more vault files are transitioned to the Approved state using the
'        No Approval Required transition.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Revoke state transitions dialog box displays.
'     a. Select a vault view.
'     b. Click Select files for which to revoke transitions.
'     c. In the Select File dialog:
'        1. Select a file that transitioned to the Approved state using the
'           No Approval Required transition.
'        2. Click Open.
'  2. Click Revoke transitions.
'  3. Click OK in the Revoke Transition dialog box.
'     The selected file's No Approval Required transition is revoked.
'  4. Close the Revoke state transitions dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchChanger As IEdmBatchChangeState3
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim retVal As Boolean
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            File1List.Items.Clear()

            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()
            'If the user didn't click Open, exit this subroutine
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            batchChanger = vault2.CreateUtility(EdmUtility.EdmUtil_BatchChangeState)

            For Each FileName As String In OpenFileDialog1.FileNames
                File1List.Items.Add(FileName)
                aFile = vault1.GetFileFromPath(FileName)
                aPos = aFile.GetFirstFolderPosition
                aFolder = aFile.GetNextFolder(aPos)
                ' Add each file selected to the batch
                batchChanger.AddFile(aFile.ID, aFolder.ID)
            Next

            batchChanger.Comment = "Revoke transitions."
            batchChanger.AllowAdminToRevoke(True)
            'batchChanger.SetRevokeUserID(vault2.GetLoggedInWindowsUserID(vault2.Name))

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub RevokeTransitions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RevokeTransitions.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            ' Get list of files affected by the transition revocation
            Dim selList As IEdmSelectionList6
            selList = batchChanger.GetFileList(EdmChangeStateFileListFlag.Ecsflf_GetChanged)

            Dim selObject As EdmSelectionObject = New EdmSelectionObject()

            Dim str As String
            Dim i As Integer
            aPos = selList.GetHeadPosition()
            str = "Files affected by this transition revocation: "
            i = 0
            While i < selList.Count
                selList.GetNext2(aPos, selObject)
                str = str + selObject.mbsPath
                i = i + 1
            End While

            'MsgBox(str)

            ' Create the file reference tree and verify transition revocation
            retVal = batchChanger.CreateTreeForRevoke("No Approval Required")

            Dim retVal2 As Boolean
            If (retVal) Then
                ' Show all of the items in the batch
                retVal2 = batchChanger.ShowDlg(Me.Handle.ToInt32())

                If (retVal2) Then
                    ' Commit all of the items in the batch to the vault
                    batchChanger.ChangeState(Me.Handle.ToInt32())
                End If
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.RevokeTransitions = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(12, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(15, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(15, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(233, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select files for which to revoke transitions..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(15, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(257, 43)
        Me.File1List.TabIndex = 4
        '
        'RevokeTransitions
        '
        Me.RevokeTransitions.Location = New System.Drawing.Point(40, 183)
        Me.RevokeTransitions.Name = "RevokeTransitions"
        Me.RevokeTransitions.Size = New System.Drawing.Size(157, 23)
        Me.RevokeTransitions.TabIndex = 6
        Me.RevokeTransitions.Text = "Revoke transitions"
        Me.RevokeTransitions.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = False
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.RevokeTransitions)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Revoke state transitions"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents RevokeTransitions As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Check In Files Example (C#)

This example shows how to check in several files in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Application.
//    b. Type BatchUnlockFiles_CSharp in Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and
safely pass arrays of structures.
// 3. Check out a vault file.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays
the Check In Files dialog box.
//    a. Select a vault view.
//    b. Click Select files to check out from vault.
//    c. In the Select File dialog:
//       1. Click the
checked-out vault file.
//       2. Click Open.
//    d. Click Check in files.
//    e. Displays the Check in dialog box with the Reload or
Close Files
//       after Check In dropdown in the
toolbar.
//
f. Click the Check in button.
//    g. Click OK in the message box.
// 2. Close the Check
In Files dialog box.
// 3. Observe that the selected file is
checked in to the selected vault.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchUnlockFiles_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;
IEdmBatchUnlock2 batchUnlocker;
IEdmSelectionList6 fileList = null;
EdmSelectionObject poSel;
EdmSelItem[] ppoSelection = new EdmSelItem[11];
int fileCount = 0;
IEdmFile5 aFile;
IEdmFolder5 aFolder;
IEdmFolder5 ppoRetParentFolder;
IEdmPos5 aPos;
string str;

bool retVal;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFiles_Click(System.Object sender, System.EventArgs e)
{
try
{

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select
File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
//Show the Select
File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();

batchUnlocker = (IEdmBatchUnlock2)vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock);

//Convert the selected files to an
//array of EdmSelItem structs
int nbrFiles = 0;
nbrFiles = OpenFileDialog1.Filenames.Count;
Array.Resize(ref ppoSelection, nbrFiles);

//If the user did
not click Open, no files selected
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
// do nothing
}
else
{
int i = 0;
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
aPos = aFile.GetFirstFolderPosition();
aFolder = aFile.GetNextFolder(aPos);
ppoSelection[i] = new EdmSelItem();
ppoSelection[i].mlDocID = aFile.ID;
ppoSelection[i].mlProjID = aFolder.ID;
i = i + 1;
}
// Add selections to the batch of files to check in
batchUnlocker.AddSelection((EdmVault5)vault1, ref ppoSelection);
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BatchUnlock_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

if ((batchUnlocker != null))
{
batchUnlocker.CreateTree(this.Handle.ToInt32(), (int)EdmUnlockBuildTreeFlags.Eubtf_ShowCloseAfterCheckinOption + (int)EdmUnlockBuildTreeFlags.Eubtf_MayUnlock);

batchUnlocker.Comment = "Updates";
fileList = (IEdmSelectionList6)batchUnlocker.GetFileList((int)EdmUnlockFileListFlag.Euflf_GetUnlocked + (int)EdmUnlockFileListFlag.Euflf_GetUndoLocked + (int)EdmUnlockFileListFlag.Euflf_GetUnprocessed);

aPos = fileList.GetHeadPosition();

str = "Getting " + fileCount + " files: ";
while (!(aPos.IsNull))
{
fileList.GetNext2(aPos, out poSel);
str = str + "\r\n" + poSel.mbsPath;
}

//MessageBox.Show(str)

retVal = batchUnlocker.ShowDlg(this.Handle.ToInt32());

object statuses = null;
if ((retVal))
{
batchUnlocker.UnlockFiles(this.Handle.ToInt32(), null);
statuses = batchUnlocker.GetStatus((int)EdmUnlockStatusFlag.Eusf_CloseAfterCheckinFlag);
MessageBox.Show("Close Files after Check In selected? " + statuses);
}

}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}
}
}

Back to top

//Form1.Designer.cs

namespace BatchUnlockFiles_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.BatchUnlock = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select files to check in to vault...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click += new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //BatchUnlock
            //
            this.BatchUnlock.Location = new System.Drawing.Point(40, 183);
            this.BatchUnlock.Name = "BatchUnlock";
            this.BatchUnlock.Size = new System.Drawing.Size(157, 23);
            this.BatchUnlock.TabIndex = 6;
            this.BatchUnlock.Text = "Check in files";
            this.BatchUnlock.UseVisualStyleBackColor = true;
            this.BatchUnlock.Click += new System.EventHandler(this.BatchUnlock_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 242);
            this.Controls.Add(this.BatchUnlock);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Check In Files";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button BatchUnlock;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Check In Files Example (VB.NET)

This example shows how to check in several files in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
'     b. Type BatchUnlockFiles in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Check out a vault file.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Check In Files dialog box.
'     a. Select a vault view.
'     b. Click Select files to check out from vault.
'     c. In the Select File dialog:
'        1. Click the checked-out vault file.
'        2. Click Open.
'     d. Click Check in files.
'     e. Displays the Check in dialog box with the Reload or Close Files
'        after Check In dropdown in the toolbar.
'     f. Click the Check in button.
'     g. Click OK in the message box.
'  2. Close the Check In Files dialog box.
'  3. Observe that the selected file is checked in to the selected vault.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim batchUnlocker As IEdmBatchUnlock2
    Dim fileList As IEdmSelectionList6 = Nothing
    Dim poSel As EdmSelectionObject = Nothing
    Dim ppoSelection() As EdmSelItem
    Dim fileCount As Integer = 0
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aPos As IEdmPos5
    Dim str As String
    Dim retVal As Boolean

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            batchUnlocker = vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock)

            Dim nbrFiles As Integer = 0
            nbrFiles = OpenFileDialog1.FileNames.Count()
            Array.Resize(ppoSelection, nbrFiles)

            'If the user did not click Open, no files selected
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                Dim i As Integer = 0
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                    aPos = aFile.GetFirstFolderPosition
                    aFolder = aFile.GetNextFolder(aPos)
                    ppoSelection(i) = New EdmSelItem
                    ppoSelection(i).mlDocID = aFile.ID
                    ppoSelection(i).mlProjID = aFolder.ID
                    i = i + 1
                Next
                ' Add selections to the batch of files to check in
                batchUnlocker.AddSelection(vault1, ppoSelection)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BatchUnlock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchUnlock.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not IsNothing(batchUnlocker) Then

                batchUnlocker.CreateTree(Me.Handle.ToInt32(), EdmUnlockBuildTreeFlags.Eubtf_ShowCloseAfterCheckinOption + EdmUnlockBuildTreeFlags.Eubtf_MayUnlock)

                batchUnlocker.Comment = "Updates"
                fileList = batchUnlocker.GetFileList(EdmUnlockFileListFlag.Euflf_GetUnlocked + EdmUnlockFileListFlag.Euflf_GetUndoLocked + EdmUnlockFileListFlag.Euflf_GetUnprocessed)

                aPos = fileList.GetHeadPosition()

                str = "Getting " & fileCount & " files: "
                While Not (aPos.IsNull())
                    fileList.GetNext2(aPos, poSel)
                    str = str + vbLf + poSel.mbsPath
                End While

                'MsgBox(str)

                retVal = batchUnlocker.ShowDlg(Me.Handle.ToInt32())

                Dim statuses As Object
                If (retVal) Then
                    batchUnlocker.UnlockFiles(Me.Handle.ToInt32(), Nothing)
                    statuses = batchUnlocker.GetStatus(EdmUnlockStatusFlag.Eusf_CloseAfterCheckinFlag)

                    MsgBox("Close Files after Check In selected? " & statuses)

                End If

            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.BatchUnlock = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select files to check in to vault..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'BatchUnlock
        '
        Me.BatchUnlock.Location = New System.Drawing.Point(40, 183)
        Me.BatchUnlock.Name = "BatchUnlock"
        Me.BatchUnlock.Size = New System.Drawing.Size(157, 23)
        Me.BatchUnlock.TabIndex = 6
        Me.BatchUnlock.Text = "Check in files"
        Me.BatchUnlock.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 242)
        Me.Controls.Add(Me.BatchUnlock)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Check In Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents BatchUnlock As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Batch Update Card Variables Example (C#)

This example shows how to update file and folder card variables in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms App.
//    b. Type BatchUpdateCardVarsCSharp in Project name.
//

c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//        Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and
safely pass arrays of structures.
// 3. Add Microsoft.CSharp as reference (click
//    Assemblies > Framework
in the left-side panel, select
//    Microsoft.CSharp, and click OK).
// 4.

Ensure that at least one text file is
checked out, and at least one folder
//    with the word Folder in the name exists in the vault.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Batch Update dialog box.
//     a. Select a vault.
//     b. Click Batch Update Variables.
//        * Updates the Title and Comment
variables in the data cards
//          only of checked-out
text files.
//        * Updates the Description variable
of the data cards of all folders
//          with the word
Folder in
their names.
//        * Displays a message box saying
Card variables updated.
//     c. Click OK to close the message box.
//  2. Close the Batch Update dialog box.
//  3. Inspect the data cards of any checked-out text files and folders
with
//     the word Folder in their names in the selected vault.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace BatchUpdateCardVarsCSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private IEdmVault5 vault1 = null;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

private void BatchUpdateButton_Click(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Create a batch update utility
IEdmBatchUpdate2 Update = default(IEdmBatchUpdate2);
Update = (IEdmBatchUpdate2)vault2.CreateUtility(EdmUtility.EdmUtil_BatchUpdate);

//Get the IDs of the file and folder
card variables to update
int TitleID = 0;
int CommentID = 0;
int DescriptionID = 0;
IEdmVariableMgr5 VariableMgr = default(IEdmVariableMgr5);

VariableMgr = (IEdmVariableMgr5)vault1;
TitleID = VariableMgr.GetVariable("Title").ID;
DescriptionID = VariableMgr.GetVariable("Description").ID;
CommentID = VariableMgr.GetVariable("Comment").ID;

//Search for all text files in the
vault
IEdmSearch5 Search = default(IEdmSearch5);
Search = (IEdmSearch5)vault2.CreateUtility(EdmUtility.EdmUtil_Search);

Search.FileName = "%.txt";

IEdmSearchResult5 Result = default(IEdmSearchResult5);
Result = Search.GetFirstResult();

while ((Result != null))
{
Update.SetVar(Result.ID, TitleID, "My Title", "", (int)EdmBatchFlags.EdmBatch_Nothing);
Update.SetVar(Result.ID, CommentID, "My Comment", "", (int)EdmBatchFlags.EdmBatch_Nothing);
Result = Search.GetNextResult();
}

//Search for all folders whose names contain
"Folder" in the vault
Search.FileName = "%Folder%";

Result = Search.GetFirstResult();

while ((Result != null))
{
Update.SetFolderVar(Result.ID, DescriptionID, "My Description", (int)EdmBatchFlags.EdmBatch_Nothing);
Result = Search.GetNextResult();
}

//Write all the card
variable values to the database
EdmBatchError2[] Errors = null;
int errorSize = 0;
errorSize = Update.CommitUpdate(out Errors, null);

//Display any errors
string Msg = null;
Msg = "Card
variables updated.";

string ErrName = null;
string ErrDesc = null;
string FileName = null;

int Lo = 0;
Lo = Errors.GetLowerBound(0);

int Hi = 0;
Hi = Errors.GetUpperBound(0);

               IEdmVault9 vault9;
                vault9 = (IEdmVault9)vault1;
                EdmObjectInfo[] ppoObjects = null;

                while (Lo < Hi - 1)
                {
                    ppoObjects[Lo].meType = EdmObjectType.EdmObject_File;
                    Lo = Lo + 1;
                }

                vault9.GetObjects(ref ppoObjects);

                while (Lo < Hi - 1)
                {
                    if ((Errors[Lo].mlFileID > 0))
                    {
                        IEdmFile6 File = default(IEdmFile6);
                        int ID;
                        ID = (int)ppoObjects[Lo].moObjectID;
                        if (ppoObjects[Lo].meType == EdmObjectType.EdmObject_File)
                        {
                            if (ID == Errors[Lo].mlFileID)
                            {
                                File = (IEdmFile6)ppoObjects[Lo].mpoObject;
                                FileName = File.Name;
                            }
                        }
                    }

                    vault1.GetErrorString(Errors[Lo].mlErrorCode, out ErrName, out ErrDesc);

                    Msg = Msg + "\n" + ErrName + " " + FileName;

                    Lo = Lo + 1;

                }

                MessageBox.Show(Msg);

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

    }

}

Back to top

//Form1.Designer.cs

namespace BatchUpdateCardVarsCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.BatchUpdateButton = new System.Windows.Forms.Button();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            //BatchUpdateButton
            //
            this.BatchUpdateButton.Location = new System.Drawing.Point(30, 100);
            this.BatchUpdateButton.Name = "BatchUpdateButton";
            this.BatchUpdateButton.Size = new System.Drawing.Size(215, 23);
            this.BatchUpdateButton.TabIndex = 0;
            this.BatchUpdateButton.Text = "Batch Update Variables";
            this.BatchUpdateButton.UseVisualStyleBackColor = true;
            this.BatchUpdateButton.Click += new System.EventHandler(this.BatchUpdateButton_Click);
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(30, 56);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(27, 23);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(91, 13);
            this.Label1.TabIndex = 2;
            this.Label1.Text = "Select vault view:";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 153);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.BatchUpdateButton);
            this.Name = "Form1";
            this.Text = "Batch Update";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Button BatchUpdateButton;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Label Label1;
        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Batch Update Card Variables Example (VB.NET)

This example shows how to update file and folder card variables in one batch.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'     b. Type BatchUpdateCardVars in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Ensure that at least one text file is checked out, and at least one folder
'     with the word Folder in its name exists in the vault.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Batch Update dialog box.
'     a. Select a vault.
'     b. Click Batch Update Variables.
'        * Updates the Title and Comment variables in the data cards
'          only of checked-out text files.
'        * Updates the Description variable of the data cards of all folders
'          with the word Folder in their names.
'        * Displays a message box saying Card variables updated.
'     c. Click OK to close the message box.
'  2. Close the Batch Update dialog box.
'  3. Inspect the data cards of any checked-out text files and folders with
'     the word Folder in their names in the selected vault.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Dim vault1 As IEdmVault5 = New EdmVault5()
    Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
    Dim Views As EdmViewInfo() = Nothing
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub BatchUpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BatchUpdateButton.Click

        Try
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Create a batch update utility
            Dim Update As IEdmBatchUpdate2
            Update = vault2.CreateUtility(EdmUtility.EdmUtil_BatchUpdate)

            'Get the IDs of the file and folder card variables to update
            Dim TitleID As Integer
            Dim CommentID As Integer
            Dim DescriptionID As Integer
            Dim VariableMgr As IEdmVariableMgr5

            VariableMgr = vault1
            TitleID = VariableMgr.GetVariable("Title").ID
            DescriptionID = VariableMgr.GetVariable("Description").ID
            CommentID = VariableMgr.GetVariable("Comment").ID

            'Search for all text files in the vault
            Dim Search As IEdmSearch5
            Search = vault1.CreateUtility(EdmUtility.EdmUtil_Search)

            Search.FileName = "%.txt"

            Dim Result As IEdmSearchResult5
            Result = Search.GetFirstResult

            While Not Result Is Nothing
                Update.SetVar(Result.ID, TitleID, "My Title", "", EdmBatchFlags.EdmBatch_Nothing)
                Update.SetVar(Result.ID, CommentID, "My Comment", "", EdmBatchFlags.EdmBatch_Nothing)
                Result = Search.GetNextResult
            End While

            'Search for all folders whose names contain the word Folder in the vault
            Search.FileName = "%Folder%"

            Result = Search.GetFirstResult

            While Not Result Is Nothing
                Update.SetFolderVar(Result.ID, DescriptionID, "My Description", EdmBatchFlags.EdmBatch_Nothing)
                Result = Search.GetNextResult
            End While

            'Write all the card variable values to the database
            Dim Errors() As EdmBatchError2 = Nothing
            Dim errorSize As Integer
            errorSize = Update.CommitUpdate(Errors, Nothing)

            'Display any errors
            Dim Msg As String
            Msg = "Card variables updated."

            Dim ErrName As String = Nothing
            Dim ErrDesc As String = Nothing
            Dim FileName As String = Nothing

            Dim Lo As Integer
            Lo = LBound(Errors)

            Dim Hi As Integer
            Hi = UBound(Errors)

            Dim vault9 As IEdmVault9
            vault9 = DirectCast(vault1, IEdmVault9)
            Dim ppoObjects(Hi) As EdmObjectInfo
            While Lo <= Hi
                ppoObjects(Lo).meType = EdmObjectType.EdmObject_File
                Lo = Lo + 1
            End While

            vault9.GetObjects(ppoObjects)

            While Lo <= Hi
                If (Errors(Lo).mlFileID > 0) Then
                    Dim File As IEdmFile6 = Nothing
                    Dim ID As Integer
                    ID = DirectCast(ppoObjects(Lo).moObjectID, Integer)
                    If (ppoObjects(Lo).meType = EdmObjectType.EdmObject_File) _
                       And (ID = Errors(Lo).mlFileID) Then
                        File = DirectCast(ppoObjects(Lo).mpoObject, IEdmFile6)
                        FileName = File.Name
                    End If
                End If

                vault1.GetErrorString(Errors(Lo).mlErrorCode, ErrName, ErrDesc)

                Msg = Msg + vbLf + ErrName + " " + FileName

                Lo = Lo + 1

            End While

            MsgBox(Msg)

        Catch ex As System.Runtime.InteropServices.COMException

            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.BatchUpdateButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'BatchUpdateButton
        '
        Me.BatchUpdateButton.Location = New System.Drawing.Point(30, 100)
        Me.BatchUpdateButton.Name = "BatchUpdateButton"
        Me.BatchUpdateButton.Size = New System.Drawing.Size(215, 23)
        Me.BatchUpdateButton.TabIndex = 0
        Me.BatchUpdateButton.Text = "Batch Update Variables"
        Me.BatchUpdateButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(30, 56)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(27, 23)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(75, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Select vault view:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 153)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.BatchUpdateButton)
        Me.Name = "Form1"
        Me.Text = "Batch Update"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents BatchUpdateButton As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Bitmasks

Bitmasks are essentially bitwise comparisons. Understanding how bitmasks work might make more sense if you think of their binary representation.

The binary representation of the decimal number 1 is 0001, 2 is 0010, 4 is 0100, etc.

Think of each bit as a switch. For example, the decimal number 5 in binary is 0101. The third bit (0100) is on and the first bit (0001) is on. So, 0101 = 0100 + 0001.

If a SOLIDWORKS PDM Professional enumerator has a bitmask like the following:

Decimal | Option | Binary
1 | OptionA | 0001
2 | OptionB | 0010
4 | OptionC | 0100
8 | OptionD | 1000

and you want OptionA and OptionC on, then add their two values together:

Decimal | Option | Binary
1 | OptionA | 0001
+ 4 | OptionC | 0100
= 5 |  | 0101


SOLIDWORKS PDM Professional API Help

Change Card Variables Add-in Example (C#)

This example shows how to create an add-in that modifies a data card variable when another data card variable changes.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Library > Class Library (.NET Framework).
// 3. Select .NET Framework 4.5
or later in the dropdown.
// 4. Type CardVariables_CSharp in Project
name.
// 5.

For Location, click ... and navigate to the folder where to
create the project.
// 6. Click Create.
// 7. Right-click the project name in the Solution Explorer and click Add > Reference....
// 8. In the Reference Manager dialog:
//    a. Add
dependencies and safely pass arrays of structures.
//    b. Add Microsoft.VisualBasic
and System.Windows.Forms as a references (click Assemblies
> Framework in the
//       left-side panel, click System.Windows.Forms
and Microsoft.VisualBasic, and click OK).
// 9. Right-click the project name in the Solution Explorer and click Properties.
//10. In the Properties window:
//    a. On the Application tab, click Assembly Information....
//    b. De-select Make assembly COM-Visible.
//    c. On the Build tab,
select Any CPU, de-select Prefer 32-bit, and
select Register for COM interop.
//11. Save the project.
//12. Copy the code below to Class1.cs.
//13. To populate the GUID
    attribute, click Tools > Create GUID in the IDE,
//    select GUID Format 5, click Copy, and click Exit.
Populate [Guid(""),...]
with
//    the copied string.
//14. Click Build > Build Solution.
//
// Postconditions:
// 1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
//    and log in as Admin.
// 2. Under vault_name, right-click Add-ins, and click New Add-in.
//    a. Navigate to the bin\Debug directory of your built project.
//    b. Click EPDM.Interop.epdm.dll and CardVariables.dll.
//    c. Click Open.
//    d. Click OK.
// 3. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
// 4. In the taskbar, click the Administration tool blueberry and click Log
off > vault_name.
// 5. Open File Explorer on a view of vault_name to:
//    a. Log in as Admin.
//    b. Create, check in,
and check out a file whose data card contains Project Name
//       and Project Number.
//    c. Click the Data Card tab.
//    d. In Project Name, type Mercury, Venus, Earth, Mars, Jupiter, or Saturn.
//    e. Observe the change in Project Number.
//    f. In Project Number, type a number between 1000 and 1005.
//    g. Observe the change in Project Name.
//---------------------------------------------------------------------------------------

using Microsoft.VisualBasic
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;

[Guid(""),
ComVisible(true)]
public class CardVariables : IEdmAddIn5
{

public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{
try
{
poInfo.mbsAddInName = "C# Card Variable Add-In";
poInfo.mbsCompany = "Dassault Systemes";
poInfo.mbsDescription = "Example demonstrating updating a card variable based on another card variable";
poInfo.mlAddInVersion = 1;
//Minimum SOLIDWORKS PDM Professional version
//needed for C# Add-Ins is 6.4
poInfo.mlRequiredVersionMajor = 6;
poInfo.mlRequiredVersionMinor = 4;

//Register to receive a notification when
//a data card variable value changes
poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardInput);

IEdmDictionary5 ProjectDictionary = default(IEdmDictionary5);
ProjectDictionary = poVault.GetDictionary("Projects", true);

bool SuccessSet = false;
SuccessSet = ProjectDictionary.StringTestAndSetAt("1000", "Mercury");
SuccessSet = ProjectDictionary.StringTestAndSetAt("1001", "Venus");
SuccessSet = ProjectDictionary.StringTestAndSetAt("1002", "Earth");
SuccessSet = ProjectDictionary.StringTestAndSetAt("1003", "Mars");
SuccessSet = ProjectDictionary.StringTestAndSetAt("1004", "Jupiter");
SuccessSet = ProjectDictionary.StringTestAndSetAt("1005", "Saturn");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\r\n" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

    readonly Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag static_OnCmd_VariableChangeInProgress_Init = new Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag();

    //A data card variable value has changed
    bool static_OnCmd_VariableChangeInProgress;
    public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
    {
        try
        {
            switch (poCmd.meCmdType)
            {
                case EdmCmdType.EdmCmd_CardInput:

                    lock (static_OnCmd_VariableChangeInProgress_Init)
                    {
                        try
                        {
                            if (InitStaticVariableHelper(static_OnCmd_VariableChangeInProgress_Init))
                            {
                                static_OnCmd_VariableChangeInProgress = false;
                            }
                        }
                        finally
                        {
                            static_OnCmd_VariableChangeInProgress_Init.State = 1;
                        }
                    }

                    IEdmEnumeratorVariable5 vars = (IEdmEnumeratorVariable5)poCmd.mpoExtra;
                    IEdmStrLst5 ConfigNames = (IEdmStrLst5)((EdmCmdData)ppoData.GetValue(0)).mpoExtra;
                    string Config = null;
                    if (IsConfigInList(ConfigNames, "@"))
                    {
                        Config = "@";
                    }
                    else
                    {
                        Config = "";
                    }

                    //Take appropriate action based on the data card variable that has changed
                    switch (poCmd.mbsComment)
                    {

                        //The Project Name variable has changed
                        case "Project Name":
                            if (static_OnCmd_VariableChangeInProgress == true)
                            {
                                static_OnCmd_VariableChangeInProgress = false;
                                break;
                            }
                            object ProjectName = "";
                            vars.GetVar("Project Name", Config, out ProjectName);

                            //Get the old Project Number
                            object ProjectNumber = "";
                            vars.GetVar("Project number", Config, out ProjectNumber);

                            //Get the existing Projects dictionary
                            IEdmDictionary5 ProjectDictionary = default(IEdmDictionary5);
                            ProjectDictionary = ((IEdmVault5)(poCmd.mpoVault)).GetDictionary("Projects", false);

                            //Look up the new project number
                            string NewProjectNumber = "";
                            //Find all values containing the substring
                            //stored in ProjectName
                            string key = "";
                            string value = "";
                            IEdmPos5 pos = default(IEdmPos5);
                            pos = ProjectDictionary.StringFindValues((string)ProjectName);
                            while (!pos.IsNull)
                            {
                                ProjectDictionary.StringGetNextAssoc(pos, out key, out value);
                                //Traverse the values until a match
                                //is found
                                if (value == (string)ProjectName)
                                {
                                    NewProjectNumber = key;
                                    break;
                                }
                            }

                            //Only update the variable if it changed
                            if (!(NewProjectNumber == (string)ProjectNumber))
                            {
                                static_OnCmd_VariableChangeInProgress = true;
                                vars.SetVar("Project number", Config, NewProjectNumber);

                            }
                            break;

                        //The Project Number variable has changed
                        case "Project number":
                            if (static_OnCmd_VariableChangeInProgress == true)
                            {
                                static_OnCmd_VariableChangeInProgress = false;
                                break;
                            }

                            ProjectNumber = "";
                            vars.GetVar("Project number", Config, out ProjectNumber);

                            //Get the old Project Name
                            ProjectName = "";
                            vars.GetVar("Project Name", Config, out ProjectName);

                            //Get the existing Projects dictionary
                            ProjectDictionary = ((IEdmVault5)(poCmd.mpoVault)).GetDictionary("Projects", false);

                            //Look up the project name
                            string NewProjectName = "";
                            ProjectDictionary.StringGetAt((string)ProjectNumber, out NewProjectName);

                            //Only update the variable if it's changed
                            if (!(NewProjectName == ((string)ProjectName)))
                            {
                                static_OnCmd_VariableChangeInProgress = true;
                                vars.SetVar("Project Name", Config, NewProjectName);
                            }
                            break;
                    }
                    break;
            }
        }
        catch (System.Runtime.InteropServices.COMException ex)
        {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\r\n" + ex.Message);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    private bool IsConfigInList(IEdmStrLst5 ConfigNames, string ConfigName)
    {
        bool functionReturnValue = false;
        functionReturnValue = false;
        try
        {
            string CurConfig = null;
            IEdmPos5 Pos = ConfigNames.GetHeadPosition();
            while (!Pos.IsNull)
            {
                CurConfig = ConfigNames.GetNext(Pos);
                if (CurConfig == ConfigName)
                {
                    functionReturnValue = true;
                    break;
                }
            }
            return functionReturnValue;
        }
        catch (System.Runtime.InteropServices.COMException ex)
        {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\r\n" + ex.Message);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
        return functionReturnValue;
    }

    static bool InitStaticVariableHelper(Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag flag)
    {
        if (flag.State == 0)
        {
            flag.State = 2;
            return true;
        }
        else if (flag.State == 2)
        {
            throw new Microsoft.VisualBasic.CompilerServices.IncompleteInitialization();
        }
        else
        {
            return false;
        }
    }

}

Back to top


SOLIDWORKS PDM Professional API Help

Change Card Variables Add-in Example (VB.NET)

This example shows how to create an add-in that modifies a data card variable when another data card variable changes.

'--------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Library > Class Library (.NET Framework).
' 3. Select .NET Framework 4.5 or later in the dropdown.
' 4. Type CardVariables in Project name.
' 5. Click Browse and navigate to the folder where to create the project.
' 6. Click OK.
' 7. Right-click the project name in the Solution Explorer and click Add > Reference....
' 8. In the Reference Manager dialog:
'    a. Add dependencies and safely pass arrays of structures.
' 9. Right-click the project name in the Solution Explorer and click Properties.
'10. In the Properties window:
'    a. On the Application tab, click Assembly Information....
'    b. De-select Make assembly COM-Visible.
'    c. On the Compile tab, select Any CPU, de-select Prefer 32-bit, and select Register for COM interop.
'11. Save the project.
'12. Copy the code below to Class1.vb.
'13. To populate the GUID attribute, click Tools > Create GUID in the IDE,
'    select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with
'    the copied string.
'14. Click Build > Build Solution.
'
' Postconditions:
' 1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
'    and log in as Admin.
' 2. Under vault_name, right-click Add-ins, and click New Add-in.
'    a. Navigate to the bin\Debug directory of your built project.
'    b. Click EPDM.Interop.epdm.dll and CardVariables.dll.
'    c. Click Open.
'    d. Click OK.
' 3. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
' 4. In the taskbar, click the Administration tool icon and click Log Off > vault_name.
' 5. Open File Explorer on a view of vault_name to:
'    a. Log in as Admin.
'    b. Create, check in, and check out a file whose data card contains Project Name
'       and Project Number.
'    c. Click the Data Card tab.
'    d. In Project Name, type Mercury, Venus, Earth, Mars, Jupiter, or Saturn.
'    e. Observe the change in Project Number.
'    f. In Project Number, type a number between 1000 and 1005.
'    g. Observe the change in Project Name.
'---------------------------------------------------------------------------------------

Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("")>
<ComVisible(True)>
Public Class CardVariables
    Implements IEdmAddIn5

    Public Sub GetAddInInfo( _
          ByRef poInfo As EdmAddInInfo, _
          ByVal poVault As IEdmVault5, _
          ByVal poCmdMgr As IEdmCmdMgr5) _
          Implements IEdmAddIn5.GetAddInInfo
        Try
            poInfo.mbsAddInName = "VB.NET Card Variable Add-In"
            poInfo.mbsCompany = "Dassault Systemes"
            poInfo.mbsDescription = "Example demonstrating " _
              + "updating a card variable based on another card variable"
            poInfo.mlAddInVersion = 1
            'Minimum SOLIDWORKS PDM Professional version
            'needed for VB.Net Add-Ins is 6.4
            poInfo.mlRequiredVersionMajor = 6
            poInfo.mlRequiredVersionMinor = 4

            'Register to receive a notification when
            'a data card variable value changes
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardInput)

            Dim ProjectDictionary As IEdmDictionary5
            ProjectDictionary = poVault.GetDictionary( _
              "Projects", True) 'Create it if it doesn't exist

            Dim SuccessSet As Boolean = False
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1000", "Mercury")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1001", "Venus")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1002", "Earth")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1003", "Mars")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1004", "Jupiter")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1005", "Saturn")

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    'A data card variable value has changed
    Public Sub OnCmd( _
          ByRef poCmd As EdmCmd, _
          ByRef ppoData As EdmCmdData[]) _
          Implements IEdmAddIn5.OnCmd
        Try

            Select Case poCmd.meCmdType

                Case EdmCmdType.EdmCmd_CardInput
                    Static VariableChangeInProgress As Boolean = _
                       False
                    Dim vars As IEdmEnumeratorVariable5 = _
                       poCmd.mpoExtra
                    Dim ConfigNames As IEdmStrLst5 = _
                        DirectCast(ppoData(0), EdmCmdData).mpoExtra
                    Dim Config As String
                    If IsConfigInList(ConfigNames, "@") Then
                        Config = "@"
                    Else
                        Config = ""
                    End If

                    'Take appropriate action based on the data card variable that has changed
                    Select Case poCmd.mbsComment

                        'The Project Name variable has changed
                        Case "Project Name"
                            If VariableChangeInProgress = True Then
                                VariableChangeInProgress = False
                                Exit Select
                            End If
                            Dim ProjectName As String = ""
                            vars.GetVar("Project Name", Config, _
                              ProjectName)

                            'Get the old Project Number
                            Dim ProjectNumber As String = ""
                            vars.GetVar("Project number", Config, _
                               ProjectNumber)

                            'Get the existing Projects dictionary
                            Dim ProjectDictionary As IEdmDictionary5
                            ProjectDictionary = poCmd.mpoVault. _
                              GetDictionary("Projects", False)

                            'Look up the new project number
                            Dim NewProjectNumber As String = ""
                            'Find all values containing the substring
                            'stored in ProjectName
                            Dim key As String = ""
                            Dim value As String = ""
                            Dim pos As IEdmPos5
                            pos = ProjectDictionary.StringFindValues( _
                              ProjectName)
                            While Not pos.IsNull
                                ProjectDictionary.StringGetNextAssoc( _
                                  pos, key, value)
                                'Traverse the values until a match
                                'is found
                                If value = ProjectName Then
                                    NewProjectNumber = key
                                    Exit While
                                End If
                            End While

                            'Only update the variable if it changed
                            If Not NewProjectNumber = ProjectNumber _
                                  Then
                                VariableChangeInProgress = True
                                vars.SetVar("Project number", Config, _
                                   NewProjectNumber)

                            End If

                            'The Project Number variable has changed
                        Case "Project number"
                            If VariableChangeInProgress = True Then
                                VariableChangeInProgress = False
                                Exit Select
                            End If

                            Dim ProjectNumber As String = ""
                            vars.GetVar("Project number", Config, _
                               ProjectNumber)

                            'Get the old Project Name
                            Dim ProjectName As String = ""
                            vars.GetVar("Project Name", Config, _
                               ProjectName)

                            'Get the existing Projects dictionary
                            Dim ProjectDictionary As IEdmDictionary5
                            ProjectDictionary = poCmd.mpoVault. _
                              GetDictionary("Projects", False)

                            'Look up the project name
                            Dim NewProjectName As String = ""
                            ProjectDictionary.StringGetAt( _
                              ProjectNumber, NewProjectName)

                            'Only update the variable if it's changed
                            If Not NewProjectName = ProjectName Then
                                VariableChangeInProgress = True
                                vars.SetVar("Project Name", Config, _
                                   NewProjectName)
                            End If
                    End Select
            End Select
        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Function IsConfigInList(ByVal ConfigNames As IEdmStrLst5, ByVal ConfigName As String) As Boolean
        IsConfigInList = False
        Try
            Dim CurConfig As String
            Dim Pos As IEdmPos5 = ConfigNames.GetHeadPosition()
            While Not Pos.IsNull
                CurConfig = ConfigNames.GetNext(Pos)
                If CurConfig = ConfigName Then
                    IsConfigInList = True
                    Exit While
                End If
            End While
            Return IsConfigInList
        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Function

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Check Out and Copy File Example (C#)

This example shows how to find a vault from a file path, check out the file from the vault, and copy the file to another location.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
//    b. Type GetVaultFromFilePath_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//        Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add
dependencies and safely pass arrays of structures.
// 3. Ensure that c:\temp exists.
// 4. Ensure that at least one file is checked into a vault.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Check
out and copy a file dialog box.
// 2. Click Check
out and copy a file.
// 3. In the Open dialog, navigate to and click a file checked into a vault.
// 4. Click Open.
//
a. Gets the vault from the selected file's path.
//    b. Logs into the vault.
//    c. Checks out the file.
//    d. Displays a message box confirming the check-out.
//    e. Click OK.
//    f. Copies the selected file to c:\temp.
//    g. Displays a message box confirming the copy.
//    h. Click OK.
// 5. Close the Check
out and copy a file dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace GetVaultFromPath_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
        }

        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                EdmVault5 vault = default(EdmVault5);
                vault = new EdmVault5();

                IEdmStrLst5 strList = default(IEdmStrLst5);
                strList = vault.BrowseForFile(this.Handle.ToInt32());

                IEdmPos5 pos = default(IEdmPos5);
                pos = strList.GetHeadPosition();
                string filePath = strList.GetNext(pos);

                //Get name of the vault in which the file is located
                string VaultName = null;
                VaultName = vault.GetVaultNameFromPath(filePath);

                //Log into the vault
                vault.LoginAuto(VaultName, this.Handle.ToInt32());

                //Get the interface to the file and its parent folder
                IEdmFile5 file = default(IEdmFile5);
                IEdmFolder5 folder = null;
                file = vault.GetFileFromPath(filePath, out folder);

                if (file == null)
                {
                    MessageBox.Show("The file is not in the vault " + VaultName + ".");
                }
                else
                {
                    //Check out the file
                    file.LockFile(folder.ID, this.Handle.ToInt32());
                    MessageBox.Show("Checked out " + file.Name + " in vault " + VaultName + ".");

                    //Copy the file
                    IEdmEnumeratorVersion5 verEnum = default(IEdmEnumeratorVersion5);
                    verEnum = (IEdmEnumeratorVersion5)file;
                    int Version = 0;
                    Version = file.GetLocalVersionNo(folder.ID);
                    IEdmVersion5 ver = default(IEdmVersion5);
                    ver = verEnum.GetVersion(Version);
                    ver.GetFileCopy(this.Handle.ToInt32(), "c:\\temp\\");
                    MessageBox.Show("Copied " + file.Name + " to c:\\temp.");
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                if (ex.ErrorCode.ToString() == "-2147220949")
                {
                    MessageBox.Show("The selected file is not located in a file vault.");
                }
                else
                {
                    MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace GetVaultFromPath_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(31, 26);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(150, 23);
            this.Button1.TabIndex = 6;
            this.Button1.Text = "Check out and copy a file";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click +=new System.EventHandler(Button1_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(263, 87);
            this.Controls.Add(this.Button1);
            this.Name = "Form1";
            this.Text = "Check out and copy a file";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);

        }

        #endregion

        internal System.Windows.Forms.Button Button1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Check Out and Copy File Example (VB.NET)

This example shows how to find a vault from a file path, check out the file from the vault, and copy the file to another location.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type GetVaultFromFilePath in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Ensure that c:\temp exists.
' 4. Ensure that at least one file is checked into a vault.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Check out and copy a file dialog box.
' 2. Click Check out and copy a file.
' 3. In the Open dialog, navigate to and click a file checked into a vault.
' 4. Click Open.
 '    a. Gets the vault from the selected file's path.
'    b. Logs into the vault.
'    c. Checks out the file.
'    d. Displays a message box confirming the check-out.
'    e. Click OK.
'    f. Copies the selected file to c:\temp.
'    g. Displays a message box confirming the copy.
'    h. Click OK.
' 5. Close the Check out and copy a file dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim vault As EdmVault5
            vault = New EdmVault5

            Dim strList As IEdmStrLst5
            strList = vault.BrowseForFile(Me.Handle.ToInt32())

            Dim pos As IEdmPos5
            pos = strList.GetHeadPosition()
            Dim filePath As String = strList.GetNext(pos)

            'Get name of the vault in which the file is located
            Dim VaultName As String
            VaultName = vault.GetVaultNameFromPath(filePath)

            'Log into the vault
            vault.LoginAuto(VaultName, Me.Handle.ToInt32())

            'Get the interface to the file and its parent folder
            Dim file As IEdmFile5
            Dim folder As IEdmFolder5 = Nothing
            file = vault.GetFileFromPath(filePath, folder)

            If file Is Nothing Then
                MessageBox.Show("The file is not in the vault " + VaultName + ".")
            Else
                'Check out the file
                file.LockFile(folder.ID, Me.Handle.ToInt32())
                MessageBox.Show("Checked out " & file.Name & " in vault " + VaultName + ".")

                'Copy the file
                Dim verEnum As IEdmEnumeratorVersion5
                verEnum = file
                Dim Version As Integer
                Version = file.GetLocalVersionNo(folder.ID)
                Dim ver As IEdmVersion5
                ver = verEnum.GetVersion(Version)
                ver.GetFileCopy(Me.Handle.ToInt32(), "c:\temp\")
                MessageBox.Show("Copied " & file.Name & " to c:\temp.")
            End If

        Catch ex As System.Runtime.InteropServices.COMException

            If ex.ErrorCode = &H8004022B Then
                MessageBox.Show("The selected file is not located in a file vault.")
            Else
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    Private components As System.ComponentModel.IContainer = Nothing

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(31, 26)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(150, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Check out and copy a file"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(263, 87)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Check out and copy a file"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Friend WithEvents Button1 As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Copy Assembly Tree of Files Example (C#)

This example shows how to copy an assembly and its tree of reference files to a destination folder in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
//    b. Type CopyTree_CSharp in Project
name.
//    c. For
Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//        Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2.

Add dependencies and
safely pass arrays of structures.
//
3. Ensure that the vault root folder contains an assembly that
//    is checked in with its referenced parts and drawings.
// 4. Create a destination folder called New Folder in the vault.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Copy
Assembly dialog box.
//    a. Select a vault view.
//    b. Click Select
assembly.
//       Locate and double-click
an assembly.
//    c. Click Select a destination folder.
//       1. Locate and select New Folder.
//       2. Click OK.
//    d. Click Copy tree.
//       The Copy Tree dialog shows the files to
copy.
//    e. Click Copy.
//       The Copying tree progress bar appears.
//    f. Inspect the destination folder.
// 2. Close the Copy
Assembly dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CopyTree_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ListBox.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Open dialog
                OpenFileDialog.InitialDirectory = vault1.RootFolderPath;
                //Show the Open dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog.ShowDialog();
                //If the user didn't click Open, exit
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                foreach (string FileName in OpenFileDialog.FileNames)
                {
                    ListBox.Items.Add(FileName);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void AddFiles_Click(System.Object sender, System.EventArgs e)
        {

            try
            {

                IEdmVault19 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault19)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if (!(ListBox.Items.Count == 1))
                {
                    MessageBox.Show("Please select an assembly.");
                    return;
                }

                if (!(listBox1.Items.Count == 1))
                {
                    MessageBox.Show("Please select a destination folder.");
                    return;
                }

                IEdmFile12 aFile = default(IEdmFile12);
                string destFolder = null;
                IEdmFolder9 Folder = default(IEdmFolder9);

                Folder = (IEdmFolder9)vault2.RootFolder;

                string[] FileNames = new string[3];
                int Index = 0;
                dynamic fileStr = "";
                foreach (Object FileName_loopVariable in ListBox.Items)
                {
                    fileStr = FileName_loopVariable.ToString();

                    FileNames[Index] = fileStr.Substring(fileStr.LastIndexOf("\\"));
                    Index = Index + 1;
                }

                // Copy the assembly's tree of files to the specified destination folder
                EdmCopyTreeOptions copyTreeOptions;
                copyTreeOptions.mbsPrefix = "Copy_";
                copyTreeOptions.mbsSuffix = "";
                copyTreeOptions.mbIncludeDrawings = -1;
                copyTreeOptions.mbUseLatestVersion = -1;

                IEdmFolder5 ppoParentFolder;

                aFile = (IEdmFile12)vault2.GetFileFromPath(Folder.LocalPath + "\\" + FileNames[0], out ppoParentFolder);
                destFolder = listBox1.Items[0].ToString();
                vault2.CopyTree(aFile.ID, Folder.ID, destFolder, true, true, copyTreeOptions, this.Handle.ToInt32());

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void BrowseDestFolder_Click(object sender, EventArgs e)
        {
            try
            {
                listBox1.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmFolder10 rootFolder = default(IEdmFolder10);
                rootFolder = (IEdmFolder10)vault1.RootFolder;

                IEdmFolder10 aFolder = default(IEdmFolder10);
                aFolder = (IEdmFolder10)vault1.BrowseForFolder(this.Handle.ToInt32(), "Select a destination folder");

                listBox1.Items.Add(rootFolder.LocalPath + "\\" + aFolder.Name);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

    }
}

Back to top

//Form1.Designer.cs

namespace CopyTree_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
                /// Required method for Designer support - do not modify
                /// the contents of this method with the code editor.
                /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseAssembly = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.CopyTree = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.BrowseDestFolder = new System.Windows.Forms.Button();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // BrowseAssembly
            //
            this.BrowseAssembly.Location = new System.Drawing.Point(16, 85);
            this.BrowseAssembly.Name = "BrowseAssembly";
            this.BrowseAssembly.Size = new System.Drawing.Size(121, 23);
            this.BrowseAssembly.TabIndex = 3;
            this.BrowseAssembly.Text = "Select assembly...";
            this.BrowseAssembly.UseVisualStyleBackColor = true;
            this.BrowseAssembly.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.SelectionMode = System.Windows.Forms.SelectionMode.None;
            this.ListBox.Size = new System.Drawing.Size(259, 30);
            this.ListBox.TabIndex = 4;
            //
            // CopyTree
            //
            this.CopyTree.Location = new System.Drawing.Point(77, 293);
            this.CopyTree.Name = "CopyTree";
            this.CopyTree.Size = new System.Drawing.Size(98, 23);
            this.CopyTree.TabIndex = 5;
            this.CopyTree.Text = "Copy tree";
            this.CopyTree.UseVisualStyleBackColor = true;
            this.CopyTree.Click += new System.EventHandler(this.AddFiles_Click);
            //
            // OpenFileDialog
            //
            this.OpenFileDialog.Title = "Open";
            //
            // BrowseDestFolder
            //
            this.BrowseDestFolder.Location = new System.Drawing.Point(16, 181);
            this.BrowseDestFolder.Name = "BrowseDestFolder";
            this.BrowseDestFolder.Size = new System.Drawing.Size(142, 23);
            this.BrowseDestFolder.TabIndex = 6;
            this.BrowseDestFolder.Text = "Select destination folder...";
            this.BrowseDestFolder.UseVisualStyleBackColor = true;
            this.BrowseDestFolder.Click += new System.EventHandler(this.BrowseDestFolder_Click);
            //
            // listBox1
            //
            this.listBox1.FormattingEnabled = true;
            this.listBox1.Location = new System.Drawing.Point(16, 211);
            this.listBox1.Name = "listBox1";
            this.listBox1.SelectionMode = System.Windows.Forms.SelectionMode.None;
            this.listBox1.Size = new System.Drawing.Size(259, 30);
            this.listBox1.TabIndex = 7;
            //
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 363);
            this.Controls.Add(this.listBox1);
            this.Controls.Add(this.BrowseDestFolder);
            this.Controls.Add(this.CopyTree);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseAssembly);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Copy Assembly";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseAssembly;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button CopyTree;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
        internal System.Windows.Forms.Button BrowseDestFolder;
        internal System.Windows.Forms.ListBox listBox1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Copy Assembly Tree of Files Example (VB.NET)

This example shows how to copy an assembly and its tree of reference files to a destination folder in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type CopyTree in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Ensure that the vault root folder contains an assembly that is checked
'    in with its referenced parts and drawings.
' 4. Create a destination folder called New Folder in the vault.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Copy Assembly dialog box.
'    a. Select a vault view.
'    b. Click Select assembly.
'       Locate and double-click an assembly.
'    c. Click Select a destination folder.
'       1. Locate and select New Folder.
'       2. Click OK.
'    d. Click Copy tree.
'       The Copy Tree dialog shows the files to copy.
'    e. Click Copy.
'       The Copying tree progress bar appears.
'    f. Inspect the destination folder.
' 2. Close the Copy Assembly dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseAssembly.Click
        Try
            ListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Open dialog
            OpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In OpenFileDialog.FileNames
                ListBox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub Button1_Click(sender As Object, e As EventArgs) Handles BrowseDestFolder.Click
        Try
            ListBox1.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim rootFolder As IEdmFolder10
            rootFolder = vault1.RootFolder

            Dim aFolder As IEdmFolder10
            aFolder = vault1.BrowseForFolder(Me.Handle.ToInt32(), "Select a destination folder")

            ListBox1.Items.Add(rootFolder.LocalPath + "\" + aFolder.Name)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub AddFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyTree.Click
        Try

            Dim vault2 As IEdmVault19 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault19)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not ListBox.Items.Count = 1 Then
                MessageBox.Show("Please select an assembly.")
                Exit Sub
            End If

            If Not ListBox1.Items.Count = 1 Then
                MessageBox.Show("Please select a destination folder.")
                Exit Sub
            End If

            Dim aFile As IEdmFile12
            Dim destFolder As String
            Dim Folder As IEdmFolder9

            Folder = vault2.RootFolder

            Dim FileNames(2) As String
            Dim Index As Integer = 0
            Dim fileStr = ""
            For Each FileName In ListBox.Items
                fileStr = FileName.ToString()
                FileNames(Index) = fileStr.Substring(fileStr.LastIndexOf("\"))
                Index = Index + 1
            Next

            ' Copy the assembly's tree of files to the specified destination folder
            Dim copyTreeOptions As EdmCopyTreeOptions = Nothing
            copyTreeOptions.mbsPrefix = "Copy_"
            copyTreeOptions.mbsSuffix = ""
            copyTreeOptions.mbIncludeDrawings = -1
            copyTreeOptions.mbUseLatestVersion = -1

            aFile = vault2.GetFileFromPath(Folder.LocalPath + "\" + FileNames(0))
            destFolder = ListBox1.Items(0)
            vault2.CopyTree(aFile.ID, Folder.ID, destFolder, True, True, copyTreeOptions, Me.Handle.ToInt32())

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
        ''' Clean up any resources being used.
        ''' </summary>
        ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
        ''' Required method for Designer support - do not modify
        ''' the contents of this method with the code editor.
        ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseAssembly = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.CopyTree = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.BrowseDestFolder = New System.Windows.Forms.Button()
        Me.ListBox1 = New System.Windows.Forms.ListBox()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseAssembly
        '
        Me.BrowseAssembly.Location = New System.Drawing.Point(16, 85)
        Me.BrowseAssembly.Name = "BrowseAssembly"
        Me.BrowseAssembly.Size = New System.Drawing.Size(108, 23)
        Me.BrowseAssembly.TabIndex = 3
        Me.BrowseAssembly.Text = "Select assembly..."
        Me.BrowseAssembly.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.SelectionMode = System.Windows.Forms.SelectionMode.None
        Me.ListBox.Size = New System.Drawing.Size(259, 17)
        Me.ListBox.TabIndex = 4
        '
        'CopyTree
        '
        Me.CopyTree.Location = New System.Drawing.Point(86, 226)
        Me.CopyTree.Name = "CopyTree"
        Me.CopyTree.Size = New System.Drawing.Size(98, 23)
        Me.CopyTree.TabIndex = 5
        Me.CopyTree.Text = "Copy tree"
        Me.CopyTree.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Multiselect = True
        Me.OpenFileDialog.Title = "Open"
        '
        'BrowseDestFolder
        '
        Me.BrowseDestFolder.Location = New System.Drawing.Point(16, 152)
        Me.BrowseDestFolder.Name = "BrowseDestFolder"
        Me.BrowseDestFolder.Size = New System.Drawing.Size(155, 23)
        Me.BrowseDestFolder.TabIndex = 6
        Me.BrowseDestFolder.Text = "Select a destination folder..."
        Me.BrowseDestFolder.UseVisualStyleBackColor = True
        '
        'ListBox1
        '
        Me.ListBox1.FormattingEnabled = True
        Me.ListBox1.Location = New System.Drawing.Point(16, 181)
        Me.ListBox1.Name = "ListBox1"
        Me.ListBox1.Size = New System.Drawing.Size(259, 17)
        Me.ListBox1.TabIndex = 7
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 280)
        Me.Controls.Add(Me.ListBox1)
        Me.Controls.Add(Me.BrowseDestFolder)
        Me.Controls.Add(Me.CopyTree)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseAssembly)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Copy Assembly"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseAssembly As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents CopyTree As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents BrowseDestFolder As Button
    Friend WithEvents ListBox1 As ListBox
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Copy File Example (C#)

This example shows how to copy a file in the vault to a different folder in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > Visual C# > Windows Forms App.
//    b. Type VaultUtilities in Project name.
//    c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click Create.

//    g. Click Show All Files in the Solution Explorer
toolbar and expand

//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form, replace the code in Form1.Designer.cs with this code.
// 2. Add dependencies and safely pass arrays of structures.
// 3. Run the Administration tool, log in as admin, expand the vault,
//    right-click File Types, click Duplicate file name settings, and
//    click Do not allow duplicate files names in this file vault.
// 4. Ensure that multiple folders exists in vault.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Copy file dialog box.
//    a. Select a vault view.
//    b. Click Copy file.
//       1. In the Open dialog, click a vault file.
//       2. Click Open.
//       3. In the Select Folder dialog, click a different folder to which to
//          copy the selected file.
//       4. Click OK.
//       5. Displays a message with the file copy status.
//       6. Click OK.
// 2. Close the Copy file dialog box.
//----------------------------------------------------------------------------
//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;
using EPDM.Interop.EPDMResultCode;

namespace VaultUtilities_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            //Copy file

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                EdmStrLst5 pathList = default(EdmStrLst5);
                pathList = vault2.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles);
                if (pathList == null)
                    return;

                IEdmFile5 file = default(IEdmFile5);
                IEdmFolder5 srcFolder = null;
                file = vault2.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out srcFolder);

                IEdmFolder5 destFolder1 = default(IEdmFolder5);
                destFolder1 = vault2.BrowseForFolder(this.Handle.ToInt32(), "Select destination folder:");
                if (destFolder1 == null)
                    return;

                IEdmFolder8 destFolder = (IEdmFolder8)destFolder1;

                int fileID = 0;
                int copyFileStatus;
                fileID = destFolder.CopyFile2(file.ID, srcFolder.ID, this.Handle.ToInt32(), out copyFileStatus, "", (int)EdmCopyFlag.EdmCpy_Simple);
                switch (copyFileStatus)
                {
                    case (int)EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY:
                        MessageBox.Show("WARNING: File is not unique in the vault, but the file was copied to a new file with a file ID of " + fileID + ".");
                        break;
                    case 0:
                        MessageBox.Show("SUCCESS: File copied to a new file with a file ID of " + fileID + ".");
                        break;
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
//Form1.Designer.cs
namespace VaultUtilities_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Button1 = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // Button1
            //
            this.Button1.Location = new System.Drawing.Point(16, 82);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(66, 23);
            this.Button1.TabIndex = 6;
            this.Button1.Text = "Copy file";
            this.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click += new System.EventHandler(this.Button1_Click);
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(197, 140);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Copy file";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button Button1;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}


SOLIDWORKS PDM Professional API Help

Copy File Example (VB.NET)

This example shows how to copy a file in the vault to a different folder in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type VaultUtilities in Project name.
'    c. For Location, click ... and navigate to the folder where to
create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Run the Administration tool, log in as admin, expand the vault,
'    right-click File Types, click Duplicate file name settings, and
'    click Do not allow duplicate files names in this file vault.
' 4. Ensure that multiple folders exist in the vault.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Copy file dialog box.
'    a. Select a vault view.
'    b. Click Copy file.
'       1. In the Open dialog, click a vault file.
'       2. Click Open.
'       3. In the Select Folder dialog, click a different folder to which to
'          copy the selected file.
'       4. Click OK.
'       5. Displays a message with the file copy status.
'       6. Click OK.
' 2. Close the Copy file dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm
Imports EPDM.Interop.EPDMResultCode

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Copy file
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim pathList As EdmStrLst5
            pathList = vault2.BrowseForFile(Me.Handle.ToInt32(), EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles)
            If pathList Is Nothing Then Exit Sub

            Dim file As IEdmFile5
            Dim srcFolder As IEdmFolder5 = Nothing
            file = vault2.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition), srcFolder)

            Dim destFolder1 As IEdmFolder5 = Nothing
            Dim destFolder As IEdmFolder8 = DirectCast(destFolder1, IEdmFolder5)
            destFolder = vault2.BrowseForFolder(Me.Handle.ToInt32(), "Select destination folder:")
            If destFolder Is Nothing Then Exit Sub
            Dim fileID As Integer
            Dim copyFileStatus As Integer
            fileID = destFolder.CopyFile2(file.ID, srcFolder.ID, Me.Handle.ToInt32(), copyFileStatus, "", EdmCopyFlag.EdmCpy_Simple)
            Select Case copyFileStatus
                Case EdmResultSuccessCodes_e.S_EDM_FILES_NOT_UNIQUE_GLOBALLY
                    MessageBox.Show("WARNING: File is not unique in the vault, but the file was copied to a new file with a file ID of " & fileID & ".")
                Case Else
                    MessageBox.Show("SUCCESS: File copied to a new file with a file ID of " & fileID & ".")
            End Select

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 84)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(62, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Copy file"
        Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Button1.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(213, 132)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Copy file"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
End Class


SOLIDWORKS PDM Professional API Help

Create and Delete Dictionaries Example (C#)

This example shows how to create and delete dictionaries and their keys and values.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//    b. Type AddDictionaryCSharp in Project name.
//    c. For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click Create.

//    g. Click Show All Files in the Solution Explorer
toolbar and expand

//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with this code.
//    i. To create the form, replace the code in Form1.Designer.cs with this code.
// 2. Add dependencies and safely pass arrays of structures.
// 3. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays a dialog.
// 2. Select a vault.
// 3. Select the MyProjects dictionary.
//    a. Click Create.
//    b. Click Add project items.
//       The Key/Value list is populated with the
//       MyProjects dictionary's keys and values.
//    c. Type a unique value in Key and any value in Value.
//    d. Click Add Key/Value.
//       The key and value are added to the Key/Value list.
//    e. Select a key and value in the Key/Value list and
//       click Remove selected Key/Value.
//       The selected key and value are deleted from the
//       dictionary.
//    f. Type an existing key in Key and any value in Value.
//    g. Click Add Key/Value.
//       A message box is displayed informing you that the
//       duplicate keys are prohibited. Neither the key
//       nor value was added to the dictionary.
//    h. Click OK to close the message box.
// 4. Select the MyCounters dictionary.
//    a. Click Create.
//    b. Click Add counter items.
//       The Key/Value list is populated with the MyCounters
//       dictionary's keys and values.
// 5. Experiment with creating your own dictionary and adding
//    and removing keys and values to and from that dictionary.
// 6. Close the dialog.
//----------------------------------------------------------------------------

//Form1.cs
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;

namespace AddDictionaryCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault;
        IEdmVault8 vault1;

        void AddDictionary_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault = new EdmVault5();
                vault1 = (IEdmVault8)vault;
                EdmViewInfo[] Views = null;

                vault1.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddProjectItemsButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                IEdmDictionary5 ProjectDictionary = default(IEdmDictionary5);
                ProjectDictionary = vault.GetDictionary("MyProjects", true);
                //Create it if it doesn't exist

                //Add the new dictionary name to the combo box
                //if it doesn't exist
                if (!DictionaryComboBox.Items.Contains("MyProjects"))
                {
                    DictionaryComboBox.Items.Add("MyProjects");
                }

                bool SuccessSet = false;
                SuccessSet = ProjectDictionary.StringTestAndSetAt("1000", "Mercedes Benz");
                SuccessSet = ProjectDictionary.StringTestAndSetAt("1001", "Lexus");
                SuccessSet = ProjectDictionary.StringTestAndSetAt("1002", "Porche");
                SuccessSet = ProjectDictionary.StringTestAndSetAt("1003", "Audi");
                SuccessSet = ProjectDictionary.StringTestAndSetAt("1004", "BMW");
                SuccessSet = ProjectDictionary.StringTestAndSetAt("1005", "Jaguar");

                if (DictionaryComboBox.Text == "MyProjects")
                {
                    DisplayDictionaryItems("MyProjects", ProjectDictionary, KeyValueListBox);
                }
                else
                {
                    DictionaryComboBox.Text = "MyProjects";
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void DictionaryComboBox_SelectedIndexChanged(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the selected dictionary, if it exists
                IEdmDictionary5 Dictionary = default(IEdmDictionary5);
                Dictionary = vault.GetDictionary(DictionaryComboBox.Text, false);
                //Display the dictionary contents
                DisplayDictionaryItems(DictionaryComboBox.Text, Dictionary, KeyValueListBox);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void CreateButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                KeyValueListBox.Items.Clear();

                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the selected dictionary, if it exists
                IEdmDictionary5 Dictionary = default(IEdmDictionary5);
                Dictionary = vault.GetDictionary(DictionaryComboBox.Text, false);
                //If it doesn't exist, create it
                if (Dictionary == null)
                {
                    //Create it, because it doesn't exist
                    Dictionary = vault.GetDictionary(DictionaryComboBox.Text, true);
                    KeyValueListBox.Items.Add(DictionaryComboBox.Text + " dictionary created.");
                }
                else
                {
                    //If it does exist, inform the user
                    KeyValueListBox.Items.Add(DictionaryComboBox.Text + " dictionary already exists.");
                }

                //Add the new dictionary name to the combo box,
                //if it doesn't exist
                if (!DictionaryComboBox.Items.Contains(DictionaryComboBox.Text))
                {
                    DictionaryComboBox.Items.Add(DictionaryComboBox.Text);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void DeleteButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                KeyValueListBox.Items.Clear();
                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the selected dictionary, if it exists
                IEdmDictionary5 Dictionary = default(IEdmDictionary5);
                Dictionary = vault.GetDictionary(DictionaryComboBox.Text, false);
                //If it doesn't exist, inform the user
                if (Dictionary == null)
                {
                    KeyValueListBox.Items.Add(DictionaryComboBox.Text + " dictionary doesn't exist.");
                    //If it does exist, delete it and inform the user
                }
                else
                {
                    Dictionary.RemoveDictionary();
                    KeyValueListBox.Items.Add(DictionaryComboBox.Text + " dictionary deleted.");
                }
                //Remove the dictionary name from the list box
                DictionaryComboBox.Items.Remove(DictionaryComboBox.Text);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddKeyValueButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmDictionary5 Dictionary = default(IEdmDictionary5);
                Dictionary = vault.GetDictionary(DictionaryComboBox.Text, false);

                //Make sure that the user has typed valid data
                if (string.IsNullOrEmpty(KeyTextBox.Text) | string.IsNullOrEmpty(ValueTextBox.Text))
                {
                    MessageBox.Show("Please type a key and a value.");
                    return;
                }

                //Add the data if it doesn't exist in the dictionary
                bool SuccessSet = false;
                SuccessSet = Dictionary.StringTestAndSetAt(KeyTextBox.Text, ValueTextBox.Text);
                if (!SuccessSet)
                {
                    MessageBox.Show("The value you typed for Key already exists; duplicate keys are prohibited. Neither the key nor value was added to this dictionary. Try again.");
                }
                else
                {
                    DisplayDictionaryItems(DictionaryComboBox.Text, Dictionary, KeyValueListBox);
                    KeyTextBox.Text = "";
                    ValueTextBox.Text = "";
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void RemoveButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (KeyValueListBox.SelectedIndex == -1)
                {
                    MessageBox.Show("No Key/Value selected.");
                    return;
                }

                string KeyValue = null;
                KeyValue = (string)KeyValueListBox.Items[KeyValueListBox.SelectedIndex];
                string key = null;
                string spaceSeparator = " ";
                string[] splitValue = KeyValue.Split(spaceSeparator.ToCharArray());
                key = (string)splitValue[0];

                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmDictionary5 Dictionary = default(IEdmDictionary5);
                Dictionary = vault.GetDictionary(DictionaryComboBox.Text, false);

                Dictionary.StringRemoveAt(key);
                KeyValueListBox.Items.Remove(KeyValue);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void AddCounterItemsButton_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                if (!vault.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmDictionary5 CounterDictionary = default(IEdmDictionary5);
                CounterDictionary = vault.GetDictionary("MyCounters", true);
                //Create it, if it doesn't exist

                //Add the new dictionary name to the list box,
                //if it doesn't exist
                if (!DictionaryComboBox.Items.Contains("MyCounters"))
                {
                    DictionaryComboBox.Items.Add("MyCounters");
                }

                bool SuccessSet = false;
                SuccessSet = CounterDictionary.StringTestAndSetAt("Electric", "5");
                SuccessSet = CounterDictionary.StringTestAndSetAt("Hybrid", "10");
                SuccessSet = CounterDictionary.StringTestAndSetAt("Gasoline", "15");
                SuccessSet = CounterDictionary.StringTestAndSetAt("Diesel", "20");

                if (DictionaryComboBox.Text == "MyCounters")
                {
                    DisplayDictionaryItems("MyCounters", CounterDictionary, KeyValueListBox);
                }
                else
                {
                    DictionaryComboBox.Text = "MyCounters";
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void DisplayDictionaryItems(string DictionaryName, IEdmDictionary5 Dictionary, ListBox ListObject)
        {
            try
            {

                ListObject.Items.Clear();

                if (Dictionary == null)
                {
                    ListObject.Items.Add(DictionaryComboBox.Text + " dictionary doesn't exist.");
                }
                else
                {
                    //Traverse and display the Key/Value pairs
                    //in the dictionary
                    string Key = "";
                    string Value = "";
                    IEdmPos5 Pos = default(IEdmPos5);
                    Pos = Dictionary.StringGetFirstPosition();
                    while (!Pos.IsNull)
                    {
                        Dictionary.StringGetNextAssoc(Pos, out Key, out Value);
                        ListObject.Items.Add(Key + " " + Value);
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}
Back to top
//Form1.Designer.cs
namespace AddDictionaryCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.DictionaryLabel = new System.Windows.Forms.Label();
            this.DictionaryComboBox = new System.Windows.Forms.ComboBox();
            this.CreateButton = new System.Windows.Forms.Button();
            this.DeleteButton = new System.Windows.Forms.Button();
            this.KeyValueLabel = new System.Windows.Forms.Label();
            this.KeyValueListBox = new System.Windows.Forms.ListBox();
            this.RemoveButton = new System.Windows.Forms.Button();
            this.KeyLabel = new System.Windows.Forms.Label();
            this.KeyTextBox = new System.Windows.Forms.TextBox();
            this.ValueLabel = new System.Windows.Forms.Label();
            this.ValueTextBox = new System.Windows.Forms.TextBox();
            this.AddKeyValueButton = new System.Windows.Forms.Button();
            this.AddProjectItemsButton = new System.Windows.Forms.Button();
            this.AddCounterItemsButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 27);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(15, 43);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(213, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // DictionaryLabel
            //
            this.DictionaryLabel.AutoSize = true;
            this.DictionaryLabel.Location = new System.Drawing.Point(16, 78);
            this.DictionaryLabel.Name = "DictionaryLabel";
            this.DictionaryLabel.Size = new System.Drawing.Size(88, 13);
            this.DictionaryLabel.TabIndex = 2;
            this.DictionaryLabel.Text = "Select dictionary:";
            //
            // DictionaryComboBox
            //
            this.DictionaryComboBox.FormattingEnabled = true;
            this.DictionaryComboBox.Items.AddRange(new object[] { "MyProjects", "MyCounters" });
            this.DictionaryComboBox.Location = new System.Drawing.Point(15, 94);
            this.DictionaryComboBox.Name = "DictionaryComboBox";
            this.DictionaryComboBox.Size = new System.Drawing.Size(210, 21);
            this.DictionaryComboBox.TabIndex = 3;
            //
            // CreateButton
            //
            this.CreateButton.Location = new System.Drawing.Point(16, 121);
            this.CreateButton.Name = "CreateButton";
            this.CreateButton.Size = new System.Drawing.Size(75, 23);
            this.CreateButton.TabIndex = 4;
            this.CreateButton.Text = "Create";
            this.CreateButton.UseVisualStyleBackColor = true;
            this.CreateButton.Click += new System.EventHandler(this.CreateButton_Click);
            //
            // DeleteButton
            //
            this.DeleteButton.Location = new System.Drawing.Point(150, 121);
            this.DeleteButton.Name = "DeleteButton";
            this.DeleteButton.Size = new System.Drawing.Size(75, 23);
            this.DeleteButton.TabIndex = 5;
            this.DeleteButton.Text = "Delete";
            this.DeleteButton.UseVisualStyleBackColor = true;
            this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
            //
            // KeyValueLabel
            //
            this.KeyValueLabel.AutoSize = true;
            this.KeyValueLabel.Location = new System.Drawing.Point(19, 163);
            this.KeyValueLabel.Name = "KeyValueLabel";
            this.KeyValueLabel.Size = new System.Drawing.Size(57, 13);
            this.KeyValueLabel.TabIndex = 6;
            this.KeyValueLabel.Text = "Key/Value";
            //
            // KeyValueListBox
            //
            this.KeyValueListBox.FormattingEnabled = true;
            this.KeyValueListBox.Location = new System.Drawing.Point(15, 190);
            this.KeyValueListBox.Name = "KeyValueListBox";
            this.KeyValueListBox.Size = new System.Drawing.Size(210, 95);
            this.KeyValueListBox.TabIndex = 7;
            //
            // RemoveButton
            //
            this.RemoveButton.Location = new System.Drawing.Point(16, 301);
            this.RemoveButton.Name = "RemoveButton";
            this.RemoveButton.Size = new System.Drawing.Size(210, 23);
            this.RemoveButton.TabIndex = 8;
            this.RemoveButton.Text = "Remove selected Key/Value";
            this.RemoveButton.UseVisualStyleBackColor = true;
            this.RemoveButton.Click += new System.EventHandler(this.RemoveButton_Click);
            //
            // KeyLabel
            //
            this.KeyLabel.AutoSize = true;
            this.KeyLabel.Location = new System.Drawing.Point(19, 340);
            this.KeyLabel.Name = "KeyLabel";
            this.KeyLabel.Size = new System.Drawing.Size(25, 13);
            this.KeyLabel.TabIndex = 9;
            this.KeyLabel.Text = "Key";
            //
            // KeyTextBox
            //
            this.KeyTextBox.Location = new System.Drawing.Point(19, 356);
            this.KeyTextBox.Name = "KeyTextBox";
            this.KeyTextBox.Size = new System.Drawing.Size(100, 20);
            this.KeyTextBox.TabIndex = 10;
            //
            // ValueLabel
            //
            this.ValueLabel.AutoSize = true;
            this.ValueLabel.Location = new System.Drawing.Point(144, 340);
            this.ValueLabel.Name = "ValueLabel";
            this.ValueLabel.Size = new System.Drawing.Size(34, 13);
            this.ValueLabel.TabIndex = 11;
            this.ValueLabel.Text = "Value";
            //
            // ValueTextBox
            //
            this.ValueTextBox.Location = new System.Drawing.Point(147, 356);
            this.ValueTextBox.Name = "ValueTextBox";
            this.ValueTextBox.Size = new System.Drawing.Size(100, 20);
            this.ValueTextBox.TabIndex = 12;
            //
            // AddKeyValueButton
            //
            this.AddKeyValueButton.Location = new System.Drawing.Point(19, 397);
            this.AddKeyValueButton.Name = "AddKeyValueButton";
            this.AddKeyValueButton.Size = new System.Drawing.Size(228, 23);
            this.AddKeyValueButton.TabIndex = 13;
            this.AddKeyValueButton.Text = "Add Key/Value";
            this.AddKeyValueButton.UseVisualStyleBackColor = true;
            this.AddKeyValueButton.Click += new System.EventHandler(this.AddKeyValueButton_Click);
            //
            // AddProjectItemsButton
            //
            this.AddProjectItemsButton.Location = new System.Drawing.Point(19, 438);
            this.AddProjectItemsButton.Name = "AddProjectItemsButton";
            this.AddProjectItemsButton.Size = new System.Drawing.Size(100, 23);
            this.AddProjectItemsButton.TabIndex = 14;
            this.AddProjectItemsButton.Text = "Add project items";
            this.AddProjectItemsButton.UseVisualStyleBackColor = true;
            this.AddProjectItemsButton.Click += new System.EventHandler(this.AddProjectItemsButton_Click);
            //
            // AddCounterItemsButton
            //
            this.AddCounterItemsButton.Location = new System.Drawing.Point(136, 438);
            this.AddCounterItemsButton.Name = "AddCounterItemsButton";
            this.AddCounterItemsButton.Size = new System.Drawing.Size(110, 23);
            this.AddCounterItemsButton.TabIndex = 15;
            this.AddCounterItemsButton.Text = "Add counter items";
            this.AddCounterItemsButton.UseVisualStyleBackColor = true;
            this.AddCounterItemsButton.Click += new System.EventHandler(this.AddCounterItemsButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 482);
            this.Controls.Add(this.AddCounterItemsButton);
            this.Controls.Add(this.AddProjectItemsButton);
            this.Controls.Add(this.AddKeyValueButton);
            this.Controls.Add(this.ValueTextBox);
            this.Controls.Add(this.ValueLabel);
            this.Controls.Add(this.KeyTextBox);
            this.Controls.Add(this.KeyLabel);
            this.Controls.Add(this.RemoveButton);
            this.Controls.Add(this.KeyValueListBox);
            this.Controls.Add(this.KeyValueLabel);
            this.Controls.Add(this.DeleteButton);
            this.Controls.Add(this.CreateButton);
            this.Controls.Add(this.DictionaryComboBox);
            this.Controls.Add(this.DictionaryLabel);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Create a dictionary";
            this.Load += new System.EventHandler(this.AddDictionary_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Label DictionaryLabel;
        private System.Windows.Forms.ComboBox DictionaryComboBox;
        private System.Windows.Forms.Button CreateButton;
        private System.Windows.Forms.Button DeleteButton;
        private System.Windows.Forms.Label KeyValueLabel;
        private System.Windows.Forms.ListBox KeyValueListBox;
        private System.Windows.Forms.Button RemoveButton;
        private System.Windows.Forms.Label KeyLabel;
        private System.Windows.Forms.TextBox KeyTextBox;
        private System.Windows.Forms.Label ValueLabel;
        private System.Windows.Forms.TextBox ValueTextBox;
        private System.Windows.Forms.Button AddKeyValueButton;
        private System.Windows.Forms.Button AddProjectItemsButton;
        private System.Windows.Forms.Button AddCounterItemsButton;
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Create and Delete Dictionaries Example (VB.NET)

This example shows how to create and delete dictionaries and their keys and values.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type AddDictionary in Project name.
'    c. For Location, click ... and navigate to the folder where to
create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays a dialog.
' 2. Select a vault.
' 3. Select the Projects dictionary.
'    a. Click Create.
'    b. Click Add project items.
'       The Key/Value list is populated with the
'       Projects dictionary's keys and values.
'    c. Type a unique value in Key and any value in Value.
'    d. Click Add Key/Value.
'       The key and value are added to the Key/Value list.
'    e. Select a key and value in the Key/Value list and
'       click Remove selected Key/Value.
'       The selected key and value are deleted from the
'       dictionary.
'    f. Type an existing key in Key and any value in Value.
'    g. Click Add Key/Value.
'       A message box is displayed informing you that the
'       duplicate keys are prohibited. Neither the key
'       nor value was added to the dictionary.
'    h. Click OK to close the message box.
' 4. Select the Counters dictionary.
'    a. Click Create.
'    b. Click Add counter items.
'       The Key/Value list is populated with the Counters
'       dictionary's keys and values.
' 5. Experiment with creating your own dictionary and adding
'    and removing keys and values to and from that dictionary.
' 6. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb
Imports EPDM.Interop.epdm

Public Class AddDictionary

    Private vault As IEdmVault5 = Nothing

    Private Sub AddDictionary_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            vault = New EdmVault5

            Dim Views() As EdmViewInfo = Nothing

            DirectCast(vault, IEdmVault8).GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub AddProjectItemsButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles AddProjectItemsButton.Click

        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                  Me.Handle.ToInt32())
            End If

            Dim ProjectDictionary As IEdmDictionary5
            ProjectDictionary = vault.GetDictionary( _
              "Projects", True) 'Create it if it doesn't exist

            'Add the new dictionary name to the combo box
            'if it doesn't exist
            If Not DictionaryComboBox.Items.Contains( _
                "Projects") Then
                DictionaryComboBox.Items.Add("Projects")
            End If

            Dim SuccessSet As Boolean = False
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1000", "Mercedes Benz")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1001", "Lexus")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1002", "Porche")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1003", "Audi")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1004", "BMW")
            SuccessSet = ProjectDictionary.StringTestAndSetAt _
              ("1005", "Jaguar")

            If DictionaryComboBox.Text = "Projects" Then
                DisplayDictionaryItems("Projects", _
                  ProjectDictionary, KeyValueListBox)
            Else
                DictionaryComboBox.Text = "Projects"
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub DictionaryComboBox_SelectedIndexChanged( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles DictionaryComboBox.SelectedIndexChanged

        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                   Me.Handle.ToInt32())
            End If

            'Get the selected dictionary, if it exists
            Dim Dictionary As IEdmDictionary5
            Dictionary = vault.GetDictionary( _
              DictionaryComboBox.Text, False)
            'Display the dictionary contents
            DisplayDictionaryItems( _
              DictionaryComboBox.Text, _
              Dictionary, KeyValueListBox)
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub CreateButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles CreateButton.Click

        Try
            KeyValueListBox.Items.Clear()

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                   Me.Handle.ToInt32())
            End If

            'Get the selected dictionary, if it exists
            Dim Dictionary As IEdmDictionary5
            Dictionary = vault.GetDictionary( _
              DictionaryComboBox.Text, False)
            'If it doesn't exist, create it
            If Dictionary Is Nothing Then
                'Create it, because it doesn't exist
                Dictionary = vault.GetDictionary( _
                  DictionaryComboBox.Text, True)
                KeyValueListBox.Items.Add( _
                  DictionaryComboBox.Text + _
                  " dictionary created.")
            Else
                'If it does exist, inform the user
                KeyValueListBox.Items.Add( _
                  DictionaryComboBox.Text + _
                  " dictionary already exists.")
            End If

            'Add the new dictionary name to the combo box,
            'if it doesn't exist
            If Not DictionaryComboBox.Items.Contains( _
                              DictionaryComboBox.Text) Then
                DictionaryComboBox.Items.Add( _
                  DictionaryComboBox.Text)
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub DeleteButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles DeleteButton.Click

        Try
            KeyValueListBox.Items.Clear()
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                   Me.Handle.ToInt32())
            End If

            'Get the selected dictionary, if it exists
            Dim Dictionary As IEdmDictionary5
            Dictionary = vault.GetDictionary( _
              DictionaryComboBox.Text, False)
            'If it doesn't exist, inform the user
            If Dictionary Is Nothing Then
                KeyValueListBox.Items.Add( _
                  DictionaryComboBox.Text + _
                  " dictionary doesn't exist.")
                'If it does exist, delete it and inform the user
            Else
                Dictionary.RemoveDictionary()
                KeyValueListBox.Items.Add( _
                  DictionaryComboBox.Text + _
                  " dictionary deleted.")
            End If
            'Remove the dictionary name from the list box
            DictionaryComboBox.Items.Remove( _
              DictionaryComboBox.Text)
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub AddKeyValueButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles AddKeyValueButton.Click

        Try
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                   Me.Handle.ToInt32())
            End If

            Dim Dictionary As IEdmDictionary5
            Dictionary = vault.GetDictionary( _
              DictionaryComboBox.Text, False)

            'Make sure that the user has typed valid data
            If KeyTextBox.Text = "" _
                Or ValueTextBox.Text = "" Then
                MessageBox.Show("Please type a key and a value.")
                Exit Sub
            End If

            'Add the data if it doesn't exist in the dictionary
            Dim SuccessSet As Boolean = False
            SuccessSet = Dictionary.StringTestAndSetAt( _
              KeyTextBox.Text, ValueTextBox.Text)
            If Not SuccessSet Then
                MessageBox.Show("The value you typed for Key already exists; duplicate keys are prohibited. Neither the key or value was added to this dictionary. Try again.")
            Else
                DisplayDictionaryItems(DictionaryComboBox.Text, _
                  Dictionary, KeyValueListBox)
                KeyTextBox.Text = ""
                ValueTextBox.Text = ""
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub RemoveButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles RemoveButton.Click

        Try
            If KeyValueListBox.SelectedIndex = -1 Then
                MessageBox.Show("No Key/Value selected.")
                Exit Sub
            End If

            Dim KeyValue As String
            KeyValue = KeyValueListBox.Items( _
              KeyValueListBox.SelectedIndex)
            Dim key As String
            key = Split(KeyValue, vbTab)(0)

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                   Me.Handle.ToInt32())
            End If

            Dim Dictionary As IEdmDictionary5
            Dictionary = vault.GetDictionary( _
              DictionaryComboBox.Text, False)

            Dictionary.StringRemoveAt(key)
            KeyValueListBox.Items.Remove(KeyValue)
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub AddCounterItemsButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles AddCounterItemsButton.Click

        Try

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                   Me.Handle.ToInt32())
            End If

            Dim CounterDictionary As IEdmDictionary5
            CounterDictionary = vault.GetDictionary _
              ("Counters", True) 'Create it, if it doesn't exist

            'Add the new dictionary name to the list box,
            'if it doesn't exist
            If Not DictionaryComboBox.Items.Contains( _
                "Counters") Then
                DictionaryComboBox.Items.Add("Counters")
            End If

            Dim SuccessSet As Boolean = False
            SuccessSet = CounterDictionary.StringTestAndSetAt _
              ("Electric", "5")
            SuccessSet = CounterDictionary.StringTestAndSetAt _
              ("Hybrid", "10")
            SuccessSet = CounterDictionary.StringTestAndSetAt _
              ("Gasoline", "15")
            SuccessSet = CounterDictionary.StringTestAndSetAt _
              ("Diesel", "20")

            If DictionaryComboBox.Text = "Counters" Then
                DisplayDictionaryItems("Counters", _
                  CounterDictionary, KeyValueListBox)
            Else
                DictionaryComboBox.Text = "Counters"
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub DisplayDictionaryItems( _
      ByVal DictionaryName As String, _
      ByVal Dictionary As IEdmDictionary5, _
      ByVal ListObject As Object)

        Try
            ListObject.Items.Clear()

            If Dictionary Is Nothing Then
                ListObject.Items.Add(DictionaryComboBox.Text + _
                  " dictionary doesn't exist.")
            Else
                'Traverse and display the Key/Value pairs
                'in the dictionary
                Dim Key As String = ""
                Dim Value As String = ""
                Dim Pos As IEdmPos5
                Pos = Dictionary.StringGetFirstPosition()
                While Not Pos.IsNull
                    Dictionary.StringGetNextAssoc(Pos, Key, Value)
                    ListObject.Items.Add(Key + vbTab + Value)
                End While
            End If
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class AddDictionary
   Inherits System.Windows.Forms.Form

   'Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.AddProjectItemsButton = New System.Windows.Forms.Button()
        Me.DictionaryComboBox = New System.Windows.Forms.ComboBox()
        Me.DictionaryLabel = New System.Windows.Forms.Label()
        Me.KeyValueListBox = New System.Windows.Forms.ListBox()
        Me.KeyValueLabel = New System.Windows.Forms.Label()
        Me.CreateButton = New System.Windows.Forms.Button()
        Me.DeleteButton = New System.Windows.Forms.Button()
        Me.KeyTextBox = New System.Windows.Forms.TextBox()
        Me.ValueTextBox = New System.Windows.Forms.TextBox()
        Me.KeyLabel = New System.Windows.Forms.Label()
        Me.ValueLabel = New System.Windows.Forms.Label()
        Me.AddKeyValueButton = New System.Windows.Forms.Button()
        Me.RemoveButton = New System.Windows.Forms.Button()
        Me.AddCounterItemsButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(17, 35)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(218, 21)
        Me.VaultsComboBox.TabIndex = 14
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(17, 19)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 15
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'AddProjectItemsButton
        '
        Me.AddProjectItemsButton.Location = New System.Drawing.Point(20, 451)
        Me.AddProjectItemsButton.Margin = New System.Windows.Forms.Padding(2)
        Me.AddProjectItemsButton.Name = "AddProjectItemsButton"
        Me.AddProjectItemsButton.Size = New System.Drawing.Size(98, 24)
        Me.AddProjectItemsButton.TabIndex = 16
        Me.AddProjectItemsButton.Text = "Add project items"
        Me.AddProjectItemsButton.UseVisualStyleBackColor = True
        '
        'DictionaryComboBox
        '
        Me.DictionaryComboBox.FormattingEnabled = True
        Me.DictionaryComboBox.Items.AddRange(New Object() {"Projects", "Counters"})
        Me.DictionaryComboBox.Location = New System.Drawing.Point(17, 86)
        Me.DictionaryComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.DictionaryComboBox.Name = "DictionaryComboBox"
        Me.DictionaryComboBox.Size = New System.Drawing.Size(218, 21)
        Me.DictionaryComboBox.TabIndex = 17
        '
        'DictionaryLabel
        '
        Me.DictionaryLabel.AutoSize = True
        Me.DictionaryLabel.Location = New System.Drawing.Point(17, 70)
        Me.DictionaryLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.DictionaryLabel.Name = "DictionaryLabel"
        Me.DictionaryLabel.Size = New System.Drawing.Size(88, 13)
        Me.DictionaryLabel.TabIndex = 18
        Me.DictionaryLabel.Text = "Select dictionary:"
        '
        'KeyValueListBox
        '
        Me.KeyValueListBox.FormattingEnabled = True
        Me.KeyValueListBox.Location = New System.Drawing.Point(17, 194)
        Me.KeyValueListBox.Margin = New System.Windows.Forms.Padding(2)
        Me.KeyValueListBox.Name = "KeyValueListBox"
        Me.KeyValueListBox.Size = New System.Drawing.Size(218, 82)
        Me.KeyValueListBox.TabIndex = 19
        '
        'KeyValueLabel
        '
        Me.KeyValueLabel.AutoSize = True
        Me.KeyValueLabel.Location = New System.Drawing.Point(17, 176)
        Me.KeyValueLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.KeyValueLabel.Name = "KeyValueLabel"
        Me.KeyValueLabel.Size = New System.Drawing.Size(57, 13)
        Me.KeyValueLabel.TabIndex = 20
        Me.KeyValueLabel.Text = "Key/Value"
        '
        'CreateButton
        '
        Me.CreateButton.Location = New System.Drawing.Point(17, 118)
        Me.CreateButton.Margin = New System.Windows.Forms.Padding(2)
        Me.CreateButton.Name = "CreateButton"
        Me.CreateButton.Size = New System.Drawing.Size(101, 24)
        Me.CreateButton.TabIndex = 21
        Me.CreateButton.Text = "Create"
        Me.CreateButton.UseVisualStyleBackColor = True
        '
        'DeleteButton
        '
        Me.DeleteButton.Location = New System.Drawing.Point(142, 118)
        Me.DeleteButton.Margin = New System.Windows.Forms.Padding(2)
        Me.DeleteButton.Name = "DeleteButton"
        Me.DeleteButton.Size = New System.Drawing.Size(93, 24)
        Me.DeleteButton.TabIndex = 22
        Me.DeleteButton.Text = "Delete"
        Me.DeleteButton.UseVisualStyleBackColor = True
        '
        'KeyTextBox
        '
        Me.KeyTextBox.Location = New System.Drawing.Point(20, 364)
        Me.KeyTextBox.Margin = New System.Windows.Forms.Padding(2)
        Me.KeyTextBox.Name = "KeyTextBox"
        Me.KeyTextBox.Size = New System.Drawing.Size(76, 20)
        Me.KeyTextBox.TabIndex = 23
        '
        'ValueTextBox
        '
        Me.ValueTextBox.Location = New System.Drawing.Point(159, 366)
        Me.ValueTextBox.Margin = New System.Windows.Forms.Padding(2)
        Me.ValueTextBox.Name = "ValueTextBox"
        Me.ValueTextBox.Size = New System.Drawing.Size(76, 20)
        Me.ValueTextBox.TabIndex = 24
        '
        'KeyLabel
        '
        Me.KeyLabel.AutoSize = True
        Me.KeyLabel.Location = New System.Drawing.Point(17, 349)
        Me.KeyLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.KeyLabel.Name = "KeyLabel"
        Me.KeyLabel.Size = New System.Drawing.Size(25, 13)
        Me.KeyLabel.TabIndex = 25
        Me.KeyLabel.Text = "Key"
        '
        'ValueLabel
        '
        Me.ValueLabel.AutoSize = True
        Me.ValueLabel.Location = New System.Drawing.Point(156, 349)
        Me.ValueLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.ValueLabel.Name = "ValueLabel"
        Me.ValueLabel.Size = New System.Drawing.Size(34, 13)
        Me.ValueLabel.TabIndex = 26
        Me.ValueLabel.Text = "Value"
        '
        'AddKeyValueButton
        '
        Me.AddKeyValueButton.Location = New System.Drawing.Point(68, 399)
        Me.AddKeyValueButton.Margin = New System.Windows.Forms.Padding(2)
        Me.AddKeyValueButton.Name = "AddKeyValueButton"
        Me.AddKeyValueButton.Size = New System.Drawing.Size(110, 25)
        Me.AddKeyValueButton.TabIndex = 27
        Me.AddKeyValueButton.Text = "Add Key/Value"
        Me.AddKeyValueButton.UseVisualStyleBackColor = True
        '
        'RemoveButton
        '
        Me.RemoveButton.Location = New System.Drawing.Point(20, 280)
        Me.RemoveButton.Margin = New System.Windows.Forms.Padding(2)
        Me.RemoveButton.Name = "RemoveButton"
        Me.RemoveButton.Size = New System.Drawing.Size(215, 41)
        Me.RemoveButton.TabIndex = 28
        Me.RemoveButton.Text = "Remove selected Key/Value"
        Me.RemoveButton.UseVisualStyleBackColor = True
        '
        'AddCounterItemsButton
        '
        Me.AddCounterItemsButton.Location = New System.Drawing.Point(142, 451)
        Me.AddCounterItemsButton.Margin = New System.Windows.Forms.Padding(2)
        Me.AddCounterItemsButton.Name = "AddCounterItemsButton"
        Me.AddCounterItemsButton.Size = New System.Drawing.Size(104, 24)
        Me.AddCounterItemsButton.TabIndex = 29
        Me.AddCounterItemsButton.Text = "Add counter items"
        Me.AddCounterItemsButton.UseVisualStyleBackColor = True
        '
        'AddDictionary
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(257, 486)
        Me.Controls.Add(Me.AddCounterItemsButton)
        Me.Controls.Add(Me.RemoveButton)
        Me.Controls.Add(Me.AddKeyValueButton)
        Me.Controls.Add(Me.ValueLabel)
        Me.Controls.Add(Me.KeyLabel)
        Me.Controls.Add(Me.ValueTextBox)
        Me.Controls.Add(Me.KeyTextBox)
        Me.Controls.Add(Me.DeleteButton)
        Me.Controls.Add(Me.CreateButton)
        Me.Controls.Add(Me.KeyValueLabel)
        Me.Controls.Add(Me.KeyValueListBox)
        Me.Controls.Add(Me.DictionaryComboBox)
        Me.Controls.Add(Me.DictionaryLabel)
        Me.Controls.Add(Me.AddProjectItemsButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "AddDictionary"
        Me.Text = "Create a dictionary"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
   Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents VaultsLabel As System.Windows.Forms.Label
   Friend WithEvents AddProjectItemsButton As System.Windows.Forms.Button
   Friend WithEvents DictionaryComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents DictionaryLabel As System.Windows.Forms.Label
   Friend WithEvents KeyValueListBox As System.Windows.Forms.ListBox
   Friend WithEvents KeyValueLabel As System.Windows.Forms.Label
   Friend WithEvents CreateButton As System.Windows.Forms.Button
   Friend WithEvents DeleteButton As System.Windows.Forms.Button
   Friend WithEvents KeyTextBox As System.Windows.Forms.TextBox
   Friend WithEvents ValueTextBox As System.Windows.Forms.TextBox
   Friend WithEvents KeyLabel As System.Windows.Forms.Label
   Friend WithEvents ValueLabel As System.Windows.Forms.Label
   Friend WithEvents AddKeyValueButton As System.Windows.Forms.Button
   Friend WithEvents RemoveButton As System.Windows.Forms.Button
   Friend WithEvents AddCounterItemsButton As System.Windows.Forms.Button

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Create Card View Example (C#)

This example shows how to create a file or folder card view.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms App.
//    b. Type CreateCardView_CSharp in Project name.
//    c.

For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and safely pass arrays of structures.
// 3. Create a folder in a vault.
// 4.
Check out a file from the vault in which
you created the folder.
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Create Card View dialog box.
// 2. Select the vault view in which you created a folder and
//    checked out a file.
// 3. Click either:
//    a. Select file.
//    b. In the Select File dialog:
//       1. Click the file checked out in
Preconditions step 5.
//       2. Click Open.
//       3. Inspect
the message box, then click OK.
//    c. In the file data card, modify a field.
//    d. Click Save data card.
//    e. Check in the file and inspect its data
card.
//       - or -
//    a. Select folder.
//    b. In the Select Folder dialog, select the vault folder
created
//       in Preconditions step 4
and click OK.
//    c. Inspect the message box,
then click OK.
//    d. In the folder data card, click the Edit Values
tab.
//    e. Modify a field.
//    f. Click Save data card.
//    g. Inspect the folder card in the vault.
// 4. Close the Create Card View dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CreateCardView_CSharp
{
public partial class Form1 : Form, EdmCallback
{

private IEdmVault5 vault1 = null;
IEdmCardView64 view;
IEdmFile7 aFile;
IEdmFolder5 aFolder;

public Form1()
{
InitializeComponent();

}

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFile_Click(System.Object sender, System.EventArgs e)
{
try
{
File1List.Items.Clear();

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

SelectFolder.Enabled = false;

//Set the initial directory in the Select File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;

//Show the Select File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();

if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
// do nothing
}
else
{
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = (IEdmFile7)vault1.GetFileFromPath(FileName, out aFolder);
ShowCard(aFolder, aFile.ID);
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFolder_Click(System.Object sender, System.EventArgs e)
{
try
{
Folder1List.Items.Clear();

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

SelectFile.Enabled = false;
aFolder = vault1.BrowseForFolder(this.Handle.ToInt32(), "Select folder:");
if (Folder1List == null)
return;
Folder1List.Items.Add(aFolder.Name);
ShowCard(aFolder, 0);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SaveCard_Click(System.Object sender, System.EventArgs e)
{
try
{
Folder1List.Items.Clear();

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

view.SaveData();
SaveCard.Enabled = false;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

//Display the card of the selected file or folder
public void ShowCard(IEdmFolder5 folder, int fileID)
{
// Create the card view interface
IEdmFolder10 folder10;
folder10 = (IEdmFolder10)folder;
view = (IEdmCardView64)folder10.CreateCardView2(fileID, this.Handle.ToInt32(), 40, 300, (EdmCallback)this,
(int)EdmCardViewFlag.EdmCvf_Normal);
if (view == null)
{
MessageBox.Show("The file does not have a card.");
return;
}

             view.SetFlagIsFocusOnDataCard(true);

            // Set input focus to the first control in the card
            view.SetFocus(0);

            // Enable all controls in the card
            view.Update(EdmCardViewUpdateType.EdmCvut_EnableCtrl);

            // Get the size needed to display the card
            int width = 0;
            int height = 0;
            view.GetCardSize(out width, out height);

            // Resize the form window to make room for the card
            this.Width = (width + 100);
            this.Height = (height + 400);
            view.ShowWindow(true);

            int ID;
            string folderName;
            string vaultName;
            IEdmVault5 vaultObject;

            // Get some folder information
            ID = folder10.ID;
            folderName = folder10.Name;
            vaultObject = folder10.Vault;
            vaultName = vaultObject.Name;

            MessageBox.Show("Database ID: " + ID.ToString() + "; Vault name: " + vaultName + "; Folder name: " + folderName);

            folder10.Refresh();

            SaveCard.Enabled = false;
        }

        public void CancelButton_Click(System.Object sender, System.EventArgs e)
        {
            view.OnCancel();
            SaveCard.Enabled = false;
            SelectFile.Enabled = true;
            SelectFolder.Enabled = true;
            view.ShowWindow(false);
        }

        public void SetModifiedFlag()
        {
            SaveCard.Enabled = true;
        }

        public void SetProgressPos(int lPos)
        {
        }

        public void SetProgressRange(int lMin, int lMax)
        {
        }

        public void SetStatusMessage(string bsMessage)
        {
        }
    }

}

Back to top

//Form1.Designer.cs

namespace CreateCardView_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFile = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.SaveCard = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SelectFolder = new System.Windows.Forms.Button();
            this.Folder1List = new System.Windows.Forms.ListBox();
            this.Cancel = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFile
            //
            this.SelectFile.Location = new System.Drawing.Point(39, 85);
            this.SelectFile.Name = "SelectFile";
            this.SelectFile.Size = new System.Drawing.Size(157, 23);
            this.SelectFile.TabIndex = 2;
            this.SelectFile.Text = "Select file...";
            this.SelectFile.UseVisualStyleBackColor = true;
            this.SelectFile.Click += new System.EventHandler(SelectFile_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //SaveCard
            //
            this.SaveCard.Location = new System.Drawing.Point(40, 255);
            this.SaveCard.Name = "SaveCard";
            this.SaveCard.Size = new System.Drawing.Size(107, 23);
            this.SaveCard.TabIndex = 6;
            this.SaveCard.Text = "Save data card";
            this.SaveCard.UseVisualStyleBackColor = true;
            this.SaveCard.Click +=new System.EventHandler(SaveCard_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            //SelectFolder
            //
            this.SelectFolder.Location = new System.Drawing.Point(40, 163);
            this.SelectFolder.Name = "SelectFolder";
            this.SelectFolder.Size = new System.Drawing.Size(157, 23);
            this.SelectFolder.TabIndex = 7;
            this.SelectFolder.Text = "Select folder...";
            this.SelectFolder.UseVisualStyleBackColor = true;
            this.SelectFolder.Click += new System.EventHandler(this.SelectFolder_Click);
            //
            //Folder1List
            //
            this.Folder1List.FormattingEnabled = true;
            this.Folder1List.Location = new System.Drawing.Point(39, 192);
            this.Folder1List.Name = "Folder1List";
            this.Folder1List.Size = new System.Drawing.Size(220, 43);
            this.Folder1List.TabIndex = 8;
            //
            //Cancel
            //
            this.Cancel.Location = new System.Drawing.Point(163, 255);
            this.Cancel.Name = "Cancel";
            this.Cancel.Size = new System.Drawing.Size(96, 23);
            this.Cancel.TabIndex = 9;
            this.Cancel.Text = "Cancel";
            this.Cancel.UseVisualStyleBackColor = true;
            this.Cancel.Click += new System.EventHandler(this.Form1_Load);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 327);
            this.Controls.Add(this.Cancel);
            this.Controls.Add(this.Folder1List);
            this.Controls.Add(this.SelectFolder);
            this.Controls.Add(this.SaveCard);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFile);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Create Card View";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFile;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button SaveCard;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
        internal System.Windows.Forms.Button SelectFolder;
        internal System.Windows.Forms.ListBox Folder1List;
        internal System.Windows.Forms.Button Cancel;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Create Card View Example (VB.NET)

This example shows how to create a file or folder card view.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type CreateCardView in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Create a folder in the vault.
' 4. Check out a file from the vault in which you created the folder.
' 5. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Create Card View dialog box.
' 2. Select the vault in which you created a folder and
'    checked out a file.
' 3. Click either:
'    a. Select file.
'    b. In the Select File dialog:
'       1. Click the file checked out in Preconditions step 5.
'       2. Click Open.
'       3. Inspect the message box, then click OK.
'    c. In the file data card, modify a field.
'    d. Click Save data card.
'    e. Check in the file and inspect its data card.
'       - or -
'    a. Select folder.
'    b. In the Select Folder dialog, select the vault folder created in
'       Preconditions step 4 and click OK.
'    c. Inspect the message box, then click OK.
'    d. In the folder data card, click the Edit Values tab.
'    e. Modify a field.
'    f. Click Save data card.
'    g. Inspect the folder card in the vault.
' 4. Close the Create Card View dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Implements EdmCallback

    Private vault1 As IEdmVault5 = Nothing
    Dim view As IEdmCardView64
    Dim aFile As IEdmFile7
    Dim aFolder As IEdmFolder5

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFile.Click
        Try
            File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            SelectFolder.Enabled = False

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = CType(vault1.GetFileFromPath(FileName, aFolder), IEdmFile7)
                    ShowCard(aFolder, aFile.ID)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFolder.Click
        Try
            Folder1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            SelectFile.Enabled = False
            aFolder = vault1.BrowseForFolder(Me.Handle.ToInt32(), "Select folder:")
            If Folder1List Is Nothing Then Exit Sub
            Folder1List.Items.Add(aFolder.Name)
            ShowCard(aFolder, 0)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SaveCard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveCard.Click
        Try
            Folder1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            view.SaveData()
            SaveCard.Enabled = False

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    'Display the card of the selected file or folder
    Private Sub ShowCard(ByVal folder As IEdmFolder5, ByVal fileID As Integer)

        ' Create the card view interface
        Dim folder10 As IEdmFolder10 = Nothing
        folder10 = DirectCast(folder, IEdmFolder10)
        view = CType(folder10.CreateCardView2(fileID, Me.Handle.ToInt32(), 40, 300, Me, EdmCardViewFlag.EdmCvf_Normal), IEdmCardView64)

        If view Is Nothing Then
            MsgBox("The file does not have a card.")
            Exit Sub
        End If

        view.SetFlagIsFocusOnDataCard(True)

        ' Set input focus to the first control in the card
        view.SetFocus(0)

        ' Enable all controls in the card
        view.Update(EdmCardViewUpdateType.EdmCvut_EnableCtrl)

        ' Get the size needed to display the card
        Dim width As Integer
        Dim height As Integer
        view.GetCardSize(width, height)

        ' Resize the form window to make room for the card
        Me.Width = (width + 100)
        Me.Height = (height + 400)
        view.ShowWindow(True)

        Dim ID As Integer
        Dim folderName As String
        Dim vaultName As String
        Dim vaultObject As IEdmVault5

        ' Get some
folder information
ID = folder10.ID
folderName = folder10.Name
vaultObject = folder10.Vault
vaultName = vaultObject.Name
MessageBox.Show("Database ID: " + ID.ToString() + "; Vault name: " + vaultName + "; Folder name: " + folderName)

folder10.Refresh()

SaveCard.Enabled = False
End Sub

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
view.OnCancel()
SaveCard.Enabled = False
SelectFile.Enabled = True
SelectFolder.Enabled = True
view.ShowWindow(False)
End Sub

Private Sub EdmCallback_SetModifiedFlag() Implements EdmCallback.SetModifiedFlag
SaveCard.Enabled = True
End Sub

Private Sub EdmCallback_SetProgressPos(ByVal lPos As Integer) Implements EdmCallback.SetProgressPos
End Sub

Private Sub EdmCallback_SetProgressRange(ByVal lMin As Integer, ByVal lMax As Integer) Implements EdmCallback.SetProgressRange
End Sub

Private Sub EdmCallback_SetStatusMessage(ByVal bsMessage As String) Implements EdmCallback.SetStatusMessage
End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFile = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.SaveCard = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SelectFolder = New System.Windows.Forms.Button()
        Me.Folder1List = New System.Windows.Forms.ListBox()
        Me.Cancel = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFile
        '
        Me.SelectFile.Location = New System.Drawing.Point(39, 85)
        Me.SelectFile.Name = "SelectFile"
        Me.SelectFile.Size = New System.Drawing.Size(157, 23)
        Me.SelectFile.TabIndex = 2
        Me.SelectFile.Text = "Select file..."
        Me.SelectFile.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'SaveCard
        '
        Me.SaveCard.Location = New System.Drawing.Point(40, 255)
        Me.SaveCard.Name = "SaveCard"
        Me.SaveCard.Size = New System.Drawing.Size(107, 23)
        Me.SaveCard.TabIndex = 6
        Me.SaveCard.Text = "Save data card"
        Me.SaveCard.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Title = "Select File"
        '
        'SelectFolder
        '
        Me.SelectFolder.Location = New System.Drawing.Point(40, 163)
        Me.SelectFolder.Name = "SelectFolder"
        Me.SelectFolder.Size = New System.Drawing.Size(157, 23)
        Me.SelectFolder.TabIndex = 7
        Me.SelectFolder.Text = "Select folder..."
        Me.SelectFolder.UseVisualStyleBackColor = True
        '
        'Folder1List
        '
        Me.Folder1List.FormattingEnabled = True
        Me.Folder1List.Location = New System.Drawing.Point(39, 192)
        Me.Folder1List.Name = "Folder1List"
        Me.Folder1List.Size = New System.Drawing.Size(220, 43)
        Me.Folder1List.TabIndex = 8
        '
        'Cancel
        '
        Me.Cancel.Location = New System.Drawing.Point(163, 255)
        Me.Cancel.Name = "Cancel"
        Me.Cancel.Size = New System.Drawing.Size(96, 23)
        Me.Cancel.TabIndex = 9
        Me.Cancel.Text = "Cancel"
        Me.Cancel.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 327)
        Me.Controls.Add(Me.Cancel)
        Me.Controls.Add(Me.Folder1List)
        Me.Controls.Add(Me.SelectFolder)
        Me.Controls.Add(Me.SaveCard)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFile)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Create Card View"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFile As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents SaveCard As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents SelectFolder As System.Windows.Forms.Button
    Friend WithEvents Folder1List As System.Windows.Forms.ListBox
    Friend WithEvents Cancel As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Create Custom Card View Example (C#)

This example shows how to create a custom file card view.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > C#, Windows,
Desktop > Windows
Forms Appl.
//    b. Type CustomCardView_CSharp in Project name.
//    c.

For Location, click ... and navigate to the folder where to
create the project.
//    d. Click Next.
//    e. Select Framework.
//    f. Click
Create.
//    g. Click Show All Files in the Solution Explorer
toolbar and expand
//       Form1.cs in the Solution Explorer.
//    h. Replace the code in Form1.cs with
this code.
//    i. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
// 2.

Add dependencies and safely pass arrays of structures
// 3.
Check out a file that has a data card with
a Comment tab and a
//    Comment variable.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//
1. Displays the Custom Card View dialog box.
// 2. Select a vault view.
// 3. Click Select file.
//    a. In the Select File dialog:
//       1. Click the text file checked out in
Preconditions step 5.
//       2. Click Open.
//    b. In the file data card, click the Comment tab.
//    c. Type something in Comments.
// 4. Click Save data card.
// 5. Click OK in the message box.
// 6. Close the Custom Card View dialog box.
// 7. Check in the file and inspect the comment in the file data card.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CustomCardView_CSharp
{
public partial class Form1 : Form, IEdmCardViewCallback6
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1;
IEdmCardView63 view;
IEdmFile7 aFile;
IEdmFolder5 aFolder;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
vault1 = new EdmVault5();
IEdmVault10 vault = (IEdmVault10)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFile_Click(System.Object sender, System.EventArgs e)
{
try
{
File1List.Items.Clear();

if (vault1 == null)
{
vault1 = new EdmVault5();
}

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;

//Show the Select File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();

if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
// do nothing
}
else
{
foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = (IEdmFile7)vault1.GetFileFromPath(FileName, out aFolder);
ShowCard(aFolder, aFile.ID);
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SaveCard_Click(System.Object sender, System.EventArgs e)
{

try
{
if (vault1 == null)
{
vault1 = new EdmVault5();
}

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

view.SaveData();
SaveCard.Enabled = false;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

//Display the card of the selected file
private void ShowCard(IEdmFolder5 folder, int fileID)
{
try
{
if (vault1 == null)
{
vault1 = new EdmVault5();
}

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}
IEdmVault10 vault = (IEdmVault10)vault1;

EdmCardViewParams @params = default(EdmCardViewParams);
@params.mlFileID = fileID;
@params.mlFolderID = folder.ID;
@params.mlCardID = 0;
@params.mlX = 40;
@params.mlY = 300;
@params.mhParentWindow = this.Handle.ToInt32();
@params.mlEdmCardViewFlags = (int)EdmCardViewFlag.EdmCvf_Normal;

//Create the card view interface
view = vault.CreateCardViewEx2(@params, this);

if (view == null)
{
MessageBox.Show("The file does not have a card.");
return;
}

//Set input focus to the first control in the card
view.SetFocus(0);

//Enable all controls in the card
view.Update(EdmCardViewUpdateType.EdmCvut_EnableCtrl);

//Get the size needed to display the card
int width = 0;
int height = 0;
view.GetCardSize(out width, out height);

//Resize the form window to make room for the card
this.Width = (width + 100);
this.Height = (height + 400);
view.ShowWindow(true);

SaveCard.Enabled = false;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void EdmCardViewCallback6_SetModifiedFlag()
{
SaveCard.Enabled = true;
}
void IEdmCardViewCallback6.SetModifiedFlag()
{
EdmCardViewCallback6_SetModifiedFlag();
}

private void EdmCardViewCallback6_OnAddInInput(int lFlags)
{
}
void IEdmCardViewCallback6.OnAddInInput(int lFlags)
{
EdmCardViewCallback6_OnAddInInput(lFlags);
}

private void EdmCardViewCallback6_SetCtrlData(int lCardWnd, int lCardID, int lControlID, int lVariableID, string bsVariableName, IEdmCardView5 poView, ref object poValue)
{
try
{
if (bsVariableName == "Comment")
{
MessageBox.Show(lCardWnd + " " + lCardID + " " + lControlID + " " + lVariableID + " " + bsVariableName + " " + poValue.ToString());

IEdmEnumeratorVariable8 enumvar = default(IEdmEnumeratorVariable8);
enumvar = (IEdmEnumeratorVariable8)aFile.GetEnumeratorVariable();

enumvar.SetVar(bsVariableName, "", poValue, true);
enumvar.CloseFile(true);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void IEdmCardViewCallback6.SetCtrlData(int lCardWnd, int lCardID, int lControlID, int lVariableID, string bsVariableName, IEdmCardView5 poView, ref object poValue)
{
EdmCardViewCallback6_SetCtrlData(lCardWnd, lCardID, lControlID, lVariableID, bsVariableName, poView, ref poValue);
}

private object EdmCardViewCallback6_GetCtrlData(int lCardWnd, int lCardID, int lControlID, int lVariableID, string bsVariableName, IEdmCardView5 poView)
{
object poValue
= null;
try

            {
                IEdmEnumeratorVariable8 enumVar = (IEdmEnumeratorVariable8)aFile.GetEnumeratorVariable();
                enumVar.GetVar(bsVariableName, "", out poValue);
            }

            catch (System.Runtime.InteropServices.COMException ex)

            {
                  MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)

            {
MessageBox.Show(ex.Message);
}

return
poValue;
}
object IEdmCardViewCallback6.GetCtrlData(int lCardWnd, int lCardID, int lControlID, int lVariableID, string bsVariableName, IEdmCardView5 poView)
{
return EdmCardViewCallback6_GetCtrlData(lCardWnd, lCardID, lControlID, lVariableID, bsVariableName, poView);
}

private object EdmCardViewCallback6_GetDefaultValueComponent(EdmDefValComp eValue)
{
return null;
}
object IEdmCardViewCallback6.GetDefaultValueComponent(EdmDefValComp eValue)
{
return EdmCardViewCallback6_GetDefaultValueComponent(eValue);
}
}
}

Back to top

//Form1.Designer.cs

namespace CustomCardView_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFile = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.SaveCard = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFile
            //
            this.SelectFile.Location = new System.Drawing.Point(39, 85);
            this.SelectFile.Name = "SelectFile";
            this.SelectFile.Size = new System.Drawing.Size(157, 23);
            this.SelectFile.TabIndex = 2;
            this.SelectFile.Text = "Select file...";
            this.SelectFile.UseVisualStyleBackColor = true;
            this.SelectFile.Click +=new System.EventHandler(SelectFile_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //SaveCard
            //
            this.SaveCard.Location = new System.Drawing.Point(40, 176);
            this.SaveCard.Name = "SaveCard";
            this.SaveCard.Size = new System.Drawing.Size(107, 23);
            this.SaveCard.TabIndex = 6;
            this.SaveCard.Text = "Save data card";
            this.SaveCard.UseVisualStyleBackColor = true;
            this.SaveCard.Click +=new System.EventHandler(SaveCard_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 227);
            this.Controls.Add(this.SaveCard);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFile);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Custom Card View";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFile;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button SaveCard;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Create Custom Card View Example (VB.NET)

This example shows how to create a custom file card view.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type CustomCardView_VBNET in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with
'       this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Check out a file that has a data card with a Comment tab and a
'    Comment variable.
' 4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Custom Card View dialog box.
' 2. Select a vault view.
' 3. Click Select file.
'    a. In the Select File dialog:
'       1. Click the text file checked out in Preconditions step 4.
'       2. Click Open.
'    b. In the file data card, click the Comment tab.
'    c. Type something in Comments.
' 4. Click Save data card.
' 5. Click OK in the message box.
' 6. Close the Custom Card View dialog box.
' 7. Check in the file and inspect the comment in the file data card.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Implements IEdmCardViewCallback6

    Private vault1 As IEdmVault5
    Dim view As IEdmCardView63
    Dim aFile As IEdmFile7
    Dim aFolder As IEdmFolder5

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            vault1 = New EdmVault5()
            Dim vault As IEdmVault10 = DirectCast(vault1, IEdmVault10)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFile.Click
        Try
            File1List.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName, aFolder)
                    ShowCard(aFolder, aFile.ID)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SaveCard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveCard.Click
        Try

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            view.SaveData()
            SaveCard.Enabled = False

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    'Display the card of the selected file
    Private Sub ShowCard(ByVal folder As IEdmFolder5, ByVal fileID As Integer)
        Try

        If vault1 Is Nothing Then
            vault1 = New EdmVault5()
        End If

        If Not vault1.IsLoggedIn Then
            vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
        End If
        Dim vault As IEdmVault10 = vault1

        Dim params As EdmCardViewParams
        params.mlFileID = fileID
        params.mlFolderID = folder.ID
        params.mlCardID = 0
        params.mlX = 40
        params.mlY = 300
        params.mhParentWindow = Me.Handle.ToInt32()
        params.mlEdmCardViewFlags = EdmCardViewFlag.EdmCvf_Normal

        'Create the card view interface
        view = vault.CreateCardViewEx2(params, Me)

        If view Is Nothing Then
            MsgBox("The file does not have a card.")
            Exit Sub
        End If

        'Set input focus to the first control in the card
        view.SetFocus(0)

        'Enable all controls in the card
        view.Update(EdmCardViewUpdateType.EdmCvut_EnableCtrl)

        'Get the size needed to display the card
        Dim width As Integer
        Dim height As Integer
        view.GetCardSize(width, height)

        'Resize the form window to make room for the card
        Me.Width = (width + 100)
        Me.Height = (height + 400)
        view.ShowWindow(True)

        SaveCard.Enabled = False

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub EdmCardViewCallback6_SetModifiedFlag() Implements IEdmCardViewCallback6.SetModifiedFlag
        SaveCard.Enabled = True
    End Sub

    Private Sub EdmCardViewCallback6_OnAddInInput(ByVal lFlags As Integer) Implements IEdmCardViewCallback6.OnAddInInput
    End Sub

    Private Sub EdmCardViewCallback6_SetCtrlData(ByVal lCardWnd As Integer, ByVal lCardID As Integer, ByVal lControlID As Integer, ByVal lVariableID As Integer, ByVal bsVariableName As String, ByVal poView As IEdmCardView5, ByRef poValue As Object) Implements IEdmCardViewCallback6.SetCtrlData

        Try
            If bsVariableName = "Comment" Then
                MsgBox(lCardWnd & " " & lCardID & " " & lControlID & " " & lVariableID & " " & bsVariableName & " " & poValue.ToString)

                Dim enumvar As IEdmEnumeratorVariable8
                enumvar = aFile.GetEnumeratorVariable()

                enumvar.SetVar(bsVariableName, "", poValue, True)
                enumvar.CloseFile(True)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Function EdmCardViewCallback6_GetCtrlData(ByVal lCardWnd As Integer, ByVal lCardID As Integer, ByVal lControlID As Integer, ByVal lVariableID As Integer, ByVal bsVariableName As String, ByVal poView As IEdmCardView5) As Object Implements IEdmCardViewCallback6.GetCtrlData

Dim poValue As Object = Nothing
Try
Dim enumVar As IEdmEnumeratorVariable5 = aFile.GetEnumeratorVariable()
enumVar.GetVar(bsVariableName, "", poValue)
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return poValue

    End Function

    Private Function EdmCardViewCallback6_GetDefaultValueComponent(ByVal eValue As EdmDefValComp) As Object Implements IEdmCardViewCallback6.GetDefaultValueComponent
        Return Nothing
    End Function

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFile = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.SaveCard = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFile
        '
        Me.SelectFile.Location = New System.Drawing.Point(39, 85)
        Me.SelectFile.Name = "SelectFile"
        Me.SelectFile.Size = New System.Drawing.Size(157, 23)
        Me.SelectFile.TabIndex = 2
        Me.SelectFile.Text = "Select file..."
        Me.SelectFile.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'SaveCard
        '
        Me.SaveCard.Location = New System.Drawing.Point(40, 176)
        Me.SaveCard.Name = "SaveCard"
        Me.SaveCard.Size = New System.Drawing.Size(107, 23)
        Me.SaveCard.TabIndex = 6
        Me.SaveCard.Text = "Save data card"
        Me.SaveCard.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 227)
        Me.Controls.Add(Me.SaveCard)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFile)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Custom Card View"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFile As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents SaveCard As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Create Labels on Folders Example (C#)

This example shows how to create a label on a folder and all of its subfolders and files.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > Visual
C# > Windows Forms Application.
//    b. Type CreateLabel_CSharp in Name.
//    c. Click Browse and navigate to the folder where to create
//       the project.
//    d. Click OK.
//    e. Click Show All Files in the Solution Explorer toolbar and expand
//       Form1.cs in the Solution Explorer.
//    f. Replace the code in Form1.cs with this code.
//    g. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add EPDM.Interop.epdm.dll as a reference (right-click the project
//    name in the Solution Explorer, click Add Reference, click
//    Assemblies > Framework in the left-side panel, browse to the top folder of
//    your SOLIDWORKS PDM Professional installation, locate and click
//    EPDM.Interop.epdm.dll, click Open, and click Add).
// 3. Right-click EPDM.Interop.epdm in References, click Properties, and set
//    Embed Interop Types to False to handle methods that pass arrays of
//    structures.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Create label dialog box.
//    a. Select a vault view.
//    b. Click Browse for
parent folder.
//       1. Locate and click a
folder
in the vault.
//       2. Click OK.
//    c. Click Create label.
//       1. Creates label, MyCompany,
on the
selected folder and all of its
//          subfolders and files.
//       2. Displays a message box with information
about all of the labels
//
on the selected folder.
//       3. Click OK.
// 2. Close the Create label dialog box.
//
3. To verify label creation on a folder or file, open a view on the
//    selected vault, click either a folder or a file, and click
//    Display > History.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CreateLabel_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ListBox.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Show the Browse For Folder dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = FolderBrowserDialog1.ShowDialog();
                //If the user didn't click OK, exit
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                ListBox.Items.Add(FolderBrowserDialog1.SelectedPath);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void CreateLabel_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmFolder5 parentFolder = default(IEdmFolder5);
                parentFolder = vault2.GetFolderFromPath(ListBox.Items[0].ToString());

                int labelID = 0;
                string labelName = "MyCompany";
                labelID = parentFolder.CreateLabel(labelName, "Label set by test program", true);

                IEdmPos5 pos = default(IEdmPos5);
                IEdmLabel5 label = default(IEdmLabel5);
                string message = null;
                message = "The following labels have been set on folder " + parentFolder.Name + ":" + "\n";
                pos = parentFolder.GetFirstLabelPosition();
                while (!pos.IsNull)
                {
                    label = (IEdmLabel5)parentFolder.GetNextLabel(pos);
                    message = message + label.Name + " (" + label.Comment + ")" + " created by " + label.User.Name + "(ID = " + label.UserID + ")" + " at " + label.Time + "\n";
                }

                MessageBox.Show(message);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace CreateLabel_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.CreateLabel = new System.Windows.Forms.Button();
            this.FolderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 85);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(186, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse for parent folder...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click +=new System.EventHandler(BrowseButton_Click);
            //
            //ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.Size = new System.Drawing.Size(259, 43);
            this.ListBox.TabIndex = 4;
            //
            //CreateLabel
            //
            this.CreateLabel.Location = new System.Drawing.Point(84, 178);
            this.CreateLabel.Name = "CreateLabel";
            this.CreateLabel.Size = new System.Drawing.Size(98, 23);
            this.CreateLabel.TabIndex = 5;
            this.CreateLabel.Text = "Create label";
            this.CreateLabel.UseVisualStyleBackColor = true;
            this.CreateLabel.Click +=new System.EventHandler(CreateLabel_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 215);
            this.Controls.Add(this.CreateLabel);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Create label";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button CreateLabel;
        internal System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Create Labels on Folders Example (VB.NET)

This example shows how to create a label on a folder and all of its subfolders and files.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type CreateLabel in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Create label dialog box.
'    a. Select a vault view.
'    b. Click Browse for parent folder.
'       1. Locate and click a folder in the vault.
'       2. Click OK.
'    c. Click Create label.
'       1. Creates label, MyCompany, on the selected folder and all of its
'          subfolders and files.
'       2. Displays a message box with information about all of the labels
'          on the selected folder.
'       3. Click OK.
' 2. Close the Create label dialog box.
' 3. To verify label creation on a folder or file, open a view on the
'    selected vault, click either a folder or a file, and click
'    Display > History.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            ListBox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Show the Browse For Folder dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = FolderBrowserDialog1.ShowDialog()
            'If the user didn't click OK, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            ListBox.Items.Add(FolderBrowserDialog1.SelectedPath)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub CreateLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateLabel.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim parentFolder As IEdmFolder5
            parentFolder = vault2.GetFolderFromPath(ListBox.Items(0).ToString())

            Dim labelID As Integer
            Dim labelName As String = "MyCompany"
            labelID = parentFolder.CreateLabel(labelName, "Label set by test program", True)

            Dim pos As IEdmPos5
            Dim label As IEdmLabel5
            Dim message As String
            message = "The following labels have been set on folder " + parentFolder.Name + ":" + vbLf
            pos = parentFolder.GetFirstLabelPosition
            While Not pos.IsNull
                label = parentFolder.GetNextLabel(pos)
                message = message & label.Name & " (" & label.Comment & ")" & " created by " & label.User.Name & "(ID = " & label.UserID & ")" & " at " & label.Time & vbLf
            End While

            MsgBox(message)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.CreateLabel = New System.Windows.Forms.Button()
        Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 85)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(186, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse for parent folder..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.Size = New System.Drawing.Size(259, 43)
        Me.ListBox.TabIndex = 4
        '
        'CreateLabel
        '
        Me.CreateLabel.Location = New System.Drawing.Point(84, 178)
        Me.CreateLabel.Name = "CreateLabel"
        Me.CreateLabel.Size = New System.Drawing.Size(98, 23)
        Me.CreateLabel.TabIndex = 5
        Me.CreateLabel.Text = "Create label"
        Me.CreateLabel.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 215)
        Me.Controls.Add(Me.CreateLabel)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Create label"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents CreateLabel As System.Windows.Forms.Button
    Friend WithEvents FolderBrowserDialog1 As System.Windows.Forms.FolderBrowserDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Create New Vault Example (C#)

This example shows how to:

  • Create a new vault.
  • Create a new vault view.
  • Log into the new vault.
  • Get all of the users currently logged into vault views on this machine.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > Visual
C# > Windows Forms Application.
//    b. Type CreateNewVault_CSharp in Name.
//    c. Click Browse and navigate to the folder where to create
//       the project.
//    d. Click OK.
//    e. Click Show All Files in the Solution Explorer toolbar and expand
//       Form1.cs in the Solution Explorer.
//    f. Replace the code in Form1.cs with this code.
//    g. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add EPDM.Interop.epdm.dll as a reference (right-click the project
//    name in the Solution Explorer, click Add Reference, click
//    Assemblies > Framework in the left-side panel, browse to the top folder of
//    your SOLIDWORKS PDM Professional installation, locate and click
//    EPDM.Interop.epdm.dll, click Open, and click Add).
// 3. Right-click EPDM.Interop.epdm in References, click Properties, and set
//    Embed Interop Types to False to handle methods that pass arrays of
//    structures.
//
4. In the code, substitute the following parameters in IEdmVault11::CreateNewVault
//    to create MyNewVault on your machine:
//    * database_server
//    * sql_sa_password
// 5. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Create
new vault dialog box.
//    a.
Click Create and log in to MyNewVault.
//    b. After a few seconds, displays a login dialog.
//    c. Type Admin's password in Password.
//    d. Click Log in.
//       1. MyNewVault is created using the
Default configuration in the root
//          folder of the archive
server.
//       2. A view of MyNewVault, accessible to
all users, is created in c:\temp.
//       3. Admin is logged into MyNewVault.
//
e. Click Get users logged into all vaults.
//
f. Displays a dialog with all of the users currently logged into
//       vault views on this machine.
//    g. Click OK.
// 2. Close the Create
new vault dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CreateNewVault_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

IEdmVault5 vault1;
IEdmVault13 vault2;
string vaults = "";
public void Form1_Load(System.Object sender, System.EventArgs e)
{
vault1 = new EdmVault5();
vault2 = (IEdmVault13)vault1;
}

public void GetLoggedIn_Click(System.Object sender, System.EventArgs e)
{
//Get all of the users currently logged into
vault views on this machine
try
{
if (vault1 == null)
{
MessageBox.Show("Click Log in");
return;
}

IEdmUserMgr5 userMgr = default(IEdmUserMgr5);
userMgr = (IEdmUserMgr5)vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr);
IEdmPos5 pos = default(IEdmPos5);
pos = userMgr.GetFirstLoggedInUserPosition(vaults);

string userName = "";
string computerName = "";
string vaultName = "";
object loginTime = null;

string message = null;
message = "The following users are
logged into vault views:" + "\n" + "\n";

while (!pos.IsNull)
{
userMgr.GetNextLoggedInUser(pos, out userName, out computerName, out vaultName, ref loginTime);
message = message + userName + " (" + computerName + ")" + " logged in to " + vaultName + " at " + loginTime + "\n";
}

MessageBox.Show(message);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button1_Click(System.Object sender, System.EventArgs e)
{
// Create
a new vault and vault view
try
{
vault1 = new EdmVault5();
vault2 = (IEdmVault13)vault1;

vault2.CreateNewVault("", "", "", "MyNewVault", "This is my new vault", "", "database_server", "sa", "sql_sa_password", "MyNewVault", 110, "", (int)EdmCreateVaultFlag.EdmCreateVault_UseDefaultAdminPassword, null, "Default");
vault2.CreateNewVaultView("", "", "", "MyNewVault", "c:\\temp", (int)EdmCreateVaultViewFlag.EdmCreateVaultView_SharedView);

EdmViewInfo[] Views = null;
vault2.GetVaultViews(out Views, false);
vaults = "";

foreach (EdmViewInfo View in Views)
{
vaults = vaults + View.mbsVaultName + "\n";
}

//Log into the new vault view
vault2.LoginAuto("MyNewVault", this.Handle.ToInt32());
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Back to top

//Form1.Designer.cs

namespace CreateNewVault_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.GetLoggedIn = new System.Windows.Forms.Button();
            this.Button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //GetLoggedIn
            //
            this.GetLoggedIn.Location = new System.Drawing.Point(31, 71);
            this.GetLoggedIn.Name = "GetLoggedIn";
            this.GetLoggedIn.Size = new System.Drawing.Size(167, 23);
            this.GetLoggedIn.TabIndex = 5;
            this.GetLoggedIn.Text = "Get users logged into all vaults";
            this.GetLoggedIn.UseVisualStyleBackColor = true;
            this.GetLoggedIn.Click +=new System.EventHandler(GetLoggedIn_Click);
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(31, 26);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(178, 23);
            this.Button1.TabIndex = 6;
            this.Button1.Text = "Create and log in to MyNewVault";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click +=new System.EventHandler(Button1_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(287, 136);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.GetLoggedIn);
            this.Name = "Form1";
            this.Text = "Create new vault";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Button GetLoggedIn;
        internal System.Windows.Forms.Button Button1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Create New Vault Example (VB.NET)

This example shows how to:

  • Create a new vault.
  • Create a new vault view.
  • Log into the new vault.
  • Get all of the users currently logged into vault views on this machine.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type CreateNewVault in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    h. Replace the code in Form1.vb with this code.
'    i. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. In the code, substitute the following parameters in IEdmVault11::CreateNewVault
'    to create MyNewVault on your machine:
'    * database_server
'    * sql_sa_password
' 4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Create new vault dialog box.
'    a. Click Create and log in to MyNewVault.
'    b. After a few seconds, displays a login dialog.
'    c. Type Admin's password in Password.
'    d. Click Log in.
'       1. MyNewVault is created using the Default configuration in the root
'          folder of the archive server.
'       2. A view of MyNewVault, accessible to all users, is created in c:\temp.
'       3. Admin is logged into MyNewVault.
'    e. Click Get users logged into all vaults.
'    f. Displays a dialog with all of the users currently logged into
'       vault views on this machine.
'    g. Click OK.
' 2. Close the Create new vault dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Dim vault1 As IEdmVault5 = New EdmVault5()
    Dim vault2 As IEdmVault13 = DirectCast(vault1, IEdmVault13)
    Dim vaults As String = ""
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Public Sub GetLoggedIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetLoggedIn.Click
        'Get all of the users currently logged into vault views on this machine
        Try
            If vault1 Is Nothing Then
                MessageBox.Show("Click Log in")
                Exit Sub
            End If

            Dim userMgr As IEdmUserMgr5
            userMgr = vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr)
            Dim pos As IEdmPos5
            pos = userMgr.GetFirstLoggedInUserPosition(vaults)

            Dim userName As String = ""
            Dim computerName As String = ""
            Dim vaultName As String = ""
            Dim loginTime As Object = Nothing

            Dim message As String
            message = "The following users are logged into vault views:" & vbLf & vbLf

            While Not pos.IsNull
                userMgr.GetNextLoggedInUser(pos, userName, computerName, vaultName, loginTime)
                message = message & userName & " (" & computerName & ")" & " logged in to " & vaultName & " at " & loginTime.ToString & vbLf
            End While

            MsgBox(message)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Create a new vault and vault view
        Try
            vault1 = New EdmVault5()
            vault2 = DirectCast(vault1, IEdmVault13)

            vault2.CreateNewVault("", "", "", "MyNewVault", "This is my new vault", "", "database_server", "sa", "sql_sa_password", "MyNewVault", 110, "", EdmCreateVaultFlag.EdmCreateVault_UseDefaultAdminPassword, Nothing, "Default")
            vault2.CreateNewVaultView("", "", "", "MyNewVault", "c:\temp", EdmCreateVaultViewFlag.EdmCreateVaultView_SharedView)

            Dim Views As EdmViewInfo() = Nothing
            vault2.GetVaultViews(Views, False)

            For Each View As EdmViewInfo In Views
                vaults = vaults & View.mbsVaultName & vbLf
            Next

            'Log into the new vault view
            vault2.LoginAuto("MyNewVault", Me.Handle.ToInt32())

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    Private components As System.ComponentModel.IContainer = Nothing

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>

    Private Sub InitializeComponent()
        Me.GetLoggedIn = New System.Windows.Forms.Button()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'GetLoggedIn
        '
        Me.GetLoggedIn.Location = New System.Drawing.Point(31, 71)
        Me.GetLoggedIn.Name = "GetLoggedIn"
        Me.GetLoggedIn.Size = New System.Drawing.Size(167, 23)
        Me.GetLoggedIn.TabIndex = 5
        Me.GetLoggedIn.Text = "Get users logged into all vaults"
        Me.GetLoggedIn.UseVisualStyleBackColor = True
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(31, 26)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(178, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Create and log in to MyNewVault"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(287, 136)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.GetLoggedIn)
        Me.Name = "Form1"
        Me.Text = "Create new vault"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents GetLoggedIn As System.Windows.Forms.Button
    Friend WithEvents Button1 As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Create User Picture Example (C#)

This example shows how to display a user's picture in a form and pop up user information when hovering over a form label.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
//    a. Click File > New > Project > Visual
C# > Windows Forms Application.
//    b. Type CreateUserPicture_CSharp in Name.
//    c. Click Browse and navigate to the folder where to create
//       the project.
//    d. Click OK.
//    e. Click Show All Files in the Solution Explorer toolbar and expand
//       Form1.cs in the Solution Explorer.
//    f. Replace the code in Form1.cs with this code.
//    g. To create the form,
replace the code in Form1.Designer.cs with this code.
// 2. Add EPDM.Interop.epdm.dll as a reference (right-click the project
//    name in the Solution Explorer, click Add Reference, click
//    Assemblies > Framework in the left-side panel, browse to the top folder of
//    your SOLIDWORKS PDM Professional installation, locate and click
//    EPDM.Interop.epdm.dll, click Open, click Add,
and click Close).
// 3. Right-click EPDM.Interop.epdm in References, click Properties, and set
//    Embed Interop Types to False to handle methods that pass arrays of
//    structures.
// 4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Get
Admin's picture dialog box.
// 2. Select a vault view.
// 3. Click Get
picture.
//
4. Displays a picture of the Admin of the selected vault.
// 5. Hover over System Administrator.
// 6. Pops up a window with the Admin's information.
// 7. Close the Get
Admin's picture dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CreateUserPicture_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmImage mpoImage;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            IEdmVault8 vault = (IEdmVault8)new EdmVault5();
            EdmViewInfo[] Views = {

};

            vault.GetVaultViews(out Views, false);
            VaultsComboBox.Items.Clear();
            foreach (EdmViewInfo View in Views)
            {
                VaultsComboBox.Items.Add(View.mbsVaultName);
            }
            if (VaultsComboBox.Items.Count > 0)
            {
                VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
            }
        }

        private void Button1_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault5 vault = default(IEdmVault5);
                IEdmVault12 vault2 = default(IEdmVault12);
                vault = new EdmVault5();
                vault2 = (IEdmVault12)vault;

                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                IEdmUserMgr8 poUserMgr = default(IEdmUserMgr8);
                poUserMgr = (IEdmUserMgr8)vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr);

                //Create a bounding rectangle for the picture
                EdmRect oRect = default(EdmRect);
                oRect.mlTop = 10;
                oRect.mlLeft = 10;
                oRect.mlRight = oRect.mlLeft + 80;
                oRect.mlBottom = oRect.mlTop + 100;

                //Create the Admin user's image
                IEdmUser10 poAdmin = default(IEdmUser10);
                poAdmin = (IEdmUser10)poUserMgr.GetUser("Admin");
                mpoImage = poUserMgr.CreateUserPicture(this.Handle.ToInt32(), ref oRect, poAdmin.ID);

                Label1.Text = poAdmin.FullName;

                //Invalidate the window to trigger a call to OnPaintPic
                this.Invalidate();

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        //Displays the Admin user's picture when the form is repainted
        private void Form1_Paint(System.Object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if ((mpoImage != null))
            {
                mpoImage.Paint(e.Graphics.GetHdc().ToInt32());
            }
        }

        //Called when the user hovers over the form label, Label1

        private void Label1_MouseHover(System.Object sender, System.EventArgs e)
        {
            IEdmVault12 poVault = default(IEdmVault12);
            poVault = (IEdmVault12)new EdmVault5();
            poVault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

            IEdmUserMgr8 poUserMgr = default(IEdmUserMgr8);
            poUserMgr = (IEdmUserMgr8)poVault.CreateUtility(EdmUtility.EdmUtil_UserMgr);

            //Get the screen coordinates of the label that displays the user name
            System.Drawing.Point pnt = default(System.Drawing.Point);
            pnt.X = Label1.Left;
            pnt.Y = Label1.Top;
            pnt = this.PointToScreen(pnt);

            //Create the bounding rectangle
            EdmRect oTrackRect = default(EdmRect);
            oTrackRect.mlTop = pnt.Y;
            oTrackRect.mlLeft = pnt.X;
            oTrackRect.mlRight = oTrackRect.mlLeft + Label1.Width;
            oTrackRect.mlBottom = oTrackRect.mlTop + Label1.Height;

            //Display a popup window with the Admin user's information
            poUserMgr.ShowUserPopup(this.Handle.ToInt32(), ref oTrackRect, Label1.Text);
        }
    }
}

Back to top

//Form1.Designer.cs

namespace CreateUserPicture_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Button1 = new System.Windows.Forms.Button();
            this.Label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(22, 164);
            this.VaultsLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 10;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(25, 179);
            this.VaultsComboBox.Margin = new System.Windows.Forms.Padding(2);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(132, 21);
            this.VaultsComboBox.TabIndex = 11;
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(48, 214);
            this.Button1.Margin = new System.Windows.Forms.Padding(2);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(101, 31);
            this.Button1.TabIndex = 14;
            this.Button1.Text = "Get picture";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click +=new System.EventHandler(Button1_Click);
            //
            //Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(22, 128);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(0, 13);
            this.Label1.TabIndex = 15;
            this.Label1.MouseHover +=new System.EventHandler(Label1_MouseHover);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(235, 256);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Margin = new System.Windows.Forms.Padding(2);
            this.Name = "Form1";
            this.Text = "Get Admin's picture";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.Paint +=new System.Windows.Forms.PaintEventHandler(Form1_Paint);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button Button1;
        internal System.Windows.Forms.Label Label1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Create User Picture Example (VB.NET)

This example shows how to display a user's picture in a form and pop up user information when hovering over a form label.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
'    a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'    b. Type CreateUserPicture in Project name.
'    c. For Location, click ... and navigate to the folder where to create the project.
'      d. Click Next.
'    e. Select Framework.
'    f. Click Create.
'    g. Click Show All Files in the Solution Explorer toolbar and expand
'       Form1.vb in the Solution Explorer.
'    f. Replace the code in Form1.vb with this code.
'    g. To create the form, replace the code in Form1.Designer.vb with this code.
' 2. Add dependencies and safely pass arrays of structures.
' 3. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Get Admin's picture dialog box.
' 2. Select a vault view.
' 3. Click Get picture.
' 4. Displays a picture of the Admin of the selected vault.
' 5. Hover over System Administrator.
' 6. Pops up a window with the Admin's information.
' 7. Close the Get Admin's picture dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Dim mpoImage As IEdmImage

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim vault As IEdmVault8 = New EdmVault5
        Dim Views() As EdmViewInfo = {}

        vault.GetVaultViews(Views, False)
        VaultsComboBox.Items.Clear()
        For Each View As EdmViewInfo In Views
            VaultsComboBox.Items.Add(View.mbsVaultName)
        Next
        If VaultsComboBox.Items.Count > 0 Then
            VaultsComboBox.Text = VaultsComboBox.Items(0)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try

            Dim vault As IEdmVault5
            Dim vault2 As IEdmVault12
            vault = New EdmVault5
            vault2 = vault

            vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())

            Dim poUserMgr As IEdmUserMgr8
            poUserMgr = vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr)

            'Create a bounding rectangle for the picture
            Dim oRect As EdmRect
            oRect.mlTop = 10
            oRect.mlLeft = 10
            oRect.mlRight = oRect.mlLeft + 80
            oRect.mlBottom = oRect.mlTop + 100

            'Create the Admin user's image
            Dim poAdmin As IEdmUser10
            poAdmin = poUserMgr.GetUser("Admin")
            mpoImage = poUserMgr.CreateUserPicture(Me.Handle.ToInt32, oRect, poAdmin.ID)

            Label1.Text = poAdmin.FullName

            'Invalidate the window to trigger a call to OnPaintPic
            Me.Invalidate()

        Catch ex As System.Runtime.InteropServices.COMException
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    'Displays the Admin user's picture when the form is repainted
    Private Sub OnPaintPic(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        If Not mpoImage Is Nothing Then
            mpoImage.Paint(e.Graphics.GetHdc())
        End If
    End Sub

    'Called when the user hovers over the form label, Label1
    Private Sub OnMouseHoverName(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseHover

        Dim poVault As IEdmVault12
        poVault = New EdmVault5
        poVault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())

        Dim poUserMgr As IEdmUserMgr8
        poUserMgr = poVault.CreateUtility(EdmUtility.EdmUtil_UserMgr)

        'Get the screen coordinates of the label that displays the user name
        Dim pnt As System.Drawing.Point
        pnt.X = Label1.Left
        pnt.Y = Label1.Top
        pnt = Me.PointToScreen(pnt)

        'Create the bounding rectangle
        Dim oTrackRect As EdmRect
        oTrackRect.mlTop = pnt.Y
        oTrackRect.mlLeft = pnt.X
        oTrackRect.mlRight = oTrackRect.mlLeft + Label1.Width
        oTrackRect.mlBottom = oTrackRect.mlTop + Label1.Height

        'Display a popup window with the Admin user's information
        poUserMgr.ShowUserPopup(Me.Handle.ToInt32, oTrackRect, Label1.Text)
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(22, 164)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 10
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(25, 179)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(132, 21)
        Me.VaultsComboBox.TabIndex = 11
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(48, 214)
        Me.Button1.Margin = New System.Windows.Forms.Padding(2)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(101, 31)
        Me.Button1.TabIndex = 14
        Me.Button1.Text = "Get picture"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(22, 128)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(0, 13)
        Me.Label1.TabIndex = 15
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(235, 256)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "Form1"
        Me.Text = "Get Admin's picture"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Create Vault View Tab Add-in Example (C#)

This example shows how to create an add-in that adds a custom tab to the bottom panel of a vault view when it is opened in File Explorer.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Library > Class
Library (.NET Framework).
// 3. Type SWEPDMAddin1 in Name.
// 4.

For Location, click
... and navigate to the folder where to
create the project.
// 5. Select Framework.
// 6. Click Create.
// 7. Add
dependencies and safely pass arrays of structures.
// 8. Right-click the project name in the Solution Explorer and select Properties.
// 9. In the Properties window:
//    a. On the Application tab, click Assembly Information.
//    b. De-select Make assembly COM-Visible.
//    c. On the Build tab,
select Any CPU, de-select
Prefer 32-bit, and select
Register for COM interop.
//10. Save the project.
//11. Copy SWEPDMADDin1
code to a new class, SWEPDMAddin1.cs.
//12. Right-click the project and select Add > User Control.
//13. Type "UserControl1.cs" in Name and click Add.
//14. Copy UserControl1 code to the code behind
UserControl1.cs.
//15. Copy UserControl1.Designer code to
UserControl1.Designer.cs.
//16. To populate the GUID
    attribute in SWEPDMAddin1.cs:
//    a. Click Tools > Create GUID in the IDE.
//    b. Select GUID Format 5.
//    c. Click Copy.
//    d. Click Exit.
//    e. Populate Guid("")
in the code with the copied string.
//17. Copy a *.png file to the project folder.
//18. Right-click the project and select Add > Existing item.
//19. Select the *.png file and click Add.
//20. Right-click the *.png file in Solution Explorer and select
Exclude from Project.
//21. Replace the png_path in SWEPDMAddin1.cs with the full path
name of the *.png
//    you just added to the project.
//22. Click Build > Build Solution.
//23. Ensure you have a vault, a vault view, and a file in the vault.
//
// Postconditions:
// 1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
//    and log in as Admin.
// 2. Under vault_name, right-click Add-ins, and click New Add-in.
//    a. Navigate to the bin\Debug
directory of your SWEPDMAddin1 project.
//    b. Click SWEPDMAddin1.dll.
//    c. Click Open.
//    d. Click OK.
// 3. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
// 4. In the taskbar, click the Administration tool icon and click Log
Off > vault_name.
// 5. Open File Explorer on a view of vault_name:
//    a. Log in as Admin.
//    b. Click UserTab1 in
the bottom panel of the vault view.
//       One or more message boxes display. Click
OK in the message boxes.
//    c. Select a file in the vault.
//       The custom tab's text box is populated with the
name of the file.
//    d. Right-click the file in the vault.
//    e. Select Test menu item #1.
//    f. Click OK in the message box.
//---------------------------------------------------------------------------------------

//SWEPDMADDin1

using System;
using System.Collections.Generic;
using System.Diagnostics;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;

namespace SWEPDMAddin1
{
[Guid(""), ComVisible(true)]
public class SWPDMAddin : IEdmAddIn5
{
Dictionary<string, UserControl1> ControlMaps = new Dictionary<string, UserControl1>();
static long Identifier = 1;
public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{
//Add-in information
poInfo.mbsAddInName = "SWPDMAddin1";
poInfo.mbsCompany = "your_company_name";
poInfo.mbsDescription = "This add-in adds a tab to the bottom panel of the vault view before it is opened in File Explorer.
It also adds context-sensitive menu items to the right-click menus of files in
the vault.";
poInfo.mlAddInVersion = 1;

//Minimum Conisio version needed for .Net add-Ins is 6.4
poInfo.mlRequiredVersionMajor = 6;
poInfo.mlRequiredVersionMinor = 4;

//Adds context-sensitive menu items to the right-click menus of files in the vault
poCmdMgr.AddCmd(1, "Test menu item #1", (int)EdmMenuFlags.EdmMenu_Nothing, "", "", 0, 0);
poCmdMgr.AddCmd(1, "Test menu item #2", (int)EdmMenuFlags.EdmMenu_Nothing, "", "", 0, 0);

AddAllHooks(poCmdMgr);

}

public void OnCmd(ref EPDM.Interop.epdm.EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
Debug.Print("Command Type: " + poCmd.meCmdType.ToString() + "\n  " + System.DateTime.Now.ToString());

IEdmVault5 edmVault = poCmd.mpoVault as IEdmVault5;

try
{
switch (poCmd.meCmdType)

{
case EdmCmdType.EdmCmd_CardButton:
break;
case EdmCmdType.EdmCmd_CardInput:
break;
case EdmCmdType.EdmCmd_CardListSrc:
break;
case EdmCmdType.EdmCmd_InstallAddIn:
break;
case EdmCmdType.EdmCmd_Menu:
//File's right-click menu item is selected
edmVault.MsgBox(0, " Context-sensitive menu item selected", EdmMBoxType.EdmMbt_OKOnly, "PDM Pro add-in");
break;
case EdmCmdType.EdmCmd_PostAdd:
break;
case EdmCmdType.EdmCmd_PostAddFolder:
break;
case EdmCmdType.EdmCmd_PostCopy:
break;
case EdmCmdType.EdmCmd_PostCopyFolder:
break;
case EdmCmdType.EdmCmd_PostDelete:
break;
case EdmCmdType.EdmCmd_PostDeleteFolder:
break;
case EdmCmdType.EdmCmd_PostGet:
break;
case EdmCmdType.EdmCmd_PostLock:
break;
case EdmCmdType.EdmCmd_PostMove:
break;
case EdmCmdType.EdmCmd_PostMoveFolder:
break;
case EdmCmdType.EdmCmd_PostRename:
break;
case EdmCmdType.EdmCmd_PostRenameFolder:
break;
case EdmCmdType.EdmCmd_PostShare:
break;
case EdmCmdType.EdmCmd_PostState:
break;
case EdmCmdType.EdmCmd_PostUndoLock:
break;
case EdmCmdType.EdmCmd_PostUnlock:
break;
case EdmCmdType.EdmCmd_PreAdd:
break;
case EdmCmdType.EdmCmd_PreAddFolder:
break;
case EdmCmdType.EdmCmd_PreCopy:
break;
case EdmCmdType.EdmCmd_PreCopyFolder:
break;
case EdmCmdType.EdmCmd_PreDelete:
break;
case EdmCmdType.EdmCmd_PreDeleteFolder:
break;
case EdmCmdType.EdmCmd_PreGet:
break;
case EdmCmdType.EdmCmd_PreLock:
break;
case EdmCmdType.EdmCmd_PreMove:
break;
case EdmCmdType.EdmCmd_PreMoveFolder:
break;
case EdmCmdType.EdmCmd_PreRename:
break;
case EdmCmdType.EdmCmd_PreRenameFolder:
break;
case EdmCmdType.EdmCmd_PreShare:
break;
case EdmCmdType.EdmCmd_PreState:
break;
case EdmCmdType.EdmCmd_PreUndoLock:
break;
case EdmCmdType.EdmCmd_PreUnlock:
break;
case EdmCmdType.EdmCmd_SerialNo:
break;
case EdmCmdType.EdmCmd_UninstallAddIn:
break;
case EdmCmdType.EdmCmd_TaskDetails:
break;
case EdmCmdType.EdmCmd_PreExploreInit:
{
// File Explorer is about to be opened
IEdmCmdMgr6 poCmdMgr6 = poCmd.mpoExtra as IEdmCmdMgr6;
UserControl1 myControl1 = new UserControl1();
// Add a custom tab to the bottom panel of the vault view
poCmdMgr6.AddVaultViewTab(myControl1.Handle.ToInt64(), "UserTab1", @"png_path", "UserTab1", Identifier.ToString());
ControlMaps.Add(Identifier.ToString(), myControl1);
Identifier++;

break;
}
case EdmCmdType.EdmCmd_SelectItem:
{
// If a file is selected, populate the textBox1 control
EdmCmdData poobject = (EdmCmdData)ppoData.GetValue(0);
string Id = poobject.mbsStrData3;
UserControl1 myControl;
bool exist = ControlMaps.TryGetValue(Id, out myControl);
if (exist)
{
if (poobject.mbsStrData1.Length != 0)
myControl.SetFileName(poobject.mbsStrData1);
else
myControl.SetFileName(poobject.mbsStrData2);
}
break;
}

case EdmCmdType.EdmCmd_DeSelectItem:
{
// If a file is de-selected, empty the textBox1 control
EdmCmdData poobject = (EdmCmdData)ppoData.GetValue(0);
string Id = poobject.mbsStrData3;
UserControl1 myControl;
bool exist = ControlMaps.TryGetValue(Id, out myControl);
if (exist)
{
myControl.SetFileName("");
}
break;
}
case EdmCmdType.EdmCmd_UserTabDelete:
{
// When
File Explorer is closed, this event is called; perform cleanup here
EdmCmdData poobject = (EdmCmdData)ppoData.GetValue(0);
string Id = poobject.mbsStrData3;
ControlMaps.Remove(Id);
break;
}
case EdmCmdType.EdmCmd_ActivateAPITab:
{
// UserTab1 is selected
edmVault.MsgBox(0, " UserTab1 selected", EdmMBoxType.EdmMbt_OKOnly, "PDM Pro add-in");
break;
}
default:
break;
}
}
catch (COMException exp)
{
string errorName, errorDesc;
edmVault.GetErrorString(exp.ErrorCode, out errorName, out errorDesc);
edmVault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);
}
}

void AddAllHooks(IEdmCmdMgr5 poCmdMgr)
{
poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardButton, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardInput, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_CardListSrc, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_InstallAddIn, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_Menu, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAdd, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAddFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostCopy, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostCopyFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostDelete, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostDeleteFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostGet, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostLock, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostMove, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostMoveFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostRename, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostRenameFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostShare, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostState, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostUndoLock, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostUnlock, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreAdd, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreAddFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreCopy, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreCopyFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreDeleteFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreGet, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreLock, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreMove, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreMoveFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreRename, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreRenameFolder, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreShare, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreState, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreUndoLock, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreUnlock, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_SerialNo, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreExploreInit, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_UninstallAddIn, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskDetails, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_SelectItem, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_DeSelectItem, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_ActivateAPITab, null);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_UserTabDelete, null);

}
}

}

Back to top

//UserControl1.Designer

namespace SWEPDMAddin1
{
    partial class UserControl1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(128, 42);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(414, 20);
            this.textBox1.TabIndex = 4;
            //
            // label1
            //
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(3, 0);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(54, 13);
            this.label1.TabIndex = 5;
            this.label1.Text = "UserTab1";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(47, 45);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(75, 13);
            this.label2.TabIndex = 6;
            this.label2.Text = "Selected Item ";
            //
            // UserControl1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.textBox1);
            this.Name = "UserControl1";
            this.Size = new System.Drawing.Size(559, 243);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
    }
}

Back to top

//UserControl1

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace SWEPDMAddin1
{
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        public void SetFileName(string strFileName)
        {

            textBox1.Text = strFileName;
        }

    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Destroy Deleted Files in Vault Example (C#)

This example shows how to create an application that displays a form in which a user can select the vault in whose root folder and subfolders all deleted files will be permanently destroyed. The user must have permission to delete files.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

IMPORTANT: Do not recreate and run this example if you do not want to destroy all deleted files in the root folder and subfolders in the selected vault. Instead, SOLIDWORKS PDM Professional suggests that you review the code to understand how you can programmatically destroy deleted files in the root folder and subfolders of a vault.

//--------------------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//  3. Type DestroyDeletedItems in Project name.
//  4.

For Location, click ... and navigate to the folder where to
create the project.
//  5. Click Next.
//  6. Select Framework.
//  7. Click
Create.
//  8. Click Show All Files in the Solution Explorer
toolbar and expand
//     Form1.cs in the Solution Explorer.
//  9. Replace the code in Form1.cs with this code.
// 10. Replace the code in Form1.Designer.cs with
this code.
// 11.

Add dependencies and
safely pass arrays of structures.
// 12. Ensure that the namespaces specified in all of the *.cs files match
//     the
project name.
// 13. Delete one or more checked-in files from the root folder
of your vault.
// 14. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Destroy Deleted Files dialog.
//  2. Select a vault.
//  3. Optionally select the Include all subfolders check box.
//  4. Click the Destroy deleted files button.
//     A message box pops up informing you that:
//     * No deleted files were found to destroy.
//       - or -
//     * The deleted files were destroyed.
//  5. Click OK in the message box.
//  6. Close the Destroy Deleted Files dialog.
//--------------------------------------------------------------------------------------

//Form1.cs

using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace DestroyDeletedItems
{

    public partial class Form1 : Form

    {

        void DestroyDeletedItems_Load(object sender, EventArgs e)

        {

            try

            {

                //Declare and create an instance of IEdmVault5

                IEdmVault5 vault1 = new EdmVault5();

                //Cast IEdmVault5 to IEdmVault8

                IEdmVault8 vault = (IEdmVault8)vault1;

                EdmViewInfo[] Views = null;

                //Populate the form with the names of

                //the vaults on the computer

                vault.GetVaultViews(out Views, false);

                VaultsComboBox.Items.Clear();

                foreach (EdmViewInfo View in Views)

                {

                    VaultsComboBox.Items.Add(View.mbsVaultName);

                }

                if (VaultsComboBox.Items.Count > 0)

                {

                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];

                }

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        void DestroyDeletedItemsButton_Click(object sender, EventArgs e)

        {

            try

            {

                //Declare and create an instance of IEdmVault5

                IEdmVault5 vault = new EdmVault5();

                //Log into selected vault as the current user

                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                //Check to see if deleted files should be

                //destroyed in all the subfolders

                bool aRecursive = false;

                if (CheckBox_Recursive.Checked)

                {

                    aRecursive = true;

                }

                EdmDeletedItems[] poDeletedItems = null;

                EdmFileInfo[] ppoDestroyedItems = null;

                EdmBatchDelErrInfo[] poErrors = null;

                IEdmFolder5 DeletedFolder1 = default(IEdmFolder5);

                //Get the root folder of the vault

                DeletedFolder1 = vault.RootFolder;

                IEdmFolder13 DeletedFolder = (IEdmFolder13)DeletedFolder1;

                DeletedFolder.GetDeletedItems(out poDeletedItems, true);

                //Destroy all deleted files in the root folder and

                //subfolders, if the check box is selected on the form

                DeletedFolder.DestroyDeletedItems2(poDeletedItems, out ppoDestroyedItems, out poErrors);

                //If any deleted files found, display their names in a message box

                string msg = null;

                int idx = 0;

                foreach (EdmFileInfo ppoDestroyedItem in ppoDestroyedItems)

                {

                    string row = null;

                    row = "\nDocumentID: " + Convert.ToString(ppoDestroyedItem.mlFileID) + ", FolderID: " + Convert.ToString(ppoDestroyedItem.mlFolderID) + ", File path: " + ppoDestroyedItem.mbsPath;

                    if (ppoDestroyedItem.mhResult == 0)

                    {

                        row = row + "\nStatus: OK\n";

                    }

                    else

                    {

                        EdmBatchDelErrInfo[] poError = null;

                        row = row + " status: Failed=" + "HRESULT = 0x" + Convert.ToString(poError[idx].mlErrorCode);

                        idx += 1;

                    }

                    msg = msg + row;

                }

                if (msg == null)

                {

                    MessageBox.Show("No deleted files were found in the selected vault's root folder or \n subfolders.");

                }

                else

                {

                    MessageBox.Show("The status for each destroyed file is:\n" + msg);

                }

            }

            catch (System.Runtime.InteropServices.COMException ex)

            {

                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

        void CheckBox_Recursive_CheckedChanged(object sender, EventArgs e)

        {

        }

        private void label1_Click(object sender, EventArgs e)

        {

        }

    }

}

Back to top

//Form1.Designer.cs

namespace DestroyDeletedItems
{

partial class Form1

    {

        /// <summary>

        ///  Required designer variable.

        /// </summary>

        private System.ComponentModel.IContainer components = null;

        /// <summary>

        ///  Clean up any resources being used.

        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }

        #region Windows Form Designer generated code

        /// <summary>

        ///  Required method for Designer support - do not modify

        ///  the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()

        {

            this.components = new System.ComponentModel.Container();

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(800, 450);

            this.Text = "Form1";

            this.label1 = new System.Windows.Forms.Label();

            this.VaultsLabel = new System.Windows.Forms.Label();

            this.VaultsComboBox = new System.Windows.Forms.ComboBox();

            this.DestroyDeletedItemsButton = new System.Windows.Forms.Button();

            this.CheckBox_Recursive = new System.Windows.Forms.CheckBox();

            this.SuspendLayout();

            //

            // label1

            //

            this.label1.Location = new System.Drawing.Point(32, 19);

            this.label1.Name = "label1";

            this.label1.Size = new System.Drawing.Size(187, 79);

            this.label1.TabIndex = 0;

            this.label1.Text = "This application destroys all deleted files in the root folder of the selected va" +

            "ult and also allows you to destroy all deleted files in all of the selected vaul" +

            "t\'s subfolders.";

            this.label1.Click += new System.EventHandler(this.label1_Click);

            //

            // VaultsLabel

            //

            this.VaultsLabel.AutoSize = true;

            this.VaultsLabel.Location = new System.Drawing.Point(35, 113);

            this.VaultsLabel.Name = "VaultsLabel";

            this.VaultsLabel.Size = new System.Drawing.Size(75, 13);

            this.VaultsLabel.TabIndex = 1;

            this.VaultsLabel.Text = "Select a vault:";

            //

            // VaultsComboBox

            //

            this.VaultsComboBox.FormattingEnabled = true;

            this.VaultsComboBox.Location = new System.Drawing.Point(35, 130);

            this.VaultsComboBox.Name = "VaultsComboBox";

            this.VaultsComboBox.Size = new System.Drawing.Size(184, 21);

            this.VaultsComboBox.TabIndex = 2;

            //

            // DestroyDeletedItemsButton

            //

            this.DestroyDeletedItemsButton.Location = new System.Drawing.Point(35, 229);

            this.DestroyDeletedItemsButton.Name = "DestroyDeletedItemsButton";

            this.DestroyDeletedItemsButton.Size = new System.Drawing.Size(184, 23);

            this.DestroyDeletedItemsButton.TabIndex = 4;

            this.DestroyDeletedItemsButton.Text = "Destroy deleted files";

            this.DestroyDeletedItemsButton.UseVisualStyleBackColor = true;

            this.DestroyDeletedItemsButton.Click += new System.EventHandler(this.DestroyDeletedItemsButton_Click);

            //

            // CheckBox_Recursive

            //

            this.CheckBox_Recursive.AutoSize = true;

            this.CheckBox_Recursive.Location = new System.Drawing.Point(38, 174);

            this.CheckBox_Recursive.Name = "CheckBox_Recursive";

            this.CheckBox_Recursive.Size = new System.Drawing.Size(125, 17);

            this.CheckBox_Recursive.TabIndex = 5;

            this.CheckBox_Recursive.Text = "Include all subfolders";

            this.CheckBox_Recursive.UseVisualStyleBackColor = true;

            this.CheckBox_Recursive.CheckedChanged += new System.EventHandler(this.CheckBox_Recursive_CheckedChanged);

            //

            // Form1

            //

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(254, 274);

            this.Controls.Add(this.CheckBox_Recursive);

            this.Controls.Add(this.DestroyDeletedItemsButton);

            this.Controls.Add(this.VaultsComboBox);

            this.Controls.Add(this.VaultsLabel);

            this.Controls.Add(this.label1);

            this.Name = "Form1";

            this.Text = "Destroy Deleted Files";

            this.Load += new System.EventHandler(this.DestroyDeletedItems_Load);

            this.ResumeLayout(false);

            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;

        private System.Windows.Forms.Label VaultsLabel;

        private System.Windows.Forms.ComboBox VaultsComboBox;

        private System.Windows.Forms.Button DestroyDeletedItemsButton;

        private System.Windows.Forms.CheckBox CheckBox_Recursive;

    }

}

Back to top


SOLIDWORKS PDM Professional API Help

Destroy Deleted Files in Vault Example (VB.NET)

This example shows how to create an application that displays a form in which a user can select the vault in whose root folder and subfolders all deleted files will be permanently destroyed. The user must have permission to delete files.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

IMPORTANT: Do not recreate and run this example if you do not want to destroy all deleted files in the root folder and subfolders in the selected vault. Instead, SOLIDWORKS PDM Professional suggests that you review the code to understand how you can programmatically destroy deleted files in the root folder and subfolders of a vault.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type the name of your project in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
' Form1.vb in the Solution Explorer.
' 9. Replace the code in Form1.vb with this code.
' 10. Replace the code in Form1.Designer.vb with this code.
' 11. Add dependencies and safely pass arrays of structures .
' 12. Delete one or more checked-in files in the root folder of your vault.
' 13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Destroy Deleted Files dialog.
'  2. Select a vault.
'  3. Optionally select the Include all subfolders check box.
'  4. Click the Destroy deleted files button.
'     A message box pops up informing you that:
'     * No deleted files were found to destroy.
'       - or -
'     * The deleted files were destroyed.
'  5. Click OK in the message box.
'  6. Close the Destroy Deleted Files dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports EPDM.Interop.epdm

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
'Declare and create an instance of IEdmVault5
'Cast IEdmVault5 to IEdmVault8
Dim vault As IEdmVault8 = New EdmVault5
Dim Views() As EdmViewInfo = Nothing

'Populate the form with the names of
'the vaults on the computer
vault.GetVaultViews(Views, False)
VaultsComboBox.Items.Clear()
For Each View As EdmViewInfo In Views
VaultsComboBox.Items.Add(View.mbsVaultName)
Next
If VaultsComboBox.Items.Count > 0 Then
VaultsComboBox.Text = VaultsComboBox.Items(0)
End If

Catch ex As Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbCrLf + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub DestroyDeletedItemsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DestroyDeletedItemsButton.Click

Try
'Declare and create an instance of IEdmVault5
Dim vault As IEdmVault5 = New EdmVault5()

'Log into selected vault as the current user
vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())

'Check to see if deleted files should be
'destroyed in all subfolders
Dim aRecursive As Boolean = False
If CheckBox_Recursive.Checked Then
aRecursive = True
End If

Dim poDeletedItems() As EdmDeletedItems = Nothing
Dim ppoDestroyedItems() As EdmFileInfo = Nothing
Dim poErrors() As EdmBatchDelErrInfo = Nothing
Dim DeletedFolder As IEdmFolder13

'Get the root folder of the vault
DeletedFolder = vault.RootFolder

DeletedFolder.GetDeletedItems(poDeletedItems, aRecursive)

DeletedFolder.DestroyDeletedItems2(poDeletedItems, ppoDestroyedItems, poErrors)

'Destroy all deleted files in the root folder and
'subfolders, if the check box is selected on the form
Dim idx As Integer
idx = LBound(ppoDestroyedItems)
Dim msg As String = Nothing

'If any deleted files found, display their names in a message box
While idx <= UBound(ppoDestroyedItems)
Dim row As String
row = "DocumentID: " + CStr(ppoDestroyedItems(idx).mlFileID) + ", FolderID: " + _
CStr(ppoDestroyedItems(idx).mlFolderID) + ", File path: " + ppoDestroyedItems(idx).mbsPath + vbCrLf
If ppoDestroyedItems(idx).mhResult = 0 Then
row = row + "Status: OK" + vbCrLf
Else
row = row + " status: Failed=" + "HRESULT = 0x" + CStr(poErrors(idx).mlErrorCode)
End If
idx = idx + 1
msg = msg + row + vbCrLf
End While

If msg Is Nothing Then
MessageBox.Show("No deleted files were found in the selected vault's root folder or subfolders.")
Else
MessageBox.Show("The status for each destroyed file is: " + vbCrLf + vbCrLf + msg)
End If

Catch ex As Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbCrLf + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub VaultsLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub CheckBox_Recursive_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox_Recursive.CheckedChanged

End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.CheckBox_Recursive = New System.Windows.Forms.CheckBox()
        Me.DestroyDeletedItemsButton = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(69, 133)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(139, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'CheckBox_Recursive
        '
        Me.CheckBox_Recursive.AutoSize = True
        Me.CheckBox_Recursive.Location = New System.Drawing.Point(69, 181)
        Me.CheckBox_Recursive.Name = "CheckBox_Recursive"
        Me.CheckBox_Recursive.Size = New System.Drawing.Size(125, 17)
        Me.CheckBox_Recursive.TabIndex = 3
        Me.CheckBox_Recursive.Text = "Include all subfolders"
        Me.CheckBox_Recursive.UseVisualStyleBackColor = True
        '
        'DestroyDeletedItemsButton
        '
        Me.DestroyDeletedItemsButton.Location = New System.Drawing.Point(69, 218)
        Me.DestroyDeletedItemsButton.Name = "DestroyDeletedItemsButton"
        Me.DestroyDeletedItemsButton.Size = New System.Drawing.Size(139, 23)
        Me.DestroyDeletedItemsButton.TabIndex = 4
        Me.DestroyDeletedItemsButton.Text = "Destroy deleted files"
        Me.DestroyDeletedItemsButton.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(66, 20)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(171, 68)
        Me.Label1.TabIndex = 5
        Me.Label1.Text = "This application destroys all deleted files in the root folder of the selected va" & _
            "ult and also allows you to destroy all deleted files in all of the selected vaul" & _
            "t's subfolders."
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(66, 108)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(75, 13)
        Me.VaultsLabel.TabIndex = 6
        Me.VaultsLabel.Text = "Select a vault:"
        '
        'DestroyDeletedItems
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 262)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.DestroyDeletedItemsButton)
        Me.Controls.Add(Me.CheckBox_Recursive)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Name = "DestroyDeletedItems"
        Me.Text = "Destroy Deleted Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents CheckBox_Recursive As System.Windows.Forms.CheckBox
    Friend WithEvents DestroyDeletedItemsButton As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label

End Class

Back to top


Display Menu of Add-ins Commands Example (VB.NET)

SOLIDWORKS PDM Professional API Help

Display Menu of Commands Example (VB.NET)

This example shows how to display a menu of commands, including commands registered by any SOLIDWORKS PDM Professional add-ins and the Administrate Add-ins command.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'--------------------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Console > Console App (.NET Framework).
'     b. Type MenuVBNET in Project name.
'     c. For Location, click ... and navigate to the folder where to create the project.
'     d. Select Framework.
'     e. Click Create.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Right-click project and then select Add > Reference... > Assemblies > System.Windows.Forms.
'  4. Replace the code in Module1.vb with this code.
'  5. Replace ACME_LAB in the code with the name of a valid vault view.
'  6. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the command window.
'     a. Click anywhere on the desktop.
'     b. Displays the menu in the upper-left corner of the desktop.
'     c. Click First Command in the menu.
'     d. Click OK to close the message box.
'     e. Click the command window and press any key.
'     f. Closes the command window and exits the application.
' 2. Click Debug > Start Debugging or press F5 again.
'     a. Displays the command window.
'     b. Click anywhere on the desktop.
'     c. Displays the menu in the upper-left corner of the desktop.
'     d. Click the Administrate Add-ins in the menu.
'        1. Displays the Administrate Add-ins dialog box.
'        2. Click Cancel to close the dialog box.
'     e. Click the command window and press any key.
'     f. Closes the command window and exits the application.
'--------------------------------------------------------------------------------------

'Module1.vb
Imports EPDM.Interop.epdm
Imports System.Windows.Forms

Module Module1

    Dim vault As EdmVault5
    Dim frmParent As Form

    Sub Main()
        Try
            'Create a vault interface
            vault = New EdmVault5()

            'Log into vault
            vault.LoginAuto("ACME_LAB", 0)

            'Show menu
            ShowMenu(vault)

        Catch ex As System.Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        Console.WriteLine()
        Console.WriteLine("Press any key to exit.")
        Console.ReadKey()

    End Sub

    Private Sub ShowMenu(ByVal vault As IEdmVault12)
        'Create a context-sensitive menu
        'using Windows InsertMenu function
        Dim mnu As System.Windows.Forms.ContextMenu
        mnu = New System.Windows.Forms.ContextMenu

        InsertMenu(mnu.Handle, 0, 0, 100, "First Command")
        InsertMenu(mnu.Handle, 0, 0, 101, "Second Command")
        InsertMenu(mnu.Handle, 0, 0, 102, "Third Command")

        'Create a selection list with all files in the root folder
        Dim selList As IEdmSelectionList6
        selList = New EdmSelectionList5

        Dim folder As IEdmFolder6
        folder = vault.RootFolder
        Dim pos As IEdmPos5
        pos = folder.GetFirstFilePosition()
        While Not pos.IsNull
            Dim file As IEdmFile8
            file = folder.GetNextFile(pos)
            Dim obj As EdmSelectionObject
            obj.mbsPath = file.GetLocalPath(folder.ID)
            obj.meType = file.ObjectType
            obj.mlID = file.ID
            obj.mlProjectID = folder.ID
            selList.AddTail2(obj)
        End While

        'Add menu items for registered add-ins and add
        'the Administrate Add-ins command
        Dim count As Integer
        count = 0
        Dim startID As Integer
        startID = 200
        Dim menuCallback As IEdmMenu7
        menuCallback = vault.CreatePluginMenu2(mnu.Handle.ToInt32(), 3, startID, selList, CreateMenuFlags.Cmf_ContextMenu + CreateMenuFlags.Cmf_IncludeAdminReactors, count)

        'Display the menu using Windows TrackPopupMenu function
        Dim TPM_RETURNCMD As Integer
        TPM_RETURNCMD = 256
        Dim cmdID As Integer
        frmParent = New Form
        cmdID = TrackPopupMenu(mnu.Handle, TPM_RETURNCMD, frmParent.Left, frmParent.Top, 0, frmParent.Handle, 0)

        'Run the selected command
        Select Case cmdID
            Case 100
                MsgBox("First command")
            Case 101
                MsgBox("Second command")
            Case 102
                MsgBox("Third command")
            Case Else
                menuCallback.OnMenuItem2(cmdID, mnu.Handle.ToInt32(), vault.RootFolderID, selList)
        End Select
    End Sub

    Private Declare Function InsertMenu Lib "user32" Alias "InsertMenuA" _
    (ByVal hMenu As System.IntPtr, _
    ByVal uPosition As Integer, _
    ByVal uFlags As Integer, _
    ByVal uIDNewItem As System.IntPtr, _
    ByVal lpNewItem As String) As Boolean

    Private Declare Function TrackPopupMenu Lib "user32" Alias "TrackPopupMenu" _
    (ByVal hMenu As IntPtr, _
    ByVal uFlags As Integer, _
    ByVal x As Integer, _
    ByVal y As Integer, _
    ByVal nReserved As Integer, _
    ByVal hWnd As IntPtr, _
    ByVal prcRect As IntPtr) As Integer

End Module


Assembly Overview

EPDM.Interop.epdm Assembly
SOLIDWORKS PDM Professional API

Namespaces

Namespace | Description
EPDM.Interop.epdm | SOLIDWORKS PDM Professional API


Assembly Overview

EPDM.Interop.EPDMResultCode Assembly
SOLIDWORKS PDM Professional API

Namespaces

Namespace | Description
EPDM.Interop.EPDMResultCode | Success and error codes.


mbsFileName Field

mbsFileName Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInFileInfo Structure : mbsFileName Field

Contains the add-in file name.

Syntax

Visual Basic
Public mbsFileName As System.String
C#
public System.string mbsFileName
C++/CLI
public:
System.String^ mbsFileName

Field Value

File name, if the bsExtractPath argument to IEdmAddInMgr8::ExtractInstalledAddIn is specified, or the complete path to the file, if an extract folder is not specified

See Also

EdmAddInFileInfo Structure
EdmAddInFileInfo Members


mlEdmAddInFileInfoFlags Field

mlEdmAddInFileInfoFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInFileInfo Structure : mlEdmAddInFileInfoFlags Field

Add-in file information flags.

Syntax

Visual Basic
Public mlEdmAddInFileInfoFlags As System.Integer
C#
public System.int mlEdmAddInFileInfoFlags
C++/CLI
public:
System.int mlEdmAddInFileInfoFlags

Field Value

Combination of EdmAddInFileInfoFlags bits.

See Also

EdmAddInFileInfo Structure
EdmAddInFileInfo Members


EdmAddInInfo Structure Fields

EdmAddInInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInInfo Structure

For a list of all members of this type, see EdmAddInInfo members.

Public Fields

 | Name | Description
public Field | mbsAddInName | Name of your add-in.
public Field | mbsCompany | Name of your company.
public Field | mbsDescription | Description, purpose, or use of your add-in.
public Field | mlAddInVersion | Version of your add-in.
public Field | mlRequiredVersionMajor | Required SOLIDWORKS PDM Professional major version.
public Field | mlRequiredVersionMinor | Required SOLIDWORKS PDM Professional minor version.
Top

See Also

EdmAddInInfo Structure
EPDM.Interop.epdm Namespace


EdmAddInInfo Structure Members

EdmAddInInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmAddInInfo Structure

The following tables list the members exposed by EdmAddInInfo.

Public Fields

 | Name | Description
public Field | mbsAddInName | Name of your add-in.
public Field | mbsCompany | Name of your company.
public Field | mbsDescription | Description, purpose, or use of your add-in.
public Field | mlAddInVersion | Version of your add-in.
public Field | mlRequiredVersionMajor | Required SOLIDWORKS PDM Professional major version.
public Field | mlRequiredVersionMinor | Required SOLIDWORKS PDM Professional minor version.
Top

See Also

EdmAddInInfo Structure
EPDM.Interop.epdm Namespace


mbsAddInName Field

mbsAddInName Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo Structure : mbsAddInName Field

Name of your add-in.

Syntax

Visual Basic
Public mbsAddInName As System.String
C#
public System.string mbsAddInName
C++/CLI
public:
System.String^ mbsAddInName

See Also

EdmAddInInfo Structure
EdmAddInInfo Members


mbsCompany Field

mbsCompany Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo Structure : mbsCompany Field

Name of your company.

Syntax

Visual Basic
Public mbsCompany As System.String
C#
public System.string mbsCompany
C++/CLI
public:
System.String^ mbsCompany

See Also

EdmAddInInfo Structure
EdmAddInInfo Members


mbsDescription Field

mbsDescription Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo Structure : mbsDescription Field

Description, purpose, or use of your add-in.

Syntax

Visual Basic
Public mbsDescription As System.String
C#
public System.string mbsDescription
C++/CLI
public:
System.String^ mbsDescription

See Also

EdmAddInInfo Structure
EdmAddInInfo Members


mlAddInVersion Field

mlAddInVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo Structure : mlAddInVersion Field

Version of your add-in.

Syntax

Visual Basic
Public mlAddInVersion As System.Integer
C#
public System.int mlAddInVersion
C++/CLI
public:
System.int mlAddInVersion

See Also

EdmAddInInfo Structure
EdmAddInInfo Members


mlRequiredVersionMajor Field

mlRequiredVersionMajor Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo Structure : mlRequiredVersionMajor Field

Required SOLIDWORKS PDM Professional major version.

Syntax

Visual Basic
Public mlRequiredVersionMajor As System.Integer
C#
public System.int mlRequiredVersionMajor
C++/CLI
public:
System.int mlRequiredVersionMajor

See Also

EdmAddInInfo Structure
EdmAddInInfo Members


mlRequiredVersionMinor Field

mlRequiredVersionMinor Field
[image]
EPDM.Interop.epdm Namespace > EdmAddInInfo Structure : mlRequiredVersionMinor Field

Required SOLIDWORKS PDM Professional minor version.

Syntax

Visual Basic
Public mlRequiredVersionMinor As System.Integer
C#
public System.int mlRequiredVersionMinor
C++/CLI
public:
System.int mlRequiredVersionMinor

See Also

EdmAddInInfo Structure
EdmAddInInfo Members


EdmBatchError Structure Fields

EdmBatchError Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBatchError Structure

For a list of all members of this type, see EdmBatchError members.

Public Fields

 | Name | Description
public Field | mlErrorCode | Error code.
public Field | mlFileID | ID of the file that caused the error.
public Field | mlVariableID | ID of variable that caused the error.
Top

See Also

EdmBatchError Structure
EPDM.Interop.epdm Namespace


EdmBatchError Structure Members

EdmBatchError Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBatchError Structure

The following tables list the members exposed by EdmBatchError.

Public Fields

 | Name | Description
public Field | mlErrorCode | Error code.
public Field | mlFileID | ID of the file that caused the error.
public Field | mlVariableID | ID of variable that caused the error.
Top

See Also

EdmBatchError Structure
EPDM.Interop.epdm Namespace


mlErrorCode Field

mlErrorCode Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError Structure : mlErrorCode Field

Error code.

Syntax

Visual Basic
Public mlErrorCode As System.Integer
C#
public System.int mlErrorCode
C++/CLI
public:
System.int mlErrorCode

Remarks

Call IEdmVault5:GetErrorString to get the name and description of the error.

See Also

EdmBatchError Structure
EdmBatchError Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError Structure : mlFileID Field

ID of the file that caused the error.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

Field Value

0, if the error is not file-specific.

See Also

EdmBatchError Structure
EdmBatchError Members


mlVariableID Field

mlVariableID Field
[image]
EPDM.Interop.epdm Namespace > EdmBatchError Structure : mlVariableID Field

ID of variable that caused the error.

Syntax

Visual Basic
Public mlVariableID As System.Integer
C#
public System.int mlVariableID
C++/CLI
public:
System.int mlVariableID

Field Value

0, if the error is not variable-specific.

See Also

EdmBatchError Structure
EdmBatchError Members


mbsCaption Field

mbsCaption Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : mbsCaption Field

Column caption.

Syntax

Visual Basic
Public mbsCaption As System.String
C#
public System.string mbsCaption
C++/CLI
public:
System.String^ mbsCaption

See Also

EdmBomColumn Structure
EdmBomColumn Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : meType Field

Type of data to show in this column.

Syntax

Visual Basic
Public meType As EdmBomColumnType
C#
public EdmBomColumnType meType
C++/CLI
public:
EdmBomColumnType meType

Field Value

Type as defined in EdmBomColumnType

See Also

EdmBomColumn Structure
EdmBomColumn Members


mlColumnID Field

mlColumnID Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : mlColumnID Field

Unique ID of the column.

Syntax

Visual Basic
Public mlColumnID As System.Integer
C#
public System.int mlColumnID
C++/CLI
public:
System.int mlColumnID

See Also

EdmBomColumn Structure
EdmBomColumn Members


mlFlags Field

mlFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : mlFlags Field

Column flags.

Syntax

Visual Basic
Public mlFlags As System.Integer
C#
public System.int mlFlags
C++/CLI
public:
System.int mlFlags

See Also

EdmBomColumn Structure
EdmBomColumn Members


mlVariableID Field

mlVariableID Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : mlVariableID Field

ID of the variable displayed in the column.

Syntax

Visual Basic
Public mlVariableID As System.Integer
C#
public System.int mlVariableID
C++/CLI
public:
System.int mlVariableID

See Also

EdmBomColumn Structure
EdmBomColumn Members


mlVariableType Field

mlVariableType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : mlVariableType Field

Type of variable displayed in the column.

Syntax

Visual Basic
Public mlVariableType As System.Integer
C#
public System.int mlVariableType
C++/CLI
public:
System.int mlVariableType

Field Value

Type as defined in EdmVariableType

See Also

EdmBomColumn Structure
EdmBomColumn Members


mlWidth Field

mlWidth Field
[image]
EPDM.Interop.epdm Namespace > EdmBomColumn Structure : mlWidth Field

Default width of the column.

Syntax

Visual Basic
Public mlWidth As System.Integer
C#
public System.int mlWidth
C++/CLI
public:
System.int mlWidth

See Also

EdmBomColumn Structure
EdmBomColumn Members


EdmBomLayout Structure Fields

EdmBomLayout Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomLayout Structure

For a list of all members of this type, see EdmBomLayout members.

Public Fields

 | Name | Description
public Field | mbsLayoutName | Layout name.
public Field | mlLayoutID | Unique ID of the BOM layout.
Top

See Also

EdmBomLayout Structure
EPDM.Interop.epdm Namespace


EdmBomLayout Structure Members

EdmBomLayout Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBomLayout Structure

The following tables list the members exposed by EdmBomLayout.

Public Fields

 | Name | Description
public Field | mbsLayoutName | Layout name.
public Field | mlLayoutID | Unique ID of the BOM layout.
Top

See Also

EdmBomLayout Structure
EPDM.Interop.epdm Namespace


mbsLayoutName Field

mbsLayoutName Field
[image]
EPDM.Interop.epdm Namespace > EdmBomLayout Structure : mbsLayoutName Field

Layout name.

Syntax

Visual Basic
Public mbsLayoutName As System.String
C#
public System.string mbsLayoutName
C++/CLI
public:
System.String^ mbsLayoutName

See Also

EdmBomLayout Structure
EdmBomLayout Members


mlLayoutID Field

mlLayoutID Field
[image]
EPDM.Interop.epdm Namespace > EdmBomLayout Structure : mlLayoutID Field

Unique ID of the BOM layout.

Syntax

Visual Basic
Public mlLayoutID As System.Integer
C#
public System.int mlLayoutID
C++/CLI
public:
System.int mlLayoutID

See Also

EdmBomLayout Structure
EdmBomLayout Members


mbsComment Field

mbsComment Field
[image]
EPDM.Interop.epdm Namespace > EdmBomVersion Structure : mbsComment Field

Comment entered by the user.

Syntax

Visual Basic
Public mbsComment As System.String
C#
public System.string mbsComment
C++/CLI
public:
System.String^ mbsComment

See Also

EdmBomVersion Structure
EdmBomVersion Members


mbsTag Field

mbsTag Field
[image]
EPDM.Interop.epdm Namespace > EdmBomVersion Structure : mbsTag Field

Label or revision name.

Syntax

Visual Basic
Public mbsTag As System.String
C#
public System.string mbsTag
C++/CLI
public:
System.String^ mbsTag

See Also

EdmBomVersion Structure
EdmBomVersion Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmBomVersion Structure : meType Field

Type of BOM version.

Syntax

Visual Basic
Public meType As EdmBomVersionType
C#
public EdmBomVersionType meType
C++/CLI
public:
EdmBomVersionType meType

Field Value

Type as defined in EdmBomVersionType

See Also

EdmBomVersion Structure
EdmBomVersion Members


mlVersion Field

mlVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmBomVersion Structure : mlVersion Field

Version number.

Syntax

Visual Basic
Public mlVersion As System.Integer
C#
public System.int mlVersion
C++/CLI
public:
System.int mlVersion

See Also

EdmBomVersion Structure
EdmBomVersion Members


moDate Field

moDate Field
[image]
EPDM.Interop.epdm Namespace > EdmBomVersion Structure : moDate Field

Time when the version, revision, or label was created.

Syntax

Visual Basic
Public moDate As System.Date
C#
public System.DateTime moDate
C++/CLI
public:
System.DateTime moDate

See Also

EdmBomVersion Structure
EdmBomVersion Members


EdmBrokenParentInfo Structure

EdmBrokenParentInfo Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmBrokenParentInfo Structure

Contains broken parent information.

Syntax

Visual Basic
Public Structure EdmBrokenParentInfo
   Inherits System.ValueType
C#
public struct EdmBrokenParentInfo : System.ValueType
C++/CLI
public value class EdmBrokenParentInfo : public System.ValueType

Example

struct EdmBrokenParentInfo{
  integer mlParentFileID;
  integer mlParentFolderID;
  string mbsParentName;
  integer mlChildFileID;
  integer mlChildFolderID;
  string mbsChildName;
};

See Also

EdmBrokenParentInfo Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2013


EdmBrokenParentInfo Structure Fields

EdmBrokenParentInfo Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmBrokenParentInfo Structure

For a list of all members of this type, see EdmBrokenParentInfo members.

Public Fields

 | Name | Description
public Field | mbsChildName | Child name.
public Field | mbsParentName | Parent name.
public Field | mlChildFileID | File ID of child.
public Field | mlChildFolderID | Folder ID of child.
public Field | mlParentFileID | File ID of parent.
public Field | mlParentFolderID | Folder ID of parent.
Top

See Also

EdmBrokenParentInfo Structure
EPDM.Interop.epdm Namespace


EdmBrokenParentInfo Structure Members

EdmBrokenParentInfo Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmBrokenParentInfo Structure

The following tables list the members exposed by EdmBrokenParentInfo.

Public Fields

 | Name | Description
public Field | mbsChildName | Child name.
public Field | mbsParentName | Parent name.
public Field | mlChildFileID | File ID of child.
public Field | mlChildFolderID | Folder ID of child.
public Field | mlParentFileID | File ID of parent.
public Field | mlParentFolderID | Folder ID of parent.
Top

See Also

EdmBrokenParentInfo Structure
EPDM.Interop.epdm Namespace


mbsChildName Field

mbsChildName Field
[image]
EPDM.Interop.epdm Namespace > EdmBrokenParentInfo Structure : mbsChildName Field

Child name.

Syntax

Visual Basic
Public mbsChildName As System.String
C#
public System.string mbsChildName
C++/CLI
public:
System.String^ mbsChildName

See Also

EdmBrokenParentInfo Structure
EdmBrokenParentInfo Members


mbsParentName Field

mbsParentName Field
[image]
EPDM.Interop.epdm Namespace > EdmBrokenParentInfo Structure : mbsParentName Field

Parent name.

Syntax

Visual Basic
Public mbsParentName As System.String
C#
public System.string mbsParentName
C++/CLI
public:
System.String^ mbsParentName

See Also

EdmBrokenParentInfo Structure
EdmBrokenParentInfo Members


mlChildFileID Field

mlChildFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmBrokenParentInfo Structure : mlChildFileID Field

File ID of child.

Syntax

Visual Basic
Public mlChildFileID As System.Integer
C#
public System.int mlChildFileID
C++/CLI
public:
System.int mlChildFileID

See Also

EdmBrokenParentInfo Structure
EdmBrokenParentInfo Members


mlChildFolderID Field

mlChildFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmBrokenParentInfo Structure : mlChildFolderID Field

Folder ID of child.

Syntax

Visual Basic
Public mlChildFolderID As System.Integer
C#
public System.int mlChildFolderID
C++/CLI
public:
System.int mlChildFolderID

See Also

EdmBrokenParentInfo Structure
EdmBrokenParentInfo Members


mlParentFileID Field

mlParentFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmBrokenParentInfo Structure : mlParentFileID Field

File ID of parent.

Syntax

Visual Basic
Public mlParentFileID As System.Integer
C#
public System.int mlParentFileID
C++/CLI
public:
System.int mlParentFileID

See Also

EdmBrokenParentInfo Structure
EdmBrokenParentInfo Members


mlParentFolderID Field

mlParentFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmBrokenParentInfo Structure : mlParentFolderID Field

Folder ID of parent.

Syntax

Visual Basic
Public mlParentFolderID As System.Integer
C#
public System.int mlParentFolderID
C++/CLI
public:
System.int mlParentFolderID

See Also

EdmBrokenParentInfo Structure
EdmBrokenParentInfo Members


mbCancel Field

mbCancel Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mbCancel Field

Command cancel status.

Syntax

Visual Basic
Public mbCancel As System.Short
C#
public System.short mbCancel
C++/CLI
public:
System.short mbCancel

Field Value

True (1) to prevent a command from running using EdmCmd_PreXxxx hooks, false (0) to disallow canceling the command

See Also

EdmCmd Structure
EdmCmd Members


mbsComment Field

mbsComment Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mbsComment Field

Contains information specific to EdmCmd.meCmdType.

Syntax

Visual Basic
Public mbsComment As System.String
C#
public System.string mbsComment
C++/CLI
public:
System.String^ mbsComment

Field Value

Information specific to the type of command or hook

See Also

EdmCmd Structure
EdmCmd Members


mbSilentMode Field

mbSilentMode Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mbSilentMode Field

Silent mode status for the command.

Syntax

Visual Basic
Public mbSilentMode As System.Short
C#
public System.short mbSilentMode
C++/CLI
public:
System.short mbSilentMode

Field Value

True to execute asynchronously in the background, false to run interactively from the user interface

See Also

EdmCmd Structure
EdmCmd Members


meCmdType Field

meCmdType Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : meCmdType Field

Type of command.

Syntax

Visual Basic
Public meCmdType As EdmCmdType
C#
public EdmCmdType meCmdType
C++/CLI
public:
EdmCmdType meCmdType

Field Value

Type of command as defined in EdmCmdType

Remarks

To use this command in your add-in, you must subscribe to it using IEdmCmdMgr5::AddCmd and IEdmCmdMgr5::AddHook.

See Also

EdmCmd Structure
EdmCmd Members


mlCmdID Field

mlCmdID Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mlCmdID Field

Command ID.

Syntax

Visual Basic
Public mlCmdID As System.Integer
C#
public System.int mlCmdID
C++/CLI
public:
System.int mlCmdID

Remarks

For menu commands, this ID is specified by the ICmdID argument to IEdmCmdMgr5::AddCmd.

See Also

EdmCmd Structure
EdmCmd Members


mlCurrentFolderID Field

mlCurrentFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mlCurrentFolderID Field

ID of the active folder.

Syntax

Visual Basic
Public mlCurrentFolderID As System.Integer
C#
public System.int mlCurrentFolderID
C++/CLI
public:
System.int mlCurrentFolderID

Remarks

Used for menu commands (meCmdType = EdmCmdType.EdmCmd_Menu).

See Also

EdmCmd Structure
EdmCmd Members


mlEdmRefreshFlags Field

mlEdmRefreshFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mlEdmRefreshFlags Field

Controls how SOLIDWORKS PDM Professional refreshes File Explorer after a call to IEdmAddIn5::OnCmd.

Syntax

Visual Basic
Public mlEdmRefreshFlags As System.Integer
C#
public System.int mlEdmRefreshFlags
C++/CLI
public:
System.int mlEdmRefreshFlags

Field Value

Combination of EdmRefreshFlag bits

See Also

EdmCmd Structure
EdmCmd Members


mlParentWnd Field

mlParentWnd Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mlParentWnd Field

Window handle of the parent window.

Syntax

Visual Basic
Public mlParentWnd As System.Integer
C#
public System.int mlParentWnd
C++/CLI
public:
System.int mlParentWnd

Field Value

0, if no parent window

See Also

EdmCmd Structure
EdmCmd Members


mpoExtra Field

mpoExtra Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mpoExtra Field

Pointer to an object containing command-specific information.

Syntax

Visual Basic
Public mpoExtra As System.Object
C#
public System.object mpoExtra
C++/CLI
public:
System.Object^ mpoExtra

Field Value

Interface to a data object that contains command-specific information

Remarks

The type of interface returned depends on the type of command or hook. See EdmCmdData for more information.

See Also

EdmCmd Structure
EdmCmd Members


mpoVault Field

mpoVault Field
[image]
EPDM.Interop.epdm Namespace > EdmCmd Structure : mpoVault Field

Pointer to the file vault's interface.

Syntax

Visual Basic
Public mpoVault As System.Object
C#
public System.object mpoVault
C++/CLI
public:
System.Object^ mpoVault

Field Value

IEdmVault5

See Also

EdmCmd Structure
EdmCmd Members


mbsPath Field

mbsPath Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderInfo Structure : mbsPath Field

Complete path to the folder.

Syntax

Visual Basic
Public mbsPath As System.String
C#
public System.string mbsPath
C++/CLI
public:
System.String^ mbsPath

See Also

EdmFolderInfo Structure
EdmFolderInfo Members


mlEdmFolderInfoFlags Field

mlEdmFolderInfoFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderInfo Structure : mlEdmFolderInfoFlags Field

Non-critical errors about this folder.

Syntax

Visual Basic
Public mlEdmFolderInfoFlags As System.Integer
C#
public System.int mlEdmFolderInfoFlags
C++/CLI
public:
System.int mlEdmFolderInfoFlags

Field Value

Combination of EdmFolderInfoFlag bits.

See Also

EdmFolderInfo Structure
EdmFolderInfo Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderInfo Structure : mlFolderID Field

ID of the folder.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

See Also

EdmFolderInfo Structure
EdmFolderInfo Members


mlParam Field

mlParam Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderInfo Structure : mlParam Field

User-defined lParam argument passed to IEdmBatchAddFolders::AddFolder.

Syntax

Visual Basic
Public mlParam As System.Integer
C#
public System.int mlParam
C++/CLI
public:
System.int mlParam

See Also

EdmFolderInfo Structure
EdmFolderInfo Members


mpoFolder Field

mpoFolder Field
[image]
EPDM.Interop.epdm Namespace > EdmFolderInfo Structure : mpoFolder Field

Interface for the folder that was added to the batch using IEdmBatchAddFolders::AddFolder.

Syntax

Visual Basic
Public mpoFolder As IEdmFolder6
C#
public IEdmFolder6 mpoFolder
C++/CLI
public:
IEdmFolder6^ mpoFolder

Remarks

This member is valid only if you specify EdmBatchAddFolderFlag.Ebaff_GetInterface in IEdmBatchAddFolders::AddFolder.

See Also

EdmFolderInfo Structure
EdmFolderInfo Members


mbsCategory Field

mbsCategory Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mbsCategory Field

Name of the file's category.

Syntax

Visual Basic
Public mbsCategory As System.String
C#
public System.string mbsCategory
C++/CLI
public:
System.String^ mbsCategory

See Also

EdmGetVarData Structure
EdmGetVarData Members


mbsRevision Field

mbsRevision Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mbsRevision Field

Name of the current revision.

Syntax

Visual Basic
Public mbsRevision As System.String
C#
public System.string mbsRevision
C++/CLI
public:
System.String^ mbsRevision

See Also

EdmGetVarData Structure
EdmGetVarData Members


mbsState Field

mbsState Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mbsState Field

Name of the current workflow state.

Syntax

Visual Basic
Public mbsState As System.String
C#
public System.string mbsState
C++/CLI
public:
System.String^ mbsState

See Also

EdmGetVarData Structure
EdmGetVarData Members


mbsWorkflow Field

mbsWorkflow Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mbsWorkflow Field

Name of the current workflow.

Syntax

Visual Basic
Public mbsWorkflow As System.String
C#
public System.string mbsWorkflow
C++/CLI
public:
System.String^ mbsWorkflow

See Also

EdmGetVarData Structure
EdmGetVarData Members


mlDateFmt Field

mlDateFmt Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mlDateFmt Field

SQL-server date format of the date used in the vault.

Syntax

Visual Basic
Public mlDateFmt As System.Integer
C#
public System.int mlDateFmt
C++/CLI
public:
System.int mlDateFmt

Remarks

See the CAST and CONVERT commands in the Microsoft SQL Server online help for more details about date codes.

See Also

EdmGetVarData Structure
EdmGetVarData Members


mlEdmGetVarDataFlags Field

mlEdmGetVarDataFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mlEdmGetVarDataFlags Field

Date flags.

Syntax

Visual Basic
Public mlEdmGetVarDataFlags As System.Integer
C#
public System.int mlEdmGetVarDataFlags
C++/CLI
public:
System.int mlEdmGetVarDataFlags

Field Value

Combination of EdmGetVarDataFlag bits.

See Also

EdmGetVarData Structure
EdmGetVarData Members


mlLatestVersion Field

mlLatestVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mlLatestVersion Field

Latest version of the file.

Syntax

Visual Basic
Public mlLatestVersion As System.Integer
C#
public System.int mlLatestVersion
C++/CLI
public:
System.int mlLatestVersion

See Also

EdmGetVarData Structure
EdmGetVarData Members


mlVersion Field

mlVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmGetVarData Structure : mlVersion Field

Local version of the file.

Syntax

Visual Basic
Public mlVersion As System.Integer
C#
public System.int mlVersion
C++/CLI
public:
System.int mlVersion

See Also

EdmGetVarData Structure
EdmGetVarData Members


EdmGroupData Structure Fields

EdmGroupData Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmGroupData Structure

For a list of all members of this type, see EdmGroupData members.

Public Fields

 | Name | Description
public Field | mbAutoAdd | Status of automatically adding users to groups.
public Field | mbsDescription | Description of group.
public Field | mbsName | Name of the group.
public Field | mhStatus | Status of adding group.
public Field | mlFlags | Group adding flags.
public Field | mlGroupID | ID of the group.
public Field | mlSysRights | System rights for the group.
public Field | moMembers | ID array of users that are members of this group.
public Field | mpoGroup | Group interface.
Top

See Also

EdmGroupData Structure
EPDM.Interop.epdm Namespace


EdmGroupData Structure Members

EdmGroupData Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmGroupData Structure

The following tables list the members exposed by EdmGroupData.

Public Fields

 | Name | Description
public Field | mbAutoAdd | Status of automatically adding users to groups.
public Field | mbsDescription | Description of group.
public Field | mbsName | Name of the group.
public Field | mhStatus | Status of adding group.
public Field | mlFlags | Group adding flags.
public Field | mlGroupID | ID of the group.
public Field | mlSysRights | System rights for the group.
public Field | moMembers | ID array of users that are members of this group.
public Field | mpoGroup | Group interface.
Top

See Also

EdmGroupData Structure
EPDM.Interop.epdm Namespace


mbAutoAdd Field

mbAutoAdd Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mbAutoAdd Field

Status of automatically adding users to groups.

Syntax

Visual Basic
Public mbAutoAdd As System.Short
C#
public System.short mbAutoAdd
C++/CLI
public:
System.short mbAutoAdd

Field Value

0 to not automatically add users to groups; 1 otherwise

See Also

EdmGroupData Structure
EdmGroupData Members


mbsDescription Field

mbsDescription Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mbsDescription Field

Description of group.

Syntax

Visual Basic
Public mbsDescription As System.String
C#
public System.string mbsDescription
C++/CLI
public:
System.String^ mbsDescription

See Also

EdmGroupData Structure
EdmGroupData Members


mbsName Field

mbsName Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mbsName Field

Name of the group.

Syntax

Visual Basic
Public mbsName As System.String
C#
public System.string mbsName
C++/CLI
public:
System.String^ mbsName

See Also

EdmGroupData Structure
EdmGroupData Members


mhStatus Field

mhStatus Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mhStatus Field

Status of adding group.

Syntax

Visual Basic
Public mhStatus As System.Integer
C#
public System.int mhStatus
C++/CLI
public:
System.int mhStatus

Field Value

0 if successful, 1 if not

See Also

EdmGroupData Structure
EdmGroupData Members


mlFlags Field

mlFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mlFlags Field

Group adding flags.

Syntax

Visual Basic
Public mlFlags As System.Integer
C#
public System.int mlFlags
C++/CLI
public:
System.int mlFlags

Field Value

Combination of EdmGroupDataFlags bits.

See Also

EdmGroupData Structure
EdmGroupData Members


mlGroupID Field

mlGroupID Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mlGroupID Field

ID of the group.

Syntax

Visual Basic
Public mlGroupID As System.Integer
C#
public System.int mlGroupID
C++/CLI
public:
System.int mlGroupID

See Also

EdmGroupData Structure
EdmGroupData Members


mlSysRights Field

mlSysRights Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mlSysRights Field

System rights for the group.

Syntax

Visual Basic
Public mlSysRights As System.Integer
C#
public System.int mlSysRights
C++/CLI
public:
System.int mlSysRights

Field Value

Combination of EdmSysRightFlags bits.

See Also

EdmGroupData Structure
EdmGroupData Members


moMembers Field

moMembers Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : moMembers Field

ID array of users that are members of this group.

Syntax

Visual Basic
Public moMembers As System.Integer()
C#
public System.int[] moMembers
C++/CLI
public:
System.array<int>^ moMembers

See Also

EdmGroupData Structure
EdmGroupData Members


mpoGroup Field

mpoGroup Field
[image]
EPDM.Interop.epdm Namespace > EdmGroupData Structure : mpoGroup Field

Group interface.

Syntax

Visual Basic
Public mpoGroup As IEdmUserGroup5
C#
public IEdmUserGroup5 mpoGroup
C++/CLI
public:
IEdmUserGroup5^ mpoGroup

Field Value

IEdmUserGroup5

Remarks

This member is valid only if EdmGroupData::mlFlags sets the EdmGroupDataFlags.Edmgdf_GetInterface bit.

See Also

EdmGroupData Structure
EdmGroupData Members


meType Field

meType Field
[image]
EPDM.Interop.epdm Namespace > EdmLicense Structure : meType Field

Type of license.

Syntax

Visual Basic
Public meType As EdmLicenseType
C#
public EdmLicenseType meType
C++/CLI
public:
EdmLicenseType meType

Field Value

Type of license as defined in EdmLicenseType

See Also

EdmLicense Structure
EdmLicense Members


mlUserCount Field

mlUserCount Field
[image]
EPDM.Interop.epdm Namespace > EdmLicense Structure : mlUserCount Field

Maximum number of users for this license type.

Syntax

Visual Basic
Public mlUserCount As System.Integer
C#
public System.int mlUserCount
C++/CLI
public:
System.int mlUserCount

Field Value

Maximum number of users for this license type.

See Also

EdmLicense Structure
EdmLicense Members


EdmListFile Structure Fields

EdmListFile Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmListFile Structure

For a list of all members of this type, see EdmListFile members.

Public Fields

 | Name | Description
public Field | mbsLockComputer | Name of computer on which the file is checked out.
public Field | mbsLockPath | Path to the folder where the file is checked out.
public Field | mbsLockUser | Name of user who has the file checked out.
public Field | mbsRevisionName | Name of the file’s current revision.
public Field | mlFileID | ID of the file.
public Field | mlFolderID | ID of the file’s parent folder.
public Field | mlLatestVersion | Latest version of the file.
public Field | mlLocalVersion | Version of the file in the local cache, based on the date of the file passed to the IEdmBatchListing::AddFile method.
public Field | mlParam | Caller-defined parameter that was passed to the IEdmBatchListing::AddFile method.
public Field | moColumnData | Column data for the selected column set.
public Field | moCurrentState | File’s current workflow state.
Top

See Also

EdmListFile Structure
EPDM.Interop.epdm Namespace


EdmListFile Structure Members

EdmListFile Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmListFile Structure

The following tables list the members exposed by EdmListFile.

Public Fields

 | Name | Description
public Field | mbsLockComputer | Name of computer on which the file is checked out.
public Field | mbsLockPath | Path to the folder where the file is checked out.
public Field | mbsLockUser | Name of user who has the file checked out.
public Field | mbsRevisionName | Name of the file’s current revision.
public Field | mlFileID | ID of the file.
public Field | mlFolderID | ID of the file’s parent folder.
public Field | mlLatestVersion | Latest version of the file.
public Field | mlLocalVersion | Version of the file in the local cache, based on the date of the file passed to the IEdmBatchListing::AddFile method.
public Field | mlParam | Caller-defined parameter that was passed to the IEdmBatchListing::AddFile method.
public Field | moColumnData | Column data for the selected column set.
public Field | moCurrentState | File’s current workflow state.
Top

See Also

EdmListFile Structure
EPDM.Interop.epdm Namespace


mbsLockComputer Field

mbsLockComputer Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mbsLockComputer Field

Name of computer on which the file is checked out.

Syntax

Visual Basic
Public mbsLockComputer As System.String
C#
public System.string mbsLockComputer
C++/CLI
public:
System.String^ mbsLockComputer

See Also

EdmListFile Structure
EdmListFile Members


mbsLockPath Field

mbsLockPath Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mbsLockPath Field

Path to the folder where the file is checked out.

Syntax

Visual Basic
Public mbsLockPath As System.String
C#
public System.string mbsLockPath
C++/CLI
public:
System.String^ mbsLockPath

See Also

EdmListFile Structure
EdmListFile Members


mbsLockUser Field

mbsLockUser Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mbsLockUser Field

Name of user who has the file checked out.

Syntax

Visual Basic
Public mbsLockUser As System.String
C#
public System.string mbsLockUser
C++/CLI
public:
System.String^ mbsLockUser

See Also

EdmListFile Structure
EdmListFile Members


mbsRevisionName Field

mbsRevisionName Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mbsRevisionName Field

Name of the file’s current revision.

Syntax

Visual Basic
Public mbsRevisionName As System.String
C#
public System.string mbsRevisionName
C++/CLI
public:
System.String^ mbsRevisionName

See Also

EdmListFile Structure
EdmListFile Members


mlFileID Field

mlFileID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mlFileID Field

ID of the file.

Syntax

Visual Basic
Public mlFileID As System.Integer
C#
public System.int mlFileID
C++/CLI
public:
System.int mlFileID

See Also

EdmListFile Structure
EdmListFile Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mlFolderID Field

ID of the file’s parent folder.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

See Also

EdmListFile Structure
EdmListFile Members


mlLatestVersion Field

mlLatestVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mlLatestVersion Field

Latest version of the file.

Syntax

Visual Basic
Public mlLatestVersion As System.Integer
C#
public System.int mlLatestVersion
C++/CLI
public:
System.int mlLatestVersion

See Also

EdmListFile Structure
EdmListFile Members


mlLocalVersion Field

mlLocalVersion Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mlLocalVersion Field

Version of the file in the local cache, based on the date of the file passed to the IEdmBatchListing::AddFile method.

Syntax

Visual Basic
Public mlLocalVersion As System.Integer
C#
public System.int mlLocalVersion
C++/CLI
public:
System.int mlLocalVersion

Field Value

Version of the file in the local cache or 0 if the date of the version of the file in local cache passed to IEdmBatchListing::AddFile doesn’t match any version of the file in the vault

See Also

EdmListFile Structure
EdmListFile Members


mlParam Field

mlParam Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : mlParam Field

Caller-defined parameter that was passed to the IEdmBatchListing::AddFile method.

Syntax

Visual Basic
Public mlParam As System.Integer
C#
public System.int mlParam
C++/CLI
public:
System.int mlParam

See Also

EdmListFile Structure
EdmListFile Members


moColumnData Field

moColumnData Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : moColumnData Field

Column data for the selected column set.

Syntax

Visual Basic
Public moColumnData As System.Object
C#
public System.object moColumnData
C++/CLI
public:
System.Object^ moColumnData

See Also

EdmListFile Structure
EdmListFile Members


moCurrentState Field

moCurrentState Field
[image]
EPDM.Interop.epdm Namespace > EdmListFile Structure : moCurrentState Field

File’s current workflow state.

Syntax

Visual Basic
Public moCurrentState As EdmWorkflowInfo
C#
public EdmWorkflowInfo moCurrentState
C++/CLI
public:
EdmWorkflowInfo moCurrentState

See Also

EdmListFile Structure
EdmListFile Members


mbsPath Field

mbsPath Field
[image]
EPDM.Interop.epdm Namespace > EdmListFolder Structure : mbsPath Field

Path to the folder.

Syntax

Visual Basic
Public mbsPath As System.String
C#
public System.string mbsPath
C++/CLI
public:
System.String^ mbsPath

See Also

EdmListFolder Structure
EdmListFolder Members


mlFolderID Field

mlFolderID Field
[image]
EPDM.Interop.epdm Namespace > EdmListFolder Structure : mlFolderID Field

ID of the folder.

Syntax

Visual Basic
Public mlFolderID As System.Integer
C#
public System.int mlFolderID
C++/CLI
public:
System.int mlFolderID

See Also

EdmListFolder Structure
EdmListFolder Members


mlParam Field

mlParam Field
[image]
EPDM.Interop.epdm Namespace > EdmListFolder Structure : mlParam Field

Caller-defined parameter passed to IEdmBatchListing::AddFolder.

Syntax

Visual Basic
Public mlParam As System.Integer
C#
public System.int mlParam
C++/CLI
public:
System.int mlParam

See Also

EdmListFolder Structure
EdmListFolder Members


moColumnData Field

moColumnData Field
[image]
EPDM.Interop.epdm Namespace > EdmListFolder Structure : moColumnData Field

Column data for the selected column set.

Syntax

Visual Basic
Public moColumnData As System.Object
C#
public System.object moColumnData
C++/CLI
public:
System.Object^ moColumnData

See Also

EdmListFolder Structure
EdmListFolder Members


EdmRevComponent Structure

EdmRevComponent Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmRevComponent Structure

Obsolete. Superseded by EdmRevComponent2.

Syntax

Visual Basic
Public Structure EdmRevComponent
   Inherits System.ValueType
C#
public struct EdmRevComponent : System.ValueType
C++/CLI
public value class EdmRevComponent : public System.ValueType

Example

struct EdmRevComponent

{
  integer mlComponentID;
  string mbsComponentName;
};

Remarks

Returned by IEdmRevisionMgr::GetRevisionNumberComponents, which is obsolete and superseded by IEdmRevisionMgr2.::GetRevisionNumberComponents2, which returns EdmRevComponent2.

The struct contains the component information.

See Also

EdmRevComponent Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmRevComponent Structure Fields

EdmRevComponent Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevComponent Structure

For a list of all members of this type, see EdmRevComponent members.

Public Fields

 | Name | Description
public Field | mbsComponentName | Name of the component.
public Field | mlComponentID | Name of the component.
Top

See Also

EdmRevComponent Structure
EPDM.Interop.epdm Namespace


EdmRevComponent Structure Members

EdmRevComponent Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmRevComponent Structure

The following tables list the members exposed by EdmRevComponent.

Public Fields

 | Name | Description
public Field | mbsComponentName | Name of the component.
public Field | mlComponentID | Name of the component.
Top

See Also

EdmRevComponent Structure
EPDM.Interop.epdm Namespace


mbsComponentName Field

mbsComponentName Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent Structure : mbsComponentName Field

Name of the component.

Syntax

Visual Basic
Public mbsComponentName As System.String
C#
public System.string mbsComponentName
C++/CLI
public:
System.String^ mbsComponentName

See Also

EdmRevComponent Structure
EdmRevComponent Members


mlComponentID Field

mlComponentID Field
[image]
EPDM.Interop.epdm Namespace > EdmRevComponent Structure : mlComponentID Field

Name of the component.

Syntax

Visual Basic
Public mlComponentID As System.Integer
C#
public System.int mlComponentID
C++/CLI
public:
System.int mlComponentID

See Also

EdmRevComponent Structure
EdmRevComponent Members


EdmSelItem Structure Fields

EdmSelItem Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmSelItem Structure

For a list of all members of this type, see EdmSelItem members.

Public Fields

 | Name | Description
public Field | mlDocID | Unique ID of the file.
public Field | mlProjID | Unique ID of the folder.
Top

See Also

EdmSelItem Structure
EPDM.Interop.epdm Namespace


EdmSelItem Structure Members

EdmSelItem Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmSelItem Structure

The following tables list the members exposed by EdmSelItem.

Public Fields

 | Name | Description
public Field | mlDocID | Unique ID of the file.
public Field | mlProjID | Unique ID of the folder.
Top

See Also

EdmSelItem Structure
EPDM.Interop.epdm Namespace


mlDocID Field

mlDocID Field
[image]
EPDM.Interop.epdm Namespace > EdmSelItem Structure : mlDocID Field

Unique ID of the file.

Syntax

Visual Basic
Public mlDocID As System.Integer
C#
public System.int mlDocID
C++/CLI
public:
System.int mlDocID

Example

See the EdmSelItem examples.

Remarks

ID can be retrieved from IEdmObject5::ID. You can set this argument to 0 to add all the files in the specified folder.

See Also

EdmSelItem Structure
EdmSelItem Members


mlProjID Field

mlProjID Field
[image]
EPDM.Interop.epdm Namespace > EdmSelItem Structure : mlProjID Field

Unique ID of the folder.

Syntax

Visual Basic
Public mlProjID As System.Integer
C#
public System.int mlProjID
C++/CLI
public:
System.int mlProjID

Example

See the EdmSelItem examples.

Remarks

The ID can be retrieved from IEdmObject5::ID.

See Also

EdmSelItem Structure
EdmSelItem Members


EdmUserData Structure

EdmUserData Structure
See Also Members
[image]
EPDM.Interop.epdm Namespace : EdmUserData Structure

Obsolete. Superseded by EdmUserData2 in SOLIDWORKS PDM Professional 2010 and later.

Syntax

Visual Basic
Public Structure EdmUserData
   Inherits System.ValueType
C#
public struct EdmUserData : System.ValueType
C++/CLI
public value class EdmUserData : public System.ValueType

Example

struct EdmUserData{
  string mbsUserName;
  string mbsInitials;
  string mbsCompleteName;
  string mbsUserData;
  string mbsPassword;
  string mbsEmail;
  integer mlFlags;
  integer mlSysRights;
  string mbsColumnView;
  integer mlUserID;
  integer mhStatus;
  IEdmUser6* mpoUser;
};

Remarks

Holds information about a user. This struct is used as argument to IEdmUserMgr6::AddUsers.

See Also

EdmUserData Members
EPDM.Interop.epdm Namespace

Availability

SOLIDWORKS PDM Professional 2007


EdmUserData Structure Fields

EdmUserData Structure Fields
[image]
EPDM.Interop.epdm Namespace : EdmUserData Structure

For a list of all members of this type, see EdmUserData members.

Public Fields

 | Name | Description
public Field | mbsColumnView | Name of the column view the user should see in File Explorer.
public Field | mbsCompleteName | User’s complete name.
public Field | mbsEmail | Email address.
public Field | mbsInitials | User's initials.
public Field | mbsPassword | User's password.
public Field | mbsUserData | Arbitrary data associated with the user.
public Field | mbsUserName | User's login name.
public Field | mhStatus | Status of the add operation.
public Field | mlFlags | Combination of EdmUserDataFlags flags.
public Field | mlSysRights | Combination of EdmSysRightFlags flags.
public Field | mlUserID | User's ID.
public Field | mpoUser | Pointer to the user's interface if the mlFlags filed contained EdmUserDataFlags.Edmudf_GetInterface.
Top

See Also

EdmUserData Structure
EPDM.Interop.epdm Namespace


EdmUserData Structure Members

EdmUserData Structure Members
See Also Fields
[image]
EPDM.Interop.epdm Namespace : EdmUserData Structure

The following tables list the members exposed by EdmUserData.

Public Fields

 | Name | Description
public Field | mbsColumnView | Name of the column view the user should see in File Explorer.
public Field | mbsCompleteName | User’s complete name.
public Field | mbsEmail | Email address.
public Field | mbsInitials | User's initials.
public Field | mbsPassword | User's password.
public Field | mbsUserData | Arbitrary data associated with the user.
public Field | mbsUserName | User's login name.
public Field | mhStatus | Status of the add operation.
public Field | mlFlags | Combination of EdmUserDataFlags flags.
public Field | mlSysRights | Combination of EdmSysRightFlags flags.
public Field | mlUserID | User's ID.
public Field | mpoUser | Pointer to the user's interface if the mlFlags filed contained EdmUserDataFlags.Edmudf_GetInterface.
Top

See Also

EdmUserData Structure
EPDM.Interop.epdm Namespace


mbsCellPhone Field

mbsCellPhone Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsCellPhone Field

Cell phone number.

Syntax

Visual Basic
Public mbsCellPhone As System.String
C#
public System.string mbsCellPhone
C++/CLI
public:
System.String^ mbsCellPhone

Remarks

If you want the Microsoft Office Communicator integration (i.e., the phone number links in the user's popup windows) to be able to call the number, then you must enter the number in a form supported by your Microsoft Office Communicator installation.

Microsoft Office Communicator must also be set up to support outgoing calls. See the Microsoft Office Communicator documentation for more details.

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsCompleteName Field

mbsCompleteName Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsCompleteName Field

Full user name.

Syntax

Visual Basic
Public mbsCompleteName As System.String
C#
public System.string mbsCompleteName
C++/CLI
public:
System.String^ mbsCompleteName

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsEmail Field

mbsEmail Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsEmail Field

Email address.

Syntax

Visual Basic
Public mbsEmail As System.String
C#
public System.string mbsEmail
C++/CLI
public:
System.String^ mbsEmail

Remarks

This address exactly must match the address used in Microsoft Office Communicator in order for instant messaging and voice over IP to work in the user popup windows.

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsInitials Field

mbsInitials Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsInitials Field

User's initials.

Syntax

Visual Basic
Public mbsInitials As System.String
C#
public System.string mbsInitials
C++/CLI
public:
System.String^ mbsInitials

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsPhone Field

mbsPhone Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsPhone Field

Office phone number.

Syntax

Visual Basic
Public mbsPhone As System.String
C#
public System.string mbsPhone
C++/CLI
public:
System.String^ mbsPhone

Remarks

If you want the Microsoft Office Communicator integration (i.e., the phone number links in the user's popup windows) to be able to call the number, then you must enter the number in a form supported by your Microsoft Office Communicator installation.

Microsoft Office Communicator must also be set up to support outgoing calls. See the Microsoft Office Communicator documentation for more details.

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsPicturePath Field

mbsPicturePath Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsPicturePath Field

Points to an image file (e.g., .jpg, .bmp, .png, etc.) that can be set using IEdmUser10::SetUserDataEx.

Syntax

Visual Basic
Public mbsPicturePath As System.String
C#
public System.string mbsPicturePath
C++/CLI
public:
System.String^ mbsPicturePath

Remarks

The member can be set to an empty or null string to remove the user's picture.

If you call IEdmUser10::GetUserDataEx, then this field points to the user's picture cached to the client computer disk. This is the cache used bySOLIDWORKS PDM Professional, so you should not delete the file from that location.

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsPresenceNote Field

mbsPresenceNote Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsPresenceNote Field

Presence (i.e., out of office) note.

Syntax

Visual Basic
Public mbsPresenceNote As System.String
C#
public System.string mbsPresenceNote
C++/CLI
public:
System.String^ mbsPresenceNote

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsUserData Field

mbsUserData Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsUserData Field

User's data string.

Syntax

Visual Basic
Public mbsUserData As System.String
C#
public System.string mbsUserData
C++/CLI
public:
System.String^ mbsUserData

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsWebSite1 Field

mbsWebSite1 Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsWebSite1 Field

First website address.

Syntax

Visual Basic
Public mbsWebSite1 As System.String
C#
public System.string mbsWebSite1
C++/CLI
public:
System.String^ mbsWebSite1

Remarks

The websites appear as buttons in the user popup windows. You can provide a custom ToolTip for web addresses by appending a new line and the Tooltip to the address like this: www.solidworks.com\nSOLIDWORKS!. The button is retrieved from the website's favicon.ico file.

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsWebSite2 Field

mbsWebSite2 Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsWebSite2 Field

Second website.

Syntax

Visual Basic
Public mbsWebSite2 As System.String
C#
public System.string mbsWebSite2
C++/CLI
public:
System.String^ mbsWebSite2

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsWebSite3 Field

mbsWebSite3 Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsWebSite3 Field

Third website.

Syntax

Visual Basic
Public mbsWebSite3 As System.String
C#
public System.string mbsWebSite3
C++/CLI
public:
System.String^ mbsWebSite3

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsWebSite4 Field

mbsWebSite4 Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mbsWebSite4 Field

Fourth website.

Syntax

Visual Basic
Public mbsWebSite4 As System.String
C#
public System.string mbsWebSite4
C++/CLI
public:
System.String^ mbsWebSite4

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mlEdmUserDataExFlags Field

mlEdmUserDataExFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mlEdmUserDataExFlags Field

Combination of EdmUserDataExFlag flags telling which of the other members of this structure should be updated or retrieved.

Syntax

Visual Basic
Public mlEdmUserDataExFlags As System.Integer
C#
public System.int mlEdmUserDataExFlags
C++/CLI
public:
System.int mlEdmUserDataExFlags

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mlUserID Field

mlUserID Field
[image]
EPDM.Interop.epdm Namespace > EdmUserDataEx Structure : mlUserID Field

ID of user to which the data belongs.

Syntax

Visual Basic
Public mlUserID As System.Integer
C#
public System.int mlUserID
C++/CLI
public:
System.int mlUserID

Remarks

This field is ignored in calls to IEdmUser10::SetUserDataEx.

See Also

EdmUserDataEx Structure
EdmUserDataEx Members


mbsColumnView Field

mbsColumnView Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsColumnView Field

Name of the column view the user should see in File Explorer.

Syntax

Visual Basic
Public mbsColumnView As System.String
C#
public System.string mbsColumnView
C++/CLI
public:
System.String^ mbsColumnView

Remarks

This field is empty is there isn't a column view.

See Also

EdmUserData Structure
EdmUserData Members


mbsCompleteName Field

mbsCompleteName Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsCompleteName Field

User’s complete name.

Syntax

Visual Basic
Public mbsCompleteName As System.String
C#
public System.string mbsCompleteName
C++/CLI
public:
System.String^ mbsCompleteName

See Also

EdmUserData Structure
EdmUserData Members


mbsEmail Field

mbsEmail Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsEmail Field

Email address.

Syntax

Visual Basic
Public mbsEmail As System.String
C#
public System.string mbsEmail
C++/CLI
public:
System.String^ mbsEmail

See Also

EdmUserData Structure
EdmUserData Members


mbsInitials Field

mbsInitials Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsInitials Field

User's initials.

Syntax

Visual Basic
Public mbsInitials As System.String
C#
public System.string mbsInitials
C++/CLI
public:
System.String^ mbsInitials

See Also

EdmUserData Structure
EdmUserData Members


mbsPassword Field

mbsPassword Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsPassword Field

User's password.

Syntax

Visual Basic
Public mbsPassword As System.String
C#
public System.string mbsPassword
C++/CLI
public:
System.String^ mbsPassword

See Also

EdmUserData Structure
EdmUserData Members


mbsUserData Field

mbsUserData Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsUserData Field

Arbitrary data associated with the user.

Syntax

Visual Basic
Public mbsUserData As System.String
C#
public System.string mbsUserData
C++/CLI
public:
System.String^ mbsUserData

See Also

EdmUserData Structure
EdmUserData Members


mbsUserName Field

mbsUserName Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mbsUserName Field

User's login name.

Syntax

Visual Basic
Public mbsUserName As System.String
C#
public System.string mbsUserName
C++/CLI
public:
System.String^ mbsUserName

See Also

EdmUserData Structure
EdmUserData Members


mhStatus Field

mhStatus Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mhStatus Field

Status of the add operation.

Syntax

Visual Basic
Public mhStatus As System.Integer
C#
public System.int mhStatus
C++/CLI
public:
System.int mhStatus

See Also

EdmUserData Structure
EdmUserData Members


mlFlags Field

mlFlags Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mlFlags Field

Combination of EdmUserDataFlags flags.

Syntax

Visual Basic
Public mlFlags As System.Integer
C#
public System.int mlFlags
C++/CLI
public:
System.int mlFlags

See Also

EdmUserData Structure
EdmUserData Members


mlSysRights Field

mlSysRights Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mlSysRights Field

Combination of EdmSysRightFlags flags.

Syntax

Visual Basic
Public mlSysRights As System.Integer
C#
public System.int mlSysRights
C++/CLI
public:
System.int mlSysRights

See Also

EdmUserData Structure
EdmUserData Members


mlUserID Field

mlUserID Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mlUserID Field

User's ID.

Syntax

Visual Basic
Public mlUserID As System.Integer
C#
public System.int mlUserID
C++/CLI
public:
System.int mlUserID

See Also

EdmUserData Structure
EdmUserData Members


mpoUser Field

mpoUser Field
[image]
EPDM.Interop.epdm Namespace > EdmUserData Structure : mpoUser Field

Pointer to the user's interface if the mlFlags filed contained EdmUserDataFlags.Edmudf_GetInterface.

Syntax

Visual Basic
Public mpoUser As IEdmUser6
C#
public IEdmUser6 mpoUser
C++/CLI
public:
IEdmUser6^ mpoUser

See Also

EdmUserData Structure
EdmUserData Members


AddReferencesID Method (IEdmAddCustomRefs)

AddReferencesID Method (IEdmAddCustomRefs)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : AddReferencesID Method (IEdmAddCustomRefs)

lRootFile
ID of file to which to add file references
ppoReferences
Array of EdmSelItems containing file references to add to lRootFile
Obsolete. Superseded by IEdmAddCustomRefs2::AddReferencesID2 .

Syntax

Visual Basic
Sub AddReferencesID( _
   ByVal lRootFile As System.Integer, _
   ByRef ppoReferences() As EdmSelItem _
)
C#
void AddReferencesID(
   System.int lRootFile,
   ref EdmSelItem[] ppoReferences
)
C++/CLI
void AddReferencesID(
&   System.int lRootFile,
&   array<EdmSelItem>^% ppoReferences
)

Parameters

lRootFile
ID of file to which to add file references
ppoReferences
Array of EdmSelItems containing file references to add to lRootFile

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


AddReferencesPath Method (IEdmAddCustomRefs)

AddReferencesPath Method (IEdmAddCustomRefs)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddCustomRefs Interface : AddReferencesPath Method (IEdmAddCustomRefs)

lRootFile
ID of file to which to add file references
ppoReferences
Array of paths to reference files to add to lRootFile
Obsolete. Superseded by IEdmAddCustomRefs2::AddReferencesPath2 .

Syntax

Visual Basic
Sub AddReferencesPath( _
   ByVal lRootFile As System.Integer, _
   ByRef ppoReferences() As System.String _
)
C#
void AddReferencesPath(
   System.int lRootFile,
   ref System.string[] ppoReferences
)
C++/CLI
void AddReferencesPath(
&   System.int lRootFile,
&   System.array<String^>^% ppoReferences
)

Parameters

lRootFile
ID of file to which to add file references
ppoReferences
Array of paths to reference files to add to lRootFile

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddCustomRefs Interface
IEdmAddCustomRefs Members

Availability

Version 6.3 of SOLIDWORKS PDM Professional


GetAddInInfo Method (IEdmAddInMgr5)

GetAddInInfo Method (IEdmAddInMgr5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmAddInMgr5 Interface : GetAddInInfo Method (IEdmAddInMgr5)

bsPath
Path to the DLL about which to get information
poReserved
Null only
poInfo
EdmAddInInfo structure; returned add-in information
Obsolete. Superseded by IEdmAddInMgr6::GetAddInInfo2 .

Syntax

Visual Basic
Sub GetAddInInfo( _
   ByVal bsPath As System.String, _
   ByRef poReserved As System.Object, _
   ByRef poInfo As EdmAddInInfo _
)
C#
void GetAddInInfo(
   System.string bsPath,
   ref System.object poReserved,
   out EdmAddInInfo poInfo
)
C++/CLI
void GetAddInInfo(
&   System.String^ bsPath,
&   System.Object^% poReserved,
&   [Out] EdmAddInInfo poInfo
)

Parameters

bsPath
Path to the DLL about which to get information
poReserved
Null only
poInfo
EdmAddInInfo structure; returned add-in information

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmAddInMgr5 Interface
IEdmAddInMgr5 Members

Availability

Version 6.4 of SOLIDWORKS PDM Professional


SetFileNameSerNo Method (IEdmBatchAdd)

SetFileNameSerNo Method (IEdmBatchAdd)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchAdd Interface : SetFileNameSerNo Method (IEdmBatchAdd)

oSerialNumberName
File name or the ID of the serial number generator
lFlags
Must be 0
For internal use only; do not use.

Syntax

Visual Basic
Sub SetFileNameSerNo( _
   ByVal oSerialNumberName As System.Object, _
   Optional ByVal lFlags As System.Integer _
)
C#
void SetFileNameSerNo(
   System.object oSerialNumberName,
   System.int lFlags
)
C++/CLI
void SetFileNameSerNo(
&   System.Object^ oSerialNumberName,
&   System.int lFlags
)

Parameters

oSerialNumberName
File name or the ID of the serial number generator
lFlags
Must be 0

Remarks

This method specifies that when a file is batch added to the vault, its data card is created with a name that is either the added file's serial number or its name.

By default when new files are added to the vault, file data cards are created with serial number names. Use this method to specify that when batch adding a file to the vault (IEdmBatchAdd::Add* methods), the file's data card name is the file name instead of the file's serial number.

If you don't call this method before calling the IEdmBatchAdd::Add* methods, they will create one serial number for the file and another serial number for the file data card. To synchronize the serial numbers:

  1. Generate the added file's serial number using IEdmSerNoGen7.
  2. Call this method, specifying oSerialNumberName with the added file's serial number generator ID.
  3. Repeat steps 1 and 2 for each new file.
  4. Call one of the IEdmBatchAdd::Add* methods to add the new files to the batch.
  5. Call IEdmBatchAdd::CommitAdd.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchAdd Interface
IEdmBatchAdd Members
IEdmFolder12::SetFileNameSerNo Method ()

Availability

Version 6.4 of SOLIDWORKS PDM Professional


ChangeState Method (IEdmBatchChangeState)

ChangeState Method (IEdmBatchChangeState)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchChangeState Interface : ChangeState Method (IEdmBatchChangeState)

lParentWnd
Parent window handle that is passed to add-ins that are notified about file state changes in the vault
poCallback
Optional pointer to a class that implements IEdmCallback to receive progress information about the operation
Obsolete. Superseded by IEdmBatchChangeState4::ChangeState2.

Syntax

Visual Basic
Sub ChangeState( _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal poCallback As EdmCallback _
)
C#
void ChangeState(
   System.int lParentWnd,
   EdmCallback poCallback
)
C++/CLI
void ChangeState(
&   System.int lParentWnd,
&   EdmCallback^ poCallback
)

Parameters

lParentWnd
Parent window handle that is passed to add-ins that are notified about file state changes in the vault
poCallback
Optional pointer to a class that implements IEdmCallback to receive progress information about the operation

Remarks

Before calling this method, you must call IEdmBatchChangeState::CreateTree if changing states or IEdmBatchChangeState2::CreateTreeForRevoke if revoking transitions.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchChangeState Interface
IEdmBatchChangeState Members

Availability

SOLIDWORKS PDM Professional 2009; for revoking a transition, SOLIDWORKS PDM Professional 2013


ShowWarningDlg Method (IEdmBatchDelete)

ShowWarningDlg Method (IEdmBatchDelete)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchDelete Interface : ShowWarningDlg Method (IEdmBatchDelete)

hParentWnd
Parent window handle for the dialog box
Obsolete. Superseded by IEdmBatchDelete2::ShowWarningDlg2 .

Syntax

Visual Basic
Function ShowWarningDlg( _
   ByVal hParentWnd As System.Integer _
) As System.Boolean
C#
System.bool ShowWarningDlg(
   System.int hParentWnd
)
C++/CLI
System.bool ShowWarningDlg(
&   System.int hParentWnd
)

Parameters

hParentWnd
Parent window handle for the dialog box

Return Value

True if the user chooses to continue the operation in spite of the warnings, false if the user cancels the operation

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NOT_INITIALIZED: IEdmBatchDelete::ComputePermissions has not been called.

See Also

IEdmBatchDelete Interface
IEdmBatchDelete Members

Availability

SOLIDWORKS PDM Professional 2008


AddSelection Method (IEdmBatchItemGeneration)

AddSelection Method (IEdmBatchItemGeneration)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchItemGeneration Interface : AddSelection Method (IEdmBatchItemGeneration)

poVault
IEdmVault5; vault in which to create the new items
ppoSelection
Array of EdmSelItem structures, one structure for each file from which to generate an item
Obsolete. Superseded by IEdmBatchItemGeneration2::AddSelection2 .

Syntax

Visual Basic
Sub AddSelection( _
   ByVal poVault As EdmVault5, _
   ByRef ppoSelection() As EdmSelItem _
)
C#
void AddSelection(
   EdmVault5 poVault,
   ref EdmSelItem[] ppoSelection
)
C++/CLI
void AddSelection(
&   EdmVault5^ poVault,
&   array<EdmSelItem>^% ppoSelection
)

Parameters

poVault
IEdmVault5; vault in which to create the new items
ppoSelection
Array of EdmSelItem structures, one structure for each file from which to generate an item

Example

See the example in the IEdmBatchItemGeneration topic.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchItemGeneration Interface
IEdmBatchItemGeneration Members

Availability

SOLIDWORKS PDM Professional 2010


Commit Method (IEdmBatchUpdate)

Commit Method (IEdmBatchUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUpdate Interface : Commit Method (IEdmBatchUpdate)

ppoRetErrors
Array of EdmBatchError structures; one structure for each error that occurred during the save operation
poCallback
Optional pointer to a class that implements IEdmCallback to get more information during the operation
Obsolete. Superseded by IEdmBatchUpdate2::CommitUpdate .

Syntax

Visual Basic
Sub Commit( _
   ByRef ppoRetErrors() As EdmBatchError, _
   Optional ByVal poCallback As EdmCallback _
)
C#
void Commit(
   out EdmBatchError[] ppoRetErrors,
   EdmCallback poCallback
)
C++/CLI
void Commit(
&   [Out] array<EdmBatchError>^ ppoRetErrors,
&   EdmCallback^ poCallback
)

Parameters

ppoRetErrors
Array of EdmBatchError structures; one structure for each error that occurred during the save operation
poCallback
Optional pointer to a class that implements IEdmCallback to get more information during the operation

Remarks

Non-fatal errors are returned in the ppoRetErrors array. Examine the contents of the returned array to determine whether the operation is successful.

See the IEdmBatchUpdate remarks for information about using this method.

See Also

IEdmBatchUpdate Interface
IEdmBatchUpdate Members

Availability

SOLIDWORKS PDM Professional Version 6.2


SetVar Method (IEdmBatchUpdate)

SetVar Method (IEdmBatchUpdate)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBatchUpdate Interface : SetVar Method (IEdmBatchUpdate)

lFileID
ID of file to which to write the variable
lVariableID
ID of variable to update; retrieve using IEdmVariableMgr5
poValue
New value of the variable
bsConfiguration
Name of the configuration to which to write the variable; empty string for files without configurations
lEdmBatchFlags
Combination of EdmBatchFlags bits
Obsolete. Superseded by IEdmBatchUpdate2::SetVar .

Syntax

Visual Basic
Sub SetVar( _
   ByVal lFileID As System.Integer, _
   ByVal lVariableID As System.Integer, _
   ByRef poValue As System.Object, _
   ByVal bsConfiguration As System.String, _
   Optional ByVal lEdmBatchFlags As System.Integer _
)
C#
void SetVar(
   System.int lFileID,
   System.int lVariableID,
   ref System.object poValue,
   System.string bsConfiguration,
   System.int lEdmBatchFlags
)
C++/CLI
void SetVar(
&   System.int lFileID,
&   System.int lVariableID,
&   System.Object^% poValue,
&   System.String^ bsConfiguration,
&   System.int lEdmBatchFlags
)

Parameters

lFileID
ID of file to which to write the variable
lVariableID
ID of variable to update; retrieve using IEdmVariableMgr5
poValue
New value of the variable
bsConfiguration
Name of the configuration to which to write the variable; empty string for files without configurations
lEdmBatchFlags
Combination of EdmBatchFlags bits

Remarks

See the IEdmBatchUpdate remarks for information about using this method.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBatchUpdate Interface
IEdmBatchUpdate Members

Availability

SOLIDWORKS PDM Professional Version 6.2


GetBomLayouts Method (IEdmBomMgr)

GetBomLayouts Method (IEdmBomMgr)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmBomMgr Interface : GetBomLayouts Method (IEdmBomMgr)

ppoRetLayouts
Array of EdmBomLayout structures; one structure for each BOM layout
Obsolete. Superseded by IEdmBomMgr2::GetBomLayouts2 .

Syntax

Visual Basic
Sub GetBomLayouts( _
   ByRef ppoRetLayouts() As EdmBomLayout _
)
C#
void GetBomLayouts(
   out EdmBomLayout[] ppoRetLayouts
)
C++/CLI
void GetBomLayouts(
&   [Out] array<EdmBomLayout>^ ppoRetLayouts
)

Parameters

ppoRetLayouts
Array of EdmBomLayout structures; one structure for each BOM layout

Example

See the IEdmBomMgr examples.

Remarks

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmBomMgr Interface
IEdmBomMgr Members

Availability

SOLIDWORKS PDM Professional 2009


GetCtrlData Method (IEdmCardViewCallback6)

GetCtrlData Method (IEdmCardViewCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardViewCallback6 Interface : GetCtrlData Method (IEdmCardViewCallback6)

lCardWnd
Window handle of the card
lCardID
ID of the card (see Remarks)
lControlID
ID of the control for which to get the value (see Remarks)
lVariableID
ID of the variable used by this control (see Remarks)
bsVariableName
Name of the variable used by this control
poView
IEdmCardView5
Gets the data to insert into a control when a card is opened.

Syntax

Visual Basic
Function GetCtrlData( _
   ByVal lCardWnd As System.Integer, _
   ByVal lCardID As System.Integer, _
   ByVal lControlID As System.Integer, _
   ByVal lVariableID As System.Integer, _
   ByVal bsVariableName As System.String, _
   ByVal poView As IEdmCardView5 _
) As System.Object
C#
System.object GetCtrlData(
   System.int lCardWnd,
   System.int lCardID,
   System.int lControlID,
   System.int lVariableID,
   System.string bsVariableName,
   IEdmCardView5 poView
)
C++/CLI
System.Object^ GetCtrlData(
&   System.int lCardWnd,
&   System.int lCardID,
&   System.int lControlID,
&   System.int lVariableID,
&   System.String^ bsVariableName,
&   IEdmCardView5^ poView
)

Parameters

lCardWnd
Window handle of the card
lCardID
ID of the card (see Remarks)
lControlID
ID of the control for which to get the value (see Remarks)
lVariableID
ID of the variable used by this control (see Remarks)
bsVariableName
Name of the variable used by this control
poView
IEdmCardView5

Return Value

Data for the specified control

Example

See the IEdmCardViewCallback6 examples.

Remarks

The framework calls this method once per control when a card created with IEdmVault10::CreateCardViewEx2 is opened.

Use... | In a call to IEdmVault5::GetObject with eType = ... | To obtain...
ICardID | EdmObjectType.EdmObject_Card | IEdmCard5
IControlID | EdmObjectType.EdmObject_CardControl | IEdmCardControl5
IVariableID | EdmObjectType.EdmObject_Variable | IEdmVariable5

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardViewCallback6 Interface
IEdmCardViewCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


GetDefaultValueComponent Method (IEdmCardViewCallback6)

GetDefaultValueComponent Method (IEdmCardViewCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardViewCallback6 Interface : GetDefaultValueComponent Method (IEdmCardViewCallback6)

eValue
Type of component for which to get a value as defined in EdmDefValComp
Called by the serial number generator to get the default value for the specified serial number component.

Syntax

Visual Basic
Function GetDefaultValueComponent( _
   ByVal eValue As EdmDefValComp _
) As System.Object
C#
System.object GetDefaultValueComponent(
   EdmDefValComp eValue
)
C++/CLI
System.Object^ GetDefaultValueComponent(
&   EdmDefValComp eValue
)

Parameters

eValue
Type of component for which to get a value as defined in EdmDefValComp

Return Value

Default value

Example

See the IEdmCardViewCallback6 examples.

Remarks

The user can generate a new serial number value in a card by right-clicking in the edit box linked to the serial number and selecting New Serial Number from the context menu. The serial number generator calls this method if it needs additional information in order to create the serial number. Implement this method to override the default behavior.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardViewCallback6 Interface
IEdmCardViewCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


OnAddInInput Method (IEdmCardViewCallback6)

OnAddInInput Method (IEdmCardViewCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardViewCallback6 Interface : OnAddInInput Method (IEdmCardViewCallback6)

lFlags
Combination of EdmCardFlag bits from a button's add-in (see Remarks)
Handles input from an add-in when an add-in button is clicked in the card view.

Syntax

Visual Basic
Sub OnAddInInput( _
   ByVal lFlags As System.Integer _
)
C#
void OnAddInInput(
   System.int lFlags
)
C++/CLI
void OnAddInInput(
&   System.int lFlags
)

Parameters

lFlags
Combination of EdmCardFlag bits from a button's add-in (see Remarks)

Example

See the IEdmCardViewCallback6 examples.

Remarks

When an add-in's button is clicked in a card view, IEdmAddIn5::OnCmd is called. lFlags contains the same data that is returned in ppoData (EdmCmdData::mlLongData1) of IEdmAddIn5::OnCmd.

This method allows you to act on the information provided by the button's add-in.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardViewCallback6 Interface
IEdmCardViewCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


SetCtrlData Method (IEdmCardViewCallback6)

SetCtrlData Method (IEdmCardViewCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardViewCallback6 Interface : SetCtrlData Method (IEdmCardViewCallback6)

lCardWnd
Window handle of the card
lCardID
ID of the card (see Remarks)
lControlID
ID of the control for which to get the value (see Remarks)
lVariableID
ID of the variable used by this control (see Remarks)
bsVariableName
Name of the variable used by this control
poView
IEdmCardView5
poValue
Control variable data to save
Stores the control's variable data when a card is saved.

Syntax

Visual Basic
Sub SetCtrlData( _
   ByVal lCardWnd As System.Integer, _
   ByVal lCardID As System.Integer, _
   ByVal lControlID As System.Integer, _
   ByVal lVariableID As System.Integer, _
   ByVal bsVariableName As System.String, _
   ByVal poView As IEdmCardView5, _
   ByRef poValue As System.Object _
)
C#
void SetCtrlData(
   System.int lCardWnd,
   System.int lCardID,
   System.int lControlID,
   System.int lVariableID,
   System.string bsVariableName,
   IEdmCardView5 poView,
   ref System.object poValue
)
C++/CLI
void SetCtrlData(
&   System.int lCardWnd,
&   System.int lCardID,
&   System.int lControlID,
&   System.int lVariableID,
&   System.String^ bsVariableName,
&   IEdmCardView5^ poView,
&   System.Object^% poValue
)

Parameters

lCardWnd
Window handle of the card
lCardID
ID of the card (see Remarks)
lControlID
ID of the control for which to get the value (see Remarks)
lVariableID
ID of the variable used by this control (see Remarks)
bsVariableName
Name of the variable used by this control
poView
IEdmCardView5
poValue
Control variable data to save

Example

See the IEdmCardViewCallback6 examples.

Remarks

The framework calls this method once per control when a card created with IEdmVault10::CreateCardViewEx2 is saved.

Use... | In a call to IEdmVault5::GetObject with eType = ... | To obtain...
ICardID | EdmObjectType.EdmObject_Card | IEdmCard5
IControlID | EdmObjectType.EdmObject_CardControl | IEdmCardControl5
IVariableID | EdmObjectType.EdmObject_Variable | IEdmVariable5

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardViewCallback6 Interface
IEdmCardViewCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


SetModifiedFlag Method (IEdmCardViewCallback6)

SetModifiedFlag Method (IEdmCardViewCallback6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmCardViewCallback6 Interface : SetModifiedFlag Method (IEdmCardViewCallback6)

Called when a card variable changes.

Syntax

Visual Basic
Sub SetModifiedFlag()
C#
void SetModifiedFlag()
C++/CLI
void SetModifiedFlag();

Example

See the IEdmCardViewCallback6 examples.

Remarks

You can implement this method, for instance, to enable Save when the card changes.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmCardViewCallback6 Interface
IEdmCardViewCallback6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


Rollback2 Method (IEdmEnumeratorVersion6)

Rollback2 Method (IEdmEnumeratorVersion6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmEnumeratorVersion6 Interface : Rollback2 Method (IEdmEnumeratorVersion6)

lVersionNo
Version number to which to roll this file back (see Remarks)
bsComment
Comment for the rollback
Obsolete. Superseded by IEdmEnumeratorVersion7::Rollback3.

Syntax

Visual Basic
Sub Rollback2( _
   ByVal lVersionNo As System.Integer, _
   ByVal bsComment As System.String _
)
C#
void Rollback2(
   System.int lVersionNo,
   System.string bsComment
)
C++/CLI
void Rollback2(
&   System.int lVersionNo,
&   System.String^ bsComment
)

Parameters

lVersionNo
Version number to which to roll this file back (see Remarks)
bsComment
Comment for the rollback

Remarks

This method destroys all versions after the version specified by lVersionNo. There is no undoing of the operation short of restoring a backup of the entire database and file archives.

After this method completes successfully, lVersionNo is the new latest version of the file.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_REVISION_NUMBER: The specified version number is out of bounds.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete files.

See Also

IEdmEnumeratorVersion6 Interface
IEdmEnumeratorVersion6 Members
IEdmVersion6::Rollback2 Method ()
IEdmRevision6::Rollback2 Method ()

Availability

SOLIDWORKS PDM Professional 2015


ChangeState Method (IEdmFile5)

ChangeState Method (IEdmFile5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile5 Interface : ChangeState Method (IEdmFile5)

poStateIdOrName
Workflow state ID or name or IEdmState5 to which this file transitions (see Remarks)
lFolderID
ID of the file's active parent folder
bsComment
Comment saved to the transition history
lParentWnd
Parent window handle
lEdmStateFlags
Optional combination of EdmStateFlags bits; default is EdmStateFlags.EdmState_Simple
Obsolete. Superseded by IEdmFile10::ChangeState2.

Syntax

Visual Basic
Sub ChangeState( _
   ByRef poStateIdOrName As System.Object, _
   ByVal lFolderID As System.Integer, _
   ByVal bsComment As System.String, _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal lEdmStateFlags As System.Integer _
)
C#
void ChangeState(
   ref System.object poStateIdOrName,
   System.int lFolderID,
   System.string bsComment,
   System.int lParentWnd,
   System.int lEdmStateFlags
)
C++/CLI
void ChangeState(
&   System.Object^% poStateIdOrName,
&   System.int lFolderID,
&   System.String^ bsComment,
&   System.int lParentWnd,
&   System.int lEdmStateFlags
)

Parameters

poStateIdOrName
Workflow state ID or name or IEdmState5 to which this file transitions (see Remarks)
lFolderID
ID of the file's active parent folder
bsComment
Comment saved to the transition history
lParentWnd
Parent window handle
lEdmStateFlags
Optional combination of EdmStateFlags bits; default is EdmStateFlags.EdmState_Simple

Remarks

There must be a transition between the current state and poStateIdOrName, or this method fails.

It is possible to create multiple workflows with two or more states having the same name. If poStateIdOrName contains the name of the destination state instead of its ID, and if several transitions from the file’s current state lead to new states all having the same name, SOLIDWORKS PDM Professional randomly selects one of them. To be sure to which state the file transitions, specify a state ID in poStateIdOrName.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_TRANSITION_ACTION_FAILED: One of the transition actions set up in the workflow failed.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the EdmCmdType.EdmCmd_PreState hooks did not permit the operation.
  • E_EDM_FILE_IS_LOCKED: The file is checked out. Changing state is only permitted on checked-in files.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks permission to change state.
  • E_EDM_CONDITIONS_NOT_MET: The conditions set up in the Workflow Editor for this transition were not met.
  • E_EDM_STATE_NOT_FOUND: There is no transition going from the file's current state to the specified state.

See Also

IEdmFile5 Interface
IEdmFile5 Members
IEdmWorkflow5 Interface
IEdmState5 Interface
IEdmTransition5 Interface

Availability

SOLIDWORKS PDM Professional Version 5.2


ChangeState2 Method (IEdmFile10)

ChangeState2 Method (IEdmFile10)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile10 Interface : ChangeState2 Method (IEdmFile10)

poStateIdOrName

Workflow state ID or name or IEdmState5 to which this file transitions (see Remarks)

lFolderID
ID of the file's active parent folder
bsComment
Comment saved to the transition history
lParentWnd
Parent window handle
lEdmStateFlags
Optional combination of EdmStateFlags bits; default is EdmStateFlags.EdmState_Simple
bsPasswd

Optional password of user executing the transition

Obsolete. Superseded by IEdmFile13::ChangeState3.

Syntax

Visual Basic
Sub ChangeState2( _
   ByRef poStateIdOrName As System.Object, _
   ByVal lFolderID As System.Integer, _
   ByVal bsComment As System.String, _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal lEdmStateFlags As System.Integer, _
   Optional ByVal bsPasswd As System.String _
)
C#
void ChangeState2(
   ref System.object poStateIdOrName,
   System.int lFolderID,
   System.string bsComment,
   System.int lParentWnd,
   System.int lEdmStateFlags,
   System.string bsPasswd
)
C++/CLI
void ChangeState2(
&   System.Object^% poStateIdOrName,
&   System.int lFolderID,
&   System.String^ bsComment,
&   System.int lParentWnd,
&   System.int lEdmStateFlags,
&   System.String^ bsPasswd
)

Parameters

poStateIdOrName

Workflow state ID or name or IEdmState5 to which this file transitions (see Remarks)

lFolderID
ID of the file's active parent folder
bsComment
Comment saved to the transition history
lParentWnd
Parent window handle
lEdmStateFlags
Optional combination of EdmStateFlags bits; default is EdmStateFlags.EdmState_Simple
bsPasswd

Optional password of user executing the transition

Remarks

The difference between this method and the now obsolete IEdmFile5::ChangeState is that this method requires a user password.

There must be a transition between the current state and poStateIdOrName, or this method fails.

It is possible to create multiple workflows with two or more states having the same name. If poStateIdOrName contains the name of the destination state instead of its ID, and if several transitions from the file’s current state lead to new states all having the same name, SOLIDWORKS PDM Professional randomly selects one of them. To be sure to which state the file transitions, specify a state ID in poStateIdOrName.

See Return Codes for the complete list of potential success and error codes. The following are just a few examples:

  • S_OK: The method successfully executed.
  • E_EDM_TRANSITION_ACTION_FAILED: One of the transition actions set up in the workflow failed.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the EdmCmdType.EdmCmd_PreState hooks did not permit the operation.
  • E_EDM_FILE_IS_LOCKED: The file is checked out. Changing state is only permitted on checked-in files.
  • E_EDM_PERMISSION_DENIED: The logged-in user lacks permission to change state.
  • E_EDM_CONDITIONS_NOT_MET: The conditions set up in the Workflow Editor for this transition were not met.
  • E_EDM_STATE_NOT_FOUND: There is no transition going from the file's current state to the specified state.

See Also

IEdmFile10 Interface
IEdmFile10 Members
IEdmWorkflow5 Interface
IEdmTransition5 Interface

Availability

SOLIDWORKS PDM Professional 2015 SP02


GetThumbnail Method (IEdmFile13)

GetThumbnail Method (IEdmFile13)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFile13 Interface : GetThumbnail Method (IEdmFile13)

Obsolete. Superseded by IEdmFile15::GetThumbnail2 .

Syntax

Visual Basic
Function GetThumbnail() As System.Object
C#
System.object GetThumbnail()
C++/CLI
System.Object^ GetThumbnail();

Return Value

IPicture

Example

'This code snippet demonstrates how to convert the IPicture object returned by this method to a usable bitmap.

VB.NET:

Imports stdole
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Module Module1

    Sub Main()

       ...

       Dim objBitMap As Object = aFile.GetThumbnail
       Dim imgPreview As System.Drawing.Image = PictureDispConverter.Convert(objBitMap)
       imgPreview.Save(sExtractDir + sFilename + ".bmp", Drawing.Imaging.ImageFormat.Bmp)
       imgPreview.Dispose()

    End Sub

End Module

'Class1
Public Class PictureDispConverter

    Inherits System.Windows.Forms.AxHost

    Public Sub New()
        MyBase.New("GUID_format5_value")
    End Sub

    Public Shared Function Convert(ByVal objIDispImage As Object) As System.Drawing.Image
        Dim objPicture As System.Drawing.Image
        objPicture = CType(System.Windows.Forms.AxHost.GetPictureFromIPicture(objIDispImage), System.Drawing.Image)
        Return objPicture
    End Function

End Class

Remarks

If a thumbnail of this file is not available, this method returns Nothing or null.

See Also

IEdmFile13 Interface
IEdmFile13 Members
IEdmEnumeratorVariable5::GetThumbnail Method ()

Availability

SOLIDWORKS PDM Professional 2018


GetThumbnail2 Method (IEdmFile15)

GetThumbnail2 Method (IEdmFile15)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFile15 Interface : GetThumbnail2 Method (IEdmFile15)

lVersion
Version of the file whose thumbnail to retrieve
Obsolete. Superseded by IEdmFile18::GetThumbnail3 .

Syntax

Visual Basic
Function GetThumbnail2( _
   ByVal lVersion As System.Integer _
) As System.Object
C#
System.object GetThumbnail2(
   System.int lVersion
)
C++/CLI
System.Object^ GetThumbnail2(
&   System.int lVersion
)

Parameters

lVersion
Version of the file whose thumbnail to retrieve

Return Value

IPicture

Example

Get a File's Thumbnail by File Version (C#)

Remarks

If a thumbnail of this file is not available, this method returns Nothing or null.

See Also

IEdmFile15 Interface
IEdmFile15 Members
IEdmEnumeratorVariable5::GetThumbnail Method ()

Availability

SOLIDWORKS PDM Professional 2018 SP04


AddFile Method (IEdmFolder5)

AddFile Method (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : AddFile Method (IEdmFolder5)

lParentWnd
Parent window handle
bsSrcPath
Path of file to copy; "" to create an empty file with name specified by bsNewFileName (see Remarks)
bsNewFileName
Optional new file name; "" to use the file name specified in bsSrcPath (see Remarks)
lEdmAddFlags
Combination of EdmAddFlag bits
Obsolete. Superseded by IEdmFolder8::AddFile2.

Syntax

Visual Basic
Function AddFile( _
   ByVal lParentWnd As System.Integer, _
   ByVal bsSrcPath As System.String, _
   Optional ByVal bsNewFileName As System.String, _
   Optional ByVal lEdmAddFlags As System.Integer _
) As System.Integer
C#
System.int AddFile(
   System.int lParentWnd,
   System.string bsSrcPath,
   System.string bsNewFileName,
   System.int lEdmAddFlags
)
C++/CLI
System.int AddFile(
&   System.int lParentWnd,
&   System.String^ bsSrcPath,
&   System.String^ bsNewFileName,
&   System.int lEdmAddFlags
)

Parameters

lParentWnd
Parent window handle
bsSrcPath
Path of file to copy; "" to create an empty file with name specified by bsNewFileName (see Remarks)
bsNewFileName
Optional new file name; "" to use the file name specified in bsSrcPath (see Remarks)
lEdmAddFlags
Combination of EdmAddFlag bits

Return Value

ID of the new file

Remarks

Use this method to:

  • copy a file from another folder that is either inside or outside of the vault.
  • create a new empty file.

Use:

  • IEdmFolder5::CopyFile to copy files within the vault.
  • IEdmFolder5::AddFileShared to share files between folders.

To add multiple files to this folder, use IEdmFolder6::AddFiles to add them all at once, which is more efficient than adding them one at a time using this method.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to add files to this folder.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file with the specified name in this folder.
  • E_EDM_INVALID_NAME: The suggested file name is invalid.
  • E_EDM_FILE_SHARE_ERROR: The source or destination file is opened exclusively by another program.
  • E_EDM_FILE_NOT_FOUND: The source file could not be found.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdType.EdmCmd_PreAdd hooks did not permit the operation.

To create a virtual document in a folder, pass an empty string as the source file. For example:

eFolder.AddFile(Me.Handle.ToInt32, '', path, 0)

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::AddFileShared Method ()
IEdmFolder5::CopyFile Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


CopyFile Method (IEdmFolder5)

CopyFile Method (IEdmFolder5)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : CopyFile Method (IEdmFolder5)

lFileID
ID of file to copy
lSrcFolderID
ID of folder from which to copy the file
lParentWnd
Parent window handle
bsNewName
Optional new name of the file; "" to use the original file name
lFlags
Combination of EdmCopyFlag bits
Obsolete. Superseded by IEdmFolder8::CopyFile2.

Syntax

Visual Basic
Function CopyFile( _
   ByVal lFileID As System.Integer, _
   ByVal lSrcFolderID As System.Integer, _
   ByVal lParentWnd As System.Integer, _
   Optional ByVal bsNewName As System.String, _
   Optional ByVal lFlags As System.Integer _
) As System.Integer
C#
System.int CopyFile(
   System.int lFileID,
   System.int lSrcFolderID,
   System.int lParentWnd,
   System.string bsNewName,
   System.int lFlags
)
C++/CLI
System.int CopyFile(
&   System.int lFileID,
&   System.int lSrcFolderID,
&   System.int lParentWnd,
&   System.String^ bsNewName,
&   System.int lFlags
)

Parameters

lFileID
ID of file to copy
lSrcFolderID
ID of folder from which to copy the file
lParentWnd
Parent window handle
bsNewName
Optional new name of the file; "" to use the original file name
lFlags
Combination of EdmCopyFlag bits

Return Value

ID of the new file

Example

Vault Utilities (C#)
Vault Utilities (VB.NET)

Remarks

This method uses the ID of a file to identify which file to copy. You can also call IEdmFolder5::AddFile, specifying the path of the file that you want to copy. IEdmFolder5::AddFile handles both source files that are inside and outside of the vault.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_NAME_ALREADY_EXISTS: There is already a file or folder with the same name in this folder.
  • E_EDM_FILE_NOT_FOUND: The source file was not found. (The ID is invalid.)
  • E_EDM_PERMISSION_DENIED: The user lacks permission to copy the specified file.
  • E_EDM_FILE_SHARE_ERROR: Cannot copy the file because it is exclusively opened in another application.
  • E_EDM_OPERATION_REFUSED_BY_PLUGIN: One of the installed EdmCmdData.EdmCmd_PreCopy hooks didn't permit the operation.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members
IEdmFolder5::AddFileShared Method ()

Availability

SOLIDWORKS PDM Professional Version 5.2


HasRights Method (IEdmFolder5)

HasRights Method (IEdmFolder5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder5 Interface : HasRights Method (IEdmFolder5)

lRights
Combination of EdmRightFlags bits
plFileID
ID of file to check
Obsolete. Superseded by IEdmFolder5::HasRightsEx.

Syntax

Visual Basic
Sub HasRights( _
   ByVal lRights As System.Integer, _
   ByRef plFileID As System.Integer _
)
C#
void HasRights(
   System.int lRights,
   ref System.int plFileID
)
C++/CLI
void HasRights(
&   System.int lRights,
&   System.int% plFileID
)

Parameters

lRights
Combination of EdmRightFlags bits
plFileID
ID of file to check

Remarks

This method is superseded by IEdmFolder5::HasRightsEx, which provides the ability to check rights on just this folder. Programs that do not need backwards compatibility with SOLIDWORKS PDM Professional 5.2 should use the new method.

This method takes into account both the rights set explicitly on the user and those rights that are inherited from groups of which the user is a member.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks one or more of the specified rights.

See Also

IEdmFolder5 Interface
IEdmFolder5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmFolder12 Interface

IEdmFolder12 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmFolder12 Interface

Allows you to access the contents of a file system folder in the vault.
NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmFolder12
   Inherits IEdmFolder10, IEdmFolder11, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C#
public interface IEdmFolder12 : IEdmFolder10, IEdmFolder11, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5
C++/CLI
public interface class IEdmFolder12 : public IEdmFolder10, IEdmFolder11, IEdmFolder5, IEdmFolder6, IEdmFolder7, IEdmFolder8, IEdmFolder9, IEdmObject5

Remarks

This interface:

  • extends IEdmFolder11 by providing the ability to specify that a new file's data card be created with a name that is either the new file's serial number or the new file's name.
  • is extended by IEdmFolder13.

See Also

IEdmFolder12 Members
EPDM.Interop.epdm Namespace


IEdmFolder12 Interface Members

IEdmFolder12 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmFolder12 Interface

The following tables list the members exposed by IEdmFolder12.

Public Methods

 | Name | Description
Method | SetFileNameSerNo | For internal use only; do not use.
Top

See Also

IEdmFolder12 Interface
EPDM.Interop.epdm Namespace


IEdmFolder12 Interface Methods

IEdmFolder12 Interface Methods
EPDM.Interop.epdm Namespace : IEdmFolder12 Interface

For a list of all members of this type, see IEdmFolder12 members.

Public Methods

 | Name | Description
Method | SetFileNameSerNo | For internal use only; do not use.
Top

See Also

IEdmFolder12 Interface
EPDM.Interop.epdm Namespace


SetFileNameSerNo Method (IEdmFolder12)

SetFileNameSerNo Method (IEdmFolder12)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmFolder12 Interface : SetFileNameSerNo Method (IEdmFolder12)

oSerialNumberName
  • File name without extension or path

- or -

  • ID of the file's serial number generator
For internal use only; do not use.

Syntax

Visual Basic
Sub SetFileNameSerNo( _
   ByVal oSerialNumberName As System.Object _
)
C#
void SetFileNameSerNo(
   System.object oSerialNumberName
)
C++/CLI
void SetFileNameSerNo(
&   System.Object^ oSerialNumberName
)

Parameters

oSerialNumberName
  • File name without extension or path

- or -

  • ID of the file's serial number generator

Remarks

This method specifies that when a file is added to the vault, its data card is created with a name that is either the added file's serial number or its name.

By default when files are added to the vault, file data cards are created with serial number names. To direct that an added file's data card be created with a file name instead of a serial number name, call this method specifying oSerialNumberName with a file name before calling IEdmFolder8::AddFile2 or IEdmFolder6::AddFiles.

If you don't call this method before calling IEdmFolder8::AddFile2 or IEdmFolder6::AddFiles, the added file and its data card are created with different serial number names. To synchronize the serial number names:

  1. Use IEdmSerNoGen7 to generate/get the added file's serial number.
  2. Call this method, specifying oSerialNumberName with the added file's serial number generator ID.
  3. Repeat steps 1 and 2 for each added file.
  4. Call IEdmFolder8::AddFile2 or IEdmFolder6::AddFiles to add the new file(s) to the vault.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: One of the arguments is invalid.

See Also

IEdmFolder12 Interface
IEdmFolder12 Members
IEdmBatchAdd::SetFileNameSerNo Method ()

Availability

SOLIDWORKS PDM Professional 2019


OnMenuItem Method (IEdmMenu5)

OnMenuItem Method (IEdmMenu5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmMenu5 Interface : OnMenuItem Method (IEdmMenu5)

lItemID
ID of the selected menu item
lParentWnd
Parent window handle (HWND)
lCurrentFolderID
ID of the currently active folder
poSelFiles
List of selected files
poSelFolders
List of selected folders
Obsolete. Superseded by IEdmMenu7::OnMenuItem2.

Syntax

Visual Basic
Function OnMenuItem( _
   ByVal lItemID As System.Integer, _
   ByVal lParentWnd As System.Integer, _
   ByVal lCurrentFolderID As System.Integer, _
   ByVal poSelFiles As EdmSelectionList5, _
   ByVal poSelFolders As EdmSelectionList5 _
) As System.Integer
C#
System.int OnMenuItem(
   System.int lItemID,
   System.int lParentWnd,
   System.int lCurrentFolderID,
   EdmSelectionList5 poSelFiles,
   EdmSelectionList5 poSelFolders
)
C++/CLI
System.int OnMenuItem(
&   System.int lItemID,
&   System.int lParentWnd,
&   System.int lCurrentFolderID,
&   EdmSelectionList5^ poSelFiles,
&   EdmSelectionList5^ poSelFolders
)

Parameters

lItemID
ID of the selected menu item
lParentWnd
Parent window handle (HWND)
lCurrentFolderID
ID of the currently active folder
poSelFiles
List of selected files
poSelFolders
List of selected folders

Return Value

User-interface elements that should be refreshed as defined in EdmRefreshFlag

Remarks

You should call this method when a user selects a menu item belonging to this menu.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: Menu item does not belong to this menu.
  • S_EDM_MENU_ITEM_NOT_APPLICABLE: The current selection of files and folders do not satisfy the constraints set by the command author. See EdmMenuFlags sent to IEdmCmdMgr5::AddCmd.

See Also

IEdmMenu5 Interface
IEdmMenu5 Members

Availability

Version 5.2 of SOLIDWORKS PDM Professional


GetFirstChildPosition Method (IEdmReference5)

GetFirstChildPosition Method (IEdmReference5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference5 Interface : GetFirstChildPosition Method (IEdmReference5)

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
lVersion
Version for which to get references; use 0 for latest version
Obsolete. Superseded by IEdmReference7::GetFirstChildPosition2.

Syntax

Visual Basic
Function GetFirstChildPosition( _
   ByRef pbsProjectName As System.String, _
   ByVal bIsTopParent As System.Boolean, _
   ByVal bPermitReadLocal As System.Boolean, _
   Optional ByVal lVersion As System.Integer _
) As IEdmPos5
C#
IEdmPos5 GetFirstChildPosition(
   out System.string pbsProjectName,
   System.bool bIsTopParent,
   System.bool bPermitReadLocal,
   System.int lVersion
)
C++/CLI
IEdmPos5^ GetFirstChildPosition(
&   [Out] System.String^ pbsProjectName,
&   System.bool bIsTopParent,
&   System.bool bPermitReadLocal,
&   System.int lVersion
)

Parameters

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
lVersion
Version for which to get references; use 0 for latest version

Return Value

Position of the first file referenced by this file (see Remarks)

Remarks

You should maintain and pass in a string, by reference, in this argument for all calls to this method in a reference tree. The project name can be allocated and returned by the topmost node in the tree and is used by its children.

Pass the position to IEdmReference5::GetNextChild to enumerate the referenced files.

C++ programmers not using smart-pointer wrapper functions must release the position.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference5 Interface
IEdmReference5 Members


GetFirstChildPosition2 Method (IEdmReference7)

GetFirstChildPosition2 Method (IEdmReference7)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmReference7 Interface : GetFirstChildPosition2 Method (IEdmReference7)

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
lVersion
Version for which to get references; use 0 for latest version
Obsolete. Superseded by IEdmReference9::GetFirstChildPosition3 .

Syntax

Visual Basic
Function GetFirstChildPosition2( _
   ByRef pbsProjectName As System.String, _
   ByVal bIsTopParent As System.Boolean, _
   ByVal bPermitReadLocal As System.Boolean, _
   ByVal lEdmRefFlags As System.Integer, _
   Optional ByVal lVersion As System.Integer _
) As IEdmPos5
C#
IEdmPos5 GetFirstChildPosition2(
   out System.string pbsProjectName,
   System.bool bIsTopParent,
   System.bool bPermitReadLocal,
   System.int lEdmRefFlags,
   System.int lVersion
)
C++/CLI
IEdmPos5^ GetFirstChildPosition2(
&   [Out] System.String^ pbsProjectName,
&   System.bool bIsTopParent,
&   System.bool bPermitReadLocal,
&   System.int lEdmRefFlags,
&   System.int lVersion
)

Parameters

pbsProjectName
Project name (see Remarks)
bIsTopParent
True if this is the topmost node in the reference tree, false if not
bPermitReadLocal
True to allow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database, false to disallow SOLIDWORKS PDM Professional to read reference information if it is not already present in the database
lEdmRefFlags
Types of references that you want enumerated as defined in EdmRefFlags
lVersion
Version for which to get references; use 0 for latest version

Return Value

Position of the first file referenced by this file (see Remarks)

Remarks

You should maintain and pass in a string, by reference, in this argument for all calls to this method in a reference tree. The project name can be allocated and returned by the topmost node in the tree and is used by its children.

Pass the position returned by this method to IEdmReference5::GetNextChild to continue to enumerate the referenced files.

C++ programmers not using smart-pointer wrapper functions must release the position.

Return code S_OK indicates that the method successfully executed.

See Also

IEdmReference7 Interface
IEdmReference7 Members

Availability

SOLIDWORKS PDM Professional 2010


Rollback2 Method (IEdmRevision6)

Rollback2 Method (IEdmRevision6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmRevision6 Interface : Rollback2 Method (IEdmRevision6)

bsComment
Comment for this revision
Obsolete. Superseded by IEdmRevision7::Rollback3.

Syntax

Visual Basic
Sub Rollback2( _
   ByVal bsComment As System.String _
)
C#
void Rollback2(
   System.string bsComment
)
C++/CLI
void Rollback2(
&   System.String^ bsComment
)

Parameters

bsComment
Comment for this revision

Remarks

This method destroys all versions after this revision number. To undo this rollback operation, you need to restore a backup of the entire database and file archives.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_PERMISSION_DENIED: The user lacks permission to delete files.

See Also

IEdmRevision6 Interface
IEdmRevision6 Members
IEdmEnumeratorVersion6::Rollback2 Method ()
IEdmVersion6::Rollback2 Method ()

Availability

SOLIDWORKS PDM Professional 2015


AddVariable Method (IEdmSearch5)

AddVariable Method (IEdmSearch5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSearch5 Interface : AddVariable Method (IEdmSearch5)

poIdOrName
ID or name of variable for which to search
poValue
Value for which to search (see Remarks)
Obsolete. Superseded by IEdmSearch8::AddVariable2 .

Syntax

Visual Basic
Sub AddVariable( _
   ByRef poIdOrName As System.Object, _
   ByRef poValue As System.Object _
)
C#
void AddVariable(
   ref System.object poIdOrName,
   ref System.object poValue
)
C++/CLI
void AddVariable(
&   System.Object^% poIdOrName,
&   System.Object^% poValue
)

Parameters

poIdOrName
ID or name of variable for which to search
poValue
Value for which to search (see Remarks)

Remarks

poValue may contain wildcards:

  • % - any number of arbitrary characters
  • _ - exactly one arbitrary character

The number of times you could call this method was limited to 4 in SOLIDWORKS PDM Professional Version 6.0 and earlier. This restriction was removed in Version 6.1.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_KEY_NOT_FOUND: The variable name was not recognized.

See Also

IEdmSearch5 Interface
IEdmSearch5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


AddTail Method (IEdmSelectionList5)

AddTail Method (IEdmSelectionList5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList5 Interface : AddTail Method (IEdmSelectionList5)

bsItemName
File or folder name
lItemID
ID of file or folder
lParentFolderID
ID of parent folder of file or folder
Obsolete. Superseded by IEdmSelectionList6::AddTail2 .

Syntax

Visual Basic
Sub AddTail( _
   ByVal bsItemName As System.String, _
   ByVal lItemID As System.Integer, _
   ByVal lParentFolderID As System.Integer _
)
C#
void AddTail(
   System.string bsItemName,
   System.int lItemID,
   System.int lParentFolderID
)
C++/CLI
void AddTail(
&   System.String^ bsItemName,
&   System.int lItemID,
&   System.int lParentFolderID
)

Parameters

bsItemName
File or folder name
lItemID
ID of file or folder
lParentFolderID
ID of parent folder of file or folder

Remarks

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmSelectionList5 Interface
IEdmSelectionList5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


GetNext Method (IEdmSelectionList5)

GetNext Method (IEdmSelectionList5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSelectionList5 Interface : GetNext Method (IEdmSelectionList5)

poPos
IEdmPos5; position of the item to get (see Remarks)
pbsItemName
Name of the file or folder (see Remarks)
plItemID
ID of the file or folder
plParentFolderID
ID of the parent folder of the file or folder
Obsolete. Superseded by IEdmSelectionList6::GetNext2 .

Syntax

Visual Basic
Sub GetNext( _
   ByVal poPos As IEdmPos5, _
   ByRef pbsItemName As System.String, _
   ByRef plItemID As System.Integer, _
   ByRef plParentFolderID As System.Integer _
)
C#
void GetNext(
   IEdmPos5 poPos,
   out System.string pbsItemName,
   out System.int plItemID,
   out System.int plParentFolderID
)
C++/CLI
void GetNext(
&   IEdmPos5^ poPos,
&   [Out] System.String^ pbsItemName,
&   [Out] System.int plItemID,
&   [Out] System.int plParentFolderID
)

Parameters

poPos
IEdmPos5; position of the item to get (see Remarks)
pbsItemName
Name of the file or folder (see Remarks)
plItemID
ID of the file or folder
plParentFolderID
ID of the parent folder of the file or folder

Remarks

Before calling this method the first time, you must populate poPos with the interface to the position of the first item, IEdmPos5. Call IEdmSelectionList5::GetHeadPosition to obtain IEdmPos5.

After calling this method the first time, poPos is automatically incremented every time it is called. Call this method repeatedly to obtain the rest of the items.

Be sure to call IEdmPos5::IsNull before you call this method to ensure you have not reached the end of the enumeration.

C++ programmers must free the string returned in pbsItemName with a call to SysFreeString.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_END_OF_LIST: You have gone past the end of the list.

See Also

IEdmSelectionList5 Interface
IEdmSelectionList5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


IEdmSerNoGen6 Interface

IEdmSerNoGen6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmSerNoGen6 Interface

Obsolete. Superseded by IEdmSerNoGen7 .

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmSerNoGen6
C#
public interface IEdmSerNoGen6
C++/CLI
public interface class IEdmSerNoGen6

Remarks

This interface:

  • inherits from IDispatch. See IDispatch Interface (Automation).
  • is superseded by IEdmSerNoGen7 which provides the ability to push back serial numbers that you do not need.

Accessors

IEdmVault7::CreateUtility

See Also

IEdmSerNoGen6 Members
EPDM.Interop.epdm Namespace


IEdmSerNoGen6 Interface Members

IEdmSerNoGen6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmSerNoGen6 Interface

The following tables list the members exposed by IEdmSerNoGen6.

Public Methods

 | Name | Description
Method | GenerateSerNo | Obsolete. Superseded by IEdmSerNoGen7::AllocSerNoValue .
Top

See Also

IEdmSerNoGen6 Interface
EPDM.Interop.epdm Namespace


IEdmSerNoGen6 Interface Methods

IEdmSerNoGen6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmSerNoGen6 Interface

For a list of all members of this type, see IEdmSerNoGen6 members.

Public Methods

 | Name | Description
Method | GenerateSerNo | Obsolete. Superseded by IEdmSerNoGen7::AllocSerNoValue .
Top

See Also

IEdmSerNoGen6 Interface
EPDM.Interop.epdm Namespace


GenerateSerNo Method (IEdmSerNoGen6)

GenerateSerNo Method (IEdmSerNoGen6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmSerNoGen6 Interface : GenerateSerNo Method (IEdmSerNoGen6)

bsSerNoName
Name of the serial number generator to use to generate a new serial number (see Remarks)
lParentWnd
Parent window handle; passed to a serial number add-in, if it exists
bsFilePath
Path to the file for which to generate a serial number
lFolderID
ID of the file's parent folder
lFileID
ID of the file for which to generate a serial number
lCardID
ID of the data card in which the serial number is generated
lCardControlID
ID of the control for which to generate a serial number
Obsolete. Superseded by IEdmSerNoGen7::AllocSerNoValue .

Syntax

Visual Basic
Function GenerateSerNo( _
   ByVal bsSerNoName As System.String, _
   Optional ByVal lParentWnd As System.Integer, _
   Optional ByVal bsFilePath As System.String, _
   Optional ByVal lFolderID As System.Integer, _
   Optional ByVal lFileID As System.Integer, _
   Optional ByVal lCardID As System.Integer, _
   Optional ByVal lCardControlID As System.Integer _
) As System.String
C#
System.string GenerateSerNo(
   System.string bsSerNoName,
   System.int lParentWnd,
   System.string bsFilePath,
   System.int lFolderID,
   System.int lFileID,
   System.int lCardID,
   System.int lCardControlID
)
C++/CLI
System.String^ GenerateSerNo(
&   System.String^ bsSerNoName,
&   System.int lParentWnd,
&   System.String^ bsFilePath,
&   System.int lFolderID,
&   System.int lFileID,
&   System.int lCardID,
&   System.int lCardControlID
)

Parameters

bsSerNoName
Name of the serial number generator to use to generate a new serial number (see Remarks)
lParentWnd
Parent window handle; passed to a serial number add-in, if it exists
bsFilePath
Path to the file for which to generate a serial number
lFolderID
ID of the file's parent folder
lFileID
ID of the file for which to generate a serial number
lCardID
ID of the data card in which the serial number is generated
lCardControlID
ID of the control for which to generate a serial number

Return Value

Serial number value

Remarks

This method is superseded by IEdmSerNoGen7:AllocSerNoValue which provides the ability to push back serial numbers that you don't need using IEdmSerNoValue.

bsSerNoName is the name you specify in the SOLIDWORKS PDM Professional Administration tool when you create a serial number generator.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_SERIAL_NUMBER_NAME: The bsSerNoName argument is invalid.

See Also

IEdmSerNoGen6 Interface
IEdmSerNoGen6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


HasSysRight Method (IEdmUser5)

HasSysRight Method (IEdmUser5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUser5 Interface : HasSysRight Method (IEdmUser5)

eRight
Permissions as defined in EdmSysRightFlags
Obsolete. Superseded by IEdmUser7::HasSysRightEx .

Syntax

Visual Basic
Function HasSysRight( _
   ByVal eRight As EdmSysRightFlags _
) As System.Boolean
C#
System.bool HasSysRight(
   EdmSysRightFlags eRight
)
C++/CLI
System.bool HasSysRight(
&   EdmSysRightFlags eRight
)

Parameters

eRight
Permissions as defined in EdmSysRightFlags

Return Value

True if the user has all of the permissions, false if the user lacks one or more of the permissions

Remarks

This method is superseded by IEdmUser7::HasSysRightEx.

Before SOLIDWORKS PDM Professional 2010, IEdmUser5::HasSysRight supported the bit-wise combination of system permissions. Because the number of system permissions has grown, and they do not all fit in a 32-bit integer, system permissions added in SOLIDWORKS PDM Professional 2010 and later are sequential numeric constants instead of bit flags. You must use IEdmUser7::HasSysRightEx to check permissions added in SOLIDWORKS PDM Professional 2010 and later.

This method checks both the permissions set directly on the user and the permissions inherited from the groups of which the user is a member.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The method successfully executed, but the user lacks the specified permissions.

See Also

IEdmUser5 Interface
IEdmUser5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


HasSysRight Method (IEdmUserGroup5)

HasSysRight Method (IEdmUserGroup5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserGroup5 Interface : HasSysRight Method (IEdmUserGroup5)

eRight
Combination of EdmSysRightFlags
Obsolete. Superseded by IEdmUserGroup6::HasSysRightEx .

Syntax

Visual Basic
Function HasSysRight( _
   ByVal eRight As EdmSysRightFlags _
) As System.Boolean
C#
System.bool HasSysRight(
   EdmSysRightFlags eRight
)
C++/CLI
System.bool HasSysRight(
&   EdmSysRightFlags eRight
)

Parameters

eRight
Combination of EdmSysRightFlags

Return Value

True if the user group has all the permissions, false if not

Remarks

This method is superseded by IEdmUserGroup6::HasSysRightEx.

Before SOLIDWORKS PDM Professional 2010, IEdmUserGroup5::HasSysRight supported the bit-wise combination of system permissions. Because the number of system permissions has grown, and they do not all fit in a 32-bit integer, system permissions added in SOLIDWORKS PDM Professional 2010 and later are sequential numeric constants instead of bit flags. You must use IEdmUserGroup6::HasSysRightEx to check permissions added in SOLIDWORKS PDM Professional 2010 and later.

To check individual user permissions, call IEdmUser5::HasSysRight, which checks both permissions set directly on the user and permissions inherited from groups of which he is a member.

Return codes:

  • S_OK: The method successfully executed, and all of the permissions are set.
  • S_FALSE: The method successfully executed, but one or more of the permissions are not set.

See Also

IEdmUserGroup5 Interface
IEdmUserGroup5 Members

Availability

SOLIDWORKS PDM Professional version 5.2


IEdmUserMgr6 Interface

IEdmUserMgr6 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmUserMgr6 Interface

Obsolete. Superseded by IEdmUserMgr7 .

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmUserMgr6
   Inherits IEdmUserMgr5
C#
public interface IEdmUserMgr6 : IEdmUserMgr5
C++/CLI
public interface class IEdmUserMgr6 : public IEdmUserMgr5

Remarks

This interface:

  • inherits from IEdmUserMgr5.
  • provides the ability to add groups and users.
  • is superseded by IEdmUserMgr7.

See Also

IEdmUserMgr6 Members
EPDM.Interop.epdm Namespace


IEdmUserMgr6 Interface Members

IEdmUserMgr6 Interface Members
See Also Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr6 Interface

The following tables list the members exposed by IEdmUserMgr6.

Public Methods

 | Name | Description
Method | AddGroups | Obsolete. Superseded by IEdmUserMgr7::AddGroups2 .
Method | AddUsers | Obsolete. Superseded by IEdmUserMgr7::AddUsers2 .
Top

See Also

IEdmUserMgr6 Interface
EPDM.Interop.epdm Namespace


IEdmUserMgr6 Interface Methods

IEdmUserMgr6 Interface Methods
EPDM.Interop.epdm Namespace : IEdmUserMgr6 Interface

For a list of all members of this type, see IEdmUserMgr6 members.

Public Methods

 | Name | Description
Method | AddGroups | Obsolete. Superseded by IEdmUserMgr7::AddGroups2 .
Method | AddUsers | Obsolete. Superseded by IEdmUserMgr7::AddUsers2 .
Top

See Also

IEdmUserMgr6 Interface
EPDM.Interop.epdm Namespace


AddGroups Method (IEdmUserMgr6)

AddGroups Method (IEdmUserMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr6 Interface : AddGroups Method (IEdmUserMgr6)

ppoGroupData
Array of EdmGroupData structures; one structure for each user group
Obsolete. Superseded by IEdmUserMgr7::AddGroups2 .

Syntax

Visual Basic
Sub AddGroups( _
   ByRef ppoGroupData() As EdmGroupData _
)
C#
void AddGroups(
   out EdmGroupData[] ppoGroupData
)
C++/CLI
void AddGroups(
&   [Out] array<EdmGroupData>^ ppoGroupData
)

Parameters

ppoGroupData
Array of EdmGroupData structures; one structure for each user group

Remarks

This method is superseded by IEdmUserMgr7::AddGroups2 which allows you to specify system permissions.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr6 Interface
IEdmUserMgr6 Members

Availability

SOLIDWORKS PDM Professional 2007


AddUsers Method (IEdmUserMgr6)

AddUsers Method (IEdmUserMgr6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr6 Interface : AddUsers Method (IEdmUserMgr6)

ppoUserData
Array of EdmUserData structures; one structure for each user
Obsolete. Superseded by IEdmUserMgr7::AddUsers2 .

Syntax

Visual Basic
Sub AddUsers( _
   ByRef ppoUserData() As EdmUserData _
)
C#
void AddUsers(
   out EdmUserData[] ppoUserData
)
C++/CLI
void AddUsers(
&   [Out] array<EdmUserData>^ ppoUserData
)

Parameters

ppoUserData
Array of EdmUserData structures; one structure for each user

Remarks

This method is superseded by IEdmUserMgr7::AddUsers2 which allows you to specify system permissions.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr6 Interface
IEdmUserMgr6 Members

Availability

SOLIDWORKS PDM Professional 2007


AddUsers2 Method (IEdmUserMgr7)

AddUsers2 Method (IEdmUserMgr7)
See Also Example
[image]
EPDM.Interop.epdm Namespace > IEdmUserMgr7 Interface : AddUsers2 Method (IEdmUserMgr7)

ppoUserData
Array of EdmUserData2 structures; one structure for each user
Obsolete. Superseded by IEdmUserMgr10::AddUsers3 .

Syntax

Visual Basic
Sub AddUsers2( _
   ByRef ppoUserData() As EdmUserData2 _
)
C#
void AddUsers2(
   out EdmUserData2[] ppoUserData
)
C++/CLI
void AddUsers2(
&   [Out] array<EdmUserData2>^ ppoUserData
)

Parameters

ppoUserData
Array of EdmUserData2 structures; one structure for each user

Example

Add Users (VB.NET)
Add Users (C#)

Remarks

This method supersedes IEdmUserMgr6::AddUsers by providing the ability to specify permissions for added users.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmUserMgr7 Interface
IEdmUserMgr7 Members

Availability

SOLIDWORKS PDM Professional 2010


BrowseForFolder Method (IEdmVault5)

BrowseForFolder Method (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : BrowseForFolder Method (IEdmVault5)

hParentWnd
Parent window handle
bsMessage
Message to display in the dialog box
Obsolete. Superseded by IEdmVault11::BrowseForFolder2 .

Syntax

Visual Basic
Function BrowseForFolder( _
   ByVal hParentWnd As System.Integer, _
   ByVal bsMessage As System.String _
) As IEdmFolder5
C#
IEdmFolder5 BrowseForFolder(
   System.int hParentWnd,
   System.string bsMessage
)
C++/CLI
IEdmFolder5^ BrowseForFolder(
&   System.int hParentWnd,
&   System.String^ bsMessage
)

Parameters

hParentWnd
Parent window handle
bsMessage
Message to display in the dialog box

Return Value

IEdmFolder5; Null if the user clicks Cancel (see Remarks)

Remarks

C++ users must release the returned interface, IEdmFolder5.

Return codes:

  • S_OK: The method successfully executed.
  • S_FALSE: The user clicked Cancel.
  • E_EDM_NOT_LOGGED_IN: You must call IEdmVault5::Login or IEdmVault5::LoginAuto before calling this method.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


CreatePluginMenu Method (IEdmVault5)

CreatePluginMenu Method (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : CreatePluginMenu Method (IEdmVault5)

hMenu
Handle of menu in which to insert add-in commands
lInsertPosition
Zero-based index of the position in the menu where new menu items should be inserted; -1 to append new menu items to the bottom of the menu
plStartID
Next available menu command ID (see Remarks)
lSelFileCount
Number of selected files
lSelFolderCount
Number of selected folders
lCreateMenuFlags
Combination of CreateMenuFlags bits
plItemCount
Number of menu items added
Obsolete. Superseded by IEdmVault12::CreatePluginMenu2 .

Syntax

Visual Basic
Function CreatePluginMenu( _
   ByVal hMenu As System.Integer, _
   ByVal lInsertPosition As System.Integer, _
   ByRef plStartID As System.Integer, _
   ByVal lSelFileCount As System.Integer, _
   ByVal lSelFolderCount As System.Integer, _
   ByVal lCreateMenuFlags As System.Integer, _
   ByRef plItemCount As System.Integer _
) As IEdmMenu5
C#
IEdmMenu5 CreatePluginMenu(
   System.int hMenu,
   System.int lInsertPosition,
   out System.int plStartID,
   System.int lSelFileCount,
   System.int lSelFolderCount,
   System.int lCreateMenuFlags,
   out System.int plItemCount
)
C++/CLI
IEdmMenu5^ CreatePluginMenu(
&   System.int hMenu,
&   System.int lInsertPosition,
&   [Out] System.int plStartID,
&   System.int lSelFileCount,
&   System.int lSelFolderCount,
&   System.int lCreateMenuFlags,
&   [Out] System.int plItemCount
)

Parameters

hMenu
Handle of menu in which to insert add-in commands
lInsertPosition
Zero-based index of the position in the menu where new menu items should be inserted; -1 to append new menu items to the bottom of the menu
plStartID
Next available menu command ID (see Remarks)
lSelFileCount
Number of selected files
lSelFolderCount
Number of selected folders
lCreateMenuFlags
Combination of CreateMenuFlags bits
plItemCount
Number of menu items added

Return Value

IEdmMenu5 (see Remarks)

Example

Remarks

When this method is called, plStartID should be the first free menu command ID that a new command is assigned. When this method returns, plStartID is the first free menu command ID after IDs for new menu commands have been reserved.

When the user chooses one of the menu items added by this method, your program must call IEdmMenu5::OnMenuItem.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


SetAddInWnd Method (IEdmVault5)

SetAddInWnd Method (IEdmVault5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault5 Interface : SetAddInWnd Method (IEdmVault5)

lAddInWnd
Add-in window handle
lParentWnd
File Explorer window handle; EdmCmd::mlParentWnd passed to IEdmAddIn5::OnCmd
Obsolete. See Keeping Add-in Windows in the Foreground .

Syntax

Visual Basic
Sub SetAddInWnd( _
   ByVal lAddInWnd As System.Integer, _
   ByVal lParentWnd As System.Integer _
)
C#
void SetAddInWnd(
   System.int lAddInWnd,
   System.int lParentWnd
)
C++/CLI
void SetAddInWnd(
&   System.int lAddInWnd,
&   System.int lParentWnd
)

Parameters

lAddInWnd
Add-in window handle
lParentWnd
File Explorer window handle; EdmCmd::mlParentWnd passed to IEdmAddIn5::OnCmd

Remarks

This method ensures that windows created from add-ins written in Visual Basic 6 do not appear behind the application window. Since VBA is no longer supported, this method is obsolete and should not be used.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault5 Interface
IEdmVault5 Members

Availability

SOLIDWORKS PDM Professional Version 5.2


CreateCardViewEx Method (IEdmVault6)

CreateCardViewEx Method (IEdmVault6)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault6 Interface : CreateCardViewEx Method (IEdmVault6)

lEdmCardViewFlags
Combination of EdmCardViewFlag bits
lCardID
ID of card to display (see Remarks)
lParentWindow
Parent window handle
lX
X-position in pixels of the parent window
lY
Y-position in pixels of the parent window
poCallback
Pointer to a class that implements IEdmCardViewCallback6
Obsolete. Superseded by IEdmVault10::CreateCardViewEx2 .

Syntax

Visual Basic
Function CreateCardViewEx( _
   ByVal lEdmCardViewFlags As System.Integer, _
   ByVal lCardID As System.Integer, _
   ByVal lParentWindow As System.Integer, _
   ByVal lX As System.Integer, _
   ByVal lY As System.Integer, _
   ByVal poCallback As IEdmCardViewCallback6 _
) As IEdmCardView6
C#
IEdmCardView6 CreateCardViewEx(
   System.int lEdmCardViewFlags,
   System.int lCardID,
   System.int lParentWindow,
   System.int lX,
   System.int lY,
   IEdmCardViewCallback6 poCallback
)
C++/CLI
IEdmCardView6^ CreateCardViewEx(
&   System.int lEdmCardViewFlags,
&   System.int lCardID,
&   System.int lParentWindow,
&   System.int lX,
&   System.int lY,
&   IEdmCardViewCallback6^ poCallback
)

Parameters

lEdmCardViewFlags
Combination of EdmCardViewFlag bits
lCardID
ID of card to display (see Remarks)
lParentWindow
Parent window handle
lX
X-position in pixels of the parent window
lY
Y-position in pixels of the parent window
poCallback
Pointer to a class that implements IEdmCardViewCallback6

Return Value

IEdmCardView6

Remarks

Use this method if you want complete control of the loading and saving of data to and from a custom file or folder data card. Use IEdmFolder5::CreateCardView if you want SOLIDWORKS PDM Professional to handle the loading and saving of data to and from a simple file or folder data card.

To obtain lCardID, call IEdmVault6::GetCardID.

Return codes:

  • S_OK: The method successfully executed.
  • E_EDM_INVALID_ID: The specified card ID is invalid.

See Also

IEdmVault6 Interface
IEdmVault6 Members

Availability

SOLIDWORKS PDM Professional Version 6.0


InstallLicense Method (IEdmVault11)

InstallLicense Method (IEdmVault11)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmVault11 Interface : InstallLicense Method (IEdmVault11)

bsUserName
Name of a SOLIDWORKS PDM Professional user
bsPasswd
Password for bsUserName
bsVaultName
Name of vault for which to install a license
bsLicenseFilePath
Path to the license file
Obsolete. Replaced by IEdmVault14::InstallLicense2.

Syntax

Visual Basic
Sub InstallLicense( _
   ByVal bsUserName As System.String, _
   ByVal bsPasswd As System.String, _
   ByVal bsVaultName As System.String, _
   ByVal bsLicenseFilePath As System.String _
)
C#
void InstallLicense(
   System.string bsUserName,
   System.string bsPasswd,
   System.string bsVaultName,
   System.string bsLicenseFilePath
)
C++/CLI
void InstallLicense(
&   System.String^ bsUserName,
&   System.String^ bsPasswd,
&   System.String^ bsVaultName,
&   System.String^ bsLicenseFilePath
)

Parameters

bsUserName
Name of a SOLIDWORKS PDM Professional user
bsPasswd
Password for bsUserName
bsVaultName
Name of vault for which to install a license
bsLicenseFilePath
Path to the license file

Remarks

In SOLIDWORKS PDM Professional 2014 and earlier, licenses were shared among all vaults that were in the same SQL Server instance. Because licenses are shared among all vaults that use the same SolidNetwork License Server (SNL) in SOLIDWORKS PDM Professional 2015 SP0 and later, this method is obsolete and replaced by IEdmVault14::InstallLicense2.

Return codes:

  • S_OK: The method successfully executed.

See Also

IEdmVault11 Interface
IEdmVault11 Members

Availability

SOLIDWORKS PDM Professional 2010


IEdmWorkflow5 Interface

IEdmWorkflow5 Interface
See Also Members
[image]
EPDM.Interop.epdm Namespace : IEdmWorkflow5 Interface

Obsolete. Superseded by IEdmWorkflow6 .

NOTE: Click the Members link, located near the top of the topic, to see this interface's methods and properties.

Syntax

Visual Basic
Public Interface IEdmWorkflow5
C#
public interface IEdmWorkflow5
C++/CLI
public interface class IEdmWorkflow5

See Also

IEdmWorkflow5 Members
EPDM.Interop.epdm Namespace


IEdmWorkflow5 Interface Members

IEdmWorkflow5 Interface Members
See Also Properties Methods
EPDM.Interop.epdm Namespace : IEdmWorkflow5 Interface

The following tables list the members exposed by IEdmWorkflow5.

Public Properties

 | Name | Description
Property | InitialState | Obsolete. Superseded by IEdmWorkflow6::InitialState .
Top

Public Methods

 | Name | Description
Method | GetFirstStatePosition | Obsolete. Superseded by IEdmWorkflow6::GetFirstStatePosition .
Method | GetFirstTransitionPosition | Obsolete. Superseded by IEdmWorkflow6::GetFirstTransitionPosition .
Method | GetNextState | Obsolete. Superseded by IEdmWorkflow6::GetNextState .
Method | GetNextTransition | Obsolete. Superseded by IEdmWorkflow6::GetNextTransition .
Method | GetState | Obsolete. Superseded by IEdmWorkflow6::GetState .
Method | GetTransition | Obsolete. Superseded by IEdmWorkflow6::GetTransition .
Top

See Also

IEdmWorkflow5 Interface
EPDM.Interop.epdm Namespace


IEdmWorkflow5 Interface Methods

IEdmWorkflow5 Interface Methods
EPDM.Interop.epdm Namespace : IEdmWorkflow5 Interface

For a list of all members of this type, see IEdmWorkflow5 members.

Public Methods

 | Name | Description
Method | GetFirstStatePosition | Obsolete. Superseded by IEdmWorkflow6::GetFirstStatePosition .
Method | GetFirstTransitionPosition | Obsolete. Superseded by IEdmWorkflow6::GetFirstTransitionPosition .
Method | GetNextState | Obsolete. Superseded by IEdmWorkflow6::GetNextState .
Method | GetNextTransition | Obsolete. Superseded by IEdmWorkflow6::GetNextTransition .
Method | GetState | Obsolete. Superseded by IEdmWorkflow6::GetState .
Method | GetTransition | Obsolete. Superseded by IEdmWorkflow6::GetTransition .
Top

See Also

IEdmWorkflow5 Interface
EPDM.Interop.epdm Namespace


IEdmWorkflow5 Interface Properties

IEdmWorkflow5 Interface Properties
EPDM.Interop.epdm Namespace : IEdmWorkflow5 Interface

For a list of all members of this type, see IEdmWorkflow5 members.

Public Properties

 | Name | Description
Property | InitialState | Obsolete. Superseded by IEdmWorkflow6::InitialState .
Top

See Also

IEdmWorkflow5 Interface
EPDM.Interop.epdm Namespace


GetFirstStatePosition Method (IEdmWorkflow5)

GetFirstStatePosition Method (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : GetFirstStatePosition Method (IEdmWorkflow5)

Obsolete. Superseded by IEdmWorkflow6::GetFirstStatePosition .

Syntax

Visual Basic
Function GetFirstStatePosition() As IEdmPos5
C#
IEdmPos5 GetFirstStatePosition()
C++/CLI
IEdmPos5^ GetFirstStatePosition();

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


GetFirstTransitionPosition Method (IEdmWorkflow5)

GetFirstTransitionPosition Method (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : GetFirstTransitionPosition Method (IEdmWorkflow5)

Obsolete. Superseded by IEdmWorkflow6::GetFirstTransitionPosition .

Syntax

Visual Basic
Function GetFirstTransitionPosition() As IEdmPos5
C#
IEdmPos5 GetFirstTransitionPosition()
C++/CLI
IEdmPos5^ GetFirstTransitionPosition();

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


GetNextState Method (IEdmWorkflow5)

GetNextState Method (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : GetNextState Method (IEdmWorkflow5)

poPos
Obsolete. Superseded by IEdmWorkflow6::GetNextState .

Syntax

Visual Basic
Function GetNextState( _
   ByVal poPos As IEdmPos5 _
) As IEdmState5
C#
IEdmState5 GetNextState(
   IEdmPos5 poPos
)
C++/CLI
IEdmState5^ GetNextState(
&   IEdmPos5^ poPos
)

Parameters

poPos

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


GetNextTransition Method (IEdmWorkflow5)

GetNextTransition Method (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : GetNextTransition Method (IEdmWorkflow5)

poPos
Obsolete. Superseded by IEdmWorkflow6::GetNextTransition .

Syntax

Visual Basic
Function GetNextTransition( _
   ByVal poPos As IEdmPos5 _
) As IEdmTransition5
C#
IEdmTransition5 GetNextTransition(
   IEdmPos5 poPos
)
C++/CLI
IEdmTransition5^ GetNextTransition(
&   IEdmPos5^ poPos
)

Parameters

poPos

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


GetState Method (IEdmWorkflow5)

GetState Method (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : GetState Method (IEdmWorkflow5)

poIdOrName
Obsolete. Superseded by IEdmWorkflow6::GetState .

Syntax

Visual Basic
Function GetState( _
   ByRef poIdOrName As System.Object _
) As IEdmState5
C#
IEdmState5 GetState(
   ref System.object poIdOrName
)
C++/CLI
IEdmState5^ GetState(
&   System.Object^% poIdOrName
)

Parameters

poIdOrName

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


GetTransition Method (IEdmWorkflow5)

GetTransition Method (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : GetTransition Method (IEdmWorkflow5)

poIdOrName
Obsolete. Superseded by IEdmWorkflow6::GetTransition .

Syntax

Visual Basic
Function GetTransition( _
   ByRef poIdOrName As System.Object _
) As IEdmTransition5
C#
IEdmTransition5 GetTransition(
   ref System.object poIdOrName
)
C++/CLI
IEdmTransition5^ GetTransition(
&   System.Object^% poIdOrName
)

Parameters

poIdOrName

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


InitialState Property (IEdmWorkflow5)

InitialState Property (IEdmWorkflow5)
See Also
[image]
EPDM.Interop.epdm Namespace > IEdmWorkflow5 Interface : InitialState Property (IEdmWorkflow5)

Obsolete. Superseded by IEdmWorkflow6::InitialState .

Syntax

Visual Basic
ReadOnly Property InitialState As IEdmState6
C#
IEdmState6 InitialState {get;}
C++/CLI
property IEdmState6^ InitialState {
   IEdmState6^ get();
}

See Also

IEdmWorkflow5 Interface
IEdmWorkflow5 Members


SOLIDWORKS PDM Professional API Help

Execute Template and Return Data Example (C#)

This example shows how to execute a template to create a folder structure in a vault and return information.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//     b. Type TemplateCSharp in Project name.
//     c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//     f. Click Create.
//     g. Click Show All Files in the Solution Explorer toolbar and expand
//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. To create the form, replace the code in Form1.Designer.cs with
//        this code.
//  2. Add dependencies and safely pass arrays of structures.
//  3. Ensure that a template exists in the vault that you plan to
//     select and that a template card is assigned to that template.
//     NOTE: This example assumes that the template in your selected vault
//     creates a folder structure and that folder structure does not already
//     exist in the selected vault.
//  4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Execute Template dialog box.
//     a. Select a vault view.
//     b. Click Execute Template.
//     c. Displays a message box showing the name of the template to execute.
//     d. Click OK to close the message box.
//     e. A template card dialog may appear to prompt for values.
//        1. Type values.
//        2. Click OK.
//  2. Displays a message box informing you that a new folder structure
//     is, or is not, created in the selected vault.
//  3. Click OK.
//  4. If a folder structure is created, displays a message box with
//     information about the folder structure.
//  5. Click OK.
//  6. Close the Execute Template dialog box.
//  7. Examine the selected vault to verify that a new folder
//     structure based on the template is, or is not, created.
//----------------------------------------------------------------------------
//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace TemplateCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = new EdmVault5();

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try {

                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views) {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0) {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            } catch (System.Runtime.InteropServices.COMException ex) {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }

        }

        private void ExecuteTemplateButton_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Access template in the selected vault
                IEdmTemplateMgr5 templateMgr = default(IEdmTemplateMgr5);
                templateMgr = (IEdmTemplateMgr5)vault2.CreateUtility(EdmUtility.EdmUtil_TemplateMgr);
                IEdmPos5 pos = default(IEdmPos5);
                pos = templateMgr.GetFirstTemplatePosition();
                IEdmTemplate53 template = null;

                string message = "";
                message = "Installed template in vault, " + vault2.Name + ", to use:" + "\n" + "\n";

                while (!pos.IsNull)
                {

                    template = (IEdmTemplate53)templateMgr.GetNextTemplate(pos);

                    message = message + template.GetMenuString() + "\n";
                    //Display message box with name of template
                    MessageBox.Show(message);

                    //Create template folders in the selected vault
                    //using this template
                    EdmRefreshFlag refreshFlag = default(EdmRefreshFlag);
                    object[] retData = null;
                    refreshFlag = (EdmRefreshFlag)template.RunEx(this.Handle.ToInt32(), vault1.RootFolderID, out retData);

                    if (retData.Length <= 0)
                    {
                        MessageBox.Show("No folder structure created.");
                    }
                    else
                    {
                        MessageBox.Show("The new folder structure based on the template is created in the selected vault.");
                        if (refreshFlag == EdmRefreshFlag.EdmRefresh_FileList)
                        {
                            vault1.RefreshFolder(vault1.RootFolderPath);
                        }

                        //Show a message box with information about the folder structure created by the template
                        long idx = 0;
                        idx = retData.GetLowerBound(0);
                        long upper = 0;
                        upper = retData.GetUpperBound(0);

                        EdmData data = default(EdmData);
                        message = "Template generated:" + "\n";
                        string row = null;

                        while (idx <= upper)
                        {
                            data = (EdmData)retData[idx];
                            switch (data.Type)
                            {
                                case EdmDataType.EdmData_File:
                                    row = "Type=File, Path=" + data.Get(EdmDataPropertyType.EdmProp_Path);
                                    break;
                                case EdmDataType.EdmData_Folder:
                                    row = "Type=Folder, path=" + data.Get(EdmDataPropertyType.EdmProp_Path);
                                    break;
                                case EdmDataType.EdmData_Variable:
                                    row = "Type=Variable, Name=" + data.Get(EdmDataPropertyType.EdmProp_Name) + ", Value=" + data.Get(EdmDataPropertyType.EdmProp_Value);
                                    break;
                                case EdmDataType.EdmData_Link:
                                    row = "Type=Link, Name=" + data.Get(EdmDataPropertyType.EdmProp_LinkPath);
                                    break;
                                default:
                                    row = "No data";
                                    break;
                            }

                            idx = idx + 1;
                            message = message + row + "\n";
                        }

                        MessageBox.Show(message);
                    }

                }

} catch (System.Runtime.InteropServices.COMException ex) {
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
} catch (Exception ex) {
MessageBox.Show(ex.Message);
}

  }
   }
}

Back to top
//Form1.Designer.cs
namespace TemplateCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.ExecuteTemplateButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(24, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(91, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(27, 41);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(242, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // ExecuteTemplateButton
            //
            this.ExecuteTemplateButton.Location = new System.Drawing.Point(27, 81);
            this.ExecuteTemplateButton.Name = "ExecuteTemplateButton";
            this.ExecuteTemplateButton.Size = new System.Drawing.Size(113, 23);
            this.ExecuteTemplateButton.TabIndex = 2;
            this.ExecuteTemplateButton.Text = "Execute Template";
            this.ExecuteTemplateButton.Click += new System.EventHandler(ExecuteTemplateButton_Click);
            this.ExecuteTemplateButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.ExecuteTemplateButton.UseVisualStyleBackColor = true;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(290, 125);
            this.Controls.Add(this.ExecuteTemplateButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "Execute Template";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button ExecuteTemplateButton;

    #endregion
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Execute Template and Return Data Example (VB.NET)

This example shows how to execute a template to create a folder structure in a vault and return information.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'     b. Type TemplateVBNET in Project name.
'     c. For Location, click ... and navigate to the folder where to
create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'     g. Click Show All Files in the Solution Explorer toolbar and expand
'        Form1.vb in the Solution Explorer.
'     h. Replace the code in Form1.vb with this code.
'     i. To create the form, replace the code in Form1.Designer.vb with
'        this code.
'  2. Add dependencies and safely pass arrays of structures.
'  3. Ensure that a template exists in the vault that you plan to
'     select and that a template card is assigned to that template.
'     NOTE: This example assumes that the template in your selected vault
'     creates a folder structure and that folder structure does not already
'     exist in the selected vault.
'  4. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Execute Template dialog box.
'     a. Select a vault view.
'     b. Click Execute Template.
'     c. Displays a message box showing the name of the template to execute.
'     d. Click OK to close the message box.
'     e. A template card dialog may appear to prompt for values.
'        1. Type values.
'        2. Click OK.
'  2. Displays a message box informing you that a new folder structure
'     is, or is not, created in the selected vault.
'  3. Click OK.
'  4. If a folder structure is created, displays a message box with
'     information about the folder structure.
'  5. Click OK.
'  6. Close the Execute Template dialog box.
'  7. Examine the selected vault to verify that a new folder
'     structure based on the template is, or is not, created.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Dim vault1 As IEdmVault5 = New EdmVault5()
    Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
    Dim Views As EdmViewInfo() = Nothing
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub ExecuteTemplateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExecuteTemplateButton.Click

        Try
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Access template in the selected vault
            Dim templateMgr As IEdmTemplateMgr5
            templateMgr = vault1.CreateUtility(EdmUtility.EdmUtil_TemplateMgr)
            Dim pos As IEdmPos5
            pos = templateMgr.GetFirstTemplatePosition
            Dim template As IEdmTemplate53 = Nothing

            Dim message As String = ""
            message = "Installed template in vault, " + vault.Name + ", to use:" + vbLf + vbLf

            While Not pos.IsNull

                template = templateMgr.GetNextTemplate(pos)

                message = message + template.GetMenuString + vbLf
                'Display message box with name of template to execute
                MessageBox.Show(message)

                'Create template folders in the selected vault
                'using this template
                Dim refreshFlag As EdmRefreshFlag
                Dim retData() As Object
                refreshFlag = template.RunEx(Me.Handle.ToInt32(), vault1.RootFolderID, retData)

                If retData.Length <= 0 Then
                    MessageBox.Show("No folder structure created.")
                Else
                    MessageBox.Show("The new folder structure based on the template is created in the selected vault.")
                    If refreshFlag = EdmRefreshFlag.EdmRefresh_FileList Then
                        vault1.RefreshFolder(vault1.RootFolderPath)
                    End If

                    'Show a message box with information about the folder structure created by the template
                    Dim idx As Long
                    idx = LBound(retData)
                    Dim upper As Long
                    upper = UBound(retData)

                    Dim data As EdmData
                    message = "Template generated:" + vbLf
                    Dim row As String

                    While idx <= upper
                        data = retData(idx)
                        Select Case data.Type
                            Case EdmDataType.EdmData_File
                                row = "Type=File, Path=" + data.Get(EdmDataPropertyType.EdmProp_Path)
                            Case EdmDataType.EdmData_Folder
                                row = "Type=Folder, path=" + data.Get(EdmDataPropertyType.EdmProp_Path)
                            Case EdmDataType.EdmData_Variable
                                row = "Type=Variable, Name=" + data.Get(EdmDataPropertyType.EdmProp_Name) + ", Value=" + data.Get(EdmDataPropertyType.EdmProp_Value)
                            Case EdmDataType.EdmData_Link
                                row = "Type=Link, Name=" + data.Get(EdmDataPropertyType.EdmProp_LinkPath)
                            Case Else
                                row = "No data"
                        End Select

                        idx = idx + 1
                        message = message + row + vbLf
                    End While

                    MessageBox.Show(message)
                End If

            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.ExecuteTemplateButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'ExecuteTemplateButton
        '
        Me.ExecuteTemplateButton.Location = New System.Drawing.Point(30, 75)
        Me.ExecuteTemplateButton.Name = "ExecuteTemplateButton"
        Me.ExecuteTemplateButton.Size = New System.Drawing.Size(102, 23)
        Me.ExecuteTemplateButton.TabIndex = 0
        Me.ExecuteTemplateButton.Text = "Execute Template"
        Me.ExecuteTemplateButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.ExecuteTemplateButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(30, 39)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(169, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(27, 23)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Select vault view:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(246, 123)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.ExecuteTemplateButton)
        Me.Name = "Form1"
        Me.Text = "Execute Template"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents ExecuteTemplateButton As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Execute Template Example (C#)

This example shows how to execute a template to create a folder structure in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//     a. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//     b. Type TemplateCSharp in Project name.
//     c. For Location, click ... and navigate to the folder where to
create the project.
//     d. Click Next.
//     e. Select Framework.
//     f. Click Create.
//     g. Click Show All Files in the Solution Explorer toolbar and expand
//        Form1.cs in the Solution Explorer.
//     h. Replace the code in Form1.cs with this code.
//     i. To create the form, replace the code in Form1.Designer.cs with
//        this code.
//  2. Add dependencies and safely pass arrays of structures.
//  3. Ensure that a template exists in the vault that you plan to
//     select and that a template card is assigned to that template.
//     NOTE: This example assumes that the template in your selected vault
//     creates a folder structure and that folder structure does not already
//     exist in the selected vault.
//  4. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Execute Template dialog box.
//     a. Select a vault.
//     b. Click Execute Template.
//     c. Displays a message box showing the name of the template to execute.
//     d. Click OK to close the message box.
//     e. Creates the folder structure defined for the template at the selected
//        vault's root folder and prompts for variable values, if any
//        exist for the template card and template.
//  2. Displays a message box informing you that a new folder structure
//     was created in the selected vault.
//     - or -
//     Displays a message box informing you that a folder structure
//     was not created.
//  3. Click OK to close the message box.
//  4. Close the Execute Template dialog box.
//  5. Examine the selected vault to verify that a new folder
//     structure based on the template was, or was not, created.
//----------------------------------------------------------------------------
//Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace TemplateCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        IEdmVault5 vault1 = new EdmVault5();

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try {

            IEdmVault8 vault = (IEdmVault8)vault1;
            EdmViewInfo[] Views = null;

            vault.GetVaultViews(out Views, false);
            VaultsComboBox.Items.Clear();
            foreach (EdmViewInfo View in Views) {
                VaultsComboBox.Items.Add(View.mbsVaultName);
            }
            if (VaultsComboBox.Items.Count > 0) {
                VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
            }
        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }

    }

    private void ExecuteTemplateButton_Click(System.Object sender, System.EventArgs e)
    {
        try {
            IEdmVault7 vault2 = null;
            if (vault1 == null) {
                vault1 = new EdmVault5();
            }
            vault2 = (IEdmVault7)vault1;

            if (!vault1.IsLoggedIn) {
                vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            //Access template in the selected vault
            IEdmTemplateMgr5 templateMgr = default(IEdmTemplateMgr5);
            templateMgr = (IEdmTemplateMgr5)vault2.CreateUtility(EdmUtility.EdmUtil_TemplateMgr);
            IEdmPos5 pos = default(IEdmPos5);
            pos = templateMgr.GetFirstTemplatePosition();
            IEdmTemplate5 template = null;

            string message = "";
            message = "Installed template in vault, " + vault1.Name + ", to use:" + "\n\n";

            while (!pos.IsNull) {
                template = templateMgr.GetNextTemplate(pos);

                string menuString = "";
                menuString = template.GetMenuString();
                message = message + menuString + "\n";
                //Display message box with name of template
                //to use in the selected vault
                MessageBox.Show(message);

                //Create template folders in the selected vault
                //using this template
                EdmRefreshFlag refreshFlag = default(EdmRefreshFlag);
                refreshFlag = (EdmRefreshFlag)template.Run(this.Handle.ToInt32(), vault1.RootFolderID);

                //Make sure folder structure created
                //Exit application if it is not created
                if (refreshFlag == EdmRefreshFlag.EdmRefresh_Nothing) {
                    MessageBox.Show("Folder structure not created.");
                    return;
                } else {
                    //Folder structure created
                    if (refreshFlag == EdmRefreshFlag.EdmRefresh_FileList) {
                        vault1.RefreshFolder(vault1.RootFolderPath);
                        MessageBox.Show("The new folder structure based on the template was created in the selected vault.");
                    }
                }

            }

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }

      }
     }
}
Back to top
//Form1.Designer.cs
namespace TemplateCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.ExecuteTemplateButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(24, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(91, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(27, 41);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(242, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // ExecuteTemplateButton
            //
            this.ExecuteTemplateButton.Location = new System.Drawing.Point(27, 81);
            this.ExecuteTemplateButton.Name = "ExecuteTemplateButton";
            this.ExecuteTemplateButton.Size = new System.Drawing.Size(113, 23);
            this.ExecuteTemplateButton.TabIndex = 2;
            this.ExecuteTemplateButton.Text = "Execute Template";
            this.ExecuteTemplateButton.Click += new System.EventHandler(ExecuteTemplateButton_Click);
            this.ExecuteTemplateButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.ExecuteTemplateButton.UseVisualStyleBackColor = true;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(290, 125);
            this.Controls.Add(this.ExecuteTemplateButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "Execute Template";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button ExecuteTemplateButton;

    #endregion
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Execute Template Example (VB.NET)

This example shows how to execute a template to create a folder structure in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'     a. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'     b. Type TemplateVBNET in Project name.
'     c. For Location, click ... and navigate to the folder where to
create the project.
'       d. Click Next.
'     e. Select Framework.
'     f. Click Create.
'  2. Click Show All Files in the Solution Explorer toolbar and expand
'     Form1.vb in the Solution Explorer.
'  3. Replace the code in Form1.vb with this code.
'  4. To create the form, replace the code in Form1.Designer.vb with
'     this code.
'  5. Add dependencies and safely pass arrays of structures.
'  6. Ensure that a template exists in the vault that you plan to
'     select and that a template card is assigned to that template.
'     NOTE: This example assumes that the template in your selected vault
'     creates a folder structure and that folder structure does not already
'     exist in the selected vault.
'  7. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Execute Template dialog box.
'     a. Select a vault.
'     b. Click Execute Template.
'     c. Displays a message box showing the name of the template to execute.
'     d. Click OK to close the message box.
'     e. Creates the folder structure defined for the template at the selected
'        vault's root folder and prompts for variable values, if any
'        exist for the template card and template.
'  2. Displays a message box informing you that a new folder structure
'     was created in the selected vault.
'     - or -
'     Displays a message box informing you that a folder structure
'     was not created.
'  3. Click OK to close the message box.
'  4. Close the Execute Template dialog box.
'  5. Examine the selected vault to verify that a new folder
'     structure based on the template was, or was not, created.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Dim vault1 As IEdmVault5 = New EdmVault5()
    Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
    Dim Views As EdmViewInfo() = Nothing
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub ExecuteTemplateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExecuteTemplateButton.Click

        Try
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Access template in the selected vault
            Dim templateMgr As IEdmTemplateMgr5
            templateMgr = vault1.CreateUtility(EdmUtility.EdmUtil_TemplateMgr)
            Dim pos As IEdmPos5
            pos = templateMgr.GetFirstTemplatePosition
            Dim template As IEdmTemplate5 = Nothing

            Dim message As String = ""
            message = "Installed template in vault, " + vault.Name + ", to use:" + vbLf + vbLf

            While Not pos.IsNull

                template = templateMgr.GetNextTemplate(pos)

                message = message + template.GetMenuString + vbLf
                'Display message box with name of template
                'to use in the selected vault
                MessageBox.Show(message)

                'Create template folders in the selected vault
                'using this template
                Dim refreshFlag As EdmRefreshFlag
                Dim retData() As Object = Nothing
                refreshFlag = template.Run(Me.Handle.ToInt32(), vault1.RootFolderID)
                'Make sure folder structure is created
                'Exit application if it is not
                If refreshFlag = EdmRefreshFlag.EdmRefresh_Nothing Then
                    MessageBox.Show("Folder structure not created.")
                    Exit Sub
                Else
                    'Folder structure created
                    If refreshFlag = EdmRefreshFlag.EdmRefresh_FileList Then
                        vault1.RefreshFolder(vault1.RootFolderPath)
                        MessageBox.Show("The new folder structure based on the template was created in the selected vault.")
                    End If
                End If

            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.ExecuteTemplateButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'ExecuteTemplateButton
        '
        Me.ExecuteTemplateButton.Location = New System.Drawing.Point(30, 75)
        Me.ExecuteTemplateButton.Name = "ExecuteTemplateButton"
        Me.ExecuteTemplateButton.Size = New System.Drawing.Size(102, 23)
        Me.ExecuteTemplateButton.TabIndex = 0
        Me.ExecuteTemplateButton.Text = "Execute Template"
        Me.ExecuteTemplateButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.ExecuteTemplateButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(30, 39)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(169, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(27, 23)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Select vault view:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(246, 123)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.ExecuteTemplateButton)
        Me.Name = "Form1"
        Me.Text = "Execute Template"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents ExecuteTemplateButton As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Favorite Search Example (C#)

This example shows how to perform a favorite search.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//  3. Type FavoriteSearch_CSharp in Project name.
//  4. For Location, click ... and navigate to the folder where to
create the project.
//  5. Click Next.
//  6. Select Framework.
//  7. Click Create.
//  8. Click Show All Files in the Solution Explorer toolbar and expand
//     Form1.cs in the Solution Explorer.
//  9. Replace the code in Form1.cs with this code.
// 10. To create the form, replace the code in Form1.Designer.cs with this code.
// 11. Add dependencies and safely pass arrays of structures.
// 12. Ensure that you know the name of a saved favorite search, and that search
//     finds at least one vault file whose extension (e.g., sldprt)
//     has a file data card (e.g. Quick Start Data Card) with a Description field.
// 13. Check out the vault file and add a description. Check it back in.
// 14. Use the Admin Tool to create a new column set for complete search results.
//     (Right-click on Admin Tool > vault_name > Columns > Search Result Columns and select New Column Set.
// 15. Click Add and select Description from the Variable dropdown
// 16. Save the new column set with name, MyFavoriteSearchResults.
// 17. Double-click Admin Tool > vault_name > Cards > Search Cards > Complete Search.
// 18. In the Card Properties panel, select the View and Preferred checkboxes next to MyFavoriteSearchResults.
// 19. Save and close the Card Editor dialog.
// 20. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Type in a favorite search name.
//  4. Click Perform Search.
//  5. Displays search results, including the custom search column, Description.
//  6. Close the dialog.
//----------------------------------------------------------------------------
//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace FavoriteSearch_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void PerformSearch_Click(System.Object sender, System.EventArgs e)
        {

            try
            {

                IEdmVault9 vault2 = null;

                if (vault1 == null)

                    vault1 = new EdmVault5();

                vault2 = (IEdmVault9)vault1;

                if (!vault1.IsLoggedIn)

                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                IEdmSearch10 oSearch = (IEdmSearch10)vault1.CreateSearch();

                IEdmSearchResult6 oSearchResult = (IEdmSearchResult6)oSearch.GetFirstFavoriteResult(TextBox1.Text, true); // get custom search result columns, if present

                do

                {

                    // oSearchResult will have default values like path or ID, even if custom columns do not exist

                    ListBox1.Items.Add("ID: " + oSearchResult.ID);

                    ListBox1.Items.Add("Name: " + oSearchResult.Name);

                    ListBox1.Items.Add("Path: " + oSearchResult.Path);

                    ListBox1.Items.Add("Version: " + oSearchResult.Version);

                    EdmListCol[] oColsInfo = null;

                    string[] oStrValues = null;

                    oSearchResult.GetCustomColumnsInfo(out oColsInfo);

                    oSearchResult.GetCustomColumnValues(out oStrValues);

                    if (oColsInfo != null)

                    {

                        for (int i = 0; i <= oColsInfo.Length - 1; i++)

                            ListBox1.Items.Add(oColsInfo[i].mbsCaption + ": " + oStrValues[i]);

                    }

                    oSearchResult = (IEdmSearchResult6)oSearch.GetNextResult();

                }

                while (oSearchResult != null);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

Back to top
//Form1.Designer.cs

namespace FavoriteSearch_CSharp

{

    partial class Form1

    {

        /// <summary>

        /// Required designer variable.

        /// </summary>

        private System.ComponentModel.IContainer components = null;

        /// <summary>

        /// Clean up any resources being used.

        /// </summary>

        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }

        #region Windows Form Designer generated code

        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InitializeComponent()

        {

            this.VaultsLabel = new System.Windows.Forms.Label();

            this.VaultsComboBox = new System.Windows.Forms.ComboBox();

            this.PerformSearch = new System.Windows.Forms.Button();

            this.TextBox1 = new System.Windows.Forms.TextBox();

            this.Label1 = new System.Windows.Forms.Label();

            this.Label2 = new System.Windows.Forms.Label();

            this.ListBox1 = new System.Windows.Forms.ListBox();

            this.SuspendLayout();

            //

            // VaultsLabel

            //

            this.VaultsLabel.AutoSize = true;

            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);

            this.VaultsLabel.Name = "VaultsLabel";

            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);

            this.VaultsLabel.TabIndex = 0;

            this.VaultsLabel.Text = "Select vault view:";

            //

            // VaultsComboBox

            //

            this.VaultsComboBox.FormattingEnabled = true;

            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);

            this.VaultsComboBox.Name = "VaultsComboBox";

            this.VaultsComboBox.Size = new System.Drawing.Size(157, 21);

            this.VaultsComboBox.TabIndex = 1;

            //

            // PerformSearch

            //

            this.PerformSearch.Location = new System.Drawing.Point(215, 101);

            this.PerformSearch.Name = "PerformSearch";

            this.PerformSearch.Size = new System.Drawing.Size(96, 23);

            this.PerformSearch.TabIndex = 6;

            this.PerformSearch.Text = "Perform Search";

            this.PerformSearch.UseVisualStyleBackColor = true;

            this.PerformSearch.Click += new System.EventHandler(this.PerformSearch_Click);

            //

            // TextBox1

            //

            this.TextBox1.Location = new System.Drawing.Point(39, 103);

            this.TextBox1.Name = "TextBox1";

            this.TextBox1.Size = new System.Drawing.Size(157, 20);

            this.TextBox1.TabIndex = 7;

            //

            // Label1

            //

            this.Label1.AutoSize = true;

            this.Label1.Location = new System.Drawing.Point(39, 84);

            this.Label1.Name = "Label1";

            this.Label1.Size = new System.Drawing.Size(136, 13);

            this.Label1.TabIndex = 8;

            this.Label1.Text = "Type favorite search name:";

            //

            // Label2

            //

            this.Label2.AutoSize = true;

            this.Label2.Location = new System.Drawing.Point(39, 164);

            this.Label2.Name = "Label2";

            this.Label2.Size = new System.Drawing.Size(45, 13);

            this.Label2.TabIndex = 10;

            this.Label2.Text = "Results:";

            //

            // ListBox1

            //

            this.ListBox1.FormattingEnabled = true;

            this.ListBox1.HorizontalScrollbar = true;

            this.ListBox1.Location = new System.Drawing.Point(39, 181);

            this.ListBox1.Name = "ListBox1";

            this.ListBox1.ScrollAlwaysVisible = true;

            this.ListBox1.Size = new System.Drawing.Size(340, 264);

            this.ListBox1.TabIndex = 11;

            //

            // Form1

            //

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(407, 472);

            this.Controls.Add(this.ListBox1);

            this.Controls.Add(this.Label2);

            this.Controls.Add(this.Label1);

            this.Controls.Add(this.TextBox1);

            this.Controls.Add(this.PerformSearch);

            this.Controls.Add(this.VaultsComboBox);

            this.Controls.Add(this.VaultsLabel);

            this.Name = "Form1";

            this.Text = "Favorite Search";

            this.Load += new System.EventHandler(this.Form1_Load);

            this.ResumeLayout(false);

            this.PerformLayout();

        }

        internal System.Windows.Forms.Label VaultsLabel;

        internal System.Windows.Forms.ComboBox VaultsComboBox;

        internal System.Windows.Forms.Button PerformSearch;

        internal System.Windows.Forms.TextBox TextBox1;

        internal System.Windows.Forms.Label Label1;

        internal System.Windows.Forms.Label Label2;

        internal System.Windows.Forms.ListBox ListBox1;

        #endregion

    }

}

Back to top


SOLIDWORKS PDM Professional API Help

Favorite Search Example (VB.NET)

This example shows how to perform a favorite search.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'  2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'  3. Type FavoriteSearch in Project name.
'  4. For Location, click ... and navigate to the folder where to create the project.
'  5. Click Next.
'  6. Select Framework.
'  7. Click Create.
 '  8. Click Show All Files in the Solution Explorer toolbar and expand
 '     Form1.vb in the Solution Explorer.
'  9. Replace the code in Form1.vb with this code.
' 10. To create the form, replace the code in Form1.Designer.vb with this code.
' 11. Add dependencies and safely pass arrays of structures.
' 12. Ensure that you know the name of a saved favorite search, and that search
'     finds at least one vault file whose extension (e.g., sldprt)
'     has a file data card (e.g. Quick Start Data Card) with a Description field.
' 13. Check out the vault file and add a description. Check it back in.
' 14. Use the Admin Tool to create a new column set for complete search results.
'     (Right-click on Admin Tool > vault_name > Columns > Search Result Columns and select New Column Set.
' 15. Click Add and select Description from the Variable dropdown
' 16. Save the new column set with name, MyFavoriteSearchResults.
' 17. Double-click Admin Tool > vault_name > Cards > Search Cards > Complete Search.
' 18. In the Card Properties panel, select the View and Preferred checkboxes next to MyFavoriteSearchResults.
' 19. Save and close the Card Editor dialog.
' 20. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Type in a favorite search name.
'  4. Click Perform Search.
'  5. Displays search results, including the custom search column, Description.
'  6. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO

Imports System.Xml.Serialization

Imports System.Collections

Imports System.Collections.Generic

Imports System.Data

Imports System.Diagnostics

Imports System.Windows.Forms

Imports System.ComponentModel

Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try

            vault1 = New EdmVault5()

            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)

            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)

            VaultsComboBox.Items.Clear()

            For Each View As EdmViewInfo In Views

                VaultsComboBox.Items.Add(View.mbsVaultName)

            Next

            If VaultsComboBox.Items.Count > 0 Then

                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)

            End If

        Catch ex As System.Runtime.InteropServices.COMException

            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

    Public Sub PerformSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PerformSearch.Click

        Try

            Dim vault2 As IEdmVault7 = Nothing

            If vault1 Is Nothing Then

                vault1 = New EdmVault5()

            End If

            vault2 = DirectCast(vault1, IEdmVault9)

            If Not vault1.IsLoggedIn Then

                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())

            End If

            Dim oSearch As IEdmSearch10 = vault1.CreateSearch()

            Dim oSearchResult As IEdmSearchResult6 = oSearch.GetFirstFavoriteResult(TextBox1.Text, True) 'get custom search result columns, if present

            Do

                'oSearchResult will have default values like path or ID, even if custom columns do not exist

                ListBox1.Items.Add("ID: " & oSearchResult.ID)

                ListBox1.Items.Add("Name: " & oSearchResult.Name)

                ListBox1.Items.Add("Path: " & oSearchResult.Path)

                ListBox1.Items.Add("Version: " & oSearchResult.Version)

                Dim oColsInfo() As EdmListCol = Nothing

                Dim oStrValues() As String = Nothing

                oSearchResult.GetCustomColumnsInfo(oColsInfo)

                oSearchResult.GetCustomColumnValues(oStrValues)

                If oColsInfo IsNot Nothing Then

                    For i As Integer = 0 To oColsInfo.Length - 1

                        ListBox1.Items.Add(oColsInfo(i).mbsCaption & ": " & oStrValues(i))

                    Next i

                End If

                oSearchResult = oSearch.GetNextResult() 'Get next result

            Loop Until oSearchResult Is Nothing

        Catch ex As System.Runtime.InteropServices.COMException

            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

End Class

Back to top
'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>

Partial Class Form1

    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()>

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        Try

            If disposing AndAlso components IsNot Nothing Then

                components.Dispose()

            End If

        Finally

            MyBase.Dispose(disposing)

        End Try

    End Sub

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer.

    'Do not modify it using the code editor.

    <System.Diagnostics.DebuggerStepThrough()>

    Private Sub InitializeComponent()

        Me.VaultsLabel = New System.Windows.Forms.Label()

        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()

        Me.PerformSearch = New System.Windows.Forms.Button()

        Me.TextBox1 = New System.Windows.Forms.TextBox()

        Me.Label1 = New System.Windows.Forms.Label()

        Me.Label2 = New System.Windows.Forms.Label()

        Me.ListBox1 = New System.Windows.Forms.ListBox()

        Me.SuspendLayout()

        '

        'VaultsLabel

        '

        Me.VaultsLabel.AutoSize = True

        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)

        Me.VaultsLabel.Name = "VaultsLabel"

        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)

        Me.VaultsLabel.TabIndex = 0

        Me.VaultsLabel.Text = "Select vault view:"

        '

        'VaultsComboBox

        '

        Me.VaultsComboBox.FormattingEnabled = True

        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)

        Me.VaultsComboBox.Name = "VaultsComboBox"

        Me.VaultsComboBox.Size = New System.Drawing.Size(157, 21)

        Me.VaultsComboBox.TabIndex = 1

        '

        'PerformSearch

        '

        Me.PerformSearch.Location = New System.Drawing.Point(215, 101)

        Me.PerformSearch.Name = "PerformSearch"

        Me.PerformSearch.Size = New System.Drawing.Size(96, 23)

        Me.PerformSearch.TabIndex = 6

        Me.PerformSearch.Text = "Perform Search"

        Me.PerformSearch.UseVisualStyleBackColor = True

        '

        'TextBox1

        '

        Me.TextBox1.Location = New System.Drawing.Point(39, 103)

        Me.TextBox1.Name = "TextBox1"

        Me.TextBox1.Size = New System.Drawing.Size(157, 20)

        Me.TextBox1.TabIndex = 7

        '

        'Label1

        '

        Me.Label1.AutoSize = True

        Me.Label1.Location = New System.Drawing.Point(39, 84)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(136, 13)

        Me.Label1.TabIndex = 8

        Me.Label1.Text = "Type favorite search name:"

        '

        'Label2

        '

        Me.Label2.AutoSize = True

        Me.Label2.Location = New System.Drawing.Point(39, 164)

        Me.Label2.Name = "Label2"

        Me.Label2.Size = New System.Drawing.Size(45, 13)

        Me.Label2.TabIndex = 10

        Me.Label2.Text = "Results:"

        '

        'ListBox1

        '

        Me.ListBox1.FormattingEnabled = True

        Me.ListBox1.HorizontalScrollbar = True

        Me.ListBox1.Location = New System.Drawing.Point(39, 181)

        Me.ListBox1.Name = "ListBox1"

        Me.ListBox1.ScrollAlwaysVisible = True

        Me.ListBox1.Size = New System.Drawing.Size(340, 264)

        Me.ListBox1.TabIndex = 11

        '

        'Form1

        '

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(407, 472)

        Me.Controls.Add(Me.ListBox1)

        Me.Controls.Add(Me.Label2)

        Me.Controls.Add(Me.Label1)

        Me.Controls.Add(Me.TextBox1)

        Me.Controls.Add(Me.PerformSearch)

        Me.Controls.Add(Me.VaultsComboBox)

        Me.Controls.Add(Me.VaultsLabel)

        Me.Name = "Form1"

        Me.Text = "Favorite Search"

        Me.ResumeLayout(False)

        Me.PerformLayout()

    End Sub

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label

    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox

    Friend WithEvents PerformSearch As System.Windows.Forms.Button

    Friend WithEvents TextBox1 As TextBox

    Friend WithEvents Label1 As Label

    Friend WithEvents Label2 As Label

    Friend WithEvents ListBox1 As ListBox

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Find Data Cards with Description Variable Example (C#)

This example shows how to find the data cards in your vault that have a Description variable.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//  3. Type CardsVariableCSharp in Project name.
//  4. For Location, click ... and navigate to the folder where to
create the project.
//  5. Click Next.
//  6. Select Framework.
//  7. Click Create.
//  8. Click Show All Files in the Solution Explorer toolbar and expand
//     Form1.cs in the Solution Explorer.
//  9. Replace the code in Form1.cs with this code.
// 10. Replace the code in Form1.Designer.cs with this code.
// 11. Add dependencies and safely pass arrays of structures.
// 12. Open the Immediate window.
// 13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click the Find cards with Description variable button.
//     The cards in your vault with a Description variable are
//     printed to the Immediate window.
//  4. Examine the Immediate window.
//  5. Close the dialog.
//----------------------------------------------------------------------------
//Form1.cs
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;
using System.Collections;

namespace CardsVariableCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        void CardsVariableCSharp_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault1 = new EdmVault5();

                //Cast IEdmVault5 to IEdmVault8
                IEdmVault8 vault = (IEdmVault8)vault1;

                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);

                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void FindCardsButton_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                //Declare and create an instance of IEdmVault5 object
                IEdmVault5 vault = new EdmVault5();

                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                ArrayList Cards = new ArrayList();
                Cards.Clear();

                IEdmFolder5 Folder = default(IEdmFolder5);
                Folder = vault.RootFolder;

                IEdmVariableMgr5 VarMgr = default(IEdmVariableMgr5);
                VarMgr = (IEdmVariableMgr5)vault;

                //You could get the "Description" variable directly,
                //but get it by enumerating through all
                //the variables until it's found -
                //Dim DescVar As IEdmVariable5
                //DescVar = VarMgr.GetVariable("Description")

                IEdmPos5 VarPos = default(IEdmPos5);
                VarPos = VarMgr.GetFirstVariablePosition();
                while (!VarPos.IsNull)
                {
                    IEdmVariable5 Var = default(IEdmVariable5);
                    Var = VarMgr.GetNextVariable(VarPos);
                    if (!(Var.Name == "Description"))
                        continue;
                    IEdmPos5 AttPos = default(IEdmPos5);
                    AttPos = Var.GetFirstAttributePosition("");
                    while (!AttPos.IsNull)
                    {
                        IEdmAttribute5 Att = default(IEdmAttribute5);
                        Att = Var.GetNextAttribute(AttPos);
                        string[] Extensions = null;
                        Extensions = Att.Extensions.Split(',');
                        string Extension = null;
                        foreach (string Extension_loopVariable in Extensions)
                        {
                            Extension = Extension_loopVariable;
                            IEdmCard5 Card = default(IEdmCard5);
                            IEdmCard6 Card1 = default(IEdmCard6);
                            try
                            {
                                Card = Folder.GetCard(Extension);
                                Card1 = (IEdmCard6)Card;
                                if (Card1.CardType == EdmCardType.EdmCard_File)
                                {
                                    if (!Cards.Contains(Card.Name))
                                    {
                                        Cards.Add(Card.Name);
                                    }
                                }
                            } catch (System.Runtime.InteropServices.COMException ex)
                            {
                                //E_EDM_INVALID_NAME
                                if (!(ex.ErrorCode == unchecked((int)0x8004021d)))
                                {
                                    throw new System.Runtime.InteropServices.COMException(ex.Message, ex.ErrorCode);
                                }
                            }
                        }
                    }
                }

                string CardName = null;
                foreach (string CardName_loopVariable in Cards)
                {
                    CardName = CardName_loopVariable;
                    Debug.Print(CardName);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}
Back to top
//Form1.Designer.cs
namespace CardsVariableCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used
        /// </summary>
        /// <param name="disposing">True if managed resources should be disposed; otherwise false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FindCardsButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(86, 23);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(70, 55);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // FindCardsButton
            //
            this.FindCardsButton.Location = new System.Drawing.Point(70, 95);
            this.FindCardsButton.Name = "FindCardsButton";
            this.FindCardsButton.Size = new System.Drawing.Size(121, 50);
            this.FindCardsButton.TabIndex = 2;
            this.FindCardsButton.Text = "Find cards with Description variable";
            this.FindCardsButton.UseVisualStyleBackColor = true;
            this.FindCardsButton.Click += new System.EventHandler(this.FindCardsButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(272, 173);
            this.Controls.Add(this.FindCardsButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Find cards with Description";
            this.Load += new System.EventHandler(this.CardsVariableCSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button FindCardsButton;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Find Data Cards with Description Variable Example (VB.NET)

This example shows how to find the data cards in your vault that have a Description variable.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'  2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'  3. Type Exercise3 in Project name.
'  4. For Location, click ... and navigate to the folder where to create the project.
'  5. Click Next.
'  6. Select Framework.
'  7. Click Create.
'  8. Click Show All Files in the Solution Explorer toolbar and expand
'     Form1.vb in the Solution Explorer.
'  9. Replace the code in Form1.vb with this code.
' 10. Replace the code in Form1.Designer.vb with this code.
' 11. Add dependencies and safely pass arrays of structures.
' 12. Open the Immediate window.
' 13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click the Find cards with Description variable button.
'     The cards in your vault with a Description variable are
'     printed to the Immediate window.
'  4. Examine the Immediate window.
'  5. Close the dialog.
'----------------------------------------------------------------------------
'Form1.vb

Imports EPDM.Interop.epdm

Public Class Exercise4

  Private Sub Exercise4_Load( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load

    Try
      'Declare and create an instance of IEdmVault5
      'Cast IEdmVault5 to IEdmVault8
      Dim vault As IEdmVault8 = New EdmVault5
      Dim Views() As EdmViewInfo = Nothing

      vault.GetVaultViews(Views, False)
      VaultsComboBox.Items.Clear()
      For Each View As EdmViewInfo In Views
        VaultsComboBox.Items.Add(View.mbsVaultName)
      Next
      If VaultsComboBox.Items.Count > 0 Then
        VaultsComboBox.Text = VaultsComboBox.Items(0)
      End If

    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub FindCardsButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles FindCardsButton.Click

    Try
      'Declare and create an instance of IEdmVault5 object
      Dim vault As IEdmVault5 = New EdmVault5()

      'Log into selected vault as the current user
      vault.LoginAuto(VaultsComboBox.Text, _
        Me.Handle.ToInt32())

      Dim Cards As New ArrayList
      Cards.Clear()

      Dim Folder As IEdmFolder5
      Folder = vault.RootFolder

      Dim VarMgr As IEdmVariableMgr5
      VarMgr = vault

      'You could get the "Description" variable directly,
      'but get it by enumerating through all
      'the variables until it's found -
      'Dim DescVar As IEdmVariable5
      'DescVar = VarMgr.GetVariable("Description")

      Dim VarPos As IEdmPos5
      VarPos = VarMgr.GetFirstVariablePosition
      While Not VarPos.IsNull
        Dim Var As IEdmVariable5
        Var = VarMgr.GetNextVariable(VarPos)
        If Not Var.Name = "Description" _
          Then Continue While
        Dim AttPos As IEdmPos5
        AttPos = Var.GetFirstAttributePosition("")
        While Not AttPos.IsNull
          Dim Att As IEdmAttribute5
          Att = Var.GetNextAttribute(AttPos)
          Dim Extensions() As String
          Extensions = Att.Extensions.Split(",")
          Dim Extension As String
          For Each Extension In Extensions
            Dim Card As IEdmCard5
            Try
              Card = Folder.GetCard(Extension)
              If Card.cardtype = _
                EdmCardType.EdmCard_File Then
                If Not Cards.Contains(Card.Name) Then
                  Cards.Add(Card.Name)
                End If
              End If
            Catch ex As _
              Runtime.InteropServices.COMException
              'E_EDM_INVALID_NAME
              If Not ex.ErrorCode = &H8004021D Then
                Throw New _
                  Runtime.InteropServices.COMException _
                  (ex.Message, ex.ErrorCode)
              End If
            End Try
          Next Extension
        End While
      End While

      Dim CardName As String
      For Each CardName In Cards
        Debug.Print(CardName)
      Next CardName

    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Exercise4
  Inherits System.Windows.Forms.Form

  'Form overrides dispose to clean up the component list.
  <System.Diagnostics.DebuggerNonUserCode()> _
  Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    Try
      If disposing AndAlso components IsNot Nothing Then
        components.Dispose()
      End If
    Finally
      MyBase.Dispose(disposing)
    End Try
  End Sub

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer

  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.
  'Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()> _
  Private Sub InitializeComponent()
        Me.FindCardsButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'FindCardsButton
        '
        Me.FindCardsButton.Location = New System.Drawing.Point(37, 96)
        Me.FindCardsButton.Margin = New System.Windows.Forms.Padding(2)
        Me.FindCardsButton.Name = "FindCardsButton"
        Me.FindCardsButton.Size = New System.Drawing.Size(212, 41)
        Me.FindCardsButton.TabIndex = 20
        Me.FindCardsButton.Text = "Find cards with Description variable"
        Me.FindCardsButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(58, 37)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(169, 21)
        Me.VaultsComboBox.TabIndex = 19
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(96, 9)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 18
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'Exercise4
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(301, 155)
        Me.Controls.Add(Me.FindCardsButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "Exercise4"
        Me.Text = "Find cards with Description"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
  Friend WithEvents FindCardsButton As System.Windows.Forms.Button
  Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
  Friend WithEvents VaultsLabel As System.Windows.Forms.Label

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Find Revisions Using Component Example (C#)

This example shows how to find the revision numbers using the revision number component named Alpha Revision Component.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
//  3. Type FindRevisionsCSharp in Project name.
//  4. For Location, click ... and navigate to the folder where to
create the project.
//  5. Click Next.
//  6. Select Framework.
//  7. Click Create.
//  8. Click Show All Files in the Solution Explorer toolbar and expand
//     Form1.cs in the Solution Explorer.
//  9. Replace the code in Form1.cs with this code.
// 10. Replace the code in Form1.Designer.cs with this code.
// 11. Add dependencies and safely pass arrays of structures.
// 12. Open the Immediate window.
// 13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click the Find revisions that use Alpha Revision Component button.
//  4. Prints the names of the revision numbers using the revision number
//     component Alpha Revision Component to the Immediate window.
//  5. Examine the Immediate window.
//  6. Close the dialog.
//----------------------------------------------------------------------------

//Form1.cs

using EPDM.Interop.epdm;
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace FindRevisionsCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        void FindRevisionsCSharp_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault1 = new EdmVault5();

                //Cast IEdmVault5 to IEdmVault8
                IEdmVault8 vault = (IEdmVault8)vault1;

                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void FindRevisionsButton_Click(System.Object sender, System.EventArgs e)
        {
            try {
                    //Declare and create an instance of IEdmVault5 object
                                   //and cast to IEdmVault7
                    IEdmVault5 vault = new EdmVault5();
                    IEdmVault7 vault1 = (IEdmVault7)vault;

                    //Log into selected vault as the current user
                    vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                    Debug.Print("Revision numbers that use revision number component \"Alpha Revision Component\":");
                    Debug.Print("");

                    IEdmRevisionMgr2 RevMgr = default(IEdmRevisionMgr2);
                    RevMgr = (IEdmRevisionMgr2)vault1.CreateUtility(EdmUtility.EdmUtil_RevisionMgr);

                    EdmRevNo[] RevNumbers = null;
                    RevMgr.GetRevisionNumbers(null, out RevNumbers);
                    foreach ( EdmRevNo RevNo in RevNumbers) {
                        EdmRevComponent2[] RevComponents = null;
                        RevMgr.GetRevisionNumberComponents2(-RevNo.mlRevNoID, out RevComponents);
                        foreach ( EdmRevComponent2 RevComponent in RevComponents) {
                            if (RevComponent.mbsComponentName == "Alpha Revision Component") {
                                Debug.Print("  " + RevNo.mbsRevNoName);
                            }
                        }
                    }

                } catch (System.Runtime.InteropServices.COMException ex) {
                    MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message);
            }
        }
    }
}
Back to top
//Form1.Designer.cs
namespace FindRevisionsCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">True if managed resources should be disposed; otherwise false</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FindRevisionsButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(112, 37);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(94, 77);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // FindRevisionsButton
            //
            this.FindRevisionsButton.Location = new System.Drawing.Point(94, 136);
            this.FindRevisionsButton.Name = "FindRevisionsButton";
            this.FindRevisionsButton.Size = new System.Drawing.Size(121, 50);
            this.FindRevisionsButton.TabIndex = 2;
            this.FindRevisionsButton.Text = "Find revisions that use Alpha Revision Component";
            this.FindRevisionsButton.UseVisualStyleBackColor = true;
            this.FindRevisionsButton.Click += new System.EventHandler(this.FindRevisionsButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(304, 209);
            this.Controls.Add(this.FindRevisionsButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Find revisions using component";
            this.Load += new System.EventHandler(this.FindRevisionsCSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button FindRevisionsButton;
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Find Revisions Using Component Example (VB.NET)

This example shows how to find the revision numbers using the revision number component named Alpha Revision Component.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'  2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'  3. Type Exercise5 in Project name.
'  4. For Location, click ... and navigate to the folder where to create the project.
'  5. Click Next.
'  6. Select Framework.
'  7. Click Create.
'  8. Click Show All Files in the Solution Explorer toolbar and expand
'     Form1.vb in the Solution Explorer.
'  9. Replace the code in Form1.vb with this code.
' 10. Replace the code in Form1.Designer.vb with this code.
' 11. Add dependencies and safely pass arrays of structures.
' 12. Open the Immediate window.
' 13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click the Find revisions that use Alpha Revision Component button.
'  4. Prints the names of the revision numbers using the revision number
'     component named Alpha Revision Component to the Immediate window.
'  5. Examine the Immediate window.
'  6. Close the dialog.
'----------------------------------------------------------------------------
'Form1.vb

Imports EPDM.Interop.epdm

Public Class Exercise5

  Private Sub Exercise5_Load( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load

    Try
      Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

      vault.GetVaultViews(Views, False)
      VaultsComboBox.Items.Clear()
      For Each View As EdmViewInfo In Views
        VaultsComboBox.Items.Add(View.mbsVaultName)
      Next
      If VaultsComboBox.Items.Count > 0 Then
        VaultsComboBox.Text = VaultsComboBox.Items(0)
      End If

    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub FindRevisionsButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles FindRevisionsButton.Click

    Try
      'Declare and create an instance of IEdmVault5 object
      Dim vault As IEdmVault5 = New EdmVault5()

      'Log into selected vault as the current user
      vault.LoginAuto(VaultsComboBox.Text, _
         Me.Handle.ToInt32())

            Debug.Print _
              ("Revision numbers that use revision number component ""Alpha Revision Component"":")
      Debug.Print("")

      Dim RevMgr As IEdmRevisionMgr2
      RevMgr = vault.CreateUtility( _
        EdmUtility.EdmUtil_RevisionMgr)

      Dim RevNumbers() As EdmRevNo = Nothing
      RevMgr.GetRevisionNumbers(Nothing, RevNumbers)
      Dim RevNo As EdmRevNo
      For Each RevNo In RevNumbers
        Dim RevComponents() As EdmRevComponent2 = Nothing
        RevMgr.GetRevisionNumberComponents2 _
          (-RevNo.mlRevNoID, RevComponents)
        Dim RevComponent As EdmRevComponent2
        For Each RevComponent In RevComponents
                    If RevComponent.mbsCocmponentName = "  " & Alpha Revision Component" _
            Then
                        Debug.Print(RevNo.mbsRevNoName)
                    End If
        Next RevComponent
      Next RevNo

    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub
End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Exercise5
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.FindRevisionsButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'FindRevisionsButton
        '
        Me.FindRevisionsButton.Location = New System.Drawing.Point(95, 107)
        Me.FindRevisionsButton.Margin = New System.Windows.Forms.Padding(2)
        Me.FindRevisionsButton.Name = "FindRevisionsButton"
        Me.FindRevisionsButton.Size = New System.Drawing.Size(132, 50)
        Me.FindRevisionsButton.TabIndex = 23
        Me.FindRevisionsButton.Text = "Find revisions that use Alpha Revision Component"
        Me.FindRevisionsButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(95, 47)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(132, 21)
        Me.VaultsComboBox.TabIndex = 22
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(113, 24)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 21
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'Exercise5
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(328, 176)
        Me.Controls.Add(Me.FindRevisionsButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "Exercise5"
        Me.Text = "Find revisions using component"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents FindRevisionsButton As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Find Users Example (C#)

This example shows how to find users in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
//  3. Type FindUser_CSharp in Project
name.
//  4. For
Location, click ... and navigate to the folder where to
create the project.
//  5. Click Next.
//  6. Select Framework.
//  7. Click Create.
//  8. Click Show All Files in the Solution Explorer toolbar and expand
//     Form1.cs in the Solution Explorer.
//  9. Replace the code in Form1.cs with this code.
// 10. To create the form, replace the code in Form1.Designer.cs with
//     this code.
// 11. Add
dependencies and safely pass arrays of structures.
// 12 Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the
Find Users dialog box.
//     a. Select a vault
view.
//     b. In
Full name contains, type a substring of the full name of a
//
user that exists in the vault.
//     c. Click
Find Users.
//
A message box confirms the substring typed in Postconditions
//
step 1b.
//
d. Click OK.
//
Displays a Search for users dialog.
//
e. Click Find.
//
Displays a Search for users dialog with results.
//
f. Click the first row.
//
g. Click Select.
//
* Displays a message box with the updated user information.
//
* The selected user's phone and website information are updated.
//
h. Click OK.
//
2. Updates the Find Users dialog box with the full name and picture,
//     if it exists, of the last user found whose full name contains the substring
//
typed in Postconditions step 1b.
//  3. Close the Find
Users dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace FindUser_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
IEdmVault5 vault1;
IEdmVault8 vault;
EdmViewInfo[] Views = null;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
vault1 = new EdmVault5();
vault = (IEdmVault8)vault1;
vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

private void FindUsers_Click(System.Object sender, System.EventArgs e)
{
try {
IEdmVault7 vault2 = null;
if (vault1 == null) {
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn) {
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Get the user search interface
IEdmFindUser poFind = default(IEdmFindUser);
poFind = (IEdmFindUser)vault2.CreateUtility(EdmUtility.EdmUtil_FindUser);

//Search for a user with specified text in the full user name
poFind.SetPropt(EdmFindUserProp.Edmfup_FullName, this.TextBox1.Text);
string val = null;
val = (string)poFind.GetPropt(EdmFindUserProp.Edmfup_FullName);
MessageBox.Show("Find users whose full
names contain " + "\"" + val + "\"");

poFind.ShowFindUI(this.Handle.ToInt32(), true, "Search for users");

IEdmEnum poResult = default(IEdmEnum);
poResult = poFind.Result;
string str = "Found " + poResult.Count.ToString() + " users with full
names containing, " +
"\"" + this.TextBox1.Text + "\"" + ":";

System.Drawing.Image oImg = default(System.Drawing.Image);
IEdmUser10 poUser = default(IEdmUser10);
EdmUserDataEx UserInfo = new EdmUserDataEx();

//Specify which user data fields are valid
UserInfo.mlEdmUserDataExFlags = (int)EdmUserDataExFlag.Edmudex_All;

foreach ( object foundUser in poResult) {
poUser = (IEdmUser10)foundUser;

//Get user's information
poUser.GetUserDataEx(ref UserInfo);

//Update user's information
UserInfo.mbsPhone = "123456789";
UserInfo.mbsWebSite1 = "http://www.solidworks.com";
UserInfo.mbsWebSite2 = "https://www.facebook.com/solidworks";
poUser.SetUserDataEx(ref UserInfo);
str = str + "\n" + "Full name: " + UserInfo.mbsCompleteName + ", Phone: " + UserInfo.mbsPhone +
", WebSite1: " + UserInfo.mbsWebSite1 + ", Website2: " + UserInfo.mbsWebSite2;
}

MessageBox.Show(str);

//Display the picture, if available, of the last user found
if ((UserInfo.mbsPicturePath != null)) {
this.TextBox2.Text = UserInfo.mbsCompleteName;
oImg = System.Drawing.Bitmap.FromFile(UserInfo.mbsPicturePath);
this.CreateGraphics().DrawImage(oImg, 40, 220);
}

} catch (System.Runtime.InteropServices.COMException ex) {
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
} catch (Exception ex) {
MessageBox.Show(ex.Message);
}

}
}
}

Back to top
//Form1.Designer.cs

namespace FindUser_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.FindUsers = new System.Windows.Forms.Button();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Label1 = new System.Windows.Forms.Label();
            this.Label2 = new System.Windows.Forms.Label();
            this.TextBox1 = new System.Windows.Forms.TextBox();
            this.Label3 = new System.Windows.Forms.Label();
            this.TextBox2 = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            //
            // FindUsers
            //
            this.FindUsers.Location = new System.Drawing.Point(72, 136);
            this.FindUsers.Name = "FindUsers";
            this.FindUsers.Size = new System.Drawing.Size(66, 23);
            this.FindUsers.TabIndex = 0;
            this.FindUsers.Text = "Find Users";
            this.FindUsers.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.FindUsers.UseVisualStyleBackColor = true;
            this.FindUsers.Click += new System.EventHandler(this.FindUsers_Click);
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(30, 39);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(169, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(27, 23);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(91, 13);
            this.Label1.TabIndex = 2;
            this.Label1.Text = "Select vault view:";
            //
            // Label2
            //
            this.Label2.AutoSize = true;
            this.Label2.Location = new System.Drawing.Point(27, 77);
            this.Label2.Name = "Label2";
            this.Label2.Size = new System.Drawing.Size(98, 13);
            this.Label2.TabIndex = 3;
            this.Label2.Text = "Full name contains:";
            //
            // TextBox1
            //
            this.TextBox1.Location = new System.Drawing.Point(32, 93);
            this.TextBox1.Name = "TextBox1";
            this.TextBox1.Size = new System.Drawing.Size(167, 20);
            this.TextBox1.TabIndex = 4;
            //
            // Label3
            //
            this.Label3.AutoSize = true;
            this.Label3.Location = new System.Drawing.Point(29, 172);
            this.Label3.Name = "Label3";
            this.Label3.Size = new System.Drawing.Size(83, 13);
            this.Label3.TabIndex = 6;
            this.Label3.Text = "Last user found:";
            //
            // TextBox2
            //
            this.TextBox2.Location = new System.Drawing.Point(30, 188);
            this.TextBox2.Name = "TextBox2";
            this.TextBox2.Size = new System.Drawing.Size(169, 20);
            this.TextBox2.TabIndex = 7;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(406, 447);
            this.Controls.Add(this.TextBox2);
            this.Controls.Add(this.Label3);
            this.Controls.Add(this.TextBox1);
            this.Controls.Add(this.Label2);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.FindUsers);
            this.Name = "Form1";
            this.Text = "Find Users";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Button FindUsers;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Label Label1;
        internal System.Windows.Forms.Label Label2;
        internal System.Windows.Forms.TextBox TextBox1;
        internal System.Windows.Forms.Label Label3;
        internal System.Windows.Forms.TextBox TextBox2;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Find Users Example (VB.NET)

This example shows how to find users in the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'  2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
'  3. Type FindUser in Project name.
'  4. For Location, click ... and navigate to the folder where to create the project.
'  5. Click Next.
'  6. Select Framework.
'  7. Click Create.
'  8. Click Show All Files in the Solution Explorer toolbar and expand
'     Form1.vb in the Solution Explorer.
'  9. Replace the code in Form1.vb with this code.
' 10. To create the form, replace the code in Form1.Designer.vb with
'     this code.
' 11. Add dependencies and safely pass arrays of structures.
' 12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Find Users dialog box.
'     a. Select a vault view.
'     b. In Full name contains, type a substring of the full name of a
'        user that exists in the vault.
'     c. Click Find Users.
'        A message box confirms the substring typed in Postconditions
'        step 1b.
'     d. Click OK.
'        Displays a Search for users dialog.
'     e. Click Find.
'        Displays a Search for users dialog with results.
'     f. Click the first row.
'     g. Click Select.
'        * Displays a message box with the updated user information.
'        * The selected user's phone and website information are updated.
'     h. Click OK.
'  2. Updates the Find Users dialog box with the full name and picture, if
'     it exists, of the last user found whose full name contains the substring
'     typed in Postconditions step 1b.
'  3. Close the Find Users dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
    Dim vault1 As IEdmVault5 = New EdmVault5()
    Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
    Dim Views As EdmViewInfo() = Nothing
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub FindUsers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindUsers.Click

        Try
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Get the user search interface
            Dim poFind As IEdmFindUser
            poFind = vault2.CreateUtility(EdmUtility.EdmUtil_FindUser)

            'Search for a user with specified text in the full user name
            poFind.SetPropt(EdmFindUserProp.Edmfup_FullName, Me.TextBox1.Text)
            Dim val As String
            val = poFind.GetPropt(EdmFindUserProp.Edmfup_FullName)
            MessageBox.Show("Find users whose full names contain " & """" & val & """")

            poFind.ShowFindUI(Me.Handle.ToInt32(), True, "Search for users")

            Dim poResult As IEdmEnum
            poResult = poFind.Result
            Dim str As String = "Found " & poResult.Count.ToString & " users with full names containing, " & """" & Me.TextBox1.Text & """" & ":"

            Dim oImg As System.Drawing.Image
            Dim poUser As IEdmUser10
            Dim UserInfo As EdmUserDataEx = New EdmUserDataEx()
            UserInfo.mlEdmUserDataExFlags = EdmUserDataExFlag.Edmudex_All

            For Each element In poResult
                poUser = element

                'Get user's information
                poUser.GetUserDataEx(UserInfo)

                'Update user's information
                UserInfo.mbsPhone = "123456789"
                UserInfo.mbsWebSite1 = "http://www.solidworks.com"
                UserInfo.mbsWebSite2 = "https://www.facebook.com/solidworks"
                poUser.SetUserDataEx(UserInfo)

                str = str & vbLf & "Full name: " & UserInfo.mbsCompleteName & ", Phone: " & UserInfo.mbsPhone & ", WebSite1: " & UserInfo.mbsWebSite1 & ", Website2: " & UserInfo.mbsWebSite2
            Next

            MessageBox.Show(str)

            'Display the picture, if available, of the last user found
            If Not UserInfo.mbsPicturePath = Nothing Then
                Me.TextBox2.Text = UserInfo.mbsCompleteName
                oImg = System.Drawing.Bitmap.FromFile(UserInfo.mbsPicturePath)
                Me.CreateGraphics().DrawImage(oImg, 40, 220)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top
'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.FindUsers = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.TextBox2 = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        '
        'FindUsers
        '
        Me.FindUsers.Location = New System.Drawing.Point(72, 136)
        Me.FindUsers.Name = "FindUsers"
        Me.FindUsers.Size = New System.Drawing.Size(66, 23)
        Me.FindUsers.TabIndex = 0
        Me.FindUsers.Text = "Find Users"
        Me.FindUsers.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.FindUsers.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(30, 39)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(169, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(27, 23)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Select vault view:"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(27, 77)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(104, 13)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Full name contains:"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(32, 93)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(167, 20)
        Me.TextBox1.TabIndex = 4
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(29, 172)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(83, 13)
        Me.Label3.TabIndex = 6
        Me.Label3.Text = "Last user found:"
        '
        'TextBox2
        '
        Me.TextBox2.Location = New System.Drawing.Point(30, 188)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(169, 20)
        Me.TextBox2.TabIndex = 7
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(406, 447)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.FindUsers)
        Me.Name = "Form1"
        Me.Text = "Find Users"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents FindUsers As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Generate Configuration Values Example (C#)

This example shows how to copy card control variable values from one configuration to another.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type Files_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9. Replace the code in Form1.cs with this code.
//10. To create the form,
replace the code in Form1.Designer.cs with this code.
//11. Add
dependencies and safely pass arrays of structures.
//12. Check out a file that has a data card with two or more configurations.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Copy
Control Values to Configurations dialog box.
//    a. Select a vault view.
//
Folder is set to the root folder.
//    b. Select a file that has a data card with two or more
configurations.
//    c. Displays the data card.
//    d. Click Copy Control Values.
//       Copies the value set in Preconditions
step 5 to all configurations.
// 2. Close
the dialog box.
// 3. Inspect the control values in all of the configurations of the data card.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace Files_CSharp
{
    public partial class MainForm : Form
    {
        Dictionary<int,IEdmFolder5> oFoldersArray = new Dictionary<int, IEdmFolder5>();
        Dictionary<int, IEdmFile5> oFileArray = new Dictionary<int, IEdmFile5>();
        IEdmCardView63 edmCardView;

        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault1 = new EdmVault5();

                //Cast IEdmVault5 to IEdmVault8
                IEdmVault8 vault = (IEdmVault8)vault1;

                EdmViewInfo[] Views = null;

                //Populate the form with the names of
                //the vaults on the computer
                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void VaultsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault = new EdmVault5();

                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                IEdmPos5 folderPos = vault.RootFolder.GetFirstSubFolderPosition();

                FoldersComboBox.Items.Clear();
                oFoldersArray.Clear();

                int i = FoldersComboBox.Items.Add("\\");
                oFoldersArray[i] = vault.RootFolder;

                while (!folderPos.IsNull)
                {
                    IEdmFolder5 edmFolder = vault.RootFolder.GetNextSubFolder(folderPos);

                    i = FoldersComboBox.Items.Add(edmFolder.Name);
                    oFoldersArray[i] = edmFolder;
                }

                FoldersComboBox.Text = (string)FoldersComboBox.Items[0];
            }catch(Exception)
            {
                FoldersComboBox.Items.Clear();
                oFoldersArray.Clear();
                FoldersComboBox.Text = "Error";
            }
        }

        private void FoldersComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int i = FoldersComboBox.SelectedIndex;
                IEdmFolder5 edmFolder = oFoldersArray[i];

                IEdmPos5 filePos = edmFolder.GetFirstFilePosition();

                FilesComboBox.Items.Clear();
                oFileArray.Clear();

                while (!filePos.IsNull)
                {
                    IEdmFile5 edmFile = edmFolder.GetNextFile(filePos);

                    i = FilesComboBox.Items.Add(edmFile.Name);
                    oFileArray[i] = edmFile;
                }

                FilesComboBox.Text = (string)FilesComboBox.Items[0];
            }
            catch (Exception ex)
            {
                FilesComboBox.Items.Clear();
                oFileArray.Clear();
                FilesComboBox.Text = "Error";
            }

        }

        private void ShowDataCard()
        {
            if (edmCardView != null)
                edmCardView.ShowWindow(false);

            int i = FoldersComboBox.SelectedIndex;
            IEdmFolder5 edmFolder = oFoldersArray[i];

            i = FilesComboBox.SelectedIndex;
            IEdmFile5 edmFile = oFileArray[i];

            IEdmVault10 vault1 = (IEdmVault10)edmFolder.Vault;

            EdmCardViewParams @params = default(EdmCardViewParams);
            @params.mlFileID = edmFile.ID;
            @params.mlFolderID = edmFolder.ID;
            @params.mlCardID = 0;
            @params.mlX = 10;
            @params.mlY = 15;
            @params.mhParentWindow = CardPanel.Handle.ToInt32();
            @params.mlEdmCardViewFlags = (int)EdmCardViewFlag.EdmCvf_Normal;

            edmCardView = vault1.CreateCardViewEx2(@params, this);
            if (edmCardView == null)
            {
                MessageBox.Show("The file does not have a card.");
                return;
            }

            edmCardView.SetFocus(0);

            int width = 0;
            int height = 0;
            edmCardView.GetCardSize(out width, out height);
            CardPanel.Width = width+20;
            CardPanel.Height = height+20;
            edmCardView.ShowWindow(true);
        }

        private void FilesComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShowDataCard();
        }

        private void DoBtn_Click(object sender, EventArgs e)
        {
            int i = FoldersComboBox.SelectedIndex;
            IEdmFolder5 edmFolder = oFoldersArray[i];

            i = FilesComboBox.SelectedIndex;
            IEdmFile14 edmFile = (IEdmFile14)oFileArray[i];

            List<string> cfgList = new List<string>();
            EdmStrLst5 configLst =  edmFile.GetConfigurations();
            IEdmPos5 cfgPos = configLst.GetHeadPosition();
            while(!cfgPos.IsNull)
            {
                string configName = configLst.GetNext(cfgPos);
                cfgList.Add(configName);
            }

            foreach (string configName in cfgList)
                // Move variable values from "@" to configName
                edmFile.GenerateDefaultConfigValues(edmFile.ID, "@", configName, "", false);

            ShowDataCard();
        }
    }
}

Back to top

//Form1.Designer.cs

namespace Files_CSharp
{
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.DoBtn = new System.Windows.Forms.Button();
            this.CardPanel = new System.Windows.Forms.Panel();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FoldersComboBox = new System.Windows.Forms.ComboBox();
            this.FilesComboBox = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // DoBtn
            //
            this.DoBtn.Location = new System.Drawing.Point(223, 108);
            this.DoBtn.Name = "DoBtn";
            this.DoBtn.Size = new System.Drawing.Size(271, 23);
            this.DoBtn.TabIndex = 0;
            this.DoBtn.Text = "Copy Control Values";
            this.DoBtn.UseVisualStyleBackColor = true;
            this.DoBtn.Click += new System.EventHandler(this.DoBtn_Click);
            //
            // CardPanel
            //
            this.CardPanel.AutoScroll = true;
            this.CardPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.CardPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.CardPanel.Location = new System.Drawing.Point(12, 162);
            this.CardPanel.Name = "CardPanel";
            this.CardPanel.Size = new System.Drawing.Size(841, 479);
            this.CardPanel.TabIndex = 1;
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(108, 25);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(273, 21);
            this.VaultsComboBox.TabIndex = 2;
            this.VaultsComboBox.SelectedIndexChanged += new System.EventHandler(this.VaultsComboBox_SelectedIndexChanged);
            //
            // FoldersComboBox
            //
            this.FoldersComboBox.FormattingEnabled = true;
            this.FoldersComboBox.Location = new System.Drawing.Point(108, 52);
            this.FoldersComboBox.Name = "FoldersComboBox";
            this.FoldersComboBox.Size = new System.Drawing.Size(434, 21);
            this.FoldersComboBox.TabIndex = 3;
            this.FoldersComboBox.SelectedIndexChanged += new System.EventHandler(this.FoldersComboBox_SelectedIndexChanged);
            //
            // FilesComboBox
            //
            this.FilesComboBox.FormattingEnabled = true;
            this.FilesComboBox.Location = new System.Drawing.Point(108, 79);
            this.FilesComboBox.Name = "FilesComboBox";
            this.FilesComboBox.Size = new System.Drawing.Size(434, 21);
            this.FilesComboBox.TabIndex = 4;
            this.FilesComboBox.SelectedIndexChanged += new System.EventHandler(this.FilesComboBox_SelectedIndexChanged);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(9, 25);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(31, 13);
            this.label1.TabIndex = 5;
            this.label1.Text = "Vault";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(9, 52);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(36, 13);
            this.label2.TabIndex = 6;
            this.label2.Text = "Folder";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(9, 79);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(23, 13);
            this.label3.TabIndex = 7;
            this.label3.Text = "File";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(12, 143);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(57, 13);
            this.label4.TabIndex = 8;
            this.label4.Text = "Data card:";
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(913, 670);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.FilesComboBox);
            this.Controls.Add(this.FoldersComboBox);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.CardPanel);
            this.Controls.Add(this.DoBtn);
            this.Name = "MainForm";
            this.Text = "Copy Control Values to Configurations";
            this.Load += new System.EventHandler(this.MainForm_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button DoBtn;
        private System.Windows.Forms.Panel CardPanel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.ComboBox FoldersComboBox;
        private System.Windows.Forms.ComboBox FilesComboBox;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
    }
}

Back to top


Generate Configuration Values Example (VB.NET

SOLIDWORKS PDM Professional API Help

Generate Configuration Values Example (VB.NET)

This example shows how to copy card control variable values from one configuration to another.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type Files in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'     Form1.vb in the Solution Explorer.
' 9. Replace the code in Form1.vb with this code.
'10. To create the form, replace the code in Form1.Designer.vb with this code.
'11. Add dependencies and safely pass arrays of structures.
'12. Check out a file that has a data card with two or more configurations.
'13. Modify a control variable in the @ configuration.
'14. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Copy Control Values to Configurations dialog box.
'    a. Select a vault view.
'       Folder is set to the root folder.
'    b. Select a file that has a data card with two or more configurations.
'    c. Displays the data card.
'    d. Click Copy Control Values.
'       Copies the value set in Preconditions step 5 to all configurations.
' 2. Close the dialog box.
' 3. Inspect the control values in all of the configurations of the data card.
'----------------------------------------------------------------------------

'Form1.vb

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Imports EPDM.Interop.epdm

Partial Public Class MainForm
Inherits Form

Private oFoldersArray As Dictionary(Of Integer,IEdmFolder5) = New Dictionary(Of Integer, IEdmFolder5)()
Private oFileArray As New Dictionary(Of Integer, IEdmFile5)()
Private edmCardView As IEdmCardView63

Public Sub New()
InitializeComponent()
End Sub

Private Sub MainForm_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Try
'Declare and create an instance of IEdmVault5
Dim vault1 As IEdmVault5 = New EdmVault5()

'Cast IEdmVault5 to IEdmVault8
Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)

Dim Views() As EdmViewInfo = Nothing

'Populate the form with the names of
'the vaults on the computer
vault.GetVaultViews(Views, False)
VaultsComboBox.Items.Clear()
For Each View As EdmViewInfo In Views
VaultsComboBox.Items.Add(View.mbsVaultName)
Next View

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" & ex.ErrorCode.ToString("X") & ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub VaultsComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles VaultsComboBox.SelectedIndexChanged
Try
'Declare and create an instance of IEdmVault5
Dim vault As IEdmVault5 = New EdmVault5()

'Log into selected vault as the current user
vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())

Dim folderPos As IEdmPos5 = vault.RootFolder.GetFirstSubFolderPosition()

FoldersComboBox.Items.Clear()
oFoldersArray.Clear()

Dim i As Integer = FoldersComboBox.Items.Add("\")
oFoldersArray(i) = vault.RootFolder

Do While Not folderPos.IsNull
Dim edmFolder As IEdmFolder5 = vault.RootFolder.GetNextSubFolder(folderPos)

i = FoldersComboBox.Items.Add(edmFolder.Name)
oFoldersArray(i) = edmFolder
Loop

FoldersComboBox.Text = CStr(FoldersComboBox.Items(0))
Catch e1 As Exception
FoldersComboBox.Items.Clear()
oFoldersArray.Clear()
FoldersComboBox.Text = "Error"
End Try
End Sub

Private Sub FoldersComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles FoldersComboBox.SelectedIndexChanged
Try
Dim i As Integer = FoldersComboBox.SelectedIndex
Dim edmFolder As IEdmFolder5 = oFoldersArray(i)

Dim filePos As IEdmPos5 = edmFolder.GetFirstFilePosition()

FilesComboBox.Items.Clear()
oFileArray.Clear()

Do While Not filePos.IsNull
Dim edmFile As IEdmFile5 = edmFolder.GetNextFile(filePos)

i = FilesComboBox.Items.Add(edmFile.Name)
oFileArray(i) = edmFile
Loop

FilesComboBox.Text = CStr(FilesComboBox.Items(0))
Catch ex As Exception
FilesComboBox.Items.Clear()
oFileArray.Clear()
FilesComboBox.Text = "Error"
End Try

End Sub

Private Sub ShowDataCard()
If edmCardView IsNot Nothing Then
edmCardView.ShowWindow(False)
End If

Dim i As Integer = FoldersComboBox.SelectedIndex
Dim edmFolder As IEdmFolder5 = oFoldersArray(i)

i = FilesComboBox.SelectedIndex
Dim edmFile As IEdmFile5 = oFileArray(i)

Dim vault1 As IEdmVault10 = DirectCast(edmFolder.Vault, IEdmVault10)

Dim params As EdmCardViewParams = Nothing
params.mlFileID = edmFile.ID
params.mlFolderID = edmFolder.ID
params.mlCardID = 0
params.mlX = 10
params.mlY = 15
params.mhParentWindow = CardPanel.Handle.ToInt32()
params.mlEdmCardViewFlags = CInt(EdmCardViewFlag.EdmCvf_Normal)

edmCardView = vault1.CreateCardViewEx2(params, Me)
If edmCardView Is Nothing Then
MessageBox.Show("The file does not have a card.")
Return
End If

edmCardView.SetFocus(0)

Dim width_Renamed As Integer = 0
Dim height_Renamed As Integer = 0
edmCardView.GetCardSize(width_Renamed, height_Renamed)
CardPanel.Width = width_Renamed+20
CardPanel.Height = height_Renamed+20
edmCardView.ShowWindow(True)
End Sub

Private Sub FilesComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles FilesComboBox.SelectedIndexChanged
ShowDataCard()
End Sub

Private Sub DoBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DoBtn.Click
Dim i As Integer = FoldersComboBox.SelectedIndex
Dim edmFolder As IEdmFolder5 = oFoldersArray(i)

i = FilesComboBox.SelectedIndex
Dim edmFile As IEdmFile14 = DirectCast(oFileArray(i), IEdmFile14)

Dim cfgList As New List(Of String)()
Dim configLst As EdmStrLst5 = edmFile.GetConfigurations()
Dim cfgPos As IEdmPos5 = configLst.GetHeadPosition()
Do While Not cfgPos.IsNull
Dim configName As String = configLst.GetNext(cfgPos)
cfgList.Add(configName)
Loop

For Each configName As String In cfgList
' Move variable values from "@" to configName
edmFile.GenerateDefaultConfigValues(edmFile.ID, "@", configName, "", False)
Next configName

ShowDataCard()
End Sub
End Class

Back to top

'Form1.Designer.vb

Partial Public Class MainForm
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.IContainer = Nothing

''' <summary>
''' Clean up any resources being used.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub

#Region "Windows Form Designer generated code"

''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
Me.DoBtn = New System.Windows.Forms.Button()
Me.CardPanel = New System.Windows.Forms.Panel()
Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
Me.FoldersComboBox = New System.Windows.Forms.ComboBox()
Me.FilesComboBox = New System.Windows.Forms.ComboBox()
Me.label1 = New System.Windows.Forms.Label()
Me.label2 = New System.Windows.Forms.Label()
Me.label3 = New System.Windows.Forms.Label()
Me.label4 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
' DoBtn
'
Me.DoBtn.Location = New System.Drawing.Point(223, 108)
Me.DoBtn.Name = "DoBtn"
Me.DoBtn.Size = New System.Drawing.Size(271, 23)
Me.DoBtn.TabIndex = 0
Me.DoBtn.Text = "Copy Control Values"
Me.DoBtn.UseVisualStyleBackColor = True

'
' CardPanel
'
Me.CardPanel.AutoScroll = True
Me.CardPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.CardPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.CardPanel.Location = New System.Drawing.Point(12, 162)
Me.CardPanel.Name = "CardPanel"
Me.CardPanel.Size = New System.Drawing.Size(841, 479)
Me.CardPanel.TabIndex = 1
'
' VaultsComboBox
'
Me.VaultsComboBox.FormattingEnabled = True
Me.VaultsComboBox.Location = New System.Drawing.Point(108, 25)
Me.VaultsComboBox.Name = "VaultsComboBox"
Me.VaultsComboBox.Size = New System.Drawing.Size(273, 21)
Me.VaultsComboBox.TabIndex = 2

'
' FoldersComboBox
'
Me.FoldersComboBox.FormattingEnabled = True
Me.FoldersComboBox.Location = New System.Drawing.Point(108, 52)
Me.FoldersComboBox.Name = "FoldersComboBox"
Me.FoldersComboBox.Size = New System.Drawing.Size(434, 21)
Me.FoldersComboBox.TabIndex = 3

'
' FilesComboBox
'
Me.FilesComboBox.FormattingEnabled = True
Me.FilesComboBox.Location = New System.Drawing.Point(108, 79)
Me.FilesComboBox.Name = "FilesComboBox"
Me.FilesComboBox.Size = New System.Drawing.Size(434, 21)
Me.FilesComboBox.TabIndex = 4

'
' label1
'
Me.label1.AutoSize = True
Me.label1.Location = New System.Drawing.Point(9, 25)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(31, 13)
Me.label1.TabIndex = 5
Me.label1.Text = "Vault"
'
' label2
'
Me.label2.AutoSize = True
Me.label2.Location = New System.Drawing.Point(9, 52)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(36, 13)
Me.label2.TabIndex = 6
Me.label2.Text = "Folder"
'
' label3
'
Me.label3.AutoSize = True
Me.label3.Location = New System.Drawing.Point(9, 79)
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(23, 13)
Me.label3.TabIndex = 7
Me.label3.Text = "File"
'
' label4
'
Me.label4.AutoSize = True
Me.label4.Location = New System.Drawing.Point(12, 143)
Me.label4.Name = "label4"
Me.label4.Size = New System.Drawing.Size(57, 13)
Me.label4.TabIndex = 8
Me.label4.Text = "Data card:"
'
' MainForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(913, 670)
Me.Controls.Add(Me.label4)
Me.Controls.Add(Me.label3)
Me.Controls.Add(Me.label2)
Me.Controls.Add(Me.label1)
Me.Controls.Add(Me.FilesComboBox)
Me.Controls.Add(Me.FoldersComboBox)
Me.Controls.Add(Me.VaultsComboBox)
Me.Controls.Add(Me.CardPanel)
Me.Controls.Add(Me.DoBtn)
Me.Name = "MainForm"
Me.Text = "Copy Control Values to Configurations"

Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

#End Region

Private WithEvents DoBtn As System.Windows.Forms.Button
Private CardPanel As System.Windows.Forms.Panel
Private WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
Private WithEvents FoldersComboBox As System.Windows.Forms.ComboBox
Private WithEvents FilesComboBox As System.Windows.Forms.ComboBox
Private label1 As System.Windows.Forms.Label
Private label2 As System.Windows.Forms.Label
Private label3 As System.Windows.Forms.Label
Private label4 As System.Windows.Forms.Label
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get and Run a Task Add-in Example (C#)

This example shows how to get a task add-in that is registered in the Admin tool and run it.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows
Forms App.
// 3. Type TasksDemo in Project name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9. Replace the code in Form1.cs
with this code.
//10. To create the form, replace the code
in Form1.Designer.cs with
//    this code.
//11.

Add dependencies and
safely pass arrays of structures.
//12. Ensure that a task add-in has been registered with the Administration tool.
//13. Ensure that a task to run the task add-in has been created in the
//    Administration
tool.
//14. Ensure that your vault has permission to run the task add-in by selecting
//    Permit in Task Host Configuration dialog.
(Right-click the SOLIDWORKS PDM
//    icon on the notification tool bar and select Task Host
Configuration.)
//15. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//
1. In the Vaults dropdown, select the vault permitted to run the task add-in.
// 2. Click Log In.
// 3. In the Tasks dropdown, select the task to run.
// 4. Click Select Files to select any files that are required for the
task.
// 5. Click Run Task.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace TasksDemo
{
    public partial class Form1 : Form
    {
        IEdmVault5 vault5;
        IEdmVault20 vault20;
        IEdmTaskMgr TaskMgr;
        EdmStrLst5 files;
        class CustomComboType
        {
            public EdmTaskInfo TaskInfo;
            public override string ToString()
            {
                return TaskInfo.mbsTaskName;
            }
        }
        public Form1()
        {
            InitializeComponent();
            vault5 = new EdmVault5();
            vault20 = (IEdmVault20)vault5;
            EdmViewInfo[] Views = new EdmViewInfo[1];
            vault20.GetVaultViews(out Views, false);
            foreach (EdmViewInfo view in Views)
                comboBox1.Items.Add(view.mbsVaultName);
            if (comboBox1.Items.Count > 0)
                comboBox1.Text = comboBox1.Items[0].ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Create a file vault interface and log into a vault
            if (comboBox1.Text != string.Empty)
            {
                vault20.LoginAuto(comboBox1.Text, this.Handle.ToInt32());
                TaskMgr = (IEdmTaskMgr)vault20.CreateUtility(EdmUtility.EdmUtil_TaskMgr);
                System.Array Tasks = TaskMgr.GetTasks();

                foreach (EdmTaskInfo task in Tasks)
                    comboBox2.Items.Add( new CustomComboType { TaskInfo = task });
                if (comboBox2.Items.Count > 0)
                    comboBox2.SelectedItem = comboBox2.Items[0];
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            files  = vault20.BrowseForFile(this.Handle.ToInt32(),
                (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitMultipleSel + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles,
                "SOLIDWORKS files " + "(*.sldprt; *.sldasm; *.slddrw)|" + "*.sldprt;*.sldasm;*.slddrw|" + "All Files (*.*)|*.*||", "", "",
                vault20.RootFolderPath, "Select Files");

        }

        private void button3_Click(object sender, EventArgs e)
        {
            EdmSelItem2[] selection = new EdmSelItem2[files.Count];
            IEdmPos5 pos = files.GetHeadPosition();
            int counter = 0;
            while(!pos.IsNull)
            {
                IEdmFolder5 parentFolder = null;
                IEdmFile5 file = vault20.GetFileFromPath(files.GetNext(pos), out parentFolder);
                selection[counter].mlID = file.ID;
                selection[counter].mlParentID = parentFolder.ID;
                selection[counter].mlVersion = file.CurrentVersion;
                selection[counter].meType = EdmObjectType.EdmObject_File;
            }
            TaskMgr.RunTask(((CustomComboType)comboBox2.SelectedItem).TaskInfo, selection, this.Handle.ToInt32());
        }
    }
}

Back to top

//Form1.Designer

namespace TasksDemo
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// comboBox1
//
this.comboBox1.DisplayMember = "mbsVaultName";
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(50, 12);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
//
// comboBox2
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(50, 66);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(121, 21);
this.comboBox2.TabIndex = 1;
//
// button1
//
this.button1.Location = new System.Drawing.Point(50, 37);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(121, 23);
this.button1.TabIndex = 2;
this.button1.Text = "Log
In";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(50, 93);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(121, 23);
this.button2.TabIndex = 3;
this.button2.Text = "Select
Files";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(50, 123);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(121, 23);
this.button3.TabIndex = 4;
this.button3.Text = "Run Task";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(2, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Vaults:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(5, 74);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(39, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Tasks:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(178, 150);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.comboBox1);
this.Name = "Form1";
this.Text = "Tasks API Demo";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}

Back to top


SOLIDWORKS PDM Professional API Help

Get and Set Folder Permissions Example (C#)

This example shows how to create an application that displays a form in which a user can assign permissions to folders for users and groups in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click
File > New > Project > C#, Windows, Desktop > Windows Forms App.
// 3. Type CallingCSharp in Project n ame.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. Replace the code in Form1.Designer.cs with
this code.
//12. Click
Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. In the Form1 dialog, select a vault and click Log In.
//    Wait for the application to populate the Users and Groups
list boxes.
// 2. Click permissions in the list box located left of the Reverse
Order check box.
// 3. Optionally select the Reverse Order check box.
// 4. Select the check boxes in front of the users and folders to which to
assign permissions.
// 5. Click Apply Permissions.
//    Wait for the application to populate the Users list.
//    The folder permissions are updated for the selected users.
// 6. Select the check boxes in front of the groups and folders to which to
assign permissions.
// 7. Click Apply Permissions.
//    Wait for the application to populate the Groups list.
//    The folder permissions are updated for the selected groups.
//----------------------------------------------------------------------------

// Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CallingCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        IEdmVault5 vault1;
        IEdmVault8 vault;
        private Dictionary<int, string> folders;
        String val;
        private enum MyEdmRightsFlags : int
        {
            MyRight_All = EdmRightFlags.EdmRight_All,
            MyRight_None = EdmRightFlags.EdmRight_None,
            MyRight_Read = EdmRightFlags.EdmRight_Read,
            MyRight_Lock = EdmRightFlags.EdmRight_Lock,
            MyRight_Delete = EdmRightFlags.EdmRight_Delete,
            MyRight_AddRename = EdmRightFlags.EdmRight_Add,
            MyRight_Share = EdmRightFlags.EdmRight_Share,
            MyRight_IncrementRevision = EdmRightFlags.EdmRight_IncrementRevision,
            MyRight_AddDeleteFolder = EdmRightFlags.EdmRight_AddFolder,
            MyRight_RecoverTrash = EdmRightFlags.EdmRight_RecoverTrash,
            MyRight_DestroyTrash = EdmRightFlags.EdmRight_DestroyTrash,
            MyRight_EditFolderCard = EdmRightFlags.EdmRight_EditFolderCard,
            MyRight_BomActivate = EdmRightFlags.EdmRight_BomActivate,
            MyRight_MaySeeComputedBOM = EdmRightFlags.EdmRight_MaySeeComputedBOM,
            MyRight_AssignGroupMembership = 0x1000,
            MyRightAssignFilePermissions = 0x2000,
            MyRight_PermitGroupAccess = 0x4000,
            MyRight_ReadNamedBOM = 0x8000,
            MyRight_ChangeCard = EdmRightFlags.EdmRight_ChangeCard,
            MyRight_ShowWorkingVersion = EdmRightFlags.EdmRight_ShowWorkingVersion,
            MyRight_Rollback = EdmRightFlags.EdmRight_Rollback,
            MyRight_ColdStoreRestore = EdmRightFlags.EdmRight_ColdStoreRestore,
            MyRight_EditVerFreeVarData = EdmRightFlags.EdmRight_EditVerFreeVarData
        }

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                vault = (IEdmVault8)vault1;
                EdmViewInfo[] aViews = null;
                vault.GetVaultViews(out aViews, false);
                comboVault.Items.Clear();
                if (aViews != null)
                {
                    foreach (EdmViewInfo View in aViews)
                    {
                        comboVault.Items.Add(View.mbsVaultName);
                    }
                    comboVault.SelectedIndex = 0;
                }

                Dictionary<MyEdmRightsFlags, String> RightLabels = new Dictionary<MyEdmRightsFlags, String>()
            {{MyEdmRightsFlags.MyRight_Read, "Read file contents"}, {MyEdmRightsFlags.MyRight_Lock, "Check out file"}, {MyEdmRightsFlags.MyRight_Delete, "Delete file"}, {MyEdmRightsFlags.MyRight_AddRename, "Add or rename file"},{MyEdmRightsFlags.MyRight_Share, "Share file to another folder"}, {MyEdmRightsFlags.MyRight_IncrementRevision, "Increment revision of a file"}, {MyEdmRightsFlags.MyRight_AddDeleteFolder, "Add or delete a folder"}, {MyEdmRightsFlags.MyRight_RecoverTrash, "Recover files from recycle bin"}, {MyEdmRightsFlags.MyRight_DestroyTrash, "Destroy"}, {MyEdmRightsFlags.MyRight_EditFolderCard, "Edit folder card data"}, {MyEdmRightsFlags.MyRight_BomActivate, "Activate computed BOM"}, {MyEdmRightsFlags.MyRight_MaySeeComputedBOM, "See computed BOM"}, {MyEdmRightsFlags.MyRight_AssignGroupMembership, "Assign group membership"}, {MyEdmRightsFlags.MyRightAssignFilePermissions, "Assign File permissions"}, {MyEdmRightsFlags.MyRight_PermitGroupAccess, "Permit or deny group-level access to files"}, {MyEdmRightsFlags.MyRight_ReadNamedBOM, "Read named bill of materials"}, {MyEdmRightsFlags.MyRight_ChangeCard, "Can update the design of cards"}, {MyEdmRightsFlags.MyRight_ShowWorkingVersion, "Show working versions of files"}, {MyEdmRightsFlags.MyRight_Rollback, "Rollback"},{MyEdmRightsFlags.MyRight_ColdStoreRestore, "Restore file from cold storage"}, {MyEdmRightsFlags.MyRight_EditVerFreeVarData, "Edit version free variable data"}};

                foreach (MyEdmRightsFlags flag in Enum.GetValues(typeof(MyEdmRightsFlags)))
                {
                    if (RightLabels.ContainsKey(flag))
                    {
                        String val;
                        RightLabels.TryGetValue(flag, out val);
                        ListViewItem rightItem = listViewPermissions.Items.Add(val);
                        rightItem.Tag = flag;
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void buttonLogIn_Click(object sender, System.EventArgs e)
        {
            try {
            vault.LoginAuto(comboVault.Text, (int)this.Handle);
            comboVault.Enabled = false;
            buttonLogIn.Enabled = false;
            buttonApply.Enabled = true;
            buttonRefresh.Enabled = true;

            folders = new Dictionary<int, string>();

            IEdmFolder7 rootFolder = (IEdmFolder7)vault.RootFolder;
            BuildFolderDictionary(rootFolder);

            ShowAllUserPermissions();
            ShowAllGroupPermissions();
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void BuildFolderDictionary(IEdmFolder7 folder)
        {
            folders.Add(folder.ID, folder.LocalPath);

            IEdmPos5 posSubFolder = folder.GetFirstSubFolderPosition();
            while (!(posSubFolder.IsNull))
            {
                IEdmFolder7 subFolder = (IEdmFolder7)folder.GetNextSubFolder(posSubFolder);
                BuildFolderDictionary(subFolder);
            }
        }

        private void ShowAllUserPermissions()
        {
            listViewUsers.Items.Clear();
            IEdmUserMgr7 userMgr = (IEdmUserMgr7)vault;
            IEdmPos5 userPos = userMgr.GetFirstUserPosition();
            while (!(userPos.IsNull))
            {
                IEdmUser5 user = (IEdmUser5)userMgr.GetNextUser(userPos);

                foreach (int folderID in folders.Keys)
                {
                    EdmFolderPermission[] aPermissions = null;
                    userMgr.GetFolderPermissions(user.ID, user.ObjectType, folderID, (int)EdmGetPermFlag.EdmGetPerm_OnlyExplicitlySet, out aPermissions);

                    if (aPermissions != null && aPermissions.Length > 0)
                    {
                        ListViewItem itemUser = listViewUsers.Items.Add(user.ID.ToString());
                        itemUser.SubItems.Add(user.Name);
                        itemUser.SubItems.Add(folderID.ToString());
                        folders.TryGetValue(folderID, out val);
                        itemUser.SubItems.Add(val);
                        EdmFolderPermission folderPermission = (EdmFolderPermission)aPermissions.GetValue(0);
                        itemUser.SubItems.Add(folderPermission.mlEdmRightFlag.ToString());
                    }
                }
            }
        }

        private void ShowAllGroupPermissions()
        {
            listViewGroups.Items.Clear();
            IEdmUserMgr7 userMgr = (IEdmUserMgr7)vault;
            IEdmPos5 groupPos = userMgr.GetFirstUserGroupPosition();
            while (!(groupPos.IsNull))
            {
                IEdmUserGroup5 @group = (IEdmUserGroup5)userMgr.GetNextUserGroup(groupPos);

                foreach (int folderID in folders.Keys)
                {
                    EdmFolderPermission[] aPermissions = null;
                    userMgr.GetFolderPermissions(@group.ID, @group.ObjectType, folderID, 0, out aPermissions);

                    if (aPermissions != null && aPermissions.Length > 0)
                    {
                        ListViewItem itemGroup = listViewGroups.Items.Add(@group.ID.ToString());
                        itemGroup.SubItems.Add(@group.Name);
                        itemGroup.SubItems.Add(folderID.ToString());
                        folders.TryGetValue(folderID, out val);
                        itemGroup.SubItems.Add(val);
                        EdmFolderPermission folderPermission = (EdmFolderPermission)aPermissions.GetValue(0);
                        itemGroup.SubItems.Add(folderPermission.mlEdmRightFlag.ToString());
                    }
                }
            }
        }

        private void buttonApply_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                int assignedRights = 0;
                foreach (ListViewItem rightItem in listViewPermissions.Items)
                {
                    if (rightItem.Checked)
                    {
                        assignedRights = assignedRights | (int)rightItem.Tag;
                    }
                }

                IEdmUserMgr7 userMgr = (IEdmUserMgr7)vault;

                List<EdmFolderPermission> listPermissions = new List<EdmFolderPermission>();
                foreach (ListViewItem itemUser in listViewUsers.Items)
                {
                    if (itemUser.Checked)
                    {
                        int folderID = Convert.ToInt32(itemUser.SubItems[2].Text);
                        EdmFolderPermission permission = default(EdmFolderPermission);
                        {
                            permission.mlFolderID = folderID;
                            permission.mlOwnerID = Convert.ToInt32(itemUser.SubItems[0].Text);
                            permission.meOwnerType = EdmObjectType.EdmObject_User;
                            permission.mlEdmRightFlag = assignedRights;
                        }
                        listPermissions.Add(permission);
                    }
                }

                foreach (ListViewItem itemGroup in listViewGroups.Items)
                {
                    if (itemGroup.Checked)
                    {
                        int folderID = Convert.ToInt32(itemGroup.SubItems[2].Text);
                        EdmFolderPermission permission = default(EdmFolderPermission);
                        {
                            permission.mlFolderID = folderID;
                            permission.mlOwnerID = Convert.ToInt32(itemGroup.SubItems[0].Text);
                            permission.meOwnerType = EdmObjectType.EdmObject_UserGroup;
                            permission.mlEdmRightFlag = assignedRights;
                        }
                        listPermissions.Add(permission);
                    }
                }

                if (checkboxReverseOrder.Checked)
                    listPermissions.Reverse();

                EdmFolderPermission[] permissions = listPermissions.ToArray();
                userMgr.SetFolderPermissions(permissions);

                ShowAllGroupPermissions();
                ShowAllUserPermissions();
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void buttonRefresh_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                ShowAllGroupPermissions();
                ShowAllUserPermissions();
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }

}

// Form1.Designer.cs

namespace CallingCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.buttonLogIn = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.buttonRefresh = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.checkboxReverseOrder = new System.Windows.Forms.CheckBox();
            this.buttonApply = new System.Windows.Forms.Button();
            this.listViewUsers = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.listViewGroups = new System.Windows.Forms.ListView();
            this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.columnHeader10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.listViewPermissions = new System.Windows.Forms.ListView();
            this.comboVault = new System.Windows.Forms.ComboBox();
            this.label4 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // buttonLogIn
            //
            this.buttonLogIn.Location = new System.Drawing.Point(518, 27);
            this.buttonLogIn.Name = "buttonLogIn";
            this.buttonLogIn.Size = new System.Drawing.Size(75, 23);
            this.buttonLogIn.TabIndex = 2;
            this.buttonLogIn.Text = "Log In";
            this.buttonLogIn.UseVisualStyleBackColor = true;
            this.buttonLogIn.Click += new System.EventHandler(this.buttonLogIn_Click);
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(38, 85);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(37, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Users";
            //
            // buttonRefresh
            //
            this.buttonRefresh.Location = new System.Drawing.Point(518, 75);
            this.buttonRefresh.Name = "buttonRefresh";
            this.buttonRefresh.Size = new System.Drawing.Size(126, 23);
            this.buttonRefresh.TabIndex = 4;
            this.buttonRefresh.Text = "Refresh Permissions";
            this.buttonRefresh.UseVisualStyleBackColor = true;
            this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(38, 227);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(44, 13);
            this.label3.TabIndex = 6;
            this.label3.Text = "Groups";
            //
            // checkboxReverseOrder
            //
            this.checkboxReverseOrder.AutoSize = true;
            this.checkboxReverseOrder.Location = new System.Drawing.Point(518, 368);
            this.checkboxReverseOrder.Name = "checkboxReverseOrder";
            this.checkboxReverseOrder.Size = new System.Drawing.Size(95, 17);
            this.checkboxReverseOrder.TabIndex = 9;
            this.checkboxReverseOrder.Text = "Reverse Order";
            this.checkboxReverseOrder.UseVisualStyleBackColor = true;
            //
            // buttonApply
            //
            this.buttonApply.Location = new System.Drawing.Point(518, 407);
            this.buttonApply.Name = "buttonApply";
            this.buttonApply.Size = new System.Drawing.Size(126, 23);
            this.buttonApply.TabIndex = 10;
            this.buttonApply.Text = "Apply Permissions";
            this.buttonApply.UseVisualStyleBackColor = true;
            this.buttonApply.Click += new System.EventHandler(buttonApply_Click);
            //
            // listViewUsers
            //
            this.listViewUsers.CheckBoxes = true;
            this.listViewUsers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2,
            this.columnHeader3,
            this.columnHeader7,
            this.columnHeader8});
            this.listViewUsers.Location = new System.Drawing.Point(38, 112);
            this.listViewUsers.Name = "listViewUsers";
            this.listViewUsers.Size = new System.Drawing.Size(501, 97);
            this.listViewUsers.TabIndex = 11;
            this.listViewUsers.UseCompatibleStateImageBehavior = false;
            this.listViewUsers.View = System.Windows.Forms.View.Details;
            //
            // columnHeader1
            //
            this.columnHeader1.Text = "ID";
            this.columnHeader1.Width = 41;
            //
            // columnHeader2
            //
            this.columnHeader2.Text = "Name";
            this.columnHeader2.Width = 137;
            //
            // columnHeader3
            //
            this.columnHeader3.Text = "Folder ID";
            //
            // columnHeader7
            //
            this.columnHeader7.Text = "Folder";
            this.columnHeader7.Width = 152;
            //
            // columnHeader8
            //
            this.columnHeader8.Text = "Folder Permissions";
            this.columnHeader8.Width = 108;
            //
            // listViewGroups
            //
            this.listViewGroups.CheckBoxes = true;
            this.listViewGroups.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader4,
            this.columnHeader5,
            this.columnHeader6,
            this.columnHeader9,
            this.columnHeader10});
            this.listViewGroups.Location = new System.Drawing.Point(38, 257);
            this.listViewGroups.Name = "listViewGroups";
            this.listViewGroups.Size = new System.Drawing.Size(501, 97);
            this.listViewGroups.TabIndex = 12;
            this.listViewGroups.UseCompatibleStateImageBehavior = false;
            this.listViewGroups.View = System.Windows.Forms.View.Details;
            //
            // columnHeader4
            //
            this.columnHeader4.Text = "ID";
            this.columnHeader4.Width = 41;
            //
            // columnHeader5
            //
            this.columnHeader5.Text = "Name";
            this.columnHeader5.Width = 137;
            //
            // columnHeader6
            //
            this.columnHeader6.Text = "Folder ID";
            //
            // columnHeader9
            //
            this.columnHeader9.Text = "Folder";
            this.columnHeader9.Width = 152;
            //
            // columnHeader10
            //
            this.columnHeader10.Text = "Folder Permissions";
            this.columnHeader10.Width = 108;
            //
            // listViewPermissions
            //
            this.listViewPermissions.CheckBoxes = true;
            this.listViewPermissions.Location = new System.Drawing.Point(38, 383);
            this.listViewPermissions.Name = "listViewPermissions";
            this.listViewPermissions.Size = new System.Drawing.Size(431, 97);
            this.listViewPermissions.TabIndex = 13;
            this.listViewPermissions.UseCompatibleStateImageBehavior = false;
            this.listViewPermissions.View = System.Windows.Forms.View.List;
            //
            // comboVault
            //
            this.comboVault.FormattingEnabled = true;
            this.comboVault.Location = new System.Drawing.Point(108, 27);
            this.comboVault.Name = "comboVault";
            this.comboVault.Size = new System.Drawing.Size(361, 21);
            this.comboVault.TabIndex = 14;
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(38, 27);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(66, 13);
            this.label4.TabIndex = 15;
            this.label4.Text = "Select vault:";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(749, 516);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.comboVault);
            this.Controls.Add(this.listViewPermissions);
            this.Controls.Add(this.listViewGroups);
            this.Controls.Add(this.listViewUsers);
            this.Controls.Add(this.buttonApply);
            this.Controls.Add(this.checkboxReverseOrder);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.buttonRefresh);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.buttonLogIn);
            this.Name = "Form1";
            this.Text = "Folder Permissions";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button buttonLogIn;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button buttonRefresh;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.CheckBox checkboxReverseOrder;
        private System.Windows.Forms.Button buttonApply;
        private System.Windows.Forms.ListView listViewUsers;
        private System.Windows.Forms.ListView listViewGroups;
        private System.Windows.Forms.ListView listViewPermissions;
        private System.Windows.Forms.ComboBox comboVault;
        public System.Windows.Forms.ColumnHeader columnHeader1;
        public System.Windows.Forms.ColumnHeader columnHeader2;
        public System.Windows.Forms.ColumnHeader columnHeader3;
        public System.Windows.Forms.ColumnHeader columnHeader7;
        public System.Windows.Forms.ColumnHeader columnHeader8;
        public System.Windows.Forms.ColumnHeader columnHeader4;
        public System.Windows.Forms.ColumnHeader columnHeader5;
        public System.Windows.Forms.ColumnHeader columnHeader6;
        public System.Windows.Forms.ColumnHeader columnHeader9;
        public System.Windows.Forms.ColumnHeader columnHeader10;
        private System.Windows.Forms.Label label4;
    }
}


SOLIDWORKS PDM Professional API Help

Get and Set Folder Permissions Example (VB.NET)

This example shows how to create an application that displays a form in which a user can assign permissions to folders for users and groups in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type the name of your project in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. Replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. In the Form1 dialog, select a vault and click Log In.
' Wait for the application to populate the Users and Groups list boxes.
' 2. Click permissions in the list box located left of the Reverse Order check box.
' 3. Optionally select the Reverse Order check box.
' 4. Select the check boxes in front of the users and folders to which to assign permissions.
' 5. Click Apply Permissions.
' Wait for the application to populate the Users list.
' The folder permissions are updated for the selected users.
' 6. Select the check boxes in front of the groups and folders to which to assign permissions.
' 7. Click Apply Permissions.
' Wait for the application to populate the Groups list.
' The folder permissions are updated for the selected groups.
'----------------------------------------------------------------------------

' Form1.vb

Imports EPDM.Interop.epdm

Public Class Form1

Private vault As IEdmVault8
Private folders As Dictionary(Of Integer, String)

Private Enum MyEdmRightsFlags As Integer
MyRight_All = EdmRightFlags.EdmRight_All
MyRight_None = EdmRightFlags.EdmRight_None
MyRight_Read = EdmRightFlags.EdmRight_Read
MyRight_Lock = EdmRightFlags.EdmRight_Lock
MyRight_Delete = EdmRightFlags.EdmRight_Delete
MyRight_AddRename = EdmRightFlags.EdmRight_Add
MyRight_Share = EdmRightFlags.EdmRight_Share
MyRight_IncrementRevision = EdmRightFlags.EdmRight_IncrementRevision
MyRight_AddDeleteFolder = EdmRightFlags.EdmRight_AddFolder
MyRight_RecoverTrash = EdmRightFlags.EdmRight_RecoverTrash
MyRight_DestroyTrash = EdmRightFlags.EdmRight_DestroyTrash
MyRight_EditFolderCard = EdmRightFlags.EdmRight_EditFolderCard
MyRight_BomActivate = EdmRightFlags.EdmRight_BomActivate
MyRight_MaySeeComputedBOM = EdmRightFlags.EdmRight_MaySeeComputedBOM
MyRight_AssignGroupMembership = &H1000
MyRightAssignFilePermissions = &H2000
MyRight_PermitGroupAccess = &H4000
MyRight_ReadNamedBOM = &H8000
MyRight_ChangeCard = EdmRightFlags.EdmRight_ChangeCard
MyRight_ShowWorkingVersion = EdmRightFlags.EdmRight_ShowWorkingVersion
MyRight_Rollback = EdmRightFlags.EdmRight_Rollback
MyRight_ColdStoreRestore = EdmRightFlags.EdmRight_ColdStoreRestore
MyRight_EditVerFreeVarData = EdmRightFlags.EdmRight_EditVerFreeVarData
End Enum

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
vault = New EdmVault5
Dim aViews As Array = Nothing
vault.GetVaultViews(aViews, False)
If aViews IsNot Nothing Then
For Each View As EdmViewInfo In aViews
comboVault.Items.Add(View.mbsVaultName)
Next
comboVault.SelectedIndex = 0
End If

Dim RightLabels As Dictionary(Of MyEdmRightsFlags, String) = New Dictionary(Of MyEdmRightsFlags, String) From _
{ _
{MyEdmRightsFlags.MyRight_Read, "Read file contents"}, _
{MyEdmRightsFlags.MyRight_Lock, "Check out file"}, _
{MyEdmRightsFlags.MyRight_Delete, "Delete file"}, _
{MyEdmRightsFlags.MyRight_AddRename, "Add or rename file"}, _
{MyEdmRightsFlags.MyRight_Share, "Share file to another folder"}, _
{MyEdmRightsFlags.MyRight_IncrementRevision, "Increment revision of a file"}, _
{MyEdmRightsFlags.MyRight_AddDeleteFolder, "Add or delete a folder"}, _
{MyEdmRightsFlags.MyRight_RecoverTrash, "Recover files from recycle bin"}, _
{MyEdmRightsFlags.MyRight_DestroyTrash, "Destroy"}, _
{MyEdmRightsFlags.MyRight_EditFolderCard, "Edit folder card data"}, _
{MyEdmRightsFlags.MyRight_BomActivate, "Activate computed BOM"}, _
{MyEdmRightsFlags.MyRight_MaySeeComputedBOM, "See computed BOM"}, _
{MyEdmRightsFlags.MyRight_AssignGroupMembership, "Assign group membership"}, _
{MyEdmRightsFlags.MyRightAssignFilePermissions, "Assign file permissions"}, _
{MyEdmRightsFlags.MyRight_PermitGroupAccess, "Permit or deny group-level access to files"}, _
{MyEdmRightsFlags.MyRight_ReadNamedBOM, "Read named bill of materials"}, _
{MyEdmRightsFlags.MyRight_ChangeCard, "Can update the design of cards"}, _
{MyEdmRightsFlags.MyRight_ShowWorkingVersion, "Show working versions of files"}, _
{MyEdmRightsFlags.MyRight_Rollback, "Roll
back"}, _
{MyEdmRightsFlags.MyRight_ColdStoreRestore, "Restore file from cold storage"}, _
{MyEdmRightsFlags.MyRight_EditVerFreeVarData, "Edit version-free variable data"}
}

For Each flag As MyEdmRightsFlags In [Enum].GetValues(GetType(MyEdmRightsFlags))
If RightLabels.ContainsKey(flag) Then
Dim rightItem As ListViewItem = listViewPermissions.Items.Add(RightLabels(flag))
rightItem.Tag = flag
End If
Next
End Sub

Private Sub buttonLogIn_Click(sender As Object, e As System.EventArgs) Handles buttonLogIn.Click
vault.LoginAuto(comboVault.Text, Me.Handle)
comboVault.Enabled = False
buttonLogIn.Enabled = False
buttonApply.Enabled = True
buttonRefresh.Enabled = True

folders = New Dictionary(Of Integer, String)()

Dim rootFolder As IEdmFolder7 = vault.RootFolder
BuildFolderDictionary(rootFolder)

ShowAllUserPermissions()
ShowAllGroupPermissions()
End Sub

Private Sub BuildFolderDictionary(folder As IEdmFolder7)
folders.Add(folder.ID, folder.LocalPath)

Dim posSubFolder As IEdmPos5 = folder.GetFirstSubFolderPosition()
Do Until posSubFolder.IsNull
Dim subFolder As IEdmFolder7 = folder.GetNextSubFolder(posSubFolder)
BuildFolderDictionary(subFolder)
Loop
End Sub

Private Sub ShowAllUserPermissions()
listViewUsers.Items.Clear()
Dim userMgr As IEdmUserMgr7 = vault
Dim userPos As IEdmPos5 = userMgr.GetFirstUserPosition()
Do Until userPos.IsNull
Dim user As IEdmUser5 = userMgr.GetNextUser(userPos)

For Each folderID As Integer In folders.Keys
Dim aPermissions As Array = Nothing
userMgr.GetFolderPermissions(user.ID, user.ObjectType, folderID, EdmGetPermFlag.EdmGetPerm_OnlyExplicitlySet, aPermissions)

If aPermissions IsNot Nothing AndAlso aPermissions.Length > 0 Then
Dim itemUser As ListViewItem = listViewUsers.Items.Add(user.ID.ToString())
itemUser.SubItems.Add(user.Name)
itemUser.SubItems.Add(folderID)
itemUser.SubItems.Add(folders(folderID))
Dim folderPermission As EdmFolderPermission = aPermissions.GetValue(0)
itemUser.SubItems.Add(folderPermission.mlEdmRightFlag.ToString())
End If
Next
Loop
End Sub

Private Sub ShowAllGroupPermissions()
listViewGroups.Items.Clear()
Dim userMgr As IEdmUserMgr7 = vault
Dim groupPos As IEdmPos5 = userMgr.GetFirstUserGroupPosition()
Do Until groupPos.IsNull
Dim group As IEdmUserGroup5 = userMgr.GetNextUserGroup(groupPos)

For Each folderID As Integer In folders.Keys
Dim aPermissions As Array = Nothing
userMgr.GetFolderPermissions(group.ID, group.ObjectType, folderID, 0, aPermissions)

If aPermissions IsNot Nothing AndAlso aPermissions.Length > 0 Then
Dim itemGroup As ListViewItem = listViewGroups.Items.Add(group.ID.ToString())
itemGroup.SubItems.Add(group.Name)
itemGroup.SubItems.Add(folderID)
itemGroup.SubItems.Add(folders(folderID))
Dim folderPermission As EdmFolderPermission = aPermissions.GetValue(0)
itemGroup.SubItems.Add(folderPermission.mlEdmRightFlag.ToString())
End If
Next
Loop
End Sub

Private Sub buttonApply_Click(sender As System.Object, e As System.EventArgs) Handles buttonApply.Click
Dim assignedRights As Integer = 0
For Each rightItem As ListViewItem In listViewPermissions.Items
If rightItem.Checked Then
assignedRights = assignedRights Or rightItem.Tag
End If
Next

Dim userMgr As IEdmUserMgr7 = vault

Dim listPermissions As List(Of EdmFolderPermission) = New List(Of EdmFolderPermission)
For Each itemUser As ListViewItem In listViewUsers.Items
If itemUser.Checked Then
Dim folderID As Integer = CInt(itemUser.SubItems(2).Text)
Dim permission As EdmFolderPermission
With permission
.mlFolderID = folderID
.mlOwnerID = CInt(itemUser.SubItems(0).Text)
.meOwnerType = EdmObjectType.EdmObject_User
.mlEdmRightFlag = assignedRights
End With
listPermissions.Add(permission)
End If
Next

For Each itemGroup As ListViewItem In listViewGroups.Items
If itemGroup.Checked Then
Dim folderID As Integer = CInt(itemGroup.SubItems(2).Text)
Dim permission As EdmFolderPermission
With permission
.mlFolderID = folderID
.mlOwnerID = CInt(itemGroup.SubItems(0).Text)
.meOwnerType = EdmObjectType.EdmObject_UserGroup
.mlEdmRightFlag = assignedRights
End With
listPermissions.Add(permission)
End If
Next

If checkboxReverseOrder.Checked Then listPermissions.Reverse()

Dim permissions() As EdmFolderPermission = listPermissions.ToArray()
userMgr.SetFolderPermissions(permissions)

ShowAllGroupPermissions()
ShowAllUserPermissions()
End Sub

Private Sub buttonRefresh_Click(sender As System.Object, e As System.EventArgs) Handles buttonRefresh.Click
ShowAllGroupPermissions()
ShowAllUserPermissions()
End Sub
End Class

' Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.comboVault = New System.Windows.Forms.ComboBox()
        Me.buttonLogIn = New System.Windows.Forms.Button()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.listViewUsers = New System.Windows.Forms.ListView()
        Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader7 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader8 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.Label3 = New System.Windows.Forms.Label()
        Me.buttonApply = New System.Windows.Forms.Button()
        Me.buttonRefresh = New System.Windows.Forms.Button()
        Me.listViewGroups = New System.Windows.Forms.ListView()
        Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader5 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader6 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader9 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.ColumnHeader10 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
        Me.listViewPermissions = New System.Windows.Forms.ListView()
        Me.checkboxReverseOrder = New System.Windows.Forms.CheckBox()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(12, 9)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(66, 13)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Select vault:"
        '
        'comboVault
        '
        Me.comboVault.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.comboVault.FormattingEnabled = True
        Me.comboVault.Location = New System.Drawing.Point(84, 6)
        Me.comboVault.Name = "comboVault"
        Me.comboVault.Size = New System.Drawing.Size(357, 21)
        Me.comboVault.TabIndex = 1
        '
        'buttonLogIn
        '
        Me.buttonLogIn.Location = New System.Drawing.Point(447, 6)
        Me.buttonLogIn.Name = "buttonLogIn"
        Me.buttonLogIn.Size = New System.Drawing.Size(98, 21)
        Me.buttonLogIn.TabIndex = 2
        Me.buttonLogIn.Text = "Log In"
        Me.buttonLogIn.UseVisualStyleBackColor = True
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(12, 51)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(34, 13)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Users"
        '
        'listViewUsers
        '
        Me.listViewUsers.CheckBoxes = True
        Me.listViewUsers.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader3, Me.ColumnHeader7, Me.ColumnHeader8})
        Me.listViewUsers.Location = New System.Drawing.Point(12, 67)
        Me.listViewUsers.Name = "listViewUsers"
        Me.listViewUsers.Size = New System.Drawing.Size(533, 107)
        Me.listViewUsers.TabIndex = 4
        Me.listViewUsers.UseCompatibleStateImageBehavior = False
        Me.listViewUsers.View = System.Windows.Forms.View.Details
        '
        'ColumnHeader1
        '
        Me.ColumnHeader1.Text = "ID"
        Me.ColumnHeader1.Width = 41
        '
        'ColumnHeader2
        '
        Me.ColumnHeader2.Text = "Name"
        Me.ColumnHeader2.Width = 137
        '
        'ColumnHeader3
        '
        Me.ColumnHeader3.Text = "Folder ID"
        '
        'ColumnHeader7
        '
        Me.ColumnHeader7.Text = "Folder"
        Me.ColumnHeader7.Width = 152
        '
        'ColumnHeader8
        '
        Me.ColumnHeader8.Text = "Folder Permissions"
        Me.ColumnHeader8.Width = 108
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(12, 182)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(41, 13)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "Groups"
        '
        'buttonApply
        '
        Me.buttonApply.Enabled = False
        Me.buttonApply.Location = New System.Drawing.Point(428, 420)
        Me.buttonApply.Name = "buttonApply"
        Me.buttonApply.Size = New System.Drawing.Size(117, 23)
        Me.buttonApply.TabIndex = 7
        Me.buttonApply.Text = "Apply Permissions"
        Me.buttonApply.UseVisualStyleBackColor = True
        '
        'buttonRefresh
        '
        Me.buttonRefresh.Enabled = False
        Me.buttonRefresh.Location = New System.Drawing.Point(428, 38)
        Me.buttonRefresh.Name = "buttonRefresh"
        Me.buttonRefresh.Size = New System.Drawing.Size(117, 23)
        Me.buttonRefresh.TabIndex = 8
        Me.buttonRefresh.Text = "Refresh Permissions"
        Me.buttonRefresh.UseVisualStyleBackColor = True
        '
        'listViewGroups
        '
        Me.listViewGroups.CheckBoxes = True
        Me.listViewGroups.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader4, Me.ColumnHeader5, Me.ColumnHeader6, Me.ColumnHeader9, Me.ColumnHeader10})
        Me.listViewGroups.Location = New System.Drawing.Point(12, 198)
        Me.listViewGroups.Name = "listViewGroups"
        Me.listViewGroups.Size = New System.Drawing.Size(533, 107)
        Me.listViewGroups.TabIndex = 9
        Me.listViewGroups.UseCompatibleStateImageBehavior = False
        Me.listViewGroups.View = System.Windows.Forms.View.Details
        '
        'ColumnHeader4
        '
        Me.ColumnHeader4.Text = "ID"
        Me.ColumnHeader4.Width = 41
        '
        'ColumnHeader5
        '
        Me.ColumnHeader5.Text = "Name"
        Me.ColumnHeader5.Width = 137
        '
        'ColumnHeader6
        '
        Me.ColumnHeader6.Text = "Folder ID"
        '
        'ColumnHeader9
        '
        Me.ColumnHeader9.Text = "Folder"
        Me.ColumnHeader9.Width = 152
        '
        'ColumnHeader10
        '
        Me.ColumnHeader10.Text = "Folder Permissions"
        Me.ColumnHeader10.Width = 108
        '
        'listViewPermissions
        '
        Me.listViewPermissions.CheckBoxes = True
        Me.listViewPermissions.Location = New System.Drawing.Point(12, 328)
        Me.listViewPermissions.Name = "listViewPermissions"
        Me.listViewPermissions.Size = New System.Drawing.Size(410, 115)
        Me.listViewPermissions.TabIndex = 10
        Me.listViewPermissions.UseCompatibleStateImageBehavior = False
        Me.listViewPermissions.View = System.Windows.Forms.View.List
        '
        'checkboxReverseOrder
        '
        Me.checkboxReverseOrder.AutoSize = True
        Me.checkboxReverseOrder.Location = New System.Drawing.Point(428, 328)
        Me.checkboxReverseOrder.Name = "checkboxReverseOrder"
        Me.checkboxReverseOrder.Size = New System.Drawing.Size(95, 17)
        Me.checkboxReverseOrder.TabIndex = 11
        Me.checkboxReverseOrder.Text = "Reverse Order"
        Me.checkboxReverseOrder.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(557, 455)
        Me.Controls.Add(Me.checkboxReverseOrder)
        Me.Controls.Add(Me.listViewPermissions)
        Me.Controls.Add(Me.listViewGroups)
        Me.Controls.Add(Me.buttonRefresh)
        Me.Controls.Add(Me.buttonApply)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.listViewUsers)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.buttonLogIn)
        Me.Controls.Add(Me.comboVault)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Form1"
        Me.Text = "Folder Permissions"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents comboVault As System.Windows.Forms.ComboBox
    Friend WithEvents buttonLogIn As System.Windows.Forms.Button
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents listViewUsers As System.Windows.Forms.ListView
    Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents buttonApply As System.Windows.Forms.Button
    Friend WithEvents buttonRefresh As System.Windows.Forms.Button
    Friend WithEvents ColumnHeader7 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader8 As System.Windows.Forms.ColumnHeader
    Friend WithEvents listViewGroups As System.Windows.Forms.ListView
    Friend WithEvents ColumnHeader4 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader5 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader6 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader9 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader10 As System.Windows.Forms.ColumnHeader
    Friend WithEvents listViewPermissions As System.Windows.Forms.ListView
    Friend WithEvents checkboxReverseOrder As System.Windows.Forms.CheckBox

End Class


SOLIDWORKS PDM Professional API Help

Get and Set Item References Example (C#)

This example shows how to get and set item references.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type ItemRefs_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form,
replace the code in Form1.Designer.cs with this code.
//12. Ensure that an item folder with at least one item is checked into the
vault.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Get
and set item references dialog box.
// 2. Select a vault view.
// 3. Click Get
item references.
//
a. Click an item folder
in the vault.
//    b. Click OK.
//    c. Displays a message box confirming your folder selection.
//    d. Click OK.
//    e. Displays a message box with item references for the
first item found
//       in the selected folder.
//    f. Click OK.
// 4. Click Set item references.
//    a. Click one or more files to add as references to the
item.
//    b. Click Open.
//    c. Displays a message box with the updated references.
//       - or -
//       Displays a message box with errors.
//    d. Click OK.
// 5. Close the Get
and set item references dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace ItemRefs_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmItem item;

        IEdmFile8 fileInt;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

                Button1.Enabled = false;

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetItemRefs_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault11 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault11)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmFolder6 folder = default(IEdmFolder6);
                folder = (IEdmFolder6)vault2.BrowseForFolder2(this.Handle.ToInt32(), "Select a folder", vault2.RootFolder, (int)EdmBrowseForFolderFlag.EdmBwsFld_None);
                if ((folder != null))
                {
                    if (folder.ObjectType == EdmObjectType.EdmObject_Folder)
                    {
                        MessageBox.Show("You selected the file folder: " + "\r\n" + folder.LocalPath);
                    }
                    else
                    {
                        MessageBox.Show("You selected the item folder: " + "\r\n" + folder.LocalPath);
                    }
                }

                //Get the first item in the selected folder
                IEdmPos5 pos = default(IEdmPos5);
                string msg = null;

                pos = folder.GetFirstFilePosition();
                fileInt = (IEdmFile8)folder.GetNextFile(pos);

                //Search for item by name to get its ID
                IEdmSearch7 search = default(IEdmSearch7);
                search = (IEdmSearch7)vault2.CreateUtility(EdmUtility.EdmUtil_Search);
                search.FindFiles = true;
                search.FindFolders = false;
                search.Recursive = true;
                search.SetToken(EdmSearchToken.Edmstok_FindItems, true);
                search.StartFolderID = vault2.ItemRootFolderID;
                search.FileName = fileInt.Name;

                IEdmSearchResult5 result = default(IEdmSearchResult5);
                result = search.GetFirstResult();

                if (result == null)
                {
                    MessageBox.Show("The item '" + fileInt.Name + "' was not found.");
                }

                while ((result != null))
                {
                    if ((result.IsKindOf(EdmObjectType.EdmObject_Item)))
                    {
                        fileInt = (IEdmFile8)result;
                        item = (IEdmItem)fileInt;

                        //Create a message about the item and its references
                        msg = "Name=" + item.Name + "\r\n";
                        msg = msg + "ID = " + item.ID.ToString() + "\r\n";
                        msg = msg + "Descriptive name = " + item.ItemDescriptiveName + "\r\n";
                        msg = msg + "Check-out path = " + fileInt.LockPath + "\r\n";
                        msg = msg + "Workflow state = " + fileInt.CurrentState.Name + "\r\n";
                        msg = msg + "\r\n"+ "Referenced files:" + "\r\n";

                        EdmItemRef[] refs = null;
                        item.GetReferences((int)EdmRefFlags.EdmRef_Dynamic + (int)EdmRefFlags.EdmRef_Static + (int)EdmRefFlags.EdmRef_Item + (int)EdmRefFlags.EdmRef_File, out refs);

                        int idx = 0;
                        idx = refs.GetLowerBound(0);

                        while ((idx <= refs.GetUpperBound(0)))
                        {
                            msg = msg + "File ID=(" + refs[idx].moNamePathOrID.ToString() + ") ";
                            msg = msg + "Parent Item ID=(" + refs[idx].moParentNamePathOrItemID.ToString() + ") ";
                            msg = msg + "Configuration='" + refs[idx].mbsConfiguration + "' ";

                            if ((refs[idx].mlEdmRefFlags & (int)EdmRefFlags.EdmRef_Dynamic) == (int)EdmRefFlags.EdmRef_Dynamic)
                            {
                                msg = msg + " (auto-update reference)";
                            }
                            else
                            {
                                if ((refs[idx].mlEdmRefFlags & (int)EdmRefFlags.EdmRef_Static) == (int)EdmRefFlags.EdmRef_Static)
                                {
                                    msg = msg + " (static reference)";
                                }
                            }
                            idx = idx + 1;
                            msg = msg + "\n";
                        }

                        MessageBox.Show(msg);
                        Button1.Enabled = true;

                    }
                    return;
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            //Set item references

            try
            {
                IEdmVault11 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault11)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the current item references
                EdmItemRef[] oldRefs = null;
                item.GetReferences((int)EdmRefFlags.EdmRef_Dynamic + (int)EdmRefFlags.EdmRef_Static + (int)EdmRefFlags.EdmRef_Item + (int)EdmRefFlags.EdmRef_File, out oldRefs);

                //Let the user browse for new file references
                IEdmStrLst5 pathList = vault2.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles + (int)EdmBrowseFlag.EdmBws_PermitMultipleSel, "All Files|*.*||");

                if (pathList == null)
                    return;

                //Create an array of new item references
                EdmItemRef[] newRefs = new EdmItemRef[pathList.Count];
                int idx = 0;
                IEdmPos5 pos = default(IEdmPos5);
                pos = pathList.GetHeadPosition();

                while (!pos.IsNull)
                {
                    string path = null;
                    path = pathList.GetNext(pos);
                    newRefs[idx].moNamePathOrID = path;
                    newRefs[idx].mlEdmRefFlags = (int)EdmRefFlags.EdmRef_Static + (int)EdmRefFlags.EdmRef_File;
                    newRefs[idx].moParentNamePathOrItemID = item.ID;
                    idx = idx + 1;
                }

                //Check out the item
                fileInt.LockFile(vault2.ItemRootFolderID, this.Handle.ToInt32());

                //Update the item references
                item.UpdateReferences(newRefs, oldRefs);

                //Collect all errors
                string msg = "";
                string errstr = "";
                idx = newRefs.GetLowerBound(0);

                while ((idx <= newRefs.GetUpperBound(0)))
                {
                    if (newRefs[idx].mhResult != 0)
                    {
                        errstr = vault2.GetErrorName(newRefs[idx].mhResult);
                        msg = msg + "Failed to save ref: '" + newRefs[idx].moNamePathOrID.ToString() + "' (" + errstr + ")" + "\r\n";
                    }
                    idx = idx + 1;
                }

                idx = oldRefs.GetLowerBound(0);

                while ((idx <= oldRefs.GetUpperBound(0)))
                {
                    if (oldRefs[idx].mhResult != 0)
                    {
                        errstr = vault2.GetErrorName(oldRefs[idx].mhResult);
                        msg = msg + "Failed to delete ref: '" + oldRefs[idx].moNamePathOrID.ToString() + "' (" + errstr + ")" + "\r\n";
                    }
                    idx = idx + 1;
                }

                //Display a status message
                if (string.IsNullOrEmpty(msg))
                {
                    msg = "Updated references successfully!" + "\n";

                    EdmItemRef[] refs = null;
                    item.GetReferences((int)EdmRefFlags.EdmRef_Dynamic + (int)EdmRefFlags.EdmRef_Static + (int)EdmRefFlags.EdmRef_Item + (int)EdmRefFlags.EdmRef_File, out refs);
                    idx = refs.GetLowerBound(0);

                    //Construct a message about the reference updates

                    while ((idx <= refs.GetUpperBound(0)))
                    {
                        msg = msg + "File ID=(" + refs[idx].moNamePathOrID.ToString() + ") ";
                        msg = msg + "Parent Item ID=(" + refs[idx].moParentNamePathOrItemID.ToString() + ") ";
                        msg = msg + "Configuration='" + refs[idx].mbsConfiguration + "' ";

                        if ((refs[idx].mlEdmRefFlags & (int)EdmRefFlags.EdmRef_Dynamic) == (int)EdmRefFlags.EdmRef_Dynamic)
                        {
                            msg = msg + " (auto-update reference)";
                        }
                        else
                        {
                            if ((refs[idx].mlEdmRefFlags & (int)EdmRefFlags.EdmRef_Static) == (int)EdmRefFlags.EdmRef_Static)
                            {
                                msg = msg + " (static reference)";
                            }
                        }
                        idx = idx + 1;
                        msg = msg + "\n";
                    }

                    MessageBox.Show(msg);
                }
                else
                {
                    MessageBox.Show("Errors detected: " + "\r\n" + msg);
                }

                //Check in the item
                fileInt.UnlockFile(this.Handle.ToInt32(), "Updated item references", (int)EdmUnlockFlag.EdmUnlock_IgnoreRefsNotLockedByCaller);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace ItemRefs_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.GetItemRefs = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.Button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //GetItemRefs
            //
            this.GetItemRefs.Location = new System.Drawing.Point(16, 86);
            this.GetItemRefs.Name = "GetItemRefs";
            this.GetItemRefs.Size = new System.Drawing.Size(139, 23);
            this.GetItemRefs.TabIndex = 5;
            this.GetItemRefs.Text = "Get item references...";
            this.GetItemRefs.UseVisualStyleBackColor = true;
            this.GetItemRefs.Click +=new System.EventHandler(GetItemRefs_Click);
            //
            //OpenFileDialog
            //
            this.OpenFileDialog.Title = "Open";
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(16, 127);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(139, 23);
            this.Button1.TabIndex = 6;
            this.Button1.Text = "Set item references...";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click +=new System.EventHandler(Button1_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 185);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.GetItemRefs);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get and set item references";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button GetItemRefs;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
        internal System.Windows.Forms.Button Button1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get and Set Item References Example (VB.NET)

This example shows how to get and set item references.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type ItemRefs in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'     Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Ensure that an item folder with at least one item is checked into the vault.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Get and set item references dialog box.
' 2. Select a vault view.
' 3. Click Get item references.
'    a. Click an item folder in the vault.
'    b. Click OK.
'    c. Displays a message box confirming your folder selection.
'    d. Click OK.
'    e. Displays a message box with item references for the first item found
'       in the selected folder.
'    f. Click OK.
' 4. Click Set item references.
'    a. Click one or more files to add as references to the item.
'    b. Click Open.
'    c. Displays a message box with the updated references.
'       - or -
'       Displays a message box with errors.
'    d. Click OK.
' 5. Close the Get and set item references dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim item As IEdmItem
    Dim fileInt As IEdmFile8

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If

            Button1.Enabled = False

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetItemRefs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetItemRefs.Click
        Try

            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim folder As IEdmFolder6
            folder = vault2.BrowseForFolder2(Me.Handle.ToInt32, "Select a folder", vault2.RootFolder, EdmBrowseForFolderFlag.EdmBwsFld_None)
            If Not folder Is Nothing Then
                If folder.ObjectType = EdmObjectType.EdmObject_Folder Then
                    MsgBox("You selected the file folder: " + vbLf + folder.LocalPath)
                Else
                    MsgBox("You selected the item folder: " + vbLf + folder.LocalPath)
                End If
            End If

            'Get the first item in the selected folder
            Dim pos As IEdmPos5
            Dim msg As String

            pos = folder.GetFirstFilePosition
            fileInt = folder.GetNextFile(pos)

            'Search for item by name to get its ID
            Dim search As IEdmSearch7
            search = vault2.CreateUtility(EdmUtility.EdmUtil_Search)
            search.FindFiles = True
            search.FindFolders = False
            search.Recursive = True
            search.SetToken(EdmSearchToken.Edmstok_FindItems, True)
            search.StartFolderID = vault2.ItemRootFolderID
            search.FileName = fileInt.Name

            Dim result As IEdmSearchResult5
            result = search.GetFirstResult

            If result Is Nothing Then
                MessageBox.Show("The item '" + fileInt.Name + "' was not found.")
            End If

            While Not result Is Nothing
                If (result.IsKindOf(EdmObjectType.EdmObject_Item)) Then
                    fileInt = result
                    item = fileInt

                    'Create a message about the item and its references
                    msg = "Name=" & item.Name & vbLf
                    msg = msg & "ID = " & item.ID.ToString & vbLf
                    msg = msg & "Descriptive name = " & item.ItemDescriptiveName & vbLf
                    msg = msg & "Check-out path = " & fileInt.LockPath & vbLf
                    msg = msg & "Workflow state = " & fileInt.CurrentState.Name & vbLf
                    msg = msg & vbLf & "Referenced files:" & vbLf

                    Dim refs() As EdmItemRef = Nothing
                    item.GetReferences(EdmRefFlags.EdmRef_Dynamic + EdmRefFlags.EdmRef_Static + EdmRefFlags.EdmRef_Item + EdmRefFlags.EdmRef_File, refs)

                    Dim idx As Integer
                    idx = LBound(refs)

                    While (idx <= UBound(refs))

                        msg = msg + "File ID=(" + CStr(refs(idx).moNamePathOrID) + ") "
                        msg = msg + "Parent Item ID=(" + CStr(refs(idx).moParentNamePathOrItemID) + ") "
                        msg = msg + "Configuration='" + refs(idx).mbsConfiguration + "' "

                        If (refs(idx).mlEdmRefFlags And EdmRefFlags.EdmRef_Dynamic) = EdmRefFlags.EdmRef_Dynamic Then
                            msg = msg + " (auto-update reference)"
                        Else
                            If (refs(idx).mlEdmRefFlags And EdmRefFlags.EdmRef_Static) = EdmRefFlags.EdmRef_Static Then
                                msg = msg + " (static reference)"
                            End If
                        End If
                        idx = idx + 1
                        msg = msg + vbLf
                    End While

                    MessageBox.Show(msg)
                    Button1.Enabled = True

                End If
                Exit Sub
            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Set item references
        Try

            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Get the current item references
            Dim oldRefs() As EdmItemRef = Nothing
            item.GetReferences(EdmRefFlags.EdmRef_Dynamic + EdmRefFlags.EdmRef_Static + EdmRefFlags.EdmRef_Item + EdmRefFlags.EdmRef_File, oldRefs)

            'Let the user browse for new file references
            Dim pathList As IEdmStrLst5 = vault2.BrowseForFile(Me.Handle.ToInt32, EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles + EdmBrowseFlag.EdmBws_PermitMultipleSel, "All Files|*.*||")

            If pathList Is Nothing Then Return

            'Create an array of new item references
            Dim newRefs(pathList.Count - 1) As EdmItemRef
            Dim idx As Integer = 0
            Dim pos As IEdmPos5
            pos = pathList.GetHeadPosition

            While Not pos.IsNull
                Dim path As String
                path = pathList.GetNext(pos)
                newRefs(idx).moNamePathOrID = path
                newRefs(idx).mlEdmRefFlags = EdmRefFlags.EdmRef_Static + EdmRefFlags.EdmRef_File
                newRefs(idx).moParentNamePathOrItemID = item.ID
                idx = idx + 1
            End While

            'Check out the item
            fileInt.LockFile(vault2.ItemRootFolderID, Me.Handle.ToInt32())

            'Update the item references
            item.UpdateReferences(newRefs, oldRefs)

            'Collect all errors
            Dim msg As String = ""
            Dim errstr As String = ""
            idx = LBound(newRefs)

            While (idx <= UBound(newRefs))
                If newRefs(idx).mhResult <> 0 Then
                    errstr = vault2.GetErrorName(newRefs(idx).mhResult)
                    msg = msg + "Failed to save ref: '" + CStr(newRefs(idx).moNamePathOrID) + "' (" + errstr + ")" + vbLf
                End If
                idx = idx + 1
            End While

            idx = LBound(oldRefs)

            While (idx <= UBound(oldRefs))
                If oldRefs(idx).mhResult <> 0 Then
                    errstr = vault2.GetErrorName(oldRefs(idx).mhResult)
                    msg = msg + "Failed to delete ref: '" + CStr(oldRefs(idx).moNamePathOrID) + "' (" + errstr + ")" + vbLf
                End If
                idx = idx + 1
            End While

            'Display a status message
            If msg = "" Then
                msg = "Updated references successfully!" & vbLf

                Dim refs() As EdmItemRef = Nothing
                item.GetReferences(EdmRefFlags.EdmRef_Dynamic + EdmRefFlags.EdmRef_Static + EdmRefFlags.EdmRef_Item + EdmRefFlags.EdmRef_File, refs)
                idx = LBound(refs)

                'Construct a message about the reference updates
                While (idx <= UBound(refs))

                    msg = msg + "File ID=(" + CStr(refs(idx).moNamePathOrID) + ") "
                    msg = msg + "Parent Item ID=(" + CStr(refs(idx).moParentNamePathOrItemID) + ") "
                    msg = msg + "Configuration='" + refs(idx).mbsConfiguration + "' "

                    If (refs(idx).mlEdmRefFlags And EdmRefFlags.EdmRef_Dynamic) = EdmRefFlags.EdmRef_Dynamic Then
                        msg = msg + " (auto-update reference)"
                    Else
                        If (refs(idx).mlEdmRefFlags And EdmRefFlags.EdmRef_Static) = EdmRefFlags.EdmRef_Static Then
                            msg = msg + " (static reference)"
                        End If
                    End If
                    idx = idx + 1
                    msg = msg + vbLf
                End While

                MessageBox.Show(msg)
            Else
                MessageBox.Show("Errors detected: " + vbLf + msg)
            End If

            'Check in the item
            fileInt.UnlockFile(Me.Handle.ToInt32(), "Updated item references", EdmUnlockFlag.EdmUnlock_IgnoreRefsNotLockedByCaller)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.GetItemRefs = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'GetItemRefs
        '
        Me.GetItemRefs.Location = New System.Drawing.Point(16, 86)
        Me.GetItemRefs.Name = "GetItemRefs"
        Me.GetItemRefs.Size = New System.Drawing.Size(139, 23)
        Me.GetItemRefs.TabIndex = 5
        Me.GetItemRefs.Text = "Get item references..."
        Me.GetItemRefs.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Title = "Open"
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 127)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(139, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Set item references..."
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 185)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.GetItemRefs)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get and set item references"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents GetItemRefs As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Button1 As System.Windows.Forms.Button
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get and Set Dictionary Key-Value Pairs Example (C#)

This example shows how to access key-value pairs in a vault dictionary.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
// 3. Type TestDictionary_CSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9. Add dependencies and safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault view.
//  3. Click Substring in key.
//  4. Click Get key-value pairs.
//     a. Displays a message box with all key-value pairs in the dictionary where
//        string key contains "at".
//     b. Click OK.
//  5. Click Integer key range.
//  6. Click Get key-value pairs.
//     a. Displays a message box with all key-value pairs in the dictionary where
//        integer keys are in the range, 13-88.
//     b. Click OK.
//  7. Click Substring in values of all integer keys.
//  8. Click Get key-value pairs.
//     a. Displays a message box with all key-value pairs in the dictionary where
//        value contains "three".
//     b. Click OK.
//  9. Click Specific integer key.
// 10. Click Get key-value pairs.
//     a. Displays a message box with the value for key, 77.
//     b. Click OK.
// 11. Click Enumeration of all integer keys.
// 12. Click Get key-value pairs.
//     a. Displays a message box with all integer key-value pairs in the dictionary.
//     b. Click OK.
// 13. Click Delete a key-value pair.
//     a. Displays a message box notifying that key, 2, is removed.
//     b. Click OK.
// 14. Click Create a key-value pair.
//     a. Displays a message box notifying that key, 2, is created.
//     b. Click OK.
// 15. Close the dialog.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace TestDictionary_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1;
        IEdmVault8 vault;

        EdmViewInfo[] Views = null;
        IEdmDictionary5 dic;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                vault = (IEdmVault8)vault1;
                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void Button5_Click(System.Object sender, System.EventArgs e)
        {
            //Delete key-value pair clicked
            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                dic = vault.GetDictionary("MyDictionary", true);
                //Add some values
                dic.LongSetAt(2, "two");
                dic.LongSetAt(15, "fifteen");
                dic.LongSetAt(300, "three hundred");
                dic.LongSetAt(77, "seventy-seven");

                dic.LongRemoveAt(2);
                MessageBox.Show("Key <2> removed.");
                dic.RemoveDictionary();

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            //Get key-value pairs clicked
            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if (this.RadioButton1.Checked)
                {
                    //Get key-value pairs by substring in key

                    dic = vault.GetDictionary("MyDictionary", true);

                    //Add some values
                    dic.StringSetAt("Cat", "Socks");
                    dic.StringSetAt("Dog", "Milou");
                    dic.StringSetAt("Human", "Attila");
                    dic.StringSetAt("At last", "Last value");

                    //Find all keys containing the text, "at"
                    string key = "";
                    string value = "";
                    string message = null;
                    message = "Keys with 'at' in them:" + "\r\n";
                    IEdmPos5 pos = default(IEdmPos5);
                    pos = dic.StringFindKeys("at");
                    while (!pos.IsNull)
                    {
                        dic.StringGetNextAssoc(pos, out key, out value);
                        message = message + "<" + key + "> = <" + value + ">" + "\r\n";
                    }

                    //Show a message and delete the dictionary
                    MessageBox.Show(message);
                    dic.RemoveDictionary();

                }
                else if (this.RadioButton2.Checked)
                {
                    //Get key-value pairs by integer key range

                    dic = vault.GetDictionary("MyDictionary", true);

                    //Add some values
                    dic.LongSetAt(2, "two");
                    dic.LongSetAt(15, "fifteen");
                    dic.LongSetAt(300, "three hundred");
                    dic.LongSetAt(77, "seventy-seven");

                    //Find all keys in the range, 13-88
                    int key = 0;
                    string value = "";
                    string message = null;
                    message = "Keys in range, 13-88:" + "\r\n";
                    IEdmPos5 pos = default(IEdmPos5);
                    pos = dic.LongFindKeys(13, 88);
                    while (!pos.IsNull)
                    {
                        dic.LongGetNextAssoc(pos, out key, out value);
                        message = message + "<" + key.ToString() + "> = <" + value + ">" + "\r\n";
                    }

                    //Show a message and delete the dictionary
                    MessageBox.Show(message);
                    dic.RemoveDictionary();

                }
                else if (this.RadioButton3.Checked)
                {
                    //Get key-value pairs by substring in values of integer keys

                    dic = vault.GetDictionary("MyDictionary", true);
                    //Add some values
                    dic.LongSetAt(2, "two");
                    dic.LongSetAt(15, "fifteen");
                    dic.LongSetAt(300, "three hundred");
                    dic.LongSetAt(77, "seventy-seven");

                    string bsValueSubString = "three";
                    IEdmPos5 aPos = default(IEdmPos5);
                    int plRetKey = 0;
                    string pbsRetValue = "";
                    aPos = dic.LongFindValues(bsValueSubString);
                    while (!aPos.IsNull)
                    {
                        dic.LongGetNextAssoc(aPos, out plRetKey, out pbsRetValue);
                        MessageBox.Show("Key-value pair with " + "\"" + bsValueSubString + "\"" + " in value: " + "\n" + "<" + plRetKey + "> = <" + pbsRetValue + ">");
                    }
                    dic.RemoveDictionary();
                }
                else if (this.RadioButton4.Checked)
                {
                    //Get key-value pairs by specific integer key

                    dic = vault.GetDictionary("MyDictionary", true);
                    //Add some values
                    dic.LongSetAt(2, "two");
                    dic.LongSetAt(15, "fifteen");
                    dic.LongSetAt(300, "three hundred");
                    dic.LongSetAt(77, "seventy-seven");

                    string pbsRetValue = "";
                    dic.LongGetAt(77, out pbsRetValue);
                    MessageBox.Show("Value for key <77>: <" + pbsRetValue + ">");
                    dic.RemoveDictionary();
                }
                else if (this.RadioButton5.Checked)
                {
                    //Get key-value pairs by enumeration of all integer keys

                    dic = vault.GetDictionary("MyDictionary", true);
                    //Add some values
                    dic.LongSetAt(2, "two");
                    dic.LongSetAt(15, "fifteen");
                    dic.LongSetAt(300, "three hundred");
                    dic.LongSetAt(77, "seventy-seven");

                    string msg = null;
                    int key = 0;
                    string value = "";

                    msg = "Integer keys in dictionary:" + "\n";

                    IEdmPos5 pos = default(IEdmPos5);
                    pos = dic.LongGetFirstPosition();
                    while (!pos.IsNull)
                    {
                        dic.LongGetNextAssoc(pos, out key, out value);
                        msg = msg + "<" + Conversion.Str(key) + "> = <" + value + ">" + "\n";
                    }
                    MessageBox.Show(msg);
                    dic.RemoveDictionary();

                }
                else
                {
                    MessageBox.Show("Select how to get key-value pairs");

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Button7_Click(System.Object sender, System.EventArgs e)
        {
            //Create key-value pair clicked
            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                string pbsRetValue = "";

                dic = vault.GetDictionary("MyDictionary", true);
                dic.LongTestAndSetAt(2, "Two");
                dic.LongGetAt(2, out pbsRetValue);
                MessageBox.Show("Created:" + "\n" + "<2> = <" + pbsRetValue + ">");
                dic.RemoveDictionary();
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top
//Form1.Designer.cs

namespace TestDictionary_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Label1 = new System.Windows.Forms.Label();
            this.Button5 = new System.Windows.Forms.Button();
            this.Button7 = new System.Windows.Forms.Button();
            this.RadioButton1 = new System.Windows.Forms.RadioButton();
            this.RadioButton2 = new System.Windows.Forms.RadioButton();
            this.RadioButton3 = new System.Windows.Forms.RadioButton();
            this.RadioButton4 = new System.Windows.Forms.RadioButton();
            this.RadioButton5 = new System.Windows.Forms.RadioButton();
            this.Button1 = new System.Windows.Forms.Button();
            this.GroupBox1 = new System.Windows.Forms.GroupBox();
            this.GroupBox1.SuspendLayout();
            this.SuspendLayout();
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(20, 39);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(169, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(19, 23);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(91, 13);
            this.Label1.TabIndex = 2;
            this.Label1.Text = "Select vault view:";
            //
            // Button5
            //
            this.Button5.Location = new System.Drawing.Point(40, 272);
            this.Button5.Name = "Button5";
            this.Button5.Size = new System.Drawing.Size(132, 23);
            this.Button5.TabIndex = 7;
            this.Button5.Text = "Delete a key-value pair";
            this.Button5.UseVisualStyleBackColor = true;
            this.Button5.Click += new System.EventHandler(this.Button5_Click);
            //
            // Button7
            //
            this.Button7.Location = new System.Drawing.Point(39, 312);
            this.Button7.Name = "Button7";
            this.Button7.Size = new System.Drawing.Size(132, 23);
            this.Button7.TabIndex = 9;
            this.Button7.Text = "Create a key-value pair";
            this.Button7.UseVisualStyleBackColor = true;
            this.Button7.Click += new System.EventHandler(this.Button7_Click);
            //
            // RadioButton1
            //
            this.RadioButton1.AutoSize = true;
            this.RadioButton1.Location = new System.Drawing.Point(30, 19);
            this.RadioButton1.Name = "RadioButton1";
            this.RadioButton1.Size = new System.Drawing.Size(100, 17);
            this.RadioButton1.TabIndex = 11;
            this.RadioButton1.Text = "Substring in key";
            this.RadioButton1.UseVisualStyleBackColor = true;
            //
            // RadioButton2
            //
            this.RadioButton2.AutoSize = true;
            this.RadioButton2.Location = new System.Drawing.Point(30, 42);
            this.RadioButton2.Name = "RadioButton2";
            this.RadioButton2.Size = new System.Drawing.Size(108, 17);
            this.RadioButton2.TabIndex = 12;
            this.RadioButton2.TabStop = true;
            this.RadioButton2.Text = "Integer key range";
            this.RadioButton2.UseVisualStyleBackColor = true;
            //
            // RadioButton3
            //
            this.RadioButton3.AutoSize = true;
            this.RadioButton3.Location = new System.Drawing.Point(29, 65);
            this.RadioButton3.Name = "RadioButton3";
            this.RadioButton3.Size = new System.Drawing.Size(199, 17);
            this.RadioButton3.TabIndex = 13;
            this.RadioButton3.TabStop = true;
            this.RadioButton3.Text = "Substring in values of all integer keys";
            this.RadioButton3.UseVisualStyleBackColor = true;
            //
            // RadioButton4
            //
            this.RadioButton4.AutoSize = true;
            this.RadioButton4.Location = new System.Drawing.Point(30, 88);
            this.RadioButton4.Name = "RadioButton4";
            this.RadioButton4.Size = new System.Drawing.Size(118, 17);
            this.RadioButton4.TabIndex = 14;
            this.RadioButton4.TabStop = true;
            this.RadioButton4.Text = "Specific integer key";
            this.RadioButton4.UseVisualStyleBackColor = true;
            //
            // RadioButton5
            //
            this.RadioButton5.AutoSize = true;
            this.RadioButton5.Location = new System.Drawing.Point(30, 111);
            this.RadioButton5.Name = "RadioButton5";
            this.RadioButton5.Size = new System.Drawing.Size(169, 17);
            this.RadioButton5.TabIndex = 15;
            this.RadioButton5.TabStop = true;
            this.RadioButton5.Text = "Enumeration of all integer keys";
            this.RadioButton5.UseVisualStyleBackColor = true;
            //
            // Button1
            //
            this.Button1.Location = new System.Drawing.Point(30, 143);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(132, 23);
            this.Button1.TabIndex = 16;
            this.Button1.Text = "Get key-value pairs";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click += new System.EventHandler(this.Button1_Click);
            //
            // GroupBox1
            //
            this.GroupBox1.Controls.Add(this.Button1);
            this.GroupBox1.Controls.Add(this.RadioButton5);
            this.GroupBox1.Controls.Add(this.RadioButton4);
            this.GroupBox1.Controls.Add(this.RadioButton3);
            this.GroupBox1.Controls.Add(this.RadioButton2);
            this.GroupBox1.Controls.Add(this.RadioButton1);
            this.GroupBox1.Location = new System.Drawing.Point(10, 69);
            this.GroupBox1.Name = "GroupBox1";
            this.GroupBox1.Size = new System.Drawing.Size(249, 181);
            this.GroupBox1.TabIndex = 17;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "Get key-value pairs by:";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(271, 366);
            this.Controls.Add(this.GroupBox1);
            this.Controls.Add(this.Button7);
            this.Controls.Add(this.Button5);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.VaultsComboBox);
            this.Name = "Form1";
            this.Text = "Dictionary Test";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Label Label1;
        internal System.Windows.Forms.Button Button5;
        internal System.Windows.Forms.Button Button7;
        internal System.Windows.Forms.RadioButton RadioButton1;
        internal System.Windows.Forms.RadioButton RadioButton2;
        internal System.Windows.Forms.RadioButton RadioButton3;
        internal System.Windows.Forms.RadioButton RadioButton4;
        internal System.Windows.Forms.RadioButton RadioButton5;
        internal System.Windows.Forms.Button Button1;
        internal System.Windows.Forms.GroupBox GroupBox1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get and Set Dictionary Key-Value Pairs Example (VB.NET)

This example shows how to access key-value pairs in a vault dictionary.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type TestDictionary in Project name.
' 4. For Location, click ... and navigate to the folder where to
create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault view.
'  3. Click Substring in key.
'  4. Click Get key-value pairs.
'     a. Displays a message box with all key-value pairs in the dictionary where
'        string key contains "at".
'     b. Click OK.
'  5. Click Integer key range.
'  6. Click Get key-value pairs.
'     a. Displays a message box with all key-value pairs in the dictionary where
'        integer keys are in the range, 13-88.
'     b. Click OK.
'  7. Click Substring in values of all integer keys.
'  8. Click Get key-value pairs.
'     a. Displays a message box with all key-value pairs in the dictionary where
'        value contains "three".
'     b. Click OK.
'  9. Click Specific integer key.
' 10. Click Get key-value pairs.
'     a. Displays a message box with the value for key, 77.
'     b. Click OK.
' 11. Click Enumeration of all integer keys.
' 12. Click Get key-value pairs.
'     a. Displays a message box with all integer key-value pairs in the dictionary.
'     b. Click OK.
' 13. Click Delete a key-value pair.
'     a. Displays a message box notifying that key, 2, is removed.
'     b. Click OK.
' 14. Click Create a key-value pair.
'     a. Displays a message box notifying that key, 2, is created.
'     b. Click OK.
' 15. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1
Dim vault1 As IEdmVault5 = New EdmVault5()
Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
Dim Views As EdmViewInfo() = Nothing
Dim dic As IEdmDictionary5
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
vault.GetVaultViews(Views, False)
VaultsComboBox.Items.Clear()
For Each View As EdmViewInfo In Views
VaultsComboBox.Items.Add(View.mbsVaultName)
Next
If VaultsComboBox.Items.Count > 0 Then
VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
End If
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'Delete key-value pair clicked
Try
Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)

If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

dic = vault.GetDictionary("MyDictionary", True)
'Add some values
dic.LongSetAt(2, "two")
dic.LongSetAt(15, "fifteen")
dic.LongSetAt(300, "three hundred")
dic.LongSetAt(77, "seventy-seven")

dic.LongRemoveAt(2)
MessageBox.Show("Key 2 removed.")
dic.RemoveDictionary()

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Get key-value pairs clicked
Try
Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)

If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

If Me.RadioButton1.Checked Then
'Get key-value pairs
by substring in key

dic = vault.GetDictionary("MyDictionary", True)

'Add some values
dic.StringSetAt("Cat", "Socks")
dic.StringSetAt("Dog", "Milou")
dic.StringSetAt("Human", "Attila")
dic.StringSetAt("At last", "Last value")

'Find all keys containing the text, "at"
Dim key As String = ""
Dim value As String = ""
Dim message As String
message = "Keys with 'at' in them:" + vbLf
Dim pos As IEdmPos5
pos = dic.StringFindKeys("at")
While Not pos.IsNull
dic.StringGetNextAssoc(pos, key, value)
message = message + "<" + key + "> = <" + value + ">" + vbLf
End While

'Show a message and delete the dictionary
MsgBox(message)
dic.RemoveDictionary()

ElseIf Me.RadioButton2.Checked Then
'Get key-value pairs
by integer key range

dic = vault.GetDictionary("MyDictionary", True)

'Add some values
dic.LongSetAt(2, "two")
dic.LongSetAt(15, "fifteen")
dic.LongSetAt(300, "three hundred")
dic.LongSetAt(77, "seventy-seven")

'Find all keys in the range, 13-88
Dim key As Long
Dim value As String = ""
Dim message As String
message = "Keys in the range 13-88:" + vbLf
Dim pos As IEdmPos5
pos = dic.LongFindKeys(13, 88)
While Not pos.IsNull
dic.LongGetNextAssoc(pos, key, value)
message = message + "<" + Str(key) + "> = <" + value + ">" + vbLf
End While

'Show a message and delete the dictionary
MsgBox(message)
dic.RemoveDictionary()

ElseIf Me.RadioButton3.Checked Then
'Get key-value pairs
by substring in values of integer keys

dic = vault.GetDictionary("MyDictionary", True)
'Add some values
dic.LongSetAt(2, "two")
dic.LongSetAt(15, "fifteen")
dic.LongSetAt(300, "three hundred")
dic.LongSetAt(77, "seventy-seven")

Dim bsValueSubString As String = "three"
Dim aPos As IEdmPos5
Dim plRetKey As Integer
Dim pbsRetValue As String = ""
aPos = dic.LongFindValues(bsValueSubString)
While Not aPos.IsNull
dic.LongGetNextAssoc(aPos, plRetKey, pbsRetValue)
MessageBox.Show("Key-value pair with " & """" & bsValueSubString & """" & " in value: " & vbLf & "<" & plRetKey & "> = <" & pbsRetValue & ">")
End While
dic.RemoveDictionary()

ElseIf Me.RadioButton4.Checked Then
'Get key-value pairs
by specific integer key

dic = vault.GetDictionary("MyDictionary", True)
'Add some values
dic.LongSetAt(2, "two")
dic.LongSetAt(15, "fifteen")
dic.LongSetAt(300, "three hundred")
dic.LongSetAt(77, "seventy-seven")

Dim pbsRetValue As String = ""
dic.LongGetAt(77, pbsRetValue)
MessageBox.Show("Value for key 77: " & pbsRetValue)
dic.RemoveDictionary()

ElseIf Me.RadioButton5.Checked Then
'Get key-value pairs
by enumeration of all integer keys

dic = vault.GetDictionary("MyDictionary", True)
'Add some values
dic.LongSetAt(2, "two")
dic.LongSetAt(15, "fifteen")
dic.LongSetAt(300, "three hundred")
dic.LongSetAt(77, "seventy-seven")

Dim msg As String
Dim key As Long
Dim value As String = ""

msg = "Integer keys in dictionary:" + vbLf

Dim pos As IEdmPos5
pos = dic.LongGetFirstPosition
While Not pos.IsNull
dic.LongGetNextAssoc(pos, key, value)
msg = msg + "<" + Str(key) + "> = <" + value + ">" + vbLf
End While
MsgBox(msg)
dic.RemoveDictionary()

Else
MessageBox.Show("Select how to get key-value pairs.")

End If

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
'Create key-value pair clicked
Try
Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)

If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

Dim pbsRetValue As String = ""

dic = vault.GetDictionary("MyDictionary", True)
dic.LongTestAndSetAt(2, "Two")
dic.LongGetAt(2, pbsRetValue)
MessageBox.Show("Created:" & vbLf & "<2> = <" & pbsRetValue & ">")
dic.RemoveDictionary()
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

End Class

Back to top
'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Button5 = New System.Windows.Forms.Button()
        Me.Button7 = New System.Windows.Forms.Button()
        Me.RadioButton1 = New System.Windows.Forms.RadioButton()
        Me.RadioButton2 = New System.Windows.Forms.RadioButton()
        Me.RadioButton3 = New System.Windows.Forms.RadioButton()
        Me.RadioButton4 = New System.Windows.Forms.RadioButton()
        Me.RadioButton5 = New System.Windows.Forms.RadioButton()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(20, 39)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(169, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(19, 23)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Select vault view:"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(40, 272)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(132, 23)
        Me.Button5.TabIndex = 7
        Me.Button5.Text = "Delete a key-value pair"
        Me.Button5.UseVisualStyleBackColor = True
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(39, 312)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(132, 23)
        Me.Button7.TabIndex = 9
        Me.Button7.Text = "Create a key-value pair"
        Me.Button7.UseVisualStyleBackColor = True
        '
        'RadioButton1
        '
        Me.RadioButton1.AutoSize = True
        Me.RadioButton1.Location = New System.Drawing.Point(30, 19)
        Me.RadioButton1.Name = "RadioButton1"
        Me.RadioButton1.Size = New System.Drawing.Size(100, 17)
        Me.RadioButton1.TabIndex = 11
        Me.RadioButton1.Text = "Substring in key"
        Me.RadioButton1.UseVisualStyleBackColor = True
        '
        'RadioButton2
        '
        Me.RadioButton2.AutoSize = True
        Me.RadioButton2.Location = New System.Drawing.Point(30, 42)
        Me.RadioButton2.Name = "RadioButton2"
        Me.RadioButton2.Size = New System.Drawing.Size(108, 17)
        Me.RadioButton2.TabIndex = 12
        Me.RadioButton2.TabStop = True
        Me.RadioButton2.Text = "Integer key range"
        Me.RadioButton2.UseVisualStyleBackColor = True
        '
        'RadioButton3
        '
        Me.RadioButton3.AutoSize = True
        Me.RadioButton3.Location = New System.Drawing.Point(29, 65)
        Me.RadioButton3.Name = "RadioButton3"
        Me.RadioButton3.Size = New System.Drawing.Size(199, 17)
        Me.RadioButton3.TabIndex = 13
        Me.RadioButton3.TabStop = True
        Me.RadioButton3.Text = "Substring in values of all integer keys"
        Me.RadioButton3.UseVisualStyleBackColor = True
        '
        'RadioButton4
        '
        Me.RadioButton4.AutoSize = True
        Me.RadioButton4.Location = New System.Drawing.Point(30, 88)
        Me.RadioButton4.Name = "RadioButton4"
        Me.RadioButton4.Size = New System.Drawing.Size(118, 17)
        Me.RadioButton4.TabIndex = 14
        Me.RadioButton4.TabStop = True
        Me.RadioButton4.Text = "Specific integer key"
        Me.RadioButton4.UseVisualStyleBackColor = True
        '
        'RadioButton5
        '
        Me.RadioButton5.AutoSize = True
        Me.RadioButton5.Location = New System.Drawing.Point(30, 111)
        Me.RadioButton5.Name = "RadioButton5"
        Me.RadioButton5.Size = New System.Drawing.Size(169, 17)
        Me.RadioButton5.TabIndex = 15
        Me.RadioButton5.TabStop = True
        Me.RadioButton5.Text = "Enumeration of all integer keys"
        Me.RadioButton5.UseVisualStyleBackColor = True
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(30, 143)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(132, 23)
        Me.Button1.TabIndex = 16
        Me.Button1.Text = "Get key-value pairs"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Button1)
        Me.GroupBox1.Controls.Add(Me.RadioButton5)
        Me.GroupBox1.Controls.Add(Me.RadioButton4)
        Me.GroupBox1.Controls.Add(Me.RadioButton3)
        Me.GroupBox1.Controls.Add(Me.RadioButton2)
        Me.GroupBox1.Controls.Add(Me.RadioButton1)
        Me.GroupBox1.Location = New System.Drawing.Point(10, 69)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(249, 181)
        Me.GroupBox1.TabIndex = 17
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Get key-value pairs by:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(271, 366)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Name = "Form1"
        Me.Text = "Dictionary Test"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button7 As System.Windows.Forms.Button
    Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get Preview Bitmap of File Example (C#)

This example shows how to get the preview bitmap of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows
Forms App.
// 3. Type GetPreviewBitmap_CSharp in Project name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with
this code.
//11. To create the form, replace the code in
Form1.Designer.cs with
//    this code.
//12.
Ensure that the root folder of the vault contains an
Autodesk DWG file.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays
the Get Preview Bitmap dialog box.
//     a. Select a vault view.
//     b. Click Select file.
//     c. In the Select File dialog:
//        1. Click a DWG file
inside the vault.
//        2. Click Open.
//     d. Click Get
preview bitmap.
//        Form1 displays the preview bitmap
of the selected file.
//  2. Close the
Get Preview Bitmap dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace GetPreviewBitmap_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmFile5 aFile;
        bool retVal;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void SelectFiles_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                File1List.Items.Clear();

                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select File dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select File dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                IEdmFolder5 ppoRetParentFolder;
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // do nothing
                }
                else
                {
                    foreach (string FileName in OpenFileDialog1.FileNames)
                    {
                        File1List.Items.Add(FileName);
                        aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void PreviewBitmap_Click(System.Object sender, System.EventArgs e)
        {
            DrawBitmapPreview(aFile);
        }

        private void DrawBitmapPreview(IEdmFile5 file)
        {

            try
            {
                IEdmEnumeratorVariable5 varEnum = default(IEdmEnumeratorVariable5);
                varEnum = (IEdmEnumeratorVariable5)file.GetEnumeratorVariable();
                IEdmBitmap5 preview = default(IEdmBitmap5);
                preview = varEnum.GetThumbnail();
                if (preview == null)
                    return;
                preview.Draw(this.Handle.ToInt32(), 45, 220, 0, 0);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace GetPreviewBitmap_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.PreviewBitmap = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select file...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click +=new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //PreviewBitmap
            //
            this.PreviewBitmap.Location = new System.Drawing.Point(40, 183);
            this.PreviewBitmap.Name = "PreviewBitmap";
            this.PreviewBitmap.Size = new System.Drawing.Size(157, 23);
            this.PreviewBitmap.TabIndex = 6;
            this.PreviewBitmap.Text = "Get preview bitmap";
            this.PreviewBitmap.UseVisualStyleBackColor = true;
            this.PreviewBitmap.Click +=new System.EventHandler(PreviewBitmap_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(629, 746);
            this.Controls.Add(this.PreviewBitmap);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get Preview Bitmap";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button PreviewBitmap;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Preview Bitmap of File Example (VB.NET)

This example shows how to get the preview bitmap of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetPreviewBitmap in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Ensure that the root folder of the vault contains an Autodesk DWG file.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Get Preview Bitmap dialog box.
'     a. Select a vault view.
'     b. Click Select file.
'     c. In the Select File dialog:
'        1. Click a DWG file inside the vault.
'        2. Click Open.
'     d. Click Get preview bitmap.
'        Form1 displays the preview bitmap of the selected file.
'  2. Close the Get Preview Bitmap dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm
Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim retVal As Boolean
   Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    Public Sub PreviewBitmap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviewBitmap.Click
        DrawBitmapPreview(aFile)
    End Sub

    Private Sub DrawBitmapPreview(ByVal file As IEdmFile5)
        Try

            Dim varEnum As IEdmEnumeratorVariable5
            varEnum = file.GetEnumeratorVariable
            Dim preview As IEdmBitmap5
            preview = varEnum.GetThumbnail
            If preview Is Nothing Then Exit Sub
            preview.Draw(Me.Handle.ToInt32(), 45, 220, 0, 0)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.PreviewBitmap = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select file..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'PreviewBitmap
        '
        Me.PreviewBitmap.Location = New System.Drawing.Point(40, 183)
        Me.PreviewBitmap.Name = "PreviewBitmap"
        Me.PreviewBitmap.Size = New System.Drawing.Size(157, 23)
        Me.PreviewBitmap.TabIndex = 6
        Me.PreviewBitmap.Text = "Get preview bitmap"
        Me.PreviewBitmap.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(629, 746)
        Me.Controls.Add(Me.PreviewBitmap)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get Preview Bitmap"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents PreviewBitmap As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get Card Control Information Example (C#)

This example shows how to get information about the list and edit box controls in a selected file's data card.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type CardControlInfo_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with this code.
//12. Ensure that there is a file in the vault whose extension has a
//    file data card in the vault.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click Select file.
//  4. In the Select File dialog:
//     a. Click a file
whose extension has a file data card in the vault.
//     b. Click Open.
//  5. Click Get card information.
//  6. A message box displays information about the selected
file's data card.
//  7. Click OK in the message box.
//  8. A message box displays the list items of any drop list controls.
//  9. Click OK in the message box.
// 10. A message box displays information about each edit box
control in the
//     data card.
// 11. Click OK in the message box.
// 12. Close the dialog.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CardControlInfo_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmFile5 aFile;
        IEdmFolder5 aFolder;
        IEdmFolder5 ppoRetParentFolder;
        IEdmCard6 aCard;
        IEdmCardControl7 aControl;
        IEdmPos5 aPos;
        int plWidth;
        int plHeight;
        int plX;
        int plY;
        int plParentCtrlID;
        int plPageNo;
        object poMin = null;
        object poMax = null;
        int varType;
        int contType;
        string fileExt;
        int cardID;
        string str;

        int k;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void SelectFiles_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                File1List.Items.Clear();

                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select File dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;

                //Show the Select File dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // do nothing
                }
                else
                {
                    foreach (string FileName in OpenFileDialog1.FileNames)
                    {
                        File1List.Items.Add(FileName);
                        aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
                        k = FileName.LastIndexOf(".");
                        fileExt = FileName.Substring(k + 1, (FileName.Length) - k - 1);
                        aPos = aFile.GetFirstFolderPosition();
                        aFolder = aFile.GetNextFolder(aPos);
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetCardControls_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                vault2 = (IEdmVault9)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if ((aFile != null))
                {
                    // Get the selected file's data card
                    aCard = (IEdmCard6)aFolder.GetCard(fileExt);
                    cardID = aFolder.GetCardID(fileExt);

                    aCard.GetSize(out plWidth, out plHeight);
                    str = "File: " + aFile.Name + "\r\n" + "Card ID: " + cardID + ", EdmCardType: " + aCard.CardType + ", Width: " + plWidth + ", Height: " + plHeight;
                    MessageBox.Show(str);

                    aPos = aCard.GetFirstControlPosition();
                    while (!(aPos.IsNull))
                    {
                        aControl = (IEdmCardControl6)aCard.GetNextControl(aPos);
                        contType = (int)aControl.ControlType;

                        bool ret = false;
                        string[] variableItemsList = null;
                        if (((contType == 7) | (contType == 8) | (contType == 9) | (contType == 10)))
                        {
                            str = "List values associated with drop-down card control: " + aControl.VariableID.ToString();
                            ret = aControl.GetControlVariableList(aFile.ID, out variableItemsList);

                            foreach (string listValue in variableItemsList)
                            {
                                str = str + "\r\n" + listValue;
                            }
                            MessageBox.Show(str);
                        }

                        // Get the edit box controls in the card
                        if (contType == 4)
                        {
                            str = "";
                            aControl.GetParentInfo(out plParentCtrlID, out plPageNo);
                            aControl.GetPosition(out plX, out plY, out plWidth, out plHeight);
                            varType = (int)aControl.GetValidation(out poMin, out poMax);

                            str = "Card control: " + aControl.Name;
                            str = str + "\r\n" + "Variable ID: " + aControl.VariableID + "\t\n" + "EdmCardControlType: " + contType + "\r\n" + "Is multi-line? " + aControl.IsMultiLine + "\r\n" + "Is read-only? " + aControl.IsReadOnly + "\r\n" + "Show in preview? " + aControl.ShowInPreview;
                            str = str + "\r\n" + "Location on card: [" + plX + ", " + plY + "], Width: " + plWidth + ", Height: " + plHeight;
                            str = str + "\r\n" + "Parent control ID (0, if none): " + plParentCtrlID;
                            str = str + "\r\n" + "Tab index: " + plPageNo;
                            str = str + "\r\n" + "EdmVariableType: " + varType;

                            str = str + "\r\n" + "Updates all configurations? " + aControl.UpdatesAllConfigurations.ToString();

                            MessageBox.Show(str);
                        }
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

Back to top

//Form1.Designer.cs

namespace CardControlInfo_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.GetCardControls = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(39, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(191, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select file...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click +=new System.EventHandler(SelectFiles_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //GetCardControls
            //
            this.GetCardControls.Location = new System.Drawing.Point(40, 183);
            this.GetCardControls.Name = "GetCardControls";
            this.GetCardControls.Size = new System.Drawing.Size(157, 23);
            this.GetCardControls.TabIndex = 6;
            this.GetCardControls.Text = "Get card  information";
            this.GetCardControls.UseVisualStyleBackColor = true;
            this.GetCardControls.Click += new System.EventHandler(GetCardControls_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 235);
            this.Controls.Add(this.GetCardControls);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Card controls";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button GetCardControls;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Card Control Information Example (VB.NET)

This example shows how to get information about the list and edit box controls in a selected file's data card.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type CardControlInfo in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Ensure that there is a file in the vault whose extension has a
'    file data card in the vault, and the file data card has a droplist
'    control.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click Select file.
'  4. In the Select File dialog:
'     a. Click a file whose extension has a file data card in the vault.
'     b. Click Open.
'  5. Click Get card information.
'  6. A message box displays information about the selected file's data card.
'  7. Click OK in the message box.
'  8. A message box displays the list items of any drop list controls.
'  9. Click OK in the message box.
' 10. A message box displays information about each edit box control in the
'     data card.
' 11. Click OK in the message box.
' 12. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim aFolder As IEdmFolder5
    Dim aCard As IEdmCard6
    Dim aControl As IEdmCardControl7
    Dim aPos As IEdmPos5
    Dim plWidth As Integer
    Dim plHeight As Integer
    Dim plX As Integer
    Dim plY As Integer
    Dim plParentCtrlID As Integer
    Dim plPageNo As Integer
    Dim poMin As Object = Nothing
    Dim poMax As Object = Nothing
    Dim varType As EdmVariableType
    Dim contType As EdmCardControlType
    Dim fileExt As String
    Dim cardID As Integer
    Dim str As String
    Dim k As Integer

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
        Try
            File1List.Items.Clear()

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName)
                    k = FileName.LastIndexOf(".")
                    fileExt = FileName.Substring(k + 1, (FileName.Length) - k - 1)
                    aPos = aFile.GetFirstFolderPosition()
                    aFolder = aFile.GetNextFolder(aPos)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetCardControls_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetCardControls.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault9)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not IsNothing(aFile) Then

                ' Get the selected file's data card
                aCard = aFolder.GetCard(fileExt)
                cardID = aFolder.GetCardID(fileExt)

                aCard.GetSize(plWidth, plHeight)
                str = "Card ID: " & cardID & ", EdmCardType: " & aCard.CardType & ", Width: " & plWidth & ", Height: " & plHeight
                MessageBox.Show(str)

                aPos = aCard.GetFirstControlPosition()
                While Not (aPos.IsNull)
                    aControl = aCard.GetNextControl(aPos)
                    contType = aControl.ControlType

                    Dim ret As Boolean
                    Dim variableItemsList As String() = Nothing
                    If ((contType = 7) Or (contType = 8) Or (contType = 9) Or (contType = 10)) Then
                        str = "List values associated with drop-down card control: " & aControl.VariableID.ToString

                        ret = aControl.GetControlVariableList(aFile.ID, variableItemsList)

                        For Each listValue As String In variableItemsList
                            str = str & vbLf & listValue
                        Next
                        MessageBox.Show(str)
                    End If

                    ' Get the edit box controls in the card
                    If (contType = 4) Then
                        str = ""
                        aControl.GetParentInfo(plParentCtrlID, plPageNo)
                        aControl.GetPosition(plX, plY, plWidth, plHeight)
                        varType = aControl.GetValidation(poMin, poMax)

                        str = "Card control: " & aControl.Name
                        str = str & vbLf & "Variable ID: " & aControl.VariableID & vbLf & "EdmCardControlType: " & contType & vbLf & "Is multi-line? " & aControl.IsMultiLine & vbLf & "Is read-only? " & aControl.IsReadOnly & vbLf & "Show in preview? " & aControl.ShowInPreview
                        str = str & vbLf & "Location on card: [" & plX & ", " & plY & "], Width: " & plWidth & ", Height: " & plHeight
                        str = str & vbLf & "Parent control ID (0, if none): " & plParentCtrlID
                        str = str & vbLf & "Tab index: " & plPageNo
                        str = str & vbLf & "EdmVariableType: " & varType

                        str = str & vbLf & "Updates all configurations? " & aControl.UpdatesAllConfigurations.ToString

                        MessageBox.Show(str)
                    End If
                End While
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top
'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.GetCardControls = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(39, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(191, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select file..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'GetCardControls
        '
        Me.GetCardControls.Location = New System.Drawing.Point(40, 183)
        Me.GetCardControls.Name = "GetCardControls"
        Me.GetCardControls.Size = New System.Drawing.Size(157, 23)
        Me.GetCardControls.TabIndex = 6
        Me.GetCardControls.Text = "Get card  information"
        Me.GetCardControls.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 235)
        Me.Controls.Add(Me.GetCardControls)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Card controls"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents GetCardControls As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get Categories Example (C#)

This example shows how to access the categories in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
// 3. Type GetCategories_CSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9. Add dependencies and safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click Get categories.
//  4. Displays a message box with the names and descriptions of all of the categories
//     in the vault.
//  5. Click OK in the message box.
//  6. Close the dialog.
//----------------------------------------------------------------------------
//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace GetCategories_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetCategories_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault9)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmCategoryMgr6 Categories = default(IEdmCategoryMgr6);
                Categories = (IEdmCategoryMgr6)vault2.CreateUtility(EdmUtility.EdmUtil_CategoryMgr);

                IEdmPos5 Pos = default(IEdmPos5);
                Pos = (IEdmPos5)Categories.GetFirstCategoryPosition();

                IEdmCategory6 Category = default(IEdmCategory6);
                string Msg = null;
                Msg = "The categories in this vault are:";

                while (!Pos.IsNull)
                {
                    Category = Categories.GetNextCategory(Pos);
                    Msg = Msg + "\r\n"+ Category.Name + " (" + Category.Description + ")";
                }

                Interaction.MsgBox(Msg);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

Back to top
//Form1.Designer.cs

namespace GetCategories_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.GetCategories = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //GetCategories
            //
            this.GetCategories.Location = new System.Drawing.Point(39, 79);
            this.GetCategories.Name = "GetCategories";
            this.GetCategories.Size = new System.Drawing.Size(157, 23);
            this.GetCategories.TabIndex = 6;
            this.GetCategories.Text = "Get categories";
            this.GetCategories.UseVisualStyleBackColor = true;
            this.GetCategories.Click +=new System.EventHandler(GetCategories_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 142);
            this.Controls.Add(this.GetCategories);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Categories";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button GetCategories;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Categories Example (VB.NET)

This example shows how to access the categories in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetCategories in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click Get categories.
'  4. Displays a message box with the names and descriptions of all of the categories
'     in the vault.
'  5. Click OK in the message box.
'  6. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault1 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetCategories_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetCategories.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault9)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim Categories As IEdmCategoryMgr6
            Categories = vault2.CreateUtility(EdmUtility.EdmUtil_CategoryMgr)

            Dim Pos As IEdmPos5
            Pos = Categories.GetFirstCategoryPosition

            Dim Category As IEdmCategory6
            Dim Msg As String
            Msg = "The categories in this vault are:"

            While Not Pos.IsNull
                Category = Categories.GetNextCategory(Pos)
                Msg = Msg + vbLf + Category.Name + " (" + Category.Description + ")"
            End While

            MsgBox(Msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top
'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.GetCategories = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'GetCategories
        '
        Me.GetCategories.Location = New System.Drawing.Point(39, 79)
        Me.GetCategories.Name = "GetCategories"
        Me.GetCategories.Size = New System.Drawing.Size(157, 23)
        Me.GetCategories.TabIndex = 6
        Me.GetCategories.Text = "Get categories"
        Me.GetCategories.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 142)
        Me.Controls.Add(Me.GetCategories)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Categories"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents GetCategories As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get File Information Example (C#)

This example shows how to access a file and get information about it.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type Files_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form,
replace the code in Form1.Designer.cs with this code.
//12. Check out a file in the vault.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Get
file information dialog box.
//    a. Select a vault view.
//    b. Click Browse.
//       1. Locate and select
the file checked out in Preconditions step 5.
//       2. Click Open.
//    c. Click Get information.
//    d. Displays a message box with information
about the selected file.
//    e. Click OK.
// 2. Close the Get
file information dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace Files_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BrowseButton_Click(System.Object sender, System.EventArgs e)
{
try
{
ListBox.Items.Clear();

if (vault1 == null)
{
vault1 = new EdmVault5();
}
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Open dialog
OpenFileDialog.InitialDirectory = vault1.RootFolderPath;
//Show the Open dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog.ShowDialog();
//If the user didn't click Open, exit
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

foreach (string FileName in OpenFileDialog.FileNames)
{
ListBox.Items.Add(FileName);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void GetInfo_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
//Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmFile17 aFile = default(IEdmFile17);
IEdmFolder5 ppoRetParentFolder;
aFile = (IEdmFile17)vault2.GetFileFromPath(ListBox.Items[0].ToString(), out ppoRetParentFolder);

//Get configurations
string msg = "Configurations: " + "\r\n";
IEdmFolder5 folder = default(IEdmFolder5);
folder = vault2.RootFolder;

EdmStrLst5 cfgList = default(EdmStrLst5);
cfgList = aFile.GetConfigurations();

IEdmPos5 pos = default(IEdmPos5);
pos = cfgList.GetHeadPosition();
string cfgName = null;
while (!pos.IsNull)
{
cfgName = cfgList.GetNext(pos);
msg = msg + cfgName + "r\\n";
}

msg = msg + "\r\n";

//Get type of file
int typ = 0;
typ = (int)aFile.FileType;
msg = msg + "EdmFileType: " + typ + "\r\n";

msg = msg + "\r\n";

//Get category of file
IEdmCategory6 cat = default(IEdmCategory6);
cat = aFile.Category;
if ((cat != null))
{
msg = msg + "Category: " + cat.Name + ", Category ID: " + aFile.CategoryID + "\r\n";
msg = msg + "\r\n";
}

//Get local file timestamp
string filePath = aFile.Name;
object fileDate = null;
fileDate = aFile.GetLocalFileDate(filePath);

if ((fileDate != null))
{
string text = null;
text = fileDate.ToString();
msg = msg + aFile.GetLocalPath(folder.ID) + " was modified " + text + "\r\n";
}
else
{
msg = msg + "There is no local copy of the file" + "\r\n";
}

msg = msg + "\r\n";

//Get local version number
int versionNo = 0;
versionNo = aFile.GetLocalVersionNo(aFile.GetLocalPath(folder.ID));

if (versionNo == -1)
{
msg = msg + "The local copy of " + aFile.Name + " does not match any existing versions" + "\r\n";
}
else
{
string versionStr = null;
versionStr = versionNo.ToString();
msg = msg + "The local copy of " + aFile.Name + " has version " + versionStr + "\r\n";
}

msg = msg + "\r\n";

//Get current version
int ver = 0;
ver = aFile.CurrentVersion;
msg = msg + "Current version: " + ver + "\r\n";

msg = msg + "\n";

//Get local revision name
string revName = null;
revName = aFile.GetLocalRevisionName(aFile.GetLocalPath(folder.ID));

if (string.IsNullOrEmpty(revName))
{
msg = msg + "The local copy of " + aFile.Name + " does not match any existing revisions" + "\r\n";
}
else
{
msg = msg + "The local copy of " + aFile.Name + " has revision name " + revName + "r\n";
}

msg = msg + "\r\n";

//Get current revision
revName = aFile.CurrentRevision;
msg = msg + "Current revision: " + revName + "\r\n";

msg = msg + "\r\n";

//Get local file size
int fileSize = 0;
fileSize = (int)aFile.GetLocalFileSize2(aFile.GetLocalPath(folder.ID));

if (fileSize == -1)
{
msg = msg + "The local copy of " + aFile.Name + " is missing" + "\r\n";
}
else
{
msg = msg + "The local copy of " + aFile.Name + " has size " + fileSize + " bytes" + "\r\n";
}

msg = msg + "\r\n";

//Get current workflow state
IEdmState5 state = default(IEdmState5);
state = aFile.CurrentState;
msg = msg + "Current workflow state: " + state.Name + "\n";

msg = msg + "\r\n";

//Get whether the file is checked out
bool checkedOut = false;
checkedOut = aFile.IsLocked;
msg = msg + "File is checked out? " + checkedOut + "\r\n";
if (checkedOut)
{
msg = msg + "Lock path: " + aFile.LockPath + "\n";
msg = msg + "Locked by: " + aFile.LockedByUser.Name + ", User ID: " + aFile.LockedByUserID + "\r\n";
msg = msg + "Locked in: " + aFile.LockedInFolder.Name + ", Folder ID: " + aFile.LockedInFolderID + "\r\n";
msg = msg + "Locked on: " + aFile.LockedOnComputer
+ ", Vault View ID: " + aFile.LockedOnViewID;
}

msg = msg + "\r\n";

                 //Get whether the file has cut list items
                bool hasCutListItems = false;
                hasCutListItems = aFile.HasCutListItems;
                msg = msg + "File has cut list items? " + hasCutListItems + "\r\n";

                msg = msg + "\r\n";

                 //Create a label

                 int labelID;
                labelID = aFile.CreateLabel("File label", "Label description shows in the history dialog box");

                 msg = msg + "File label ID: " + "\r\n";

                MessageBox.Show(msg);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace Files_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.ListBox = new System.Windows.Forms.ListBox();
            this.GetInfo = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 85);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(98, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click +=new System.EventHandler(BrowseButton_Click);
            //
            //ListBox
            //
            this.ListBox.FormattingEnabled = true;
            this.ListBox.HorizontalScrollbar = true;
            this.ListBox.Location = new System.Drawing.Point(16, 114);
            this.ListBox.Name = "ListBox";
            this.ListBox.Size = new System.Drawing.Size(259, 43);
            this.ListBox.TabIndex = 4;
            //
            //GetInfo
            //
            this.GetInfo.Location = new System.Drawing.Point(84, 178);
            this.GetInfo.Name = "GetInfo";
            this.GetInfo.Size = new System.Drawing.Size(98, 23);
            this.GetInfo.TabIndex = 5;
            this.GetInfo.Text = "Get information";
            this.GetInfo.UseVisualStyleBackColor = true;
            this.GetInfo.Click +=new System.EventHandler(GetInfo_Click);
            //
            //OpenFileDialog
            //
            this.OpenFileDialog.Title = "Open";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 215);
            this.Controls.Add(this.GetInfo);
            this.Controls.Add(this.ListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get file information";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox ListBox;
        internal System.Windows.Forms.Button GetInfo;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get File Information Example (VB.NET)

This example shows how to access a file and get information about it.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type Files in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Check out a file in the vault.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Get file information dialog box.
'    a. Select a vault view.
'    b. Click Browse.
'       1. Locate and select the file checked out in Preconditions step 4.
'       2. Click Open.
'    c. Click Get information.
'    d. Displays a message box with information about the selected file.
'    e. Click OK.
' 2. Close the Get file information dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

Private vault1 As IEdmVault5 = Nothing

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
Dim vault1 As IEdmVault5 = New EdmVault5()
Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
Dim Views As EdmViewInfo() = Nothing

vault.GetVaultViews(Views, False)
VaultsComboBox.Items.Clear()
For Each View As EdmViewInfo In Views
VaultsComboBox.Items.Add(View.mbsVaultName)
Next
If VaultsComboBox.Items.Count > 0 Then
VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
End If
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
Try
ListBox.Items.Clear()

If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
If Not vault1.IsLoggedIn Then
'Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

'Set the initial directory in the Open dialog
OpenFileDialog.InitialDirectory = vault1.RootFolderPath
'Show the Open dialog
Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
DialogResult = OpenFileDialog.ShowDialog()
'If the user didn't click Open, exit
If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
Return
End If

For Each FileName As String In OpenFileDialog.FileNames
ListBox.Items.Add(FileName)
Next
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub GetInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetInfo.Click
Try

Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)
If Not vault1.IsLoggedIn Then
'Log into selected vault as the current user
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

Dim aFile As IEdmFile17
aFile = vault2.GetFileFromPath(ListBox.Items(0).ToString())

'Get configurations
Dim msg As String = "Configurations: " & vbLf
Dim folder As IEdmFolder5
folder = vault2.RootFolder

Dim cfgList As EdmStrLst5
cfgList = aFile.GetConfigurations

Dim pos As IEdmPos5
pos = cfgList.GetHeadPosition
Dim cfgName As String
While Not pos.IsNull
cfgName = cfgList.GetNext(pos)
msg = msg & cfgName & vbLf
End While

msg = msg & vbLf

'Get type of file
Dim typ As Integer
typ = aFile.FileType
msg = msg & "EdmFileType: " & typ & vbLf

msg = msg & vbLf

'Get category of file
Dim cat As IEdmCategory6
cat = aFile.Category
If Not IsNothing(cat) Then
msg = msg & "Category: " & cat.Name & ", Category ID: " & aFile.CategoryID & vbLf
msg = msg & vbLf
End If

'Get local file timestamp
Dim filePath As String = aFile.Name
Dim fileDate As Object
fileDate = aFile.GetLocalFileDate(filePath)

If Not IsNothing(fileDate) Then
Dim text As String
text = fileDate
msg = msg & aFile.GetLocalPath(folder.ID) & " was modified " & text & vbLf
Else
msg = msg & "There is no local copy of the file" & vbLf
End If

msg = msg & vbLf

'Get local version number
Dim versionNo As Integer
versionNo = aFile.GetLocalVersionNo(aFile.GetLocalPath(folder.ID))

If versionNo = -1 Then
msg = msg & "The local copy of " & aFile.Name & " does not match any existing versions" & vbLf
Else
Dim versionStr As String
versionStr = versionNo
msg = msg & "The local copy of " & aFile.Name & " has version " & versionStr & vbLf
End If

msg = msg & vbLf

'Get current version
Dim ver As Integer
ver = aFile.CurrentVersion
msg = msg & "Current version: " & ver & vbLf

msg = msg & vbLf

'Get local revision name
Dim revName As String
revName = aFile.GetLocalRevisionName(aFile.GetLocalPath(folder.ID))

If revName = "" Then
msg = msg & "The local copy of " & aFile.Name & " does not match any existing revisions" & vbLf
Else
msg = msg & "The local copy of " & aFile.Name & " has revision name " & revName & vbLf
End If

msg = msg & vbLf

'Get current revision
revName = aFile.CurrentRevision
msg = msg & "Current revision: " & revName & vbLf

msg = msg & vbLf

'Get local file size
Dim fileSize As Integer
fileSize = aFile.GetLocalFileSize2(aFile.GetLocalPath(folder.ID))

If fileSize = -1 Then
msg = msg & "The local copy of " & aFile.Name & " is missing" & vbLf
Else
msg = msg & "The local copy of " & aFile.Name & " has size " & fileSize & " bytes" & vbLf
End If

msg = msg & vbLf

'Get current workflow state
Dim state As IEdmState5
state = aFile.CurrentState
msg = msg & "Current workflow state: " & state.Name & vbLf

msg = msg & vbLf

'Get whether the file is checked out
Dim checkedOut As Boolean
checkedOut = aFile.IsLocked
msg = msg & "File is checked out? " & checkedOut & vbLf
If checkedOut Then
msg = msg & "Lock path: " & aFile.LockPath & vbLf
msg = msg & "Locked by: " & aFile.LockedByUser.Name & ", User ID: " & aFile.LockedByUserID & vbLf
msg = msg & "Locked in: " & aFile.LockedInFolder.Name & ", Folder ID: " & aFile.LockedInFolderID & vbLf
msg = msg & "Locked on: " & aFile.LockedOnComputer
& ", Vault View ID: " & aFile.LockedOnViewID
End If

            msg = msg & vbLf

             'Get whether the file has cut list items

             Dim hasCutListItems As Boolean
            hasCutListItems = aFile.HasCutlistItems

             msg = msg & "File has cut list items? " & hasCutListItems & vbLf

            msg = msg & vbLf

             'Create a label

             Dim labelID As Integer
            labelID = aFile.CreateLabel("File label", "Label description shows in the history dialog box")

             msg = msg & "File label ID: " & labelID & vbLf

            MessageBox.Show(msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.ListBox = New System.Windows.Forms.ListBox()
        Me.GetInfo = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 85)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(98, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'ListBox
        '
        Me.ListBox.FormattingEnabled = True
        Me.ListBox.HorizontalScrollbar = True
        Me.ListBox.Location = New System.Drawing.Point(16, 114)
        Me.ListBox.Name = "ListBox"
        Me.ListBox.Size = New System.Drawing.Size(259, 43)
        Me.ListBox.TabIndex = 4
        '
        'GetInfo
        '
        Me.GetInfo.Location = New System.Drawing.Point(84, 178)
        Me.GetInfo.Name = "GetInfo"
        Me.GetInfo.Size = New System.Drawing.Size(98, 23)
        Me.GetInfo.TabIndex = 5
        Me.GetInfo.Text = "Get information"
        Me.GetInfo.UseVisualStyleBackColor = True
        '
        'OpenFileDialog
        '
        Me.OpenFileDialog.Title = "Open"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 215)
        Me.Controls.Add(Me.GetInfo)
        Me.Controls.Add(Me.ListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get file information"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents ListBox As System.Windows.Forms.ListBox
    Friend WithEvents GetInfo As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get File References for a File Example (C#)

This example shows how to get the file references for a file and export any file references to an XML file. This example also shows how to get whether the file and any file references in local cache are valid or obsolete.

NOTE:

  • This example does not work with assemblies that contain weldment components.
  • If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
// 3. Type GetFiles2CSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with this code.
//12. Right-click the GetFiles2CSharp project name in the Solution Explorer.
//        1. Click Add > Class > Class.
//        2. Type FileRef.cs in Name.
//        3. Click Add.
//        4. Replace the code in FileRef.cs with this code.
//13. Verify that C:\temp exists.
//14. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click Browse, locate and select a file in the vault that
//     has file references, and click Open.
//  4. Click Write file references to an XML file, which exports
//     the names of any file references to C:\temp\BatchFileRefInfo.xml.
//  5. Displays a message box that says file references were exported
//     to an XML file.
//  6. Click OK to close the message box.
//  7. Double-click C:\temp\BatchFileRefInfo.xml and examine its contents.
//----------------------------------------------------------------------------

//Form1.cs
using System.IO;
using System.Xml.Serialization;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using EPDM.Interop.epdm;

namespace GetFiles2CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;

        public void FileReferencesCSharp_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                BatchRefListBox.Items.Clear();

                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                    vault1 = new EdmVault5();
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the File Open dialog
                BatchRefOpenFileDialog.InitialDirectory = vault1.RootFolderPath;
                //Show the File Open dialog
                System.Windows.Forms.DialogResult DialogResult = default(System.Windows.Forms.DialogResult);
                DialogResult = BatchRefOpenFileDialog.ShowDialog();
                //If the user didn't click Open, exit the sub
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                    return;

                foreach (string FileName in BatchRefOpenFileDialog.FileNames)
                {
                    BatchRefListBox.Items.Add(FileName);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetReferencedFiles(IEdmReference10 Reference, string FilePath, int Level, string ProjectName, ref Dictionary<string, string> RefFilesDictionary)
        {
            try
            {
                bool Top = false;
                if (Reference == null)
                {
                    //This is the first time this function is called for this
                    //reference tree; i.e., this is the root
                    Top = true;
                    //Add the top-level file path to the dictionary
                    RefFilesDictionary.Add(FilePath, Level.ToString());
                    IEdmFile5 File = null;
                    IEdmFolder5 ParentFolder = null;
                    File = vault1.GetFileFromPath(FilePath, out ParentFolder);
                    //Get the reference tree for this file
                    Reference = (IEdmReference10)File.GetReferenceTree(ParentFolder.ID);
                    GetReferencedFiles(Reference, "", Level + 1, ProjectName, ref RefFilesDictionary);
                }
                else
                {
                    //Execute this code when this function is called recursively;
                    //i.e., this is not the top-level IEdmReference in the tree

                    //Recursively traverse the references
                    IEdmPos5 pos = default(IEdmPos5);
                    IEdmReference10 Reference2 = (IEdmReference10)Reference;
                    pos = Reference2.GetFirstChildPosition3(ProjectName, Top, true, (int)EdmRefFlags.EdmRef_File, "", 0);
                    IEdmReference10 @ref = default(IEdmReference10);
                    while ((!pos.IsNull))
                    {
                        @ref = (IEdmReference10)Reference.GetNextChild(pos);
                        RefFilesDictionary.Add(@ref.FoundPath, Level.ToString());
                        GetReferencedFiles(@ref, "", Level + 1, ProjectName, ref RefFilesDictionary);
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void WriteXmlButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                    vault1 = new EdmVault5();
                    vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the file paths of all of the referenced files
                //and store them in RefFilesDictionary as keys;
                //the levels where they are found in the file hierarchy
                //are stored as values
                Dictionary<string, string> RefFilesDictionary = new Dictionary<string, string>();
                foreach (string FileName in BatchRefListBox.Items)
                {
                    GetReferencedFiles(null, FileName, 0, "A", ref RefFilesDictionary);
                }

                //Because selecting a file in the Open File dialog
                //adds the file and its references to the local cache,
                //clear the local cache to demonstrate that the
                //IEdmBatchListing methods don't add the files to
                //the local cache

                //Declare and create the IEdmClearLocalCache3 object
                IEdmClearLocalCache3 ClearLocalCache = default(IEdmClearLocalCache3);
                ClearLocalCache = (IEdmClearLocalCache3)vault2.CreateUtility(EdmUtility.EdmUtil_ClearLocalCache);
                ClearLocalCache.IgnoreToolboxFiles = true;
                ClearLocalCache.UseAutoClearCacheOption = true;

                //Declare and create the IEdmBatchListing object
                IEdmBatchListing4 BatchListing = default(IEdmBatchListing4);
                BatchListing = (IEdmBatchListing4)vault2.CreateUtility(EdmUtility.EdmUtil_BatchList);

                //Add all of the reference file paths to the
                //IEdmClearLocalCache object to clear from the
                //local cache and to the IEdmBatchListing object
                //to get the file information in batch mode
                foreach (KeyValuePair<string, string> KvPair in RefFilesDictionary)
                {
                    ClearLocalCache.AddFileByPath(KvPair.Key);
                    ((IEdmBatchListing4)BatchListing).AddFileCfg(KvPair.Key, DateTime.Now, (Convert.ToInt32(KvPair.Value)), "@", Convert.ToInt32(EdmListFileFlags.EdmList_Nothing));
                }
                //Clear the local cache of the reference files
                ClearLocalCache.CommitClear();

                //Create the batch file listing along with the file
                //card variables Description and Number
                EdmListCol[] BatchListCols = null;
                ((IEdmBatchListing4)BatchListing).CreateListEx("\n\nDescription\nNumber", Convert.ToInt32(EdmCreateListExFlags.Edmclef_MayReadFiles), ref BatchListCols, null);
                //Get the generated file information
                EdmListFile2[] BatchListFiles = null;
                BatchListing.GetFiles2(ref BatchListFiles);

                //Create the list where to store all the file information
                List<FileRef> FileRefs = new List<FileRef>();

                //Recursively add the file information to the list
                int j = 0;
                AddFileRef(ref BatchListFiles, ref j, 0, ref FileRefs);

                if (!Directory.Exists("C:\\temp"))
                {
                    MessageBox.Show("Directory \"c:\temp\" does " + "not exist; please create it and try again.");
                }
                else
                {
                    XmlSerializer XmlSer = new XmlSerializer(typeof(List<FileRef>));
                    StreamWriter StrWriter = new StreamWriter("C:\\temp\\BatchFileRefInfo.xml");
                    XmlSer.Serialize(StrWriter, FileRefs);
                    StrWriter.Close();
                    MessageBox.Show("File references successfully exported to an XML file.");
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void AddFileRef(ref EdmListFile2[] BatchListFiles, ref int curIndex, int curLevel, ref List<FileRef> FileRefs)

        {
            try
            {

                while (curIndex < BatchListFiles.Length)
                {
                    EdmListFile2 curListFile = BatchListFiles[curIndex];
                    //If the depth level of this listfile is <
                    //the current depth level then...
                    if (curListFile.mlParam > curLevel)
                    {
                        //Create a new FileRefs list
                        FileRefs[FileRefs.Count - 1].FileRefs = new List<FileRef>();
                        List<FileRef> fRef = FileRefs[FileRefs.Count - 1].FileRefs;
                        //Recurse using a new FileRefs list
                         AddFileRef(ref BatchListFiles, ref curIndex, curListFile.mlParam, ref fRef);
                    }
                    else
                    {
                        //Create a new FileRef object to hold
                        //the file information
                        FileRef FileRef = new FileRef();
                        //Assign the FileRef properties
                        FileRef.CheckedOutBy = curListFile.mbsLockUser;
                        FileRef.CurrentState = curListFile.moCurrentState.mbsStateName;
                        object[] columnData = (object[])curListFile.moColumnData;
                        FileRef.Description = (string)columnData[0];
                        IEdmFile5 File = default(IEdmFile5);
                        File = (IEdmFile5)vault1.GetObject(EdmObjectType.EdmObject_File, curListFile.mlFileID);
                        FileRef.FileName = File.Name;
                        FileRef.LatestRevision = curListFile.mbsRevisionName;
                        FileRef.LatestVersion = Convert.ToString(curListFile.mlLatestVersion);
                        FileRef.Number = (string)columnData[1];
                        FileRef.FileRefs = null;
                        //Add the FileRef to this level's list
                        FileRefs.Add(FileRef);
                        curIndex += 1;
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}

Back to top
//Form1.Designer.cs
namespace GetFiles2CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BatchRefLabel = new System.Windows.Forms.Label();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.BatchRefListBox = new System.Windows.Forms.ListBox();
            this.WriteXMLButton = new System.Windows.Forms.Button();
            this.BatchRefOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 59);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // BatchRefLabel
            //
            this.BatchRefLabel.AutoSize = true;
            this.BatchRefLabel.Location = new System.Drawing.Point(16, 116);
            this.BatchRefLabel.Name = "BatchRefLabel";
            this.BatchRefLabel.Size = new System.Drawing.Size(160, 13);
            this.BatchRefLabel.TabIndex = 2;
            this.BatchRefLabel.Text = "Files for which to get references:";
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(197, 106);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(75, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(BrowseButton_Click);
            //
            // BatchRefListBox
            //
            this.BatchRefListBox.FormattingEnabled = true;
            this.BatchRefListBox.Location = new System.Drawing.Point(13, 150);
            this.BatchRefListBox.Name = "BatchRefListBox";
            this.BatchRefListBox.Size = new System.Drawing.Size(259, 95);
            this.BatchRefListBox.TabIndex = 4;
            //
            // WriteXMLButton
            //
            this.WriteXMLButton.Location = new System.Drawing.Point(13, 270);
            this.WriteXMLButton.Name = "WriteXMLButton";
            this.WriteXMLButton.Size = new System.Drawing.Size(259, 23);
            this.WriteXMLButton.TabIndex = 5;
            this.WriteXMLButton.Text = "Write file references to an XML file";
            this.WriteXMLButton.UseVisualStyleBackColor = true;
            this.WriteXMLButton.Click += new System.EventHandler(this.WriteXmlButton_Click);

            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 308);
            this.Controls.Add(this.WriteXMLButton);
            this.Controls.Add(this.BatchRefListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.BatchRefLabel);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get file references";
            this.Load += new System.EventHandler(this.FileReferencesCSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Label BatchRefLabel;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.ListBox BatchRefListBox;
        private System.Windows.Forms.Button WriteXMLButton;
        private System.Windows.Forms.OpenFileDialog BatchRefOpenFileDialog;
    }
}
Back to top
//FileRef.cs
using System;
using System.Collections;
using System.Diagnostics;
using System.Collections.Generic;

namespace GetFiles2CSharp
{

    public class FileRef
    {
        private short mLocalOverWrittenVersionObsolete;
        private string mFileName;
        private string mLatestVersion;
        private string mLatestRevision;
        private string mNumber;
        private string mDescription;
        private string mCurrentState;
        private string mCheckedOutBy;
        private List<FileRef> mFileRefs;

        public FileRef()
        {

        }

        public string FileName
        {
            get { return mFileName; }
            set { mFileName = value; }
        }

        public string LatestVersion
        {
            get { return mLatestVersion; }
            set { mLatestVersion = value; }
        }

        public string LatestRevision
        {
            get { return mLatestRevision; }
            set { mLatestRevision = value; }
        }

        public string Number
        {
            get { return mNumber; }
            set { mNumber = value; }
        }

        public string Description
        {
            get { return mDescription; }
            set { mDescription = value; }
        }

        public string CurrentState
        {
            get { return mCurrentState; }
            set { mCurrentState = value; }
        }

        public string CheckedOutBy
        {
            get { return mCheckedOutBy; }
            set { mCheckedOutBy = value; }
        }

    public short LocalOverWrittenVersionObsolete
    {
           get { return mLocalOverWrittenVersionObsolete; }
           set { mLocalOverWrittenVersionObsolete = value; }
    }

        public List<FileRef> FileRefs
        {
            get { return mFileRefs; }
            set { mFileRefs = value; }
        }
    }

}
Back to top


SOLIDWORKS PDM Professional API Help

Get File References for a File Example (VB.NET)

This example shows how to get the file references for a file and export any file references to an XML file. This example also shows how to get whether the file and any file references in local cache are valid or obsolete.

NOTE:

  • This example does not work with assemblies that contain weldment components.
  • If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetFiles2 in Project name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.

' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.

' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Right-click the GetFiles2 project name in the Solution Explorer.
'        1. Click Add > Class > Class.
'        2. Type FileRef.vb in Name.
'        3. Click Add.
'        4. Replace the code in FileRef.vb with this code.
'13. Verify that C:\temp exists.
'14. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click Browse, locate and select a file in the vault that
'     has file references, and click Open.
'  4. Click Write file references to an XML file, which exports
'     the names of any file references to C:\temp\BatchFileRefInfo.xml.
'  5. Displays a message box that says file references were exported
'     to an XML file.
'  6. Click OK to close the message box.
'  7. Double-click C:\temp\BatchFileRefInfo.xml and examine its contents.
'----------------------------------------------------------------------------

'Form1.vb
Imports System.IO
Imports System.Xml.Serialization

Imports EPDM.Interop.epdm

Public Class Form1

  Dim vault As IEdmVault5 = Nothing

  Private Sub BatchRefTreeInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Try
      Dim vault As IEdmVault8 = New EdmVault5
      Dim Views() As EdmViewInfo = {}

      vault.GetVaultViews(Views, False)
      VaultsComboBox.Items.Clear()
      For Each View As EdmViewInfo In Views
        VaultsComboBox.Items.Add(View.mbsVaultName)
      Next
      If VaultsComboBox.Items.Count > 0 Then
        VaultsComboBox.Text = VaultsComboBox.Items(0)
      End If
    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
      ex.ErrorCode.ToString("X") + vbCrLf + _
      ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
    Try
      BatchRefListBox.Items.Clear()

            'Only create a new vault object
            'if one hasn't been created yet
            If vault Is Nothing Then vault = New EdmVault5
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, _
                  Me.Handle.ToInt32())
            End If

            'Set the initial directory in the File Open dialog
            BatchRefOpenFileDialog.InitialDirectory = vault.RootFolderPath
            'Show the File Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult
            DialogResult = BatchRefOpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit the sub
            If Not DialogResult = System.Windows.Forms.DialogResult.OK Then Exit Sub

            For Each FileName As String In BatchRefOpenFileDialog.FileNames
                BatchRefListBox.Items.Add(FileName)
            Next FileName
        Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
      ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub GetReferencedFiles( _
    ByVal Reference As IEdmReference10, _
    ByVal FilePath As String, _
    ByVal Level As Integer, _
    ByVal ProjectName As String, _
    ByRef RefFilesDictionary _
    As Dictionary(Of String, String))

        Try
            Dim Top As Boolean = False
            If Reference Is Nothing Then
                'This is the first time this function is called for this
                'file reference tree; i.e., this is the root
                Top = True
                'Add the top-level file path to the dictionary
                RefFilesDictionary.Add(FilePath, Level.ToString())
                Dim File As IEdmFile5 = Nothing
                Dim ParentFolder As IEdmFolder5 = Nothing
                File = vault.GetFileFromPath(FilePath, ParentFolder)
                'Get the file reference tree for this file
                Reference = File.GetReferenceTree(ParentFolder.ID)
                GetReferencedFiles(Reference, "", Level + 1, ProjectName, RefFilesDictionary)
            Else
                'Execute this code when this function is called recursively;
                'i.e., this is not the top-level IEdmReference in the tree

                'Recursively traverse the references
                Dim pos As IEdmPos5
                pos = Reference.GetFirstChildPosition4(ProjectName, Top, True, True, EdmRefFlags.EdmRef_file, "", 0)
                Dim ref As IEdmReference10
                While (Not pos.IsNull)
                    ref = Reference.GetNextChild(pos)
                    RefFilesDictionary.Add(ref.FoundPath, Level.ToString())
                    GetReferencedFiles(ref, "", Level + 1, ProjectName, RefFilesDictionary)
                End While
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
  End Sub

  Private Sub WriteXmlButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles WriteXmlButton.Click

        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault Is Nothing Then vault = New EdmVault5
            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Get the file paths of all of the referenced files
            'and store them in RefFilesDictionary as keys;
            'the levels where they are found in the file hierarchy
            'are stored as values
            Dim RefFilesDictionary As Dictionary(Of String, String) = _
                    New Dictionary(Of String, String)()
            For Each FileName As String In BatchRefListBox.Items
                GetReferencedFiles(Nothing, FileName, 0, "A", RefFilesDictionary)
            Next FileName

            'Because selecting a file in the Open File dialog
            'adds the file and its references to the local cache,
            'clear the local cache to demonstrate that the
            'IEdmBatchListing methods don't add the files to
            'the local cache

            'Declare and create the IEdmClearLocalCache3 object
            Dim ClearLocalCache As IEdmClearLocalCache3
            ClearLocalCache = vault.CreateUtility(EdmUtility.EdmUtil_ClearLocalCache)
        ClearLocalCache.IgnoreToolboxFiles = True
        ClearLocalCache.UseAutoClearCacheOption = True
            'Declare and create the IEdmBatchListing object
            Dim BatchListing As IEdmBatchListing4
            BatchListing = vault.CreateUtility(EdmUtility.EdmUtil_BatchList)

            'Add all of the file reference paths to the
            'IEdmClearLocalCache object to clear from the
            'local cache and to the IEdmBatchListing object
            'to get the file information in batch mode
            For Each KvPair As KeyValuePair(Of String, String) In RefFilesDictionary
                ClearLocalCache.AddFileByPath(KvPair.Key)
                DirectCast(BatchListing, IEdmBatchListing4).AddFileCfg(KvPair.Key, Nothing, KvPair.Value, "@", EdmListFileFlags.EdmList_Nothing)
            Next
            'Clear the local cache of the file references
            ClearLocalCache.CommitClear()

            'Create the batch file listing along with the file
            'card variables Description and Number
            Dim BatchListCols() As EdmListCol = Nothing
            DirectCast(BatchListing, IEdmBatchListing4). _
                CreateListEx(vbLf + "Description" + vbLf + _
                    "Number", EdmCreateListExFlags.Edmclef_MayReadFiles, _
                    BatchListCols, Nothing)
            'Get the generated file information
            Dim BatchListFiles() As EdmListFile2 = Nothing
            BatchListing.GetFiles2(BatchListFiles)

            'Create the list where to store all the file information
            Dim FileRefs As New List(Of FileRef)

            'Recursively add the file information to the list
            AddFileRef(BatchListFiles, 0, 0, FileRefs)

            If Not Directory.Exists("C:\temp") Then
                MessageBox.Show("Directory ""c:\temp"" does " + _
                                "not exist; please create it and try again.")
            Else
                'Write out the file references to an XML file
                Dim XmlSer As New XmlSerializer(GetType(List(Of FileRef)))
                Dim StrWriter As New StreamWriter("C:\temp\BatchFileRefInfo.xml")
                XmlSer.Serialize(StrWriter, FileRefs)
                StrWriter.Close()
                MessageBox.Show( _
                    "File references successfully exported to an XML file.")
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
  End Sub

  Private Sub AddFileRef( _
    ByRef BatchListFiles() As EdmListFile2, _
    ByRef curIndex As Integer, _
    ByVal curLevel As Integer, _
    ByRef FileRefs As List(Of FileRef))

        Try
            While curIndex < BatchListFiles.Length
                Dim curListFile As EdmListFile2 = BatchListFiles(curIndex)
                'If the depth level of this listfile is <
                'the current depth level, then...
                If curListFile.mlParam > curLevel Then
                    'Create a new FileRefs list
                    FileRefs(FileRefs.Count - 1).FileRefs = New List(Of FileRef)
                    'Recurse using a new FileRefs list
                    AddFileRef(BatchListFiles, curIndex, curListFile.mlParam, _
                               FileRefs.Item(FileRefs.Count - 1).FileRefs)
                Else
                    'Create a new FileRef object to hold
                    'the file information
                    Dim FileRef As New FileRef
                    'Assign the FileRef properties
                    FileRef.CheckedOutBy = curListFile.mbsLockUser
                    FileRef.CurrentState = curListFile.moCurrentState.mbsStateName
                    FileRef.Description = curListFile.moColumnData(0)
                    Dim File As IEdmFile5
                    File = vault.GetObject(EdmObjectType.EdmObject_File, curListFile.mlFileID)
                    FileRef.FileName = File.Name
                    FileRef.LatestRevision = curListFile.mbsRevisionName
                    FileRef.LatestVersion = curListFile.mlLatestVersion
                    FileRef.Number = curListFile.moColumnData(1)
                    FileRef.FileRefs = Nothing
                    'Add the FileRef to this level's list
                    FileRefs.Add(FileRef)
                    curIndex += 1
                End If
            End While

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
            ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
  End Sub
End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer.
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.BatchRefOpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.BatchRefListBox = New System.Windows.Forms.ListBox()
        Me.BatchRefLabel = New System.Windows.Forms.Label()
        Me.WriteXmlButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(180, 65)
        Me.BrowseButton.Margin = New System.Windows.Forms.Padding(2)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(64, 19)
        Me.BrowseButton.TabIndex = 17
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 32)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(136, 21)
        Me.VaultsComboBox.TabIndex = 15
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(16, 16)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 16
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'BatchRefOpenFileDialog
        '
        Me.BatchRefOpenFileDialog.InitialDirectory = "C:\"
        Me.BatchRefOpenFileDialog.Multiselect = True
        '
        'BatchRefListBox
        '
        Me.BatchRefListBox.FormattingEnabled = True
        Me.BatchRefListBox.Location = New System.Drawing.Point(18, 94)
        Me.BatchRefListBox.Margin = New System.Windows.Forms.Padding(2)
        Me.BatchRefListBox.Name = "BatchRefListBox"
        Me.BatchRefListBox.Size = New System.Drawing.Size(218, 56)
        Me.BatchRefListBox.TabIndex = 18
        '
        'BatchRefLabel
        '
        Me.BatchRefLabel.AutoSize = True
        Me.BatchRefLabel.Location = New System.Drawing.Point(16, 71)
        Me.BatchRefLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.BatchRefLabel.Name = "BatchRefLabel"
        Me.BatchRefLabel.Size = New System.Drawing.Size(160, 13)
        Me.BatchRefLabel.TabIndex = 19
        Me.BatchRefLabel.Text = "Files for which to get references:"
        '
        'WriteXmlButton
        '
        Me.WriteXmlButton.Location = New System.Drawing.Point(19, 169)
        Me.WriteXmlButton.Margin = New System.Windows.Forms.Padding(2)
        Me.WriteXmlButton.Name = "WriteXmlButton"
        Me.WriteXmlButton.Size = New System.Drawing.Size(217, 19)
        Me.WriteXmlButton.TabIndex = 20
        Me.WriteXmlButton.Text = "Write file references to an XML file"
        Me.WriteXmlButton.UseVisualStyleBackColor = True
        '
        'BatchRefTreeInfo
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(255, 227)
        Me.Controls.Add(Me.WriteXmlButton)
        Me.Controls.Add(Me.BatchRefLabel)
        Me.Controls.Add(Me.BatchRefListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2)
        Me.Name = "BatchRefTreeInfo"
        Me.Text = "Get file references"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents BatchRefOpenFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents BatchRefListBox As System.Windows.Forms.ListBox
    Friend WithEvents BatchRefLabel As System.Windows.Forms.Label
    Friend WithEvents WriteXmlButton As System.Windows.Forms.Button

End Class
Back to top
'FileRef.vb
Public Class FileRef
  Private mLocalOverwittenVersionObsolete As Short
  Private mFileName As String
  Private mLatestVersion As String
  Private mLatestRevision As String
  Private mNumber As String
  Private mDescription As String
  Private mCurrentState As String
  Private mCheckedOutBy As String
  Private mFileRefs As List(Of FileRef)

  Public Sub New()

  End Sub

  Public Property FileName() As String
    Get
      Return mFileName
    End Get
    Set(ByVal value As String)
      mFileName = value
    End Set
  End Property

  Public Property LatestVersion() As String
    Get
      Return mLatestVersion
    End Get
    Set(ByVal value As String)
      mLatestVersion = value
    End Set
  End Property

  Public Property LatestRevision() As String
    Get
      Return mLatestRevision
    End Get
    Set(ByVal value As String)
      mLatestRevision = value
    End Set
  End Property

  Public Property Number() As String
    Get
      Return mNumber
    End Get
    Set(ByVal value As String)
      mNumber = value
    End Set
  End Property

  Public Property Description() As String
    Get
      Return mDescription
    End Get
    Set(ByVal value As String)
      mDescription = value
    End Set
  End Property

  Public Property CurrentState() As String
    Get
      Return mCurrentState
    End Get
    Set(ByVal value As String)
      mCurrentState = value
    End Set
  End Property

  Public Property CheckedOutBy() As String
    Get
      Return mCheckedOutBy
    End Get
    Set(ByVal value As String)
      mCheckedOutBy = value
    End Set
  End Property
  Public Property LocalOverwrittenVersionObsolete() As Short
    Get
        Return mLocalOverwittenVersionObsolete
    End Get
    Set(ByVal value As Short)
        mLocalOverwittenVersionObsolete = value
    End Set
  End Property

  Public Property FileRefs() As List(Of FileRef)
    Get
      Return mFileRefs
    End Get
    Set(ByVal value As List(Of FileRef))
      mFileRefs = value
    End Set
  End Property

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Get a File's Thumbnail by File Version (C#)

This example shows how to get a file's thumbnail by version.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows
Forms App.
// 3. Type CallingCSharp in Project name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9. Replace the code in Form1.cs
with this code.
//10. To create the form, replace the code
in Form1.Designer.cs with
//    this code.
//11.

Add dependencies and
safely pass arrays of structures.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//
1. In the Get Thumbnail dialog, click Browse.
// 2. Navigate to a vault that contains a model with a thumbnail. Click Open.
// 3. In the Get Thumbnail dialog, click Get.
// 4. c:\temp\123456.bmp is the thumbnail of the model.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CallingCSharp
{
    public partial class Form1 : Form
    {
        //Create form
        public Form1()
        {
            InitializeComponent();
        }

        //Load form
        private void Form1_Load(System.Object sender, System.EventArgs e)
        {
            textBox1.Text = "Images will be saved as 123456.bmp in C:\\Temp. \nChange code to update the location and name if needed.";
            textBox1.Enabled = false;
        }

        //Event handler: browse button click
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            var openDlg = new OpenFileDialog();
            openDlg.Multiselect = false;
            var result = openDlg.ShowDialog();
            if(result == DialogResult.OK)
            {
                var path = openDlg.FileName;
                filePath.Text = path;
            }
        }

        //Event handler: get button click
        private void btnGet_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(filePath.Text))
            {
                MessageBox.Show("Invalid file path");
                return;
            }

            if(!System.IO.File.Exists(filePath.Text))
            {
                MessageBox.Show("Invalid file path");
                return;
            }

            IEdmVault5 vault5 = new EdmVault5();
            var vaultName = vault5.GetVaultNameFromPath(filePath.Text);
            vault5.Login("admin", "", vaultName);
            IEdmVault20 vault20 = (IEdmVault20)vault5;
            IEdmFolder5 folder5 = null;
            IEdmFile5 file5 = null;
            file5 = vault20.GetFileFromPath(filePath.Text, out folder5);
            if (file5 == null || folder5 == null)
            {
                MessageBox.Show("Invalid vault file or folder");
            }
            var fileId = file5.ID;
            var version = file5.CurrentVersion;
            IEdmFile15 file15 = (IEdmFile15)file5;
            var obj = file15.GetThumbnail2(version);

            System.Drawing.Image imgPreview = PictureDispConverter.Convert(obj);
            imgPreview.Save(@"C:\temp\123456.bmp" , System.Drawing.Imaging.ImageFormat.Bmp);
            imgPreview.Dispose();
        }
    }

    //Class1
    public class PictureDispConverter : AxHost
    {
        public PictureDispConverter()
            : base("56174C86-1546-4778-8EE6-B6AC606875E7")
        {
        }

        public static System.Drawing.Image Convert(object objIDispImage)
        {
            System.Drawing.Image objPicture = default(System.Drawing.Image);
            objPicture = (System.Drawing.Image)System.Windows.Forms.AxHost.GetPictureFromIPicture(objIDispImage);
            return objPicture;
        }

    }
}

Back to top

//Form1.Designer

namespace CallingCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnBrowse = new System.Windows.Forms.Button();
            this.filePath = new System.Windows.Forms.TextBox();
            this.btnTest = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            //
            // btnBrowse
            //
            this.btnBrowse.Location = new System.Drawing.Point(352, 12);
            this.btnBrowse.Name = "btnBrowse";
            this.btnBrowse.Size = new System.Drawing.Size(75, 23);
            this.btnBrowse.TabIndex = 0;
            this.btnBrowse.Text = "Browse";
            this.btnBrowse.UseVisualStyleBackColor = true;
            this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
            //
            // filePath
            //
            this.filePath.Enabled = false;
            this.filePath.Location = new System.Drawing.Point(12, 14);
            this.filePath.Name = "filePath";
            this.filePath.Size = new System.Drawing.Size(334, 20);
            this.filePath.TabIndex = 1;
            //
            // btnTest
            //
            this.btnTest.Location = new System.Drawing.Point(352, 59);
            this.btnTest.Name = "btnTest";
            this.btnTest.Size = new System.Drawing.Size(73, 22);
            this.btnTest.TabIndex = 2;
            this.btnTest.Text = "Get thumbnail";
            this.btnTest.UseVisualStyleBackColor = true;
            this.btnTest.Click += new System.EventHandler(this.btnGet_Click);
            //
            // textBox1
            //
            this.textBox1.Enabled = false;
            this.textBox1.Location = new System.Drawing.Point(12, 49);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(334, 42);
            this.textBox1.TabIndex = 3;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(439, 103);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.btnTest);
            this.Controls.Add(this.filePath);
            this.Controls.Add(this.btnBrowse);
            this.Name = "Form1";
            this.Text = "Get Thumbnail";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnBrowse;
        private System.Windows.Forms.TextBox filePath;
        private System.Windows.Forms.Button btnTest;
        private System.Windows.Forms.TextBox textBox1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get a File's Thumbnail Handle by File Version (C#)

This example shows how to get a file's thumbnail by version.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows
Forms App.
// 3. Type CallingCSharp in Project name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9. Replace the code in Form1.cs
with this code.
//10. To create the form, replace the code
in Form1.Designer.cs with
//    this code.
//11.

Add dependencies and
safely pass arrays of structures.
//12. Modify the vault admin password in the
code: (vault5.Login("admin", "", vaultName)).
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//
1. In the Get Thumbnail dialog, click Browse.
// 2. Navigate to a vault that contains a model with a thumbnail. Click Open.
// 3. In the Get Thumbnail dialog, click Get thumbnail.
// 4. c:\temp\123456.bmp is the thumbnail of the model.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace CallingCSharp
{
public partial class Form1 : Form
{
//Create form
public Form1()
{
InitializeComponent();
}

//Load form
private void Form1_Load(System.Object sender, System.EventArgs e)
{
textBox1.Text = "Image will be saved as 123456.bmp in C:\\Temp. \nChange code to update the location and name if needed.";
textBox1.Enabled = false;
}

//Event handler: browse button click
private void btnBrowse_Click(object sender, EventArgs e)
{
var openDlg = new OpenFileDialog();
openDlg.Multiselect = false;
var result = openDlg.ShowDialog();
if(result == DialogResult.OK)
{
var path = openDlg.FileName;
filePath.Text = path;
}
}

//Event handler: get button click
private void btnGet_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(filePath.Text))
{
MessageBox.Show("Invalid file path");
return;
}

if(!System.IO.File.Exists(filePath.Text))
{
MessageBox.Show("Invalid file path");
return;
}

IEdmVault5 vault5 = new EdmVault5();
var vaultName = vault5.GetVaultNameFromPath(filePath.Text);
vault5.Login("admin", "", vaultName);
IEdmVault20 vault20 = (IEdmVault20)vault5;
IEdmFolder5 folder5 = null;
IEdmFile5 file5 = null;
file5 = vault20.GetFileFromPath(filePath.Text, out folder5);
if (file5 == null || folder5 == null)
{
MessageBox.Show("Invalid vault file or folder");
}
var fileId = file5.ID;
var version = file5.CurrentVersion;
IEdmFile18
file18 = file5 as IEdmFile18;
var obj
= (IntPtr)file18.GetThumbnail3(version);
var imgPreview
= System.Drawing.Image.FromHbitmap(obj);
imgPreview.Save(@"C:\temp\123456.bmp", System.Drawing.Imaging.ImageFormat.Png);
imgPreview.Dispose();
}
}

Back to top

//Form1.Designer

namespace CallingCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnBrowse = new System.Windows.Forms.Button();
            this.filePath = new System.Windows.Forms.TextBox();
            this.btnTest = new System.Windows.Forms.Button();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            //
            // btnBrowse
            //
            this.btnBrowse.Location = new System.Drawing.Point(352, 12);
            this.btnBrowse.Name = "btnBrowse";
            this.btnBrowse.Size = new System.Drawing.Size(75, 23);
            this.btnBrowse.TabIndex = 0;
            this.btnBrowse.Text = "Browse";
            this.btnBrowse.UseVisualStyleBackColor = true;
            this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
            //
            // filePath
            //
            this.filePath.Enabled = false;
            this.filePath.Location = new System.Drawing.Point(12, 14);
            this.filePath.Name = "filePath";
            this.filePath.Size = new System.Drawing.Size(334, 20);
            this.filePath.TabIndex = 1;
            //
            // btnTest
            //
            this.btnTest.Location = new System.Drawing.Point(352, 59);
            this.btnTest.Name = "btnTest";
            this.btnTest.Size = new System.Drawing.Size(73, 22);
            this.btnTest.TabIndex = 2;
            this.btnTest.Text = "Get thumbnail";
            this.btnTest.UseVisualStyleBackColor = true;
            this.btnTest.Click += new System.EventHandler(this.btnGet_Click);
            //
            // textBox1
            //
            this.textBox1.Enabled = false;
            this.textBox1.Location = new System.Drawing.Point(12, 49);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(334, 42);
            this.textBox1.TabIndex = 3;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(439, 103);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.btnTest);
            this.Controls.Add(this.filePath);
            this.Controls.Add(this.btnBrowse);
            this.Name = "Form1";
            this.Text = "Get Thumbnail";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnBrowse;
        private System.Windows.Forms.TextBox filePath;
        private System.Windows.Forms.Button btnTest;
        private System.Windows.Forms.TextBox textBox1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get File Variable Data Example (C#)

This example shows how to get the card variable data for the latest version of a selected file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type FileVariableData_CSharp in Project name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with
this code.
//11. To create the form, replace the code in
Form1.Designer.cs with
//       this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//
1. Displays the File variable data dialog box.
// 2. Select a vault view.
// 3. Click Select file.
//    a. In the Select File dialog:
//       1. Click a vault file.
//       2. Click Open.
// 4. Click Get variable data.
// 5. Click OK in the message box.
// 6. Close the File variable data dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace FileVariableData_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1;
        IEdmFile7 aFile;
        IEdmFolder5 aFolder;

        IEdmEnumeratorVariable7 enumVar;
        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                IEdmVault10 vault = (IEdmVault10)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void SelectFile_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                File1List.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select File dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;

                //Show the Select File dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // do nothing
                }
                else
                {
                    foreach (string FileName in OpenFileDialog1.FileNames)
                    {
                        File1List.Items.Add(FileName);
                        aFile = (IEdmFile7)vault1.GetFileFromPath(FileName, out aFolder);
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetVarData_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                object[] ppoRetVars = null;
                string[] ppoRetConfs = null;
                EdmGetVarData poRetDat = new EdmGetVarData();

                enumVar = (IEdmEnumeratorVariable7)aFile.GetEnumeratorVariable();
                enumVar.GetVersionVars(0, aFolder.ID, out ppoRetVars, out ppoRetConfs, ref poRetDat);

                string str = null;
                str = "File variable data for " + aFile.Name + "\r\n";
                str = str + "Version: " + poRetDat.mlVersion + "\r\n";
                str = str + "Latest version: " + poRetDat.mlLatestVersion + "\r\n";
                str = str + "Revision: " + poRetDat.mbsRevision + "\r\n";
                str = str + "State: " + poRetDat.mbsState + "\r\n";
                str = str + "Workflow: " + poRetDat.mbsWorkflow + "r\\n";
                str = str + "Category: " + poRetDat.mbsCategory + "\r\n";
                str = str + "SQL Server date format code: " + poRetDat.mlDateFmt + "\r\n";
                str = str + "EdmGetVarDataFlags: " + poRetDat.mlEdmGetVarDataFlags;

                MessageBox.Show(str);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace FileVariableData_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFile = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.GetVarData = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();

            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(36, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(39, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //SelectFile
            //
            this.SelectFile.Location = new System.Drawing.Point(39, 85);
            this.SelectFile.Name = "SelectFile";
            this.SelectFile.Size = new System.Drawing.Size(157, 23);
            this.SelectFile.TabIndex = 2;
            this.SelectFile.Text = "Select file...";
            this.SelectFile.UseVisualStyleBackColor = true;
            this.SelectFile.Click +=new System.EventHandler(SelectFile_Click);
            //
            //File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(40, 114);
            this.File1List.Name = "File1List";
            this.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.File1List.Size = new System.Drawing.Size(220, 43);
            this.File1List.TabIndex = 4;
            //
            //GetVarData
            //
            this.GetVarData.Location = new System.Drawing.Point(40, 176);
            this.GetVarData.Name = "GetVarData";
            this.GetVarData.Size = new System.Drawing.Size(107, 23);
            this.GetVarData.TabIndex = 6;
            this.GetVarData.Text = "Get variable data";
            this.GetVarData.UseVisualStyleBackColor = true;
            this.GetVarData.Click +=new System.EventHandler(GetVarData_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Title = "Select File";
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 227);
            this.Controls.Add(this.GetVarData);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFile);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "File variable data";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFile;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button GetVarData;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

        #endregion
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get File Variable Data Example (VB.NET)

This example shows how to get the card variable data for the latest version of a selected file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the File variable data dialog box.
' 2. Select a vault view.
' 3. Click Select file.
'    a. In the Select File dialog:
'       1. Click a vault file.
'       2. Click Open.
' 4. Click Get variable data.
' 5. Click OK in the message box.
' 6. Close the File variable data dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5
    Dim aFile As IEdmFile7
    Dim aFolder As IEdmFolder5
    Dim enumVar As IEdmEnumeratorVariable7

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            vault1 = New EdmVault5()
            Dim vault As IEdmVault10 = DirectCast(vault1, IEdmVault10)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub SelectFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFile.Click
        Try
            File1List.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select File dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select File dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' do nothing
            Else
                For Each FileName As String In OpenFileDialog1.FileNames
                    File1List.Items.Add(FileName)
                    aFile = vault1.GetFileFromPath(FileName, aFolder)
                Next
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetVarData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetVarData.Click
        Try

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim ppoRetVars() As Object = Nothing
            Dim ppoRetConfs() As String = Nothing
            Dim poRetDat As EdmGetVarData = Nothing

            enumVar = aFile.GetEnumeratorVariable()
            enumVar.GetVersionVars(0, aFolder.ID, ppoRetVars, ppoRetConfs, poRetDat)

            Dim str As String
            str = "File variable data for " & aFile.Name & vbLf
            str = str & "Version: " & poRetDat.mlVersion & vbLf
            str = str & "Latest version: " & poRetDat.mlLatestVersion & vbLf
            str = str & "Revision: " & poRetDat.mbsRevision & vbLf
            str = str & "State: " & poRetDat.mbsState & vbLf
            str = str & "Workflow: " & poRetDat.mbsWorkflow & vbLf
            str = str & "Category: " & poRetDat.mbsCategory & vbLf
            str = str & "SQL Server date format code: " & poRetDat.mlDateFmt & vbLf
            str = str & "EdmGetVarDataFlags: " & poRetDat.mlEdmGetVarDataFlags

            MsgBox(str)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFile = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.GetVarData = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(36, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(39, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFile
        '
        Me.SelectFile.Location = New System.Drawing.Point(39, 85)
        Me.SelectFile.Name = "SelectFile"
        Me.SelectFile.Size = New System.Drawing.Size(157, 23)
        Me.SelectFile.TabIndex = 2
        Me.SelectFile.Text = "Select file..."
        Me.SelectFile.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(40, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.File1List.Size = New System.Drawing.Size(220, 43)
        Me.File1List.TabIndex = 4
        '
        'GetVarData
        '
        Me.GetVarData.Location = New System.Drawing.Point(40, 176)
        Me.GetVarData.Name = "GetVarData"
        Me.GetVarData.Size = New System.Drawing.Size(107, 23)
        Me.GetVarData.TabIndex = 6
        Me.GetVarData.Text = "Get variable data"
        Me.GetVarData.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 227)
        Me.Controls.Add(Me.GetVarData)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFile)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "File variable data"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFile As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents GetVarData As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get File Version Information Example (C#)

This example shows how to get the version information of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
// 3. Type GetFileVersionsCSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Version Information dialog box.
//     a. Select a vault view.
//     b. Click Browse.
//     c. In the Select a file dialog:
//        1. Click a file in the vault.
//        2. Click Open.
//  2. Click Get file's version information.
//  3. Displays a message box containing the file name, number of versions, and
//     each version number, date, user, file size, and comments, if any.
//  4. Click OK to close the message box.
//  5. Close the Version Information dialog box.
//----------------------------------------------------------------------------
//Form1.cs

using EPDM.Interop.epdm;
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace GetFileVersionsCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private IEdmVault5 vault1 = null;
        IEdmFile5 aFile;

        public void GetFileVersionsCSharp_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Select a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // Do nothing
                }
                else
                {
                    // Browse for file whose versions to get
                    string FileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(FileName);
                    IEdmFolder5 retFolder = default(IEdmFolder5);
                    aFile = vault1.GetFileFromPath(FileName, out retFolder);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void Button1_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmFile5 file = null;
                file = aFile;
                IEdmEnumeratorVersion5 enumVersion;
                enumVersion = (IEdmEnumeratorVersion5)file;
                IEdmPos5 pos = default(IEdmPos5);
                pos = enumVersion.GetFirstVersionPosition();
                IEdmVersion7 version = default(IEdmVersion7);
                string message = null;
                message = "History of " + file.Name + ": " + "\n";
                message = message + "Number of versions: " + enumVersion.VersionCount.ToString() + "\n";
                message = message + "\n";
                string str = null;
                while (!pos.IsNull)
                {
                    version = (IEdmVersion7)enumVersion.GetNextVersion(pos);
                    str = "Version: " + version.VersionNo.ToString();
                    message = message + str;
                    str = version.VersionDate.ToString();
                    message = message + ", file date = " + str + ", user = " + version.User.Name;
                    str = version.FileSize2.ToString();
                    message = message + ", file size = " + str + " bytes, comment = " + version.Comment + "\n";
                }

                MessageBox.Show(message);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
Back to top
//Form1.Designer.cs
namespace GetFileVersionsCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Button1 = new System.Windows.Forms.Button();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.Label1 = new System.Windows.Forms.Label();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.SuspendLayout();
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.Location = new System.Drawing.Point(12, 37);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(161, 21);
            this.VaultsComboBox.TabIndex = 7;
            //
            //Button1
            //
            this.Button1.Location = new System.Drawing.Point(12, 135);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(158, 23);
            this.Button1.TabIndex = 4;
            this.Button1.Text = "Get file's version information";
            this.Button1.UseVisualStyleBackColor = true;
            this.Button1.Click += new System.EventHandler(Button1_Click);
            //
            //BrowseButton
            //
            this.BrowseButton.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
            this.BrowseButton.Location = new System.Drawing.Point(179, 83);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(60, 28);
            this.BrowseButton.TabIndex = 5;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(BrowseButton_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select a file";
            //
            //Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(12, 21);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(91, 13);
            this.Label1.TabIndex = 6;
            this.Label1.Text = "Select vault view:";
            //
            //FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(12, 81);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(161, 30);
            this.FileListBox.TabIndex = 8;
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(252, 175);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.VaultsComboBox);
            this.Name = "Form1";
            this.Text = "Version Information";
            this.Load += new System.EventHandler(this.GetFileVersionsCSharp_Load);

            this.ResumeLayout(false);
            this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.ComboBox VaultsComboBox;
    private System.Windows.Forms.Button BrowseButton;
    private System.Windows.Forms.Button Button1;
    private System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    private System.Windows.Forms.Label Label1;
    private System.Windows.Forms.ListBox FileListBox;

    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get File Version Information Example (VB.NET)

This example shows how to get the version information of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetFileVersionsVBNET in Project name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.

' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.

' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Version Information dialog box.
'     a. Select a vault view.
'     b. Click Browse.
'     c. In the Select a file dialog:
'        1. Click a file in the vault.
'        2. Click Open.
'  2. Click Get file's version information.
'  3. Displays a message box containing the file name, number of versions, and
'     each version's number, date, user, file size, and comments, if any.
'  4. Click OK to close the message box.
'  5. Close the Version Information dialog box.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim aPos As IEdmPos5

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Select a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select a file dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' Do nothing
            Else
                ' Browse for file whose versions to get
                Dim FileName As String = OpenFileDialog1.FileName
                FileListBox.Items.Add(FileName)
                aFile = vault1.GetFileFromPath(FileName)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim file As IEdmFile5 = Nothing
            file = aFile
            Dim enumVersion = DirectCast(file, IEdmEnumeratorVersion5)
            Dim pos As IEdmPos5
            pos = enumVersion.GetFirstVersionPosition
            Dim version As IEdmVersion7
            Dim message As String
            message = "History of " + file.Name + ": " + vbLf
            message = message + vbLf + "Number of versions: " + enumVersion.VersionCount.ToString + vbLf
            message = message + vbLf
            Dim str As String
            While Not pos.IsNull
                version = enumVersion.GetNextVersion(pos)
                str = "Version: " + version.VersionNo.ToString
                message = message + str
                str = version.VersionDate
                message = message + ", file date = " & str + ", user = " + version.User.Name
                str = version.FileSize2
                message = message + ", file size = " + str + " bytes, comment = " + version.Comment + vbLf
            End While

            MsgBox(message)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.Location = New System.Drawing.Point(12, 37)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(161, 21)
        Me.VaultsComboBox.TabIndex = 7
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(12, 135)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(158, 23)
        Me.Button1.TabIndex = 4
        Me.Button1.Text = "Get file's version information"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'BrowseButton
        '
        Me.BrowseButton.ImageAlign = System.Drawing.ContentAlignment.TopLeft
        Me.BrowseButton.Location = New System.Drawing.Point(179, 83)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(60, 28)
        Me.BrowseButton.TabIndex = 5
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select a file"
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(12, 21)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 6
        Me.Label1.Text = "Select vault view:"
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(12, 81)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(161, 30)
        Me.FileListBox.TabIndex = 8
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(252, 175)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Name = "Form1"
        Me.Text = "Version Information"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Get Files in Workflow State Example (C#)

This example shows how to get all of the files in a particular workflow state.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type GetFilesInState_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form,
replace the code in Form1.Designer.cs with this code.
//12. Ensure that you have at least one approved file in the vault.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Get
files in state dialog box.
// 2. Select a vault view.
// 3. Click Get
approved files.
//
4. Displays a message box with all of the files in the Approved state
//    for each workflow in the vault.
// 5. Click OK in each message box.
// 6. Close the Get
files in state dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace GetFilesInState_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;
        IEdmItem item;
        IEdmFile8 fileInt;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetApprovedFiles_Click(System.Object sender, System.EventArgs e)
        {
            //Get approved files
            try
            {

                IEdmVault7 vault2 = default(IEdmVault7);
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmWorkflowMgr6 wfmgr = (IEdmWorkflowMgr6)vault2.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr);

                IEdmPos5 pos = default(IEdmPos5);
                pos = wfmgr.GetFirstWorkflowPosition();
                while (!pos.IsNull)
                {
                    IEdmWorkflow6 wf = wfmgr.GetNextWorkflow(pos);

                    IEdmState6 state = default(IEdmState6);
                    state = wf.GetState("Approved");
                    if ((state != null))
                    {

                        string message = null;
                        IEdmFile5 file = default(IEdmFile5);
                        IEdmPos5 pos2 = default(IEdmPos5);
                        pos2 = state.GetFirstFilePosition();

                        if (!pos2.IsNull)
                        {
                            message = "These files are approved in workflow, " + wf.Name + ":" + "\n";

                            while (!pos2.IsNull)
                            {
                                file = state.GetNextFile(pos2);
                                message = message + file.Name + "\n";
                            }

                            MessageBox.Show(message);
                        }
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace GetFilesInState_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.GetApprovedFiles = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //GetApprovedFiles
            //
            this.GetApprovedFiles.Location = new System.Drawing.Point(16, 86);
            this.GetApprovedFiles.Name = "GetApprovedFiles";
            this.GetApprovedFiles.Size = new System.Drawing.Size(139, 23);
            this.GetApprovedFiles.TabIndex = 5;
            this.GetApprovedFiles.Text = "Get approved files";
            this.GetApprovedFiles.UseVisualStyleBackColor = true;
            this.GetApprovedFiles.Click +=new System.EventHandler(GetApprovedFiles_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(216, 137);
            this.Controls.Add(this.GetApprovedFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get files in state";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button GetApprovedFiles;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Files in Workflow State Example (VB.NET)

This example shows how to get all of the files in a particular workflow state.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetFilesInState in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Ensure that you have at least one approved file in the vault.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Get files in state dialog box.
' 2. Select a vault view.
' 3. Click Get approved files.
' 4. Displays a message box with all of the files in the Approved state
'    for each workflow in the vault.
' 5. Click OK in each message box.
' 6. Close the Get files in state dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim item As IEdmItem
    Dim fileInt As IEdmFile8

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetApprovedFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetApprovedFiles.Click
        'Get approved files
        Try

            Dim vault2 As IEdmVault7
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            vault2 = vault1
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim wfmgr As IEdmWorkflowMgr6 = vault2.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr)

            Dim pos As IEdmPos5
            pos = wfmgr.GetFirstWorkflowPosition()
            While Not pos.IsNull
                Dim wf As IEdmWorkflow6 = wfmgr.GetNextWorkflow(pos)

                Dim state As IEdmState6
                state = wf.GetState("Approved")

                If Not state Is Nothing Then

                    Dim message As String
                    Dim file As IEdmFile5
                    Dim pos2 As IEdmPos5
                    pos2 = state.GetFirstFilePosition

                    If Not pos2.IsNull Then
                        message = "These files are approved in workflow, " & wf.Name & ":" + vbLf
                        While Not pos2.IsNull
                            file = state.GetNextFile(pos2)
                            message = message + file.Name + vbLf
                        End While
                        MessageBox.Show(message)
                    End If
                End If
            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.GetApprovedFiles = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'GetApprovedFiles
        '
        Me.GetApprovedFiles.Location = New System.Drawing.Point(16, 86)
        Me.GetApprovedFiles.Name = "GetApprovedFiles"
        Me.GetApprovedFiles.Size = New System.Drawing.Size(139, 23)
        Me.GetApprovedFiles.TabIndex = 5
        Me.GetApprovedFiles.Text = "Get approved files"
        Me.GetApprovedFiles.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(216, 137)
        Me.Controls.Add(Me.GetApprovedFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get files in state"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents GetApprovedFiles As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get File's State Transitions Example (C#)

This example shows how to get a file's current and next possible state transitions.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type StatesCSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. Ensure that the vault contains a file in a workflow state.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the State Transitions dialog box.
// 2. Select a vault view.
// 3. Click Browse.
// 4. Displays the Select a file dialog box.
//    a. Select a file in the selected vault.
//    b. Click Open.
//    The selected file's path and file name appear
//    in the Select a file dialog box.
// 5. Click Get state transitions.
// 6. Displays a message box showing the name of the selected
//    file and its current and next possible state transitions.
// 7. Click OK to close the message box.
// 8.
Displays a message box showing whether the logged-in
user must
//    add comment when transitioning the selected file to one of
its next
//    possible states.
// 9. Click OK to close the message box.
//10. Displays a message box with the archive server log.
//11. Click OK to close the message box.
//12. Close the State Transitions dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace StatesCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmFile5 aFile;

        void Form1_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetTransitionButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmVault20 vault2;
                vault2 = (IEdmVault20)vault1;

                //Get the file's current workflow state
                IEdmState5 workflowState = default(IEdmState5);
                workflowState = aFile.CurrentState;

                //Start an enumeration of the transitions to
                //and from the file's current workflow state
                IEdmPos5 pos = default(IEdmPos5);
                pos = workflowState.GetFirstTransitionPosition();

                //Make sure current workflow state
                //has a next transition state
                //If not, exit application
                if (pos.IsNull)
                {
                    MessageBox.Show("No next possible transition states.");
                    return;
                }

                IEdmTransition10 transition = default(IEdmTransition10);

                //Get the file's next possible transition to or from
                //the file's current workflow state
                transition = (IEdmTransition10)workflowState.GetNextTransition(pos);

                string message = "Current state for " + aFile.Name + ": " + "\n";
                message = message + " * " + workflowState.Name + "\n" + "\n";
                message = message + "Next possible state transitions for " + aFile.Name + ":" + "\n";
                message = message + "  * " + transition.Name + "\n";
                //message = message + "    Requires authentication? " + transition.Authentication.ToString() + "\n";

                //Iterate through the file's remaining next possible state
                //transitions to or from the file's current workflow state
                while ((!pos.IsNull))
                {
                    transition = (IEdmTransition10)workflowState.GetNextTransition(pos);
                    message = message + "  * " + transition.Name + "\n";
                    //message = message + "    Requires authentication? " + transition.Authentication.ToString() + "\n";
                }

                //Display a message box showing the file's name and its
                //next possible state transitions
                MessageBox.Show(message);

                IEdmUserMgr10 userMgr;
                userMgr = (IEdmUserMgr10)vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr);

                IEdmUser5 user;
                user = userMgr.GetLoggedInUser();

                int[] files = new int[1];
                files[0] = aFile.ID;

                string[] transitions = new string[1];
                transitions[0] = transition.Name;  //a possible transition

                bool[] permBool = new bool[1];
                permBool = vault2.GetTransitionCommentPermissions(user.ID, files, transitions);

                message = "Logged-in user, " + user.Name + ", must add a state change comment on " + transition.Name + " for " + aFile.Name + "? " + permBool[0];

                //Display a message box showing whether the logged-in user must add a comment
                //when transitioning the file to one of the next possible states
                MessageBox.Show(message);

                //Display a message box with the archive server's log
                string asLog = "";
                vault2.GetArchiveServerLog(out asLog);
                message = "Archive server log: " + asLog;
                MessageBox.Show(message);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //If one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                //Set the initial directory in the Select a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    //Do nothing
                }
                else
                {
                    //Browse for a file whose next possible state
                    //transitions to get
                    string fileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(fileName);
                    IEdmFolder5 retFolder = default(IEdmFolder5);
                    aFile = vault1.GetFileFromPath(fileName, out retFolder);

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}

Back to top

//Form1.Designer.cs

namespace StatesCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.GetTransitionButton = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 22);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 39);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(221, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(16, 96);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(179, 30);
            this.FileListBox.TabIndex = 2;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(209, 96);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(75, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(BrowseButton_Click);
            //
            // GetTransitionButton
            //
            this.GetTransitionButton.Location = new System.Drawing.Point(16, 150);
            this.GetTransitionButton.Name = "GetTransitionButton";
            this.GetTransitionButton.Size = new System.Drawing.Size(188, 23);
            this.GetTransitionButton.TabIndex = 4;
            this.GetTransitionButton.Text = "Get next possible state transitions";
            this.GetTransitionButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.GetTransitionButton.UseVisualStyleBackColor = true;
            this.GetTransitionButton.Click += new System.EventHandler(GetTransitionButton_Click);
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select a file";
            //

            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 200);
            this.Controls.Add(this.GetTransitionButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Workflow State Transitions";
            this.ResumeLayout(false);
            this.PerformLayout();
            this.Load += new System.EventHandler(Form1_Load);

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.ListBox FileListBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.Button GetTransitionButton;
        private System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get File's State Transitions Example (VB.NET)

This example shows how to get a file's current and next possible state transitions.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
' 3. Type StatesVBNET in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Ensure that the vault contains a file in a workflow state.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the State Transitions dialog box.
' 2. Select a vault view.
' 3. Click Browse.
' 4. Displays the Select a file dialog box.
'    a. Select a file in the selected vault.
'    b. Click Open.
'    The selected file's path and file name appear
'    in the Select a file dialog box.
' 5. Click Get state transitions.
' 6. Displays a message box showing the name of the selected
'    file and its current and next possible state transitions.
' 7. Click OK to close the message box.
' 8. Displays a message box showing whether the logged-in user must
'    add a comment when transitioning the selected file to one of its next
'    possible states.
' 9. Click OK to close the message box.
'10. Displays a message box with the archive server log.
'11. Click OK to close the message box.
'12. Close the State Transitions dialog box.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetTransitionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetTransitionButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim vault2 As IEdmVault20
            vault2 = vault1

            'Get the file's current workflow state
            Dim workflowState As IEdmState5
            workflowState = aFile.CurrentState

            'Start an enumeration of the transitions to
            'and from the file's current workflow state
            Dim pos As IEdmPos5
            pos = workflowState.GetFirstTransitionPosition

            'Make sure current workflow state
            'has a next transition state
            'If not, exit application
            If pos.IsNull Then
                MessageBox.Show("No next possible transition states.")
                Exit Sub
            End If

            Dim transition As IEdmTransition10

            'Get the file's next possible transition to or from
            'the file's current workflow state
            transition = workflowState.GetNextTransition(pos)

            Dim message As String = "Current state for " + aFile.Name + ": " + vbLf
            message = message + "  * " + workflowState.Name + vbLf + vbLf
            message = message + "Next possible state transitions for " + aFile.Name + ":" + vbLf
            message = message + "  * " + transition.Name + vbLf
            'message = message + "    Requires authentication? " + transition.Authentication.ToString + vbLf

            'Iterate through the file's remaining next possible
            'transitions to or from the file's current workflow state
            While (Not pos.IsNull)
                transition = workflowState.GetNextTransition(pos)
                message = message + "  * " + transition.Name + vbLf
                'message = message + "    Requires authentication? " + transition.Authentication.ToString + vbLf
            End While

            'Display a message box showing the file's name and its
            'next possible state transitions
            MessageBox.Show(message)

        Dim userMgr As IEdmUserMgr10
            userMgr = vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr)
            Dim user As IEdmUser5
            user = userMgr.GetLoggedInUser()
            Dim files(0) As Integer
            files(0) = aFile.ID
            Dim transitions(0) As String
            transitions(0) = transition.Name 'a possible transition
            Dim permBool As Object

            permBool = vault2.GetTransitionCommentPermissions(user.ID, files, transitions)
            message = "Logged-in user, " & user.Name & ", must add a state change comment on " & transition.Name & " for " & aFile.Name & "? " & permBool(0)

        'Display a message box showing whether the logged-in user must add a comment
            'when transitioning the file to one of the next possible states
            MessageBox.Show(message)

'Display a message box with the archive server log
Dim asLog As String = ""
vault1.GetArchiveServerLog(asLog)
message = "Archive server log: " & asLog
            MessageBox.Show(message)

        Catch ex As System.Runtime.InteropServices.COMException

            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click

        Try

            'If one hasn't been created yet

            If vault1 Is Nothing Then

                vault1 = New EdmVault5()

            End If

            If Not vault1.IsLoggedIn Then

                'Log into selected vault as the current user

                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())

            End If

            'Set the initial directory in the Select a file dialog

            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath

            'Show the Select a file dialog

            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing

            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then

                'Do nothing

            Else

                'Browse for a file whose next possible state

                'transitions to get

                Dim fileName As String = OpenFileDialog1.FileName

                FileListBox.Items.Add(fileName)

                aFile = vault1.GetFileFromPath(fileName)

            End If

        Catch ex As System.Runtime.InteropServices.COMException

            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.GetTransitionButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.VaultsLabel.Location = New System.Drawing.Point(25, 28)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(28, 44)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(190, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(28, 97)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(190, 17)
        Me.FileListBox.TabIndex = 3
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select a file"
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(236, 97)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(56, 23)
        Me.BrowseButton.TabIndex = 4
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'GetTransitionButton
        '
        Me.GetTransitionButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.GetTransitionButton.Location = New System.Drawing.Point(28, 152)
        Me.GetTransitionButton.Name = "GetTransitionButton"
        Me.GetTransitionButton.Size = New System.Drawing.Size(201, 23)
        Me.GetTransitionButton.TabIndex = 5
        Me.GetTransitionButton.Text = "Get next possible state transitions"
        Me.GetTransitionButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.GetTransitionButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(323, 184)
        Me.Controls.Add(Me.GetTransitionButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Workflow State Transitions"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents GetTransitionButton As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get Histories of Files Example (C#)

This example shows how to update version comments and get histories of files.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type GetHistories_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the
form, replace the code in Form1.Designer.cs with
//    this code.
//12. Ensure that the vault contains a checked-in
file with two versions.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays
the Get histories dialog box.
//     a. Select a vault view.
//     b. Click Select a
file.
//     c. In the Select File dialog:
//        1. Select one
or more checked-in vault files.
//        2. Click Open.
//        3. Updates all version comments for
the selected files to
//           "New comment".
//     d. Click Get
history.
//     e. Displays a message box for each history item.
//     f. Observe the updated version comments.
//     g. Click OK to close each message box.
//     h. Click Roll back to first version.
//        Rolls back the selected file to its
first version.
//     i. Click Get history.
//        A message box displays one history
item.
//  2. Close the Get histories dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace GetHistories_CSharp
{

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;
IEdmHistory3 history;
IEdmHistoryUpdate historyUpdate;
IEdmFolder5 ppoRetParentFolder;
IEdmFile5 aFile;
EdmHistoryItem rollbackItem;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void SelectFiles_Click(System.Object sender, System.EventArgs e)
{
try
{
File1List.Items.Clear();

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;

if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Select File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
//Show the Select File dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = OpenFileDialog1.ShowDialog();
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

historyUpdate = (IEdmHistoryUpdate)vault2.CreateUtility(EdmUtility.EdmUtil_HistoryUpdate);

foreach (string FileName in OpenFileDialog1.FileNames)
{
File1List.Items.Add(FileName);
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
// Update all version comments for the selected files
historyUpdate.UpdateVersionComment(aFile.ID, -1, "New comment");
}

historyUpdate.CommitUpdates();

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void GetHistories_Click(System.Object sender, System.EventArgs e)
{

try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

history = (IEdmHistory3)vault2.CreateUtility(EdmUtility.EdmUtil_History);

foreach (string FileName in OpenFileDialog1.FileNames)
{
aFile = vault1.GetFileFromPath(FileName, out ppoRetParentFolder);
// Add each file selected to the set of files for which to get histories
history.AddFile(aFile.ID);
}

EdmHistoryItem[] ppoRethistory = null;
history.GetSortedHistory(ref ppoRethistory, (int)EdmHistoryType.Edmhist_FileVersion);

string str = null;
string evDesc
= "";

foreach (EdmHistoryItem item in ppoRethistory)
{
evDesc = history.GetEventDescription(item, (int)EdmLangCode.LanEng);
str = "History of " + item.mbsItemName + "\n";
str = str + "Event description: " + evDesc +
"\n";
str = str + "Type
of history record as defined in EdmHistoryType: " + item.meType + "\n";
str = str + "Date: " + item.moDate + "\n";
str = str + "Version: " + item.mlVersion + "\n";
str = str + "User ID: " + item.mlUserID + "\n";
str = str + "File ID: " + item.mlFileID + "\n";
str = str + "Folder ID: " + item.mlFolderID + "\n";
str = str + "User name: " + item.mbsUserName + "\n";
str = str + "Comment: " + item.mbsComment + "\n";
str = str + "\n";
MessageBox.Show(str);
rollbackItem = item;
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

        public void Rollback_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                if (history != null & aFile != null )
                {
                    history.Rollback(rollbackItem);

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

    }
}

Back to top

//Form1.Designer.cs

namespace GetHistories_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SelectFiles = new System.Windows.Forms.Button();
            this.File1List = new System.Windows.Forms.ListBox();
            this.GetHistories = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(12, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(15, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // SelectFiles
            //
            this.SelectFiles.Location = new System.Drawing.Point(15, 85);
            this.SelectFiles.Name = "SelectFiles";
            this.SelectFiles.Size = new System.Drawing.Size(88, 23);
            this.SelectFiles.TabIndex = 2;
            this.SelectFiles.Text = "Select a file...";
            this.SelectFiles.UseVisualStyleBackColor = true;
            this.SelectFiles.Click += new System.EventHandler(this.SelectFiles_Click);
            //
            // File1List
            //
            this.File1List.FormattingEnabled = true;
            this.File1List.HorizontalScrollbar = true;
            this.File1List.Location = new System.Drawing.Point(15, 114);
            this.File1List.Name = "File1List";
            this.File1List.Size = new System.Drawing.Size(257, 56);
            this.File1List.TabIndex = 4;
            //
            // GetHistories
            //
            this.GetHistories.Location = new System.Drawing.Point(64, 193);
            this.GetHistories.Name = "GetHistories";
            this.GetHistories.Size = new System.Drawing.Size(157, 23);
            this.GetHistories.TabIndex = 6;
            this.GetHistories.Text = "Get history";
            this.GetHistories.UseVisualStyleBackColor = true;
            this.GetHistories.Click += new System.EventHandler(this.GetHistories_Click);
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = false;
            this.OpenFileDialog1.Title = "Select File";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(64, 235);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(157, 23);
            this.button1.TabIndex = 7;
            this.button1.Text = "Roll back to first version";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.Rollback_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 280);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.GetHistories);
            this.Controls.Add(this.File1List);
            this.Controls.Add(this.SelectFiles);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get histories";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion
        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button SelectFiles;
        internal System.Windows.Forms.ListBox File1List;
        internal System.Windows.Forms.Button GetHistories;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
        private System.Windows.Forms.Button button1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Histories of Files Example (VB.NET)

This example shows how to update version comments and get histories of files.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetHistories_VBNET in Project name.
 ' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Ensure that the vault contains a checked-in file with two versions.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Get histories dialog box.
'    a. Select a vault view.
'    b. Click Select a file.
'    c. In the Select File dialog:
'       1. Select a checked-in vault file.
'       2. Click Open.
'       3. Updates all version comments for the selected file to
'          "New comment".
'    d. Click Get history.
'    e. Displays a message box for each history item.
'    f. Observe the updated version comments.
'    g. Click OK to close each message box.
'    h. Click Roll back to first version.
'       Rolls back the selected file to its first version.
'    i. Click Get history.
'       A message box displays one history item.
' 2. Close the Get histories dialog box.
'----------------------------------------------------------------------------
'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim history As IEdmHistory3
    Dim historyUpdate As IEdmHistoryUpdate
    Dim aFile As IEdmFile5

    Dim rollbackItem As EdmHistoryItem = Nothing

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
Dim vault1 As IEdmVault5 = New EdmVault5()
Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
Dim Views As EdmViewInfo() = Nothing

vault.GetVaultViews(Views, False)
VaultsComboBox.Items.Clear()
For Each View As EdmViewInfo In Views
VaultsComboBox.Items.Add(View.mbsVaultName)
Next
If VaultsComboBox.Items.Count > 0 Then
VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
End If
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub SelectFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFiles.Click
Try
File1List.Items.Clear()

Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)

If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

'Set the initial directory in the Select File dialog
OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
'Show the Select File dialog
Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
DialogResult = OpenFileDialog1.ShowDialog()
If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
Return
End If

historyUpdate = vault2.CreateUtility(EdmUtility.EdmUtil_HistoryUpdate)

For Each FileName As String In OpenFileDialog1.FileNames
File1List.Items.Add(FileName)
aFile = vault1.GetFileFromPath(FileName)
' Update all version comments for the selected files
historyUpdate.UpdateVersionComment(aFile.ID, -1, "New comment")
Next

historyUpdate.CommitUpdates()

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub GetHistories_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetHistories.Click
Try

Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)
If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

history = vault2.CreateUtility(EdmUtility.EdmUtil_History)

For Each FileName As String In OpenFileDialog1.FileNames
aFile = vault1.GetFileFromPath(FileName)
' Add each file selected to the set of files for which to get histories
history.AddFile(aFile.ID)
Next

Dim ppoRethistory() As EdmHistoryItem = Nothing
history.GetSortedHistory(ppoRethistory, EdmHistoryType.Edmhist_FileVersion)

Dim str As String
Dim evDesc As String

For Each item As EdmHistoryItem In ppoRethistory
evDesc = history.GetEventDescription(item, EdmLangCode.LanEng)
str = "History of " & item.mbsItemName & vbLf
str = str & "Event description: " & evDesc &
vbLf
str = str & "Type
of history record as defined in EdmHistoryType: " & item.meType & vbLf
str = str & "Date: " & item.moDate & vbLf
str = str & "Version: " & item.mlVersion & vbLf
str = str & "User ID: " & item.mlUserID & vbLf
str = str & "File ID: " & item.mlFileID & vbLf
str = str & "Folder ID: " & item.mlFolderID & vbLf
str = str & "User name: " & item.mbsUserName & vbLf
str = str & "Comment: " & item.mbsComment & vbLf
str = str & vbLf
MessageBox.Show(str)
rollbackItem = item
Next

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

    Public Sub Rollback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetHistories.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            If Not aFile Is Nothing And Not history Is Nothing Then

                'Roll back to the file's first version, which is the last history item reported above
                history.Rollback(rollbackItem)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SelectFiles = New System.Windows.Forms.Button()
        Me.File1List = New System.Windows.Forms.ListBox()
        Me.GetHistories = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.Rollback = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(12, 24)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(15, 40)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'SelectFiles
        '
        Me.SelectFiles.Location = New System.Drawing.Point(15, 85)
        Me.SelectFiles.Name = "SelectFiles"
        Me.SelectFiles.Size = New System.Drawing.Size(88, 23)
        Me.SelectFiles.TabIndex = 2
        Me.SelectFiles.Text = "Select a file..."
        Me.SelectFiles.UseVisualStyleBackColor = True
        '
        'File1List
        '
        Me.File1List.FormattingEnabled = True
        Me.File1List.HorizontalScrollbar = True
        Me.File1List.Location = New System.Drawing.Point(15, 114)
        Me.File1List.Name = "File1List"
        Me.File1List.Size = New System.Drawing.Size(257, 43)
        Me.File1List.TabIndex = 4
        '
        'GetHistories
        '
        Me.GetHistories.Location = New System.Drawing.Point(54, 172)
        Me.GetHistories.Name = "GetHistories"
        Me.GetHistories.Size = New System.Drawing.Size(157, 23)
        Me.GetHistories.TabIndex = 6
        Me.GetHistories.Text = "Get history"
        Me.GetHistories.UseVisualStyleBackColor = True
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = False
        Me.OpenFileDialog1.Title = "Select File"
        '
        'Rollback
        '
        Me.Rollback.Location = New System.Drawing.Point(54, 214)
        Me.Rollback.Name = "Rollback"
        Me.Rollback.Size = New System.Drawing.Size(157, 23)
        Me.Rollback.TabIndex = 7
        Me.Rollback.Text = "Roll back to first version"
        Me.Rollback.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 259)
        Me.Controls.Add(Me.Rollback)
        Me.Controls.Add(Me.GetHistories)
        Me.Controls.Add(Me.File1List)
        Me.Controls.Add(Me.SelectFiles)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get histories"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents SelectFiles As System.Windows.Forms.Button
    Friend WithEvents File1List As System.Windows.Forms.ListBox
    Friend WithEvents GetHistories As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Rollback As Button
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get Menu Command Items Example (C#)

This example shows how to get add-in menu command items.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Console > Console App.
// 3. Type MenuCSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Replace the code in Program.cs with this code.
// 9. Add dependencies and
safely pass arrays of structures.
//10. Add System.Windows.Forms as a reference.
//11. Replace ACME_LAB with the name of a valid vault view.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the command window.
// 2. Displays a message box for each add-in menu command item.
// 3. Click OK to close each message box.
// 4. Displays the menu in the upper-left corner of the desktop.
// 5. Click First Command in the menu.
// 6. Click OK to close the message box.
// 7. Click the command window and press any key.
// 8. Closes the command window and exits the application.
//--------------------------------------------------------------------------------------

//Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;

namespace MenuCSharp
{
    class Program
    {
        static EdmVault5 vault;

        static Form frmParent;
        static void Main(string[] args)
        {
            try
            {
                //Create a vault interface
                vault = new EdmVault5();

                //Log into vault
                vault.LoginAuto("ACME_LAB", 0);

                //Show menu
                ShowMenu((IEdmVault12)vault);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
        private static void ShowMenu(IEdmVault12 vault)
        {
            //Create a context-sensitive menu
            //using Windows InsertMenu function
            System.Windows.Forms.ContextMenu mnu = default(System.Windows.Forms.ContextMenu);
            mnu = new System.Windows.Forms.ContextMenu();

            InsertMenu((IntPtr)mnu.Handle, 0, 0, (IntPtr)100, "First Command");
            InsertMenu((IntPtr)mnu.Handle, 0, 0, (IntPtr)101, "Second Command");
            InsertMenu((IntPtr)mnu.Handle, 0, 0, (IntPtr)102, "Third Command");

            //Create a selection list with all files in the root folder
            IEdmSelectionList5 selList = default(IEdmSelectionList5);
            selList = new EdmSelectionList5();

            IEdmFolder6 folder = default(IEdmFolder6);
            folder = (IEdmFolder6)vault.RootFolder;
            IEdmPos5 pos = default(IEdmPos5);
            pos = folder.GetFirstFilePosition();
            while (!pos.IsNull)
            {
                IEdmFile8 file = default(IEdmFile8);
                file = (IEdmFile8)folder.GetNextFile(pos);
                EdmSelectionObject obj = default(EdmSelectionObject);
                obj.mbsPath = file.GetLocalPath(folder.ID);
                obj.meType = file.ObjectType;
                obj.mlID = file.ID;
                obj.mlProjectID = folder.ID;
                ((IEdmSelectionList6)selList).AddTail2(obj);
            }

            //Add menu items for registered add-ins
            int count = 0;
            count = 0;
            int startID = 0;
            startID = 200;
            IEdmMenu7 menuCallback = default(IEdmMenu7);
            EdmCmdInfo[] ppoRetItems = null;
            menuCallback = vault.CreatePluginMenu2(mnu.Handle.ToInt32(), 3, ref startID, (IEdmSelectionList6)selList, (int)CreateMenuFlags.Cmf_ContextMenu, out count);
            menuCallback.GetItems((int)EdmMenuFlags.EdmMenu_Nothing, out ppoRetItems);

            string str = null;
            foreach (EdmCmdInfo item in ppoRetItems)
            {
                str = "Add-in menu command item: " + "\r\n";
                str = str + "Command ID: " + item.mlCmdID + "\r\n";
                str = str + "Command string: " + item.mbsCmdStr + "\r\n";
                str = str + "Tooltip: " + item.mbsTooltip + "\r\n";
                str = str + "Status bar help: " + item.mbsStatusBarHelp + "\r\n";
                str = str + "EdmMenuFlags: " + item.mlEdmMenuFlags;
                MessageBox.Show(str);
            }

            //Display the menu using Windows TrackPopupMenu function
            int TPM_RETURNCMD = 0;
            TPM_RETURNCMD = 256;
            int cmdID = 0;
            frmParent = new Form();
            cmdID = TrackPopupMenu((IntPtr)mnu.Handle, TPM_RETURNCMD, frmParent.Left, frmParent.Top, 0, (IntPtr)frmParent.Handle, (IntPtr)0);

            //Run the selected command
            switch (cmdID)
            {
                case 100:
                    MessageBox.Show("First command");
                    break;
                case 101:
                    MessageBox.Show("Second command");
                    break;
                case 102:
                    MessageBox.Show("Third command");
                    break;
                default:
                    MessageBox.Show(cmdID);
                    break;
            }
        }
        [DllImport("user32", EntryPoint = "InsertMenuA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        private static extern bool InsertMenu(System.IntPtr hMenu, int uPosition, int uFlags, System.IntPtr uIDNewItem, string lpNewItem);
        [DllImport("user32", EntryPoint = "TrackPopupMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

        private static extern int TrackPopupMenu(IntPtr hMenu, int uFlags, int x, int y, int nReserved, IntPtr hWnd, IntPtr prcRect);
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Menu Command Items Example (VB.NET)

This example shows how to get add-in menu command items.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'--------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Console > Console App.
' 3. Type MenuVBNET in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Replace the code in Module1.vb with this code.
' 9. Add dependencies and safely pass arrays of structures.
'10. Add System.Windows.Forms as a reference.
'11. Replace ACME_LAB with the name of a valid vault view.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the command window.
' 2. Displays a message box for each add-in menu command item.
' 3. Click OK to close each message box.
' 4. Displays the menu in the upper-left corner of the desktop.
' 5. Click First Command in the menu.
' 6. Click OK to close the message box.
' 7. Click the command window and press any key.
' 8. Closes the command window and exits the application.
'--------------------------------------------------------------------------------------

'Module1.vb

Imports EPDM.Interop.epdm
Imports System.Windows.Forms

Module Module1

    Dim vault As EdmVault5
    Dim frmParent As Form

    Sub Main()
        Try
            'Create a vault interface
            vault = New EdmVault5()

            'Log into vault
            vault.LoginAuto("ACME_LAB", 0)

            'Show menu
            ShowMenu(vault)

        Catch ex As System.Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        Console.WriteLine()
        Console.WriteLine("Press any key to exit.")
        Console.ReadKey()

    End Sub

    Private Sub ShowMenu(ByVal vault As IEdmVault12)
        'Create a context-sensitive menu
        'using Windows InsertMenu function
        Dim mnu As System.Windows.Forms.ContextMenu
        mnu = New System.Windows.Forms.ContextMenu

        InsertMenu(mnu.Handle, 0, 0, 100, "First Command")
        InsertMenu(mnu.Handle, 0, 0, 101, "Second Command")
        InsertMenu(mnu.Handle, 0, 0, 102, "Third Command")

        'Create a selection list with all files in the root folder
        Dim selList As IEdmSelectionList6
        selList = New EdmSelectionList5

        Dim folder As IEdmFolder6
        folder = vault.RootFolder
        Dim pos As IEdmPos5
        pos = folder.GetFirstFilePosition()
        While Not pos.IsNull
            Dim file As IEdmFile8
            file = folder.GetNextFile(pos)
            Dim obj As EdmSelectionObject
            obj.mbsPath = file.GetLocalPath(folder.ID)
            obj.meType = file.ObjectType
            obj.mlID = file.ID
            obj.mlProjectID = folder.ID
            selList.AddTail2(obj)
        End While

        'Add menu items for registered add-ins
        Dim count As Integer
        count = 0
        Dim startID As Integer
        startID = 200
        Dim menuCallback As IEdmMenu6
        Dim ppoRetItems() As EdmCmdInfo = Nothing
        menuCallback = vault.CreatePluginMenu2(mnu.Handle.ToInt32(), 3, startID, selList, CreateMenuFlags.Cmf_ContextMenu, count)
        menuCallback.GetItems(EdmMenuFlags.EdmMenu_Nothing, ppoRetItems)

        Dim str As String
        For Each item As EdmCmdInfo In ppoRetItems
            str = "Add-in menu command item: " & vbLf
            str = str & "Command ID: " & item.mlCmdID & vbLf
            str = str & "Command string: " & item.mbsCmdStr & vbLf
            str = str & "Tooltip: " & item.mbsTooltip & vbLf
            str = str & "Status bar help: " & item.mbsStatusBarHelp & vbLf
            str = str & "EdmMenuFlags: " & item.mlEdmMenuFlags
            MsgBox(str)
        Next

        'Display the menu using Windows TrackPopupMenu function
        Dim TPM_RETURNCMD As Integer
        TPM_RETURNCMD = 256
        Dim cmdID As Integer
        frmParent = New Form
        cmdID = TrackPopupMenu(mnu.Handle, TPM_RETURNCMD, frmParent.Left, frmParent.Top, 0, frmParent.Handle, 0)

        'Run the selected command
        Select Case cmdID
            Case 100
                MsgBox("First command")
            Case 101
                MsgBox("Second command")
            Case 102
                MsgBox("Third command")
            Case Else
                MsgBox(cmdID)
        End Select
    End Sub

    Private Declare Function InsertMenu Lib "user32" Alias "InsertMenuA" _
    (ByVal hMenu As System.IntPtr, _
    ByVal uPosition As Integer, _
    ByVal uFlags As Integer, _
    ByVal uIDNewItem As System.IntPtr, _
    ByVal lpNewItem As String) As Boolean

    Private Declare Function TrackPopupMenu Lib "user32" Alias "TrackPopupMenu" _
    (ByVal hMenu As IntPtr, _
    ByVal uFlags As Integer, _
    ByVal x As Integer, _
    ByVal y As Integer, _
    ByVal nReserved As Integer, _
    ByVal hWnd As IntPtr, _
    ByVal prcRect As IntPtr) As Integer

End Module

Back to top


SOLIDWORKS PDM Professional API Help

Get Messages Example (C#)

This example shows how to get and encapsulate text messages in the Admin's inbox in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows Forms App.
// 3. Type MessageCSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with this code.
//12. Ensure that one or more text messages exist in the inbox of
//     Admin in a vault.
//     a. Log into a vault as Admin.
//     b. Open a File Explorer window for that vault.
//     c. Click Tools > Inbox.
//     d. Click Text Messages.
//     e. If no text messages are listed, send a text message to Admin.
//        1. Click New mail message.
//        2. Type Admin in To.
//        3. Type Test Get messages in Subject.
//        4. Type Testing Get messages in the body of the message.
//        5. Click Send.
//        6. Wait until you receive the SOLIDWORKS PDM Professional
//           message notification before executing the next step.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Get Messages dialog.
//  2. Select the vault that you examined or where you sent Admin
//     a text message in Preconditions step 4.
//  3. Click Get messages.
//  4. Displays a message box for each text message in Admin's inbox
//     in the selected vault. The message box contains encapsulated
//     information about the text message.
//  5. Click OK to close each message box.
//  6. Close the Get Messages dialog box.
//----------------------------------------------------------------------------
//Form1.cs
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace MessageCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void GetMessagesButton_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Declare an IEdmUserMgr5 object
                IEdmUserMgr5 userMgr = default(IEdmUserMgr5);

                //The IEdmUserMgr5 interface is implemented by the
                //same class as the IEdmVault5 interface,
                //so you can assign the value of
                //the IEdmVault5 object
                userMgr = (IEdmUserMgr5)vault1;

                IEdmUser5 user = default(IEdmUser5);
                user = userMgr.GetLoggedInUser();
                IEdmInbox5 inbox = (IEdmInbox5)user;

                //Get first text message in Admin's inbox
                IEdmMessage5 message = default(IEdmMessage5);
                IEdmPos5 pos = default(IEdmPos5);
                pos = inbox.GetFirstMessagePosition((int)EdmGetMsgFlag.EdmGetMsg_UserMessages);

                //If no text messages in Admin's inbox, exit application
                if (pos.IsNull)
                {
                    MessageBox.Show("No messages in Admin's inbox.");
                    return;
                }

                //Otherwise, iterate through Admin's inbox and
                //display a message box with each encapsulated text message
                while (!pos.IsNull)
                {
                    message = inbox.GetNextMessage(pos);
                    bool readStatus = false;
                    readStatus = message.IsRead;
                    System.DateTime messageDate;
                    messageDate = message.Date;

                    MessageBox.Show("Sender name = " + message.SenderName + "\n" +
                        "Send ID = " + message.SenderID.ToString() + "\n" +
                        "Is read = " + readStatus + "\n" +
                        "Type = " + message.MessageType.ToString() + "\n" +
                        "Date = " + messageDate.ToString() + "\n" +
                        "Subject = " + message.Subject + "\n" +
                        "Body = " + message.Body + "\n");

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}
Back to top
//Form1.Designer.cs
namespace MessageCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.GetMessagesButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 54);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(189, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // GetMessagesButton
            //
            this.GetMessagesButton.Location = new System.Drawing.Point(16, 93);
            this.GetMessagesButton.Name = "GetMessagesButton";
            this.GetMessagesButton.Size = new System.Drawing.Size(130, 23);
            this.GetMessagesButton.TabIndex = 2;
            this.GetMessagesButton.Text = "Get messages";
            this.GetMessagesButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.GetMessagesButton.UseVisualStyleBackColor = true;
            this.GetMessagesButton.Click += new System.EventHandler(this.GetMessagesButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(241, 142);
            this.Controls.Add(this.GetMessagesButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get Messages";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button GetMessagesButton;
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Get Messages Example (VB.NET)

This example shows how to get and encapsulate text messages in the Admin's inbox in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type MessageVBNET in Project name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.

' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.

' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Ensure that one or more text messages exist in the inbox of Admin
'    in a vault.
'     a. Log into a vault as Admin.
'     b. Open a File Explorer window for that vault.
'     c. Click Tools > Inbox.
'     d. Click Text Messages.
'     e. If no text messages are listed, send a text message to Admin.
'        1. Click New mail message.
'        2. Type Admin in To.
'        3. Type Test Get messages in Subject.
'        4. Type Testing Get messages in the body of the message.
'        5. Click Send.
'        6. Wait until you receive the SOLIDWORKS PDM Professional
'           message notification before executing the next step.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Get Messages dialog.
'  2. Select the vault that you examined or where you sent Admin
'     a text message in Preconditions step 4.
'  3. Click Get messages.
'  4. Displays a message box for each text message in Admin's inbox
'     in the selected vault. The message box contains encapsulated
'     information about the text message.
'  5. Click OK to close each message box.
'  6. Close the Get Messages dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports EPDM.Interop.epdm

Public Class Form1

    Dim vault As IEdmVault8 = New EdmVault5

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try

            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub GetMessagesButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles GetMessagesButton.Click

        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault Is Nothing Then
                vault = New EdmVault5()
            End If

            If Not vault.IsLoggedIn Then
                'Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Declare an IEdmUserMgr5 object
            Dim userMgr As IEdmUserMgr5

            'The IEdmUserMgr5 interface is implemented by the
            'same class as the IEdmVault5 interface,
            'so you can assign the value of
            'the IEdmVault5 object
            userMgr = vault

            Dim user As IEdmUser5
            user = userMgr.GetLoggedInUser
            Dim inbox As IEdmInbox5 = DirectCast(user, IEdmInbox5)

            'Get first text message in Admin's inbox
            Dim message As IEdmMessage5
            Dim pos As IEdmPos5
            pos = inbox.GetFirstMessagePosition(EdmGetMsgFlag.EdmGetMsg_UserMessages)

            'If no text messages in Admin's inbox, exit application
            If pos.IsNull Then
                MsgBox("No messages in Admin's inbox.")
                Exit Sub
            End If

            'Otherwise, iterate through Admin's inbox and
            'display a message box with each encapsulated text message
            While Not pos.IsNull
                message = inbox.GetNextMessage(pos)
                Dim messageDate As String
                messageDate = message.Date

                MsgBox("Sender name = " + message.SenderName + vbLf + _
                        "Sender ID = " + message.SenderID + vbLF + _
                        "Is read = " + message.IsRead.ToString + vbLf + _
                        "Type = " + message.MessageType.ToString + vbLf + _
                        "Date = " + messageDate + vbLf + _
                        "Subject = " + message.Subject + vbLf + _
                        "Body = " + message.Body + vbLf)

            End While

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.GetMessagesButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 22)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(13, 39)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(198, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'GetMessagesButton
        '
        Me.GetMessagesButton.Location = New System.Drawing.Point(16, 81)
        Me.GetMessagesButton.Name = "GetMessagesButton"
        Me.GetMessagesButton.Size = New System.Drawing.Size(88, 23)
        Me.GetMessagesButton.TabIndex = 2
        Me.GetMessagesButton.Text = "Get messages"
        Me.GetMessagesButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.GetMessagesButton.UseVisualStyleBackColor = True
        '
        'MessageVBNET
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(243, 130)
        Me.Controls.Add(Me.GetMessagesButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get Messages"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents GetMessagesButton As System.Windows.Forms.Button

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Get Parent References of File Example (C#)

This example shows how to find the parent references of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type GetParentReferences_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form,
replace the code in Form1.Designer.cs with this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Get parent references dialog displays.
// 2. Select a vault view.
// 3. Click Browse for file.
// 4. Locate and click one of the parts mentioned in Preconditions step 4.
// 5. Click Open.
// 6. Click Get parent references.
// 7. Displays the references of the
selected part.
// 8. Click OK.
// 9. Close the Get
parent references dialog.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace GetParentReferences_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private IEdmVault5 vault1 = null;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                Listbox.Items.Clear();

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Set the initial directory in the Open dialog
                OpenFileDialog.InitialDirectory = vault1.RootFolderPath;
                //Show the Open dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog.ShowDialog();
                //If the user didn't click Open, exit
                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    return;
                }

                foreach (string FileName in OpenFileDialog.FileNames)
                {
                    Listbox.Items.Add(FileName);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GetParentReferences_Click(System.Object sender, System.EventArgs e)
        {
            try
            {

                IEdmVault7 vault2 = null;
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmFile5 file = null;
                IEdmFolder5 parentFolder = null;
                int i = 0;
                foreach (string FileName in Listbox.Items)
                {
                    file = vault2.GetFileFromPath(FileName, out parentFolder);
                    i += 1;
                }

                //Get an interface to the reference tree
                IEdmReference7 @ref = default(IEdmReference7);
                @ref = (IEdmReference7)file.GetReferenceTree(parentFolder.ID);

                //Enumerate parent references
                string msg = null;
                msg = "Parent references of file '" + file.Name + "':" + "\n";
                IEdmPos5 pos = default(IEdmPos5);
                pos = @ref.GetFirstParentPosition2(0, false, (int)EdmRefFlags.EdmRef_File + (int)EdmRefFlags.EdmRef_Item + (int)EdmRefFlags.EdmRef_Dynamic + (int)EdmRefFlags.EdmRef_Static);
                while (!pos.IsNull)
                {
                    IEdmReference7 parent = default(IEdmReference7);
                    parent = (IEdmReference7)@ref.GetNextParent(pos);
                    msg = msg + parent.FoundPath + "\n";
                }

                MessageBox.Show(msg);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace GetParentReferences_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.Listbox = new System.Windows.Forms.ListBox();
            this.GetParentReferences = new System.Windows.Forms.Button();
            this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 81);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(121, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse for file...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click +=new System.EventHandler(BrowseButton_Click);
            //
            //Listbox
            //
            this.Listbox.FormattingEnabled = true;
            this.Listbox.HorizontalScrollbar = true;
            this.Listbox.Location = new System.Drawing.Point(16, 110);
            this.Listbox.Name = "Listbox";
            this.Listbox.Size = new System.Drawing.Size(259, 43);
            this.Listbox.TabIndex = 4;
            //
            //GetParentReferences
            //
            this.GetParentReferences.Location = new System.Drawing.Point(16, 173);
            this.GetParentReferences.Name = "GetParentReferences";
            this.GetParentReferences.Size = new System.Drawing.Size(121, 23);
            this.GetParentReferences.TabIndex = 5;
            this.GetParentReferences.Text = "Get parent references";
            this.GetParentReferences.UseVisualStyleBackColor = true;
            this.GetParentReferences.Click +=new System.EventHandler(GetParentReferences_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(289, 215);
            this.Controls.Add(this.GetParentReferences);
            this.Controls.Add(this.Listbox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get parent references";
            this.Load +=new System.EventHandler(Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button BrowseButton;
        internal System.Windows.Forms.ListBox Listbox;
        internal System.Windows.Forms.Button GetParentReferences;
        internal System.Windows.Forms.OpenFileDialog OpenFileDialog;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Parent References of File Example (VB.NET)

This example shows how to find the parent references of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App.
' 3. Type GetParentReferences in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Ensure that an assembly and its parts are checked into a vault.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. The Get parent references dialog displays.
' 2. Select a vault view.
' 3. Click Browse for file.
' 4. Locate and click one of the parts mentioned in Preconditions step 4.
' 5. Click Open.
' 6. Click Get parent references.
' 7. Displays the references of the selected part.
' 8. Click OK.
' 9. Close the Get parent references dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            Listbox.Items.Clear()

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Set the initial directory in the Open dialog
            OpenFileDialog.InitialDirectory = vault1.RootFolderPath
            'Show the Open dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog.ShowDialog()
            'If the user didn't click Open, exit
            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                Return
            End If

            For Each FileName As String In OpenFileDialog.FileNames
                Listbox.Items.Add(FileName)
            Next
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GetParentReferences_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetParentReferences.Click
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim file As IEdmFile5 = Nothing
            Dim parentFolder As IEdmFolder5 = Nothing
            Dim i As Integer = 0
            For Each FileName As String In Listbox.Items
                file = vault2.GetFileFromPath(FileName, parentFolder)
                i += 1
            Next

            'Get an interface to the reference tree
            Dim ref As IEdmReference7
            ref = file.GetReferenceTree(parentFolder.ID)

            'Enumerate parent references
            Dim msg As String
            msg = "Parent references of file '" + file.Name + "':" + vbLf
            Dim pos As IEdmPos5
            pos = ref.GetFirstParentPosition2(0, False, EdmRefFlags.EdmRef_File + EdmRefFlags.EdmRef_Item + EdmRefFlags.EdmRef_Dynamic + EdmRefFlags.EdmRef_Static)
            While Not pos.IsNull
                Dim parent As IEdmReference7
                parent = ref.GetNextParent(pos)
                msg = msg + parent.FoundPath + vbLf
            End While

            MessageBox.Show(msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.Listbox = New System.Windows.Forms.ListBox()
        Me.GetParentReferences = New System.Windows.Forms.Button()
        Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 81)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(121, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse for file..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'Listbox
        '
        Me.Listbox.FormattingEnabled = True
        Me.Listbox.HorizontalScrollbar = True
        Me.Listbox.Location = New System.Drawing.Point(16, 110)
        Me.Listbox.Name = "Listbox"
        Me.Listbox.Size = New System.Drawing.Size(259, 43)
        Me.Listbox.TabIndex = 4
        '
        'GetParentReferences
        '
        Me.GetParentReferences.Location = New System.Drawing.Point(16, 173)
        Me.GetParentReferences.Name = "GetParentReferences"
        Me.GetParentReferences.Size = New System.Drawing.Size(121, 23)
        Me.GetParentReferences.TabIndex = 5
        Me.GetParentReferences.Text = "Get parent references"
        Me.GetParentReferences.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(289, 215)
        Me.Controls.Add(Me.GetParentReferences)
        Me.Controls.Add(Me.Listbox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get parent references"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents Listbox As System.Windows.Forms.ListBox
    Friend WithEvents GetParentReferences As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Get Revision Names for Local Version of File Example (C#)

This example shows how to the revision names for the local version of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#, Windows, Desktop > Windows Forms Application.
// 3. Type RevisionCSharp in Project name.
// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. To find a file with a revision scheme:
//     a. Open a vault view in File Explorer.
//     b. Click a file.
//     c. Click Display > History.
//     d. Examine the Event column. If Revision is:
//        * listed in the Event column, then the file
//          has a revision scheme.
//        * not listed in the Event column, then
//          repeat steps 4b - 4d until you find a file with
//          a revision scheme.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Get revision names dialog box.
//  2. Select a vault view.
//  3. Click Browse.
//  4. Displays the Select a file dialog box.
//     a. Click the file identified in Preconditions step 4 in the
//        selected vault.
//     b. Click Open.
//        The selected file's path and file name appear
//        in the Get revision names dialog box.
//  5. Click Get revisions.
//  6. Displays a message box:
//     * telling you that a local copy of the selected file does not exist.
//       - or -
//     * telling you that the selected file does not have a revision scheme.
//       - or -
//     * showing you a list of the names of the revisions for the selected file.
//  7. Click OK to close the message box.
//  8. Close the Get revision names dialog box.
//----------------------------------------------------------------------------
//Form1.cs

using EPDM.Interop.epdm;
using System.Windows.Forms;
using System;

namespace RevisionCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmVault8 vault = null;
        IEdmFile5 aFile;
        IEdmFolder5 folder;

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = { };

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void RevisionButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the local version number
                int version = 0;
                version = aFile.GetLocalVersionNo(folder.ID);
                if (version < 1)
                {
                    MessageBox.Show("A local copy of " + aFile.Name + " does not exist.");
                    return;
                }

                //Get the version interface
                IEdmEnumeratorVersion5 verEnum = default(IEdmEnumeratorVersion5);
                verEnum = (IEdmEnumeratorVersion5)aFile;
                IEdmVersion5 ver = default(IEdmVersion5);
                ver = (IEdmVersion5)verEnum.GetVersion(version);

                //Enumerate the revisions
                string message = null;
                IEdmPos5 pos = default(IEdmPos5);
                pos = ver.GetFirstRevisionPosition();

                if (!pos.IsNull)
                {
                    message = "The following revisions are set on " + aFile.Name + ": " + "\n";
                    IEdmRevision5 rev = default(IEdmRevision5);
                    while (!pos.IsNull)
                    {
                        rev = ver.GetNextRevision(pos);
                        message = message + "    " + rev.Name + "\n";
                    }
                }
                else
                {
                    message = "A revision scheme is not defined for " + aFile.Name + "." + "\n";
                    MessageBox.Show(message);
                    return;
                }

                MessageBox.Show(message);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //If one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                //Set the initial directory in the Select a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    //Do nothing
                }
                else
                {
                    //Browse for a local file whose revisions you want to see
                    string fileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(fileName);
                    aFile = vault1.GetFileFromPath(fileName, out folder);

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}
Back to top
//Form1.Designer.cs
namespace RevisionCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.RevisionButton = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(23, 13);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(26, 30);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(220, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(26, 90);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(167, 17);
            this.FileListBox.TabIndex = 2;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(199, 84);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(75, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(BrowseButton_Click);
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select a file";

            //
            // RevisionButton
            //
            this.RevisionButton.Location = new System.Drawing.Point(26, 137);
            this.RevisionButton.Name = "RevisionButton";
            this.RevisionButton.Size = new System.Drawing.Size(88, 23);
            this.RevisionButton.TabIndex = 4;
            this.RevisionButton.Text = "Get revisions";
            this.RevisionButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.RevisionButton.UseVisualStyleBackColor = true;
            this.RevisionButton.Click += new System.EventHandler(RevisionButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 187);
            this.Controls.Add(this.RevisionButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get revision names";
            this.Load += new System.EventHandler(Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.ListBox FileListBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.Button RevisionButton;
        private System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Get Revision Names for Local Version of File Example (VB.NET)

This example shows how to get the revision names for a local version of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms Application.
' 3. Type RevisionVBNET in Project name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.

' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.

' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. To find a file with a revision scheme:
'     a. Open a vault view in File Explorer.
'     b. Click a file.
'     c. Click Display > History.
'     d. Examine the Event column. If Revision is:
'        * listed in the Event column, then the file has
'          a revision scheme.
'        * not listed in the Event column, then
'          repeat steps 4b - 4d until you find a file with
'          a revision scheme.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Get revision names dialog box.
'  2. Select a vault view.
'  3. Click Browse.
'  4. Displays the Select a file dialog box.
'     a. Click the file identified in Preconditions step 4 in the
'        selected vault.
'     b. Click Open.
'        The selected file's path and file name appear
'        in the Get revision names dialog box.
'  5. Click Get revisions.
'  6. Displays a message box:
'     * telling you that a local copy of the selected file does not exist.
'       - or -
'     * telling you that the selected file does not have a revision scheme.
'       - or -
'     * showing you a list of the names of the revisions for the selected file.
'  7. Click OK to close the message box.
'  8. Close the Get revision names dialog box.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim folder As IEdmFolder5

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub RevisionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RevisionButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Get the local version number
            Dim version As Integer
            version = aFile.GetLocalVersionNo(folder.ID)
            If version < 1 Then
                MsgBox("A local copy of " + aFile.Name + " does not exist.")
                Exit Sub
            End If

            'Get the version interface
            Dim verEnum As IEdmEnumeratorVersion5
            verEnum = aFile
            Dim ver As IEdmVersion5
            ver = verEnum.GetVersion(version)

            'Enumerate the revisions
            Dim message As String
            Dim pos As IEdmPos5
            pos = ver.GetFirstRevisionPosition
            If Not pos.IsNull Then

                message = "The following revisions are set on " + aFile.Name + ": " + vbLf
                Dim rev As IEdmRevision5
                While Not pos.IsNull
                    rev = ver.GetNextRevision(pos)
                    message = message + "    " + rev.Name + vbLf
                End While
            Else
                message = "A revision scheme is not defined for " + aFile.Name + "." + vbLf
                MsgBox(message)
                Exit Sub
            End If

            MsgBox(message)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            'If one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            'Set the initial directory in the Select a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select a file dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                'Do nothing
            Else
                'Browse for a local file whose revisions you want to see
                Dim fileName As String = OpenFileDialog1.FileName
                FileListBox.Items.Add(fileName)
                aFile = vault1.GetFileFromPath(fileName, folder)

            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.RevisionButton = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(24, 27)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(27, 44)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(166, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select a file"
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(27, 95)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(206, 17)
        Me.FileListBox.TabIndex = 2
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(239, 89)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(62, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'RevisionButton
        '
        Me.RevisionButton.Location = New System.Drawing.Point(27, 140)
        Me.RevisionButton.Name = "RevisionButton"
        Me.RevisionButton.Size = New System.Drawing.Size(88, 23)
        Me.RevisionButton.TabIndex = 4
        Me.RevisionButton.Text = "Get revisions"
        Me.RevisionButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.RevisionButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(311, 195)
        Me.Controls.Add(Me.RevisionButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get revision names"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents RevisionButton As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Graph a Workflow Example (C#)

This example shows how to graph a workflow.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type PaintWorkflowGraph_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form,
replace the code in Form1.Designer.cs with this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Graph
a workflow dialog box.
// 2. Maximize the dialog box for the workflow graph.
// 3. Select a vault view.
// 4. Click a workflow.
// 5. Click Graph
workflow.
//
6. Graphs the selected workflow in the dialog box.
// 7. Close the Graph
a workflow dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace PaintWorkflowGraph_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmWorkflow6 wf;
        IEdmWorkflowMgr6 wfmgr;
        IEdmPos5 pos;

        public void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void GraphWorkflow_Click(System.Object sender, System.EventArgs e)
        {
            //Graph workflow
            try
            {
                IEdmVault7 vault2 = default(IEdmVault7);
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                vault2 = (IEdmVault7)vault1;
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Retrieve the graphics interface of this window
                System.Drawing.Graphics gfx = default(System.Drawing.Graphics);
                gfx = this.CreateGraphics();
                gfx.Clear(Color.AliceBlue);

                //Create font with which to draw text
                System.Drawing.Font font = default(System.Drawing.Font);
                font = new System.Drawing.Font("Arial", 10, FontStyle.Bold);

                //Loop over all the workflows to find the selected workflow
                pos = wfmgr.GetFirstWorkflowPosition();
                while (!pos.IsNull)
                {
                    wf = wfmgr.GetNextWorkflow(pos);

                    if ((wf.Name == ListBox1.SelectedItem.ToString()))
                    {
                        //Loop over all workflow transitions
                        pos = default(IEdmPos5);
                        pos = wf.GetFirstTransitionPosition();
                        while (!pos.IsNull)
                        {
                            IEdmTransition7 trans = default(IEdmTransition7);
                            trans = (IEdmTransition7)wf.GetNextTransition(pos);

                            //Draw the arrow of the transition
                            EdmPoint[] vertices = null;
                            vertices = null;
                            trans.GetArrowVertices(out vertices);
                            PaintArrow(gfx, vertices);

                            //Get the transition box
                            EdmRect transRect = default(EdmRect);
                            trans.GetRect(out transRect);
                            System.Drawing.RectangleF rectF = default(System.Drawing.RectangleF);
                            rectF.X = transRect.mlLeft;
                            rectF.Y = transRect.mlTop;
                            rectF.Width = transRect.mlRight - transRect.mlLeft;
                            rectF.Height = transRect.mlBottom - transRect.mlTop;

                            //Draw the transition box
                            gfx.FillRectangle(Brushes.LightYellow, rectF);
                            gfx.DrawRectangle(Pens.Black, rectF.X, rectF.Y, rectF.Width, rectF.Height);
                            gfx.DrawString(trans.Name, font, Brushes.Black, rectF);
                        }

                        //Loop over all workflow states
                        pos = wf.GetFirstStatePosition();
                        while (!pos.IsNull)
                        {
                            IEdmState7 state = default(IEdmState7);
                            state = (IEdmState7)wf.GetNextState(pos);

                            //Get the state box
                            EdmRect stateRect = default(EdmRect);
                            state.GetRect(out stateRect);
                            System.Drawing.RectangleF rectF = default(System.Drawing.RectangleF);
                            rectF.X = stateRect.mlLeft;
                            rectF.Y = stateRect.mlTop;
                            rectF.Width = stateRect.mlRight - stateRect.mlLeft;
                            rectF.Height = stateRect.mlBottom - stateRect.mlTop;

                            //Draw the state box
                            gfx.FillRectangle(Brushes.Azure, rectF);
                            gfx.DrawRectangle(Pens.Black, rectF.X, rectF.Y, rectF.Width, rectF.Height);
                            gfx.DrawString(state.Name, font, Brushes.Black, rectF);
                        }
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        //Draw the arrow of a transition
        private void PaintArrow(System.Drawing.Graphics gfx, EdmPoint[] vertices)
        {
            try
            {
                System.Drawing.PointF[] points = new System.Drawing.PointF[vertices.GetUpperBound(0) + 1];
                int i = 0;
                i = vertices.GetLowerBound(0);
                while (i <= vertices.GetUpperBound(0))
                {
                    points[i].X = vertices[i].mlX;
                    points[i].Y = vertices[i].mlY;
                    i = i + 1;
                }

                //Draw the arrow lines
                gfx.DrawLines(Pens.DarkRed, points);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void VaultsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;

                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                ListBox1.Items.Clear();

                wfmgr = (IEdmWorkflowMgr6)vault.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr);
                pos = wfmgr.GetFirstWorkflowPosition();
                while (!pos.IsNull)
                {
                    wf = wfmgr.GetNextWorkflow(pos);
                    ListBox1.Items.Add(wf.Name);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace PaintWorkflowGraph_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.GraphWorkflow = new System.Windows.Forms.Button();
            this.ListBox1 = new System.Windows.Forms.ListBox();
            this.Label1 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = " Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // GraphWorkflow
            //
            this.GraphWorkflow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.GraphWorkflow.Location = new System.Drawing.Point(15, 199);
            this.GraphWorkflow.Name = "GraphWorkflow";
            this.GraphWorkflow.Size = new System.Drawing.Size(121, 23);
            this.GraphWorkflow.TabIndex = 5;
            this.GraphWorkflow.Text = "Graph workflow";
            this.GraphWorkflow.UseVisualStyleBackColor = true;
            this.GraphWorkflow.Click += new System.EventHandler(this.GraphWorkflow_Click);
            //
            // ListBox1
            //
            this.ListBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.ListBox1.FormattingEnabled = true;
            this.ListBox1.HorizontalScrollbar = true;
            this.ListBox1.Location = new System.Drawing.Point(15, 98);
            this.ListBox1.Name = "ListBox1";
            this.ListBox1.Size = new System.Drawing.Size(120, 95);
            this.ListBox1.TabIndex = 6;
            //
            // Label1
            //
            this.Label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(13, 82);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(85, 13);
            this.Label1.TabIndex = 7;
            this.Label1.Text = "Select workflow:";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(227, 262);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.ListBox1);
            this.Controls.Add(this.GraphWorkflow);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Graph a workflow";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        internal System.Windows.Forms.Label VaultsLabel;
        internal System.Windows.Forms.ComboBox VaultsComboBox;
        internal System.Windows.Forms.Button GraphWorkflow;
        internal System.Windows.Forms.ListBox ListBox1;
        internal System.Windows.Forms.Label Label1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Graph a Workflow Example (VB.NET)

This example shows how to graph a workflow.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App
' 3. Type PaintWorkflowGraph in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Graph a workflow dialog box.
' 2. Maximize the dialog box for the workflow graph.
' 3. Select a vault view.
' 4. Click a workflow.
' 5. Click Graph workflow.
' 6. Graphs the selected workflow in the dialog box.
' 7. Close the Graph a workflow dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim wf As IEdmWorkflow6
    Dim wfmgr As IEdmWorkflowMgr6
    Dim pos As IEdmPos5

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault1 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub GraphWorkflow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GraphWorkflow.Click
        'Graph workflow
        Try
            Dim vault2 As IEdmVault7
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            vault2 = vault1
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Retrieve the graphics interface of this window
            Dim gfx As System.Drawing.Graphics
            gfx = Me.CreateGraphics()
            gfx.Clear(Color.AliceBlue)

            'Create font with which to draw text
            Dim font As System.Drawing.Font
            font = New System.Drawing.Font("Arial", 10, FontStyle.Bold)

            'Loop over all the workflows to find the selected workflow
            pos = wfmgr.GetFirstWorkflowPosition()
            While Not pos.IsNull
                wf = wfmgr.GetNextWorkflow(pos)
                If (wf.Name = ListBox1.SelectedItem.ToString) Then

                    'Loop over all workflow transitions
                    Dim pos As IEdmPos5
                    pos = wf.GetFirstTransitionPosition
                    While Not pos.IsNull
                        Dim trans As IEdmTransition7
                        trans = wf.GetNextTransition(pos)

                        'Draw the arrow of the transition
                        Dim vertices() As EdmPoint
                        vertices = Nothing
                        trans.GetArrowVertices(vertices)
                        PaintArrow(gfx, vertices)

                        'Get the transition box
                        Dim transRect As EdmRect
                        trans.GetRect(transRect)
                        Dim rectF As System.Drawing.RectangleF
                        rectF.X = transRect.mlLeft
                        rectF.Y = transRect.mlTop
                        rectF.Width = transRect.mlRight - transRect.mlLeft
                        rectF.Height = transRect.mlBottom - transRect.mlTop

                        'Draw the transition box
                        gfx.FillRectangle(Brushes.LightYellow, rectF)
                        gfx.DrawRectangle(Pens.Black, rectF.X, rectF.Y, rectF.Width, rectF.Height)
                        gfx.DrawString(trans.Name, font, Brushes.Black, rectF)
                    End While

                    'Loop over all workflow states
                    pos = wf.GetFirstStatePosition
                    While Not pos.IsNull
                        Dim state As IEdmState7
                        state = wf.GetNextState(pos)

                        'Get the state box
                        Dim stateRect As EdmRect
                        state.GetRect(stateRect)
                        Dim rectF As System.Drawing.RectangleF
                        rectF.X = stateRect.mlLeft
                        rectF.Y = stateRect.mlTop
                        rectF.Width = stateRect.mlRight - stateRect.mlLeft
                        rectF.Height = stateRect.mlBottom - stateRect.mlTop

                        'Draw the state box
                        gfx.FillRectangle(Brushes.Azure, rectF)
                        gfx.DrawRectangle(Pens.Black, rectF.X, rectF.Y, rectF.Width, rectF.Height)
                        gfx.DrawString(state.Name, font, Brushes.Black, rectF)
                    End While
                End If
            End While
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    'Draw the arrow of a transition
    Private Sub PaintArrow(ByVal gfx As System.Drawing.Graphics, ByVal vertices() As EdmPoint)
        Try
            Dim points(UBound(vertices)) As System.Drawing.PointF
            Dim i As Integer
            i = LBound(vertices)
            While i <= UBound(vertices)
                points(i).X = vertices(i).mlX
                points(i).Y = vertices(i).mlY
                i = i + 1
            End While

            'Draw the arrow lines
            gfx.DrawLines(Pens.DarkRed, points)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub VaultsComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VaultsComboBox.SelectedIndexChanged
        Try
            vault1 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)

            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            ListBox1.Items.Clear()

            wfmgr = vault.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr)
            pos = wfmgr.GetFirstWorkflowPosition()
            While Not pos.IsNull
                wf = wfmgr.GetNextWorkflow(pos)
                ListBox1.Items.Add(wf.Name)
            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.GraphWorkflow = New System.Windows.Forms.Button()
        Me.ListBox1 = New System.Windows.Forms.ListBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'GraphWorkflow
        '
        Me.GraphWorkflow.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.GraphWorkflow.Location = New System.Drawing.Point(15, 199)
        Me.GraphWorkflow.Name = "GraphWorkflow"
        Me.GraphWorkflow.Size = New System.Drawing.Size(121, 23)
        Me.GraphWorkflow.TabIndex = 5
        Me.GraphWorkflow.Text = "Graph workflow"
        Me.GraphWorkflow.UseVisualStyleBackColor = True
        '
        'ListBox1
        '
        Me.ListBox1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.ListBox1.FormattingEnabled = True
        Me.ListBox1.HorizontalScrollbar = True
        Me.ListBox1.Location = New System.Drawing.Point(15, 98)
        Me.ListBox1.Name = "ListBox1"
        Me.ListBox1.Size = New System.Drawing.Size(120, 95)
        Me.ListBox1.TabIndex = 6
        '
        'Label1
        '
        Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(13, 82)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(85, 13)
        Me.Label1.TabIndex = 7
        Me.Label1.Text = "Select workflow:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(227, 262)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.ListBox1)
        Me.Controls.Add(Me.GraphWorkflow)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Graph a workflow"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents GraphWorkflow As System.Windows.Forms.Button
    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
    Friend WithEvents Label1 As System.Windows.Forms.Label

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Programming Items

A file in SOLIDWORKS PDM Professional consists of two parts:

  • The file that is stored on the archive server.
  • The metadata associated with the file, or an item, which is stored in the SQL database.

The metadata consists of card contents, file references, permissions, workflow states, revisions, etc. An item is all of the metadata associated with a file. Most of the existing functions that work for files have been adjusted so that they also work for items. Only a few functions are specific to items.

All items and item folders are placed under a folder named "<items>", which is located directly beneath the vault root. SOLIDWORKS PDM Professional does not show this folder in the user interface, but it is included in the paths returned by the SOLIDWORKS PDM Professional API.

All items have the file extension, ".<item>". This extension in also hidden in the user interface, but it is returned by the SOLIDWORKS PDM Professional API.

Code Samples

  • Creating items from a file structure
  • Creating items without linking them to files
  • Retrieving the IEdmItem interface for an item with a certain database ID
  • Displaying properties and references for an item with a certain database ID
  • Obtaining an IEdmItem pointer from an item path
  • Obtaining an IEdmItem pointer from an item name (via searching)
  • Displaying a message with all references in an item
  • Updating an item's references
  • Adding a reference from an item to an item with IEdmBatchItemReferenceUpdate

Interfaces

  • IEdmBatchItemGeneration
  • IEdmBatchItemGeneration2
  • IEdmBatchItemReferenceUpdate
  • IEdmItem


SOLIDWORKS PDM Professional API Help

Install Add-in Example (C#)

This example shows how to install an add-in, obtain information about it, and uninstall it.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type AddinMgr_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. Replace the code in Form1.Designer.cs with this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. The Install add-in dialog box displays.
//     a. Select a vault view.
//     b. Click Browse for add-in.
//     c. In the Browse for add-ins dialog:
//        1. Navigate to your add-in directory
and click addin_name.dll
//           and EPDM.Interop.epdm.dll.
//        2. Click Open.
//     d. Click Install add-in.
//        A message box containing
information about each add-in installed in
//        the selected vault displays.
//     e. Click OK to close each message box.
//     f. Click Remove add-in.
//  2. Close the Install add-in dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Xml.Serialization;
using System.Windows.Forms;
using System.ComponentModel;
using EPDM.Interop.epdm;

namespace AddinMgr_CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private IEdmVault5 vault1 = null;

        string addinName = "";

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void BrowseButton_Click(System.Object sender, System.EventArgs e)
{
try
{
AddinListBox.Items.Clear();

if (vault1 == null)
{
vault1 = new EdmVault5();
}
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

//Set the initial directory in the Browse
for add-ins dialog
AddinOpenFileDialog.InitialDirectory = vault1.RootFolderPath;

//Show the Browse
for add-ins dialog
System.Windows.Forms.DialogResult DialogResult;
DialogResult = AddinOpenFileDialog.ShowDialog();

//If the user did
not click Open, exit the subroutine
if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
{
return;
}

foreach (string FileName in AddinOpenFileDialog.FileNames)
{
AddinListBox.Items.Add(FileName);
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void LoadAddin_Click(System.Object sender, System.EventArgs e)
{
try
{

IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmAddInMgr8 AddinMgr = default(IEdmAddInMgr8);
AddinMgr = (IEdmAddInMgr8)vault1;

string fileList = "";
int fileidx = 1;

// Save the path and name of the add-in just installed
string justInstalledPathName = "";

foreach (string FileName in AddinListBox.Items)
{
if (!(FileName.Contains("Interop")))
{
justInstalledPathName = FileName;
}

if (fileidx == 1)
{
fileList = FileName;
}
else
{
fileList = fileList + "\n" + FileName;
}

fileidx = fileidx + 1;
}

AddinMgr.AddAddIns(fileList, (int)EdmAddAddInFlags.EdmAddin_AddAllFilesToOneAddIn, null);

// Get information about each
of the installed add-ins
EdmAddInInfo2[] addIns = null;
AddinMgr.GetInstalledAddIns(out addIns);

string s = "";
int idx = 0;
idx = addIns.GetLowerBound(0);

while (idx <= addIns.GetUpperBound(0))
{
s = "Add-in: " + addIns[idx].mbsAddInName + "\n" + "Class: " + addIns[idx].mbsClassID + "\n";
s = s + "Company: " + addIns[idx].mbsCompany + "\n" + "Description: " + addIns[idx].mbsDescription + "\n";
s = s + "Path: " + addIns[idx].mbsModulePath + "\n" + "Version: " + Convert.ToString(addIns[idx].mlAddInVersion) + "\n";
s = s + "Req ver: " + Convert.ToString(addIns[idx].mlRequiredVersionMajor) + "." + Convert.ToString(addIns[idx].mlRequiredVersionMinor);

MessageBox.Show(s);
// Save the name of the add-in just installed
addinName = addIns[idx].mbsAddInName;

idx = idx + 1;
}

// Get information about each of the add-ins installed for debugging
EdmAddInInfo2[] debugAddIns = new EdmAddInInfo2[10];
AddinMgr.GetDebugAddIns(ref debugAddIns);

idx = debugAddIns.GetLowerBound(0);

while (idx <= debugAddIns.GetUpperBound(0))
{
s = "Debug add-in: " + debugAddIns[idx].mbsAddInName + "\n" + "Class: " + debugAddIns[idx].mbsClassID + "\n";
s = s + "Company: " + debugAddIns[idx].mbsCompany + "\n" + "Description: " + debugAddIns[idx].mbsDescription + "\n";
s = s + "Path: " + debugAddIns[idx].mbsModulePath + "\n" + "Version: " + Convert.ToString(debugAddIns[idx].mlAddInVersion) + "\n";
s = s + "Req ver: " + Convert.ToString(debugAddIns[idx].mlRequiredVersionMajor) + "." + Convert.ToString(debugAddIns[idx].mlRequiredVersionMinor);

MessageBox.Show(s);
idx = idx + 1;
}

// Get information about the add-in just installed
EdmAddInInfo2 poInfo = new EdmAddInInfo2();
AddinMgr.GetAddInInfo2(justInstalledPathName, null, ref poInfo);

s = "Getting info for add-in: " + poInfo.mbsAddInName + "\n" + "Class: " + poInfo.mbsClassID + "\n";
s = s + "Company: " + poInfo.mbsCompany + "\n" + "Description: " + poInfo.mbsDescription + "\n";
s = s + "Path: " + poInfo.mbsModulePath + "\n" + "Version: " + Convert.ToString(poInfo.mlAddInVersion) + "\n";
s = s + "Req ver: " + Convert.ToString(poInfo.mlRequiredVersionMajor) + "." + Convert.ToString(poInfo.mlRequiredVersionMinor);

MessageBox.Show(s);

// Extract information about the add-in just installed
EdmAddInFileInfo[] ppoFiles = null;
EdmAddInMenuInfo[] ppoCmds = null;
AddinMgr.GetInstalledAddIn(addinName, "c:\\temp", out poInfo, out ppoFiles, out ppoCmds);

string msg = null;
msg = "Extracting info for add-in: " + poInfo.mbsAddInName + "\n";
msg = msg + "CLSID=" + poInfo.mbsClassID + "\n";
msg = msg + "Company=" + poInfo.mbsCompany + "\n";
msg = msg + "Module=" + poInfo.mbsModulePath + "\n";
msg = msg + "Version=" + Convert.ToString(poInfo.mlAddInVersion) + "\n";
msg = msg + "Requires version=" + Convert.ToString(poInfo.mlRequiredVersionMajor) + "." + Convert.ToString(poInfo.mlRequiredVersionMinor);
msg = msg + "\n" + "Files:" + "\n";

idx = ppoFiles.GetLowerBound(0);
while (idx <= ppoFiles.GetUpperBound(0))
{
msg = msg + ppoFiles[idx].mbsFileName + " Flags=" + Convert.ToString(ppoFiles[idx].mlEdmAddInFileInfoFlags) + "\n";
idx = idx + 1;
}

msg = msg + "\n" + "Commands:" + "\n";

idx = ppoCmds.GetLowerBound(0);
while (idx <= ppoCmds.GetUpperBound(0))
{
msg = msg + "'" + ppoCmds[idx].mbsMenuStr + "' Flags=" + Convert.ToString(ppoCmds[idx].mlEdmMenuFlags) + "\n";
idx = idx + 1;
}

vault1.MsgBox(this.Handle.ToInt32(), msg);

// Get CAF information about the add-in just installed
AddinMgr.GetCAFInfo(poInfo.mbsModulePath, "c:\\temp", out poInfo, out ppoFiles, out ppoCmds);
msg = "Getting CAF info for add-in: " + poInfo.mbsAddInName + "\n";
msg = msg + "CLSID=" + poInfo.mbsClassID + "\n";
msg = msg + "Company=" + poInfo.mbsCompany + "\n";
msg = msg + "Module=" + poInfo.mbsModulePath + "\n";
msg = msg + "Version=" + Convert.ToString(poInfo.mlAddInVersion) + "\n";
msg = msg + "Requires version=" + Convert.ToString(poInfo.mlRequiredVersionMajor) + "." + Convert.ToString(poInfo.mlRequiredVersionMinor);
msg = msg + "\n" + "Files:" + "\n";

idx = ppoFiles.GetLowerBound(0);
while (idx <= ppoFiles.GetUpperBound(0))
{
msg = msg + ppoFiles[idx].mbsFileName + " Flags=" + Convert.ToString(ppoFiles[idx].mlEdmAddInFileInfoFlags) + "\n";
idx = idx + 1;
}

msg = msg + "\n" + "Commands:" + "\n";

idx = ppoCmds.GetLowerBound(0);
while (idx <= ppoCmds.GetUpperBound(0))
{
msg = msg + "'" + ppoCmds[idx].mbsMenuStr + "' flags=" + Convert.ToString(ppoCmds[idx].mlEdmMenuFlags) + "\n";
idx = idx + 1;
}

vault1.MsgBox(this.Handle.ToInt32(), msg);

return;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                IEdmAddInMgr9 AddinMgr = default(IEdmAddInMgr9);
                AddinMgr = (IEdmAddInMgr9)vault1;

                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }
                if (!vault1.IsLoggedIn)
                {
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                AddinMgr.RemoveAddIn(addinName);
                this.button1.Enabled = false;
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}

Back to top

//Form1.Designer.cs

namespace AddinMgr_CSharp
{
    partial class Form1
{
    /// <summary>
            /// Required designer variable.
            /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
    private void InitializeComponent()
    {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.AddinListBox = new System.Windows.Forms.ListBox();
            this.LoadAddin = new System.Windows.Forms.Button();
            this.AddinOpenFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 59);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(16, 98);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(271, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse for add-in...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // AddinListBox
            //
            this.AddinListBox.FormattingEnabled = true;
            this.AddinListBox.HorizontalScrollbar = true;
            this.AddinListBox.Location = new System.Drawing.Point(16, 151);
            this.AddinListBox.Name = "AddinListBox";
            this.AddinListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
            this.AddinListBox.Size = new System.Drawing.Size(259, 56);
            this.AddinListBox.TabIndex = 4;
            //
            // LoadAddin
            //
            this.LoadAddin.Location = new System.Drawing.Point(16, 230);
            this.LoadAddin.Name = "LoadAddin";
            this.LoadAddin.Size = new System.Drawing.Size(259, 23);
            this.LoadAddin.TabIndex = 5;
            this.LoadAddin.Text = "Install add-in";
            this.LoadAddin.UseVisualStyleBackColor = true;
            this.LoadAddin.Click += new System.EventHandler(this.LoadAddin_Click);
            //
            // AddinOpenFileDialog
            //
            this.AddinOpenFileDialog.Multiselect = true;
            this.AddinOpenFileDialog.Title = "Browse for add-ins";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(16, 260);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(259, 23);
            this.button1.TabIndex = 6;
            this.button1.Text = "Remove add-in";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Enabled = false;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(317, 308);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.LoadAddin);
            this.Controls.Add(this.AddinListBox);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Install add-in";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.OpenFileDialog AddinOpenFileDialog;
    private System.Windows.Forms.Label VaultsLabel;
    private System.Windows.Forms.ComboBox VaultsComboBox;
    private System.Windows.Forms.Button BrowseButton;
    private System.Windows.Forms.ListBox AddinListBox;
    private System.Windows.Forms.Button LoadAddin;
    private System.Windows.Forms.Button button1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Install Add-in Example (VB.NET)

This example shows how to install an add-in, obtain information about it, and uninstall it.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App
' 3. Type AddinMgr in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. Replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. The Install add-in dialog box displays.
'     a. Select a vault view.
'     b. Click Browse for add-in.
'     c. In the Browse for add-ins dialog:
'        1. Navigate to your add-in directory and click addin_name.dll
'           and EPDM.Interop.epdm.dll.
'        2. Click Open.
'     d. Click Install add-in.
'        A message box containing information about each add-in installed in
'        the selected vault displays.
'     e. Click OK to close each message box.
'     f. Click Remove add-in.
'  2. Close the Install add-in dialog box.
'----------------------------------------------------------------------------

'Form1.vb
Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

Private vault1 As IEdmVault5 = Nothing
Dim addinName As String
= ""

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
Dim vault1 As IEdmVault5 = New EdmVault5()
Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
Dim Views As EdmViewInfo() = Nothing

vault.GetVaultViews(Views, False)
VaultsComboBox.Items.Clear()
For Each View As EdmViewInfo In Views
VaultsComboBox.Items.Add(View.mbsVaultName)
Next
If VaultsComboBox.Items.Count > 0 Then
VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
End If
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
Try
AddinListBox.Items.Clear()

If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

'Set the initial directory in the Browse
for add-ins dialog
AddinOpenFileDialog.InitialDirectory = vault1.RootFolderPath

'Show the Browse
for add-ins dialog
Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
DialogResult = AddinOpenFileDialog.ShowDialog()

'If the user did
not click Open, exit this subroutine
If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
Return
End If

For Each FileName As String In AddinOpenFileDialog.FileNames
AddinListBox.Items.Add(FileName)
Next

Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Public Sub LoadAddin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadAddin.Click
Try

Dim vault2 As IEdmVault7 = Nothing
If vault1 Is Nothing Then
vault1 = New EdmVault5()
End If
vault2 = DirectCast(vault1, IEdmVault7)
If Not vault1.IsLoggedIn Then
vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
End If

Dim AddinMgr As IEdmAddInMgr8
AddinMgr = vault1

Dim ppoFiles() As EdmAddInFileInfo = Nothing
Dim fileList As String
fileList = ""
Dim fileidx As Integer = 1

' Save the path and name of the add-in just installed
Dim justInstalledPathName As String = ""

For Each FileName As String In AddinListBox.Items
If Not (FileName.Contains("Interop")) Then
justInstalledPathName = FileName
End If

If fileidx = 1 Then
fileList = FileName

Else
fileList = fileList & vbLf & FileName
End If
fileidx = fileidx + 1
Next

AddinMgr.AddAddIns(fileList, EdmAddAddInFlags.EdmAddin_AddAllFilesToOneAddIn, Nothing)

' Get information about each
of the installed add-ins
Dim addIns() As EdmAddInInfo2 = Nothing
AddinMgr.GetInstalledAddIns(addIns)

Dim addinPath As String = ""
Dim s As String = ""
Dim idx As Integer
idx = LBound(addIns)

While idx <= UBound(addIns)

s = "Add-in: " + addIns(idx).mbsAddInName + vbLf + "Class: " + addIns(idx).mbsClassID + vbLf
s = s + "Company: " + addIns(idx).mbsCompany + vbLf + "Description: " + addIns(idx).mbsDescription + vbLf
s = s + "Path: " + addIns(idx).mbsModulePath + vbLf + "Version: " + CStr(addIns(idx).mlAddInVersion) + vbLf
s = s + "Req ver: " + CStr(addIns(idx).mlRequiredVersionMajor) + "." + CStr(addIns(idx).mlRequiredVersionMinor)

MsgBox(s)
addinName = addIns(idx).mbsAddInName ' Save the name of the add-in just installed
idx = idx + 1
End While

' Get information about each add-in installed for debugging
Dim debugAddIns() As EdmAddInInfo2 = Nothing
AddinMgr.GetDebugAddIns(debugAddIns)

idx = LBound(debugAddIns)
While idx <= UBound(debugAddIns)

s = "Debug add-in: " + debugAddIns(idx).mbsAddInName + vbLf + "Class: " + debugAddIns(idx).mbsClassID + vbLf
s = s + "Company: " + debugAddIns(idx).mbsCompany + vbLf + "Description: " + debugAddIns(idx).mbsDescription + vbLf
s = s + "Path: " + debugAddIns(idx).mbsModulePath + vbLf + "Version: " + CStr(debugAddIns(idx).mlAddInVersion) + vbLf
s = s + "Req ver: " + CStr(debugAddIns(idx).mlRequiredVersionMajor) + "." + CStr(debugAddIns(idx).mlRequiredVersionMinor)

MsgBox(s)
idx = idx + 1
End While

' Get information about the add-in just installed
Dim poInfo As EdmAddInInfo2 = Nothing
AddinMgr.GetAddInInfo2(justInstalledPathName, Nothing, poInfo)

s = "Getting info for add-in: " + poInfo.mbsAddInName + vbLf + "Class: " + poInfo.mbsClassID + vbLf
s = s + "Company: " + poInfo.mbsCompany + vbLf + "Description: " + poInfo.mbsDescription + vbLf
s = s + "Path: " + poInfo.mbsModulePath + vbLf + "Version: " + CStr(poInfo.mlAddInVersion) + vbLf
s = s + "Req ver: " + CStr(poInfo.mlRequiredVersionMajor) + "." + CStr(poInfo.mlRequiredVersionMinor)

MsgBox(s)

' Extract information about the add-in just installed
Dim ppoCmds() As EdmAddInMenuInfo = Nothing
AddinMgr.GetInstalledAddIn(addinName, "c:\temp", poInfo, ppoFiles, ppoCmds)

Dim msg As String
msg = "Extracting info for add-in: " + poInfo.mbsAddInName + vbLf
msg = msg + "CLSID=" + poInfo.mbsClassID + vbLf
msg = msg + "Company=" + poInfo.mbsCompany + vbLf
msg = msg + "Module=" + poInfo.mbsModulePath + vbLf
msg = msg + "Version=" + CStr(poInfo.mlAddInVersion) + vbLf
msg = msg + "Requires version=" + CStr(poInfo.mlRequiredVersionMajor) + "." + CStr(poInfo.mlRequiredVersionMinor)
msg = msg + vbLf + "Files:" + vbLf

idx = LBound(ppoFiles)
While idx <= UBound(ppoFiles)
msg = msg + ppoFiles(idx).mbsFileName + " Flags=" + CStr(ppoFiles(idx).mlEdmAddInFileInfoFlags) + vbLf
idx = idx + 1
End While

msg = msg + vbLf + "Commands:" + vbLf

idx = LBound(ppoCmds)
While idx <= UBound(ppoCmds)
msg = msg + "'" + ppoCmds(idx).mbsMenuStr + "' Flags=" + CStr(ppoCmds(idx).mlEdmMenuFlags) + vbLf
idx = idx + 1
End While

vault1.MsgBox(Me.Handle.ToInt32, msg)

' Get CAF information about the add-in just installed
AddinMgr.GetCAFInfo(poInfo.mbsModulePath, "c:\temp", poInfo, ppoFiles, ppoCmds)
msg = "Getting CAF info for add-in: " + poInfo.mbsAddInName + vbLf
msg = msg + "CLSID=" + poInfo.mbsClassID + vbLf
msg = msg + "Company=" + poInfo.mbsCompany + vbLf
msg = msg + "Module=" + poInfo.mbsModulePath + vbLf
msg = msg + "Version=" + CStr(poInfo.mlAddInVersion) + vbLf
msg = msg + "Requires version=" + CStr(poInfo.mlRequiredVersionMajor) + "." + CStr(poInfo.mlRequiredVersionMinor)
msg = msg + vbLf + "Files:" + vbLf

idx = LBound(ppoFiles)
While idx <= UBound(ppoFiles)
msg = msg + ppoFiles(idx).mbsFileName + " Flags=" + CStr(ppoFiles(idx).mlEdmAddInFileInfoFlags) + vbLf
idx = idx + 1
End While

msg = msg + vbLf + "Commands:" + vbLf

idx = LBound(ppoCmds)
While idx <= UBound(ppoCmds)
msg = msg + "'" + ppoCmds(idx).mbsMenuStr + "' flags=" + CStr(ppoCmds(idx).mlEdmMenuFlags) + vbLf
idx = idx + 1
End While

vault1.MsgBox(Me.Handle.ToInt32, msg)

            Me.Button1.Enabled = True

            Exit Sub

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try

            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim AddinMgr As IEdmAddInMgr9
            AddinMgr = vault1

            AddinMgr.RemoveAddIn(addinName)
            Me.Button1.Enabled = False

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
        ''' Clean up any resources being used.
        ''' </summary>
        ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
        ''' Required method for Designer support - do not modify
        ''' the contents of this method with the code editor.
        ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.AddinListBox = New System.Windows.Forms.ListBox()
        Me.LoadAddin = New System.Windows.Forms.Button()
        Me.AddinOpenFileDialog = New System.Windows.Forms.OpenFileDialog()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 59)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(16, 98)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(271, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse for add-in..."
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'AddinListBox
        '
        Me.AddinListBox.FormattingEnabled = True
        Me.AddinListBox.HorizontalScrollbar = True
        Me.AddinListBox.Location = New System.Drawing.Point(16, 151)
        Me.AddinListBox.Name = "AddinListBox"
        Me.AddinListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple
        Me.AddinListBox.Size = New System.Drawing.Size(259, 56)
        Me.AddinListBox.TabIndex = 4
        '
        'Load add-in
        '
        Me.LoadAddin.Location = New System.Drawing.Point(16, 230)
        Me.LoadAddin.Name = "LoadAddin"
        Me.LoadAddin.Size = New System.Drawing.Size(259, 23)
        Me.LoadAddin.TabIndex = 5
        Me.LoadAddin.Text = "Install add-in"
        Me.LoadAddin.UseVisualStyleBackColor = True
        '
        'AddinOpenFileDialog
        '
        Me.AddinOpenFileDialog.Multiselect = True
        Me.AddinOpenFileDialog.Title = "Browse for add-ins"
        '
        'Remove add-in
        '
        Me.Button1.Location = New System.Drawing.Point(16, 273)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(259, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Remove add-in"
        Me.Button1.UseVisualStyleBackColor = True
        Me.Button1.Enabled = False
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(317, 314)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.LoadAddin)
        Me.Controls.Add(Me.AddinListBox)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Install add-in"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents AddinListBox As System.Windows.Forms.ListBox
    Friend WithEvents LoadAddin As System.Windows.Forms.Button
    Friend WithEvents AddinOpenFileDialog As System.Windows.Forms.OpenFileDialog
    Friend WithEvents Button1 As System.Windows.Forms.Button
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Log Into Vault and Display Information Example (C#)

This example shows how to create an application that displays a form where a user can select a vault in which to log in and display information about that vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type Exercise1CSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click Log in and display vault information.
//     A message box pops up containing the version of
//     SOLIDWORKS PDM Professional installed on your computer.
//  4. Click OK to close the message box.
//     Another message box pops up containing the path of the selected
//     vault view folder.
//  5. Click OK to close the message box.
//  6. Type the name of a nonexistent vault in the drop-down combo box.
//  7. Click Log in and display vault information.
//  8. A message box pops up instructing you to type or select
//     a valid database.
//  9. Click OK to close the message box.
// 10. Close the dialog box.
//----------------------------------------------------------------------------

//Form1.cs
using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;
using EPDM.Interop.EPDMResultCode;

namespace Exercise1CSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        void Exercise1CSharp_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault1 = new EdmVault5();

                //Cast IEdmVault5 to IEdmVault8
                IEdmVault8 vault = (IEdmVault8)vault1;

                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " +  ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void LoginButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Declare and create an instance of IEdmVault5 object
                IEdmVault5 vault = new EdmVault5();

                //Log into the selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                //Display the SOLIDWORKS PDM Professional version
                int VerMajor = 0;
                int VerMinor = 0;
                vault.GetVersion(ref VerMajor, ref VerMinor);
                MessageBox.Show("SOLIDWORKS PDM Professional " + "version is " + VerMajor.ToString() + "." + VerMinor.ToString());

                //Display the path of the vault view folder
                MessageBox.Show("The path of the vault view " + "folder is \"" + vault.RootFolderPath + "\".");
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                switch (ex.ErrorCode)
                {
                    case (int)EdmResultErrorCodes_e.E_EDM_CANT_OPEN_DATABASE:
                        MessageBox.Show("Could not open database. Select or type the name of valid database.");
                        break;
                    default:
                        MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
Back to top
//Form1.Designer.cs

namespace Exercise1CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used
        /// </summary>
        /// <param name="disposing">True if managed resources should be disposed; otherwise false</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.LoginButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(62, 23);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(75, 13);
            this.VaultsLabel.TabIndex = 1;
            this.VaultsLabel.Text = "Select a vault:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(22, 54);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(184, 21);
            this.VaultsComboBox.TabIndex = 2;
            //
            // LoginButton
            //
            this.LoginButton.Location = new System.Drawing.Point(37, 100);
            this.LoginButton.Name = "LoginButton";
            this.LoginButton.Size = new System.Drawing.Size(146, 37);
            this.LoginButton.TabIndex = 4;
            this.LoginButton.Text = "Log in and display vault information";
            this.LoginButton.UseVisualStyleBackColor = true;
            this.LoginButton.Click += new System.EventHandler(this.LoginButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(227, 184);
            this.Controls.Add(this.LoginButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Load += new System.EventHandler(this.Exercise1CSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button LoginButton;

    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Log Into Vault and Display Information Example (VB.NET)

This example shows how to create an application that displays a form where a user can select a vault to which to log in and display information about that vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type Exercise1 in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click Log in and display vault information.
'     A message box pops up containing the version of
'     SOLIDWORKS PDM Professional installed on your computer.
'  4. Click OK to close the message box.
'     Another message box pops up containing the path of the selected
'     vault view folder.
'  5. Click OK to close the message box.
'  6. Type the name of a nonexistent vault in the drop-down combo box.
'  7. Click Log in and display vault information.
'  8. A message box pops up instructing you to type or select
'     a valid database.
'  9. Click OK to close the message box.
' 10. Close the dialog box.
'----------------------------------------------------------------------------

'Form1
Imports EPDM.Interop.epdm
Imports EPDM.Interop.EPDMResultCode

Public Class Exercise1

    Private Sub Exercise1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
            ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub LoginButton_Click( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles LoginButton.Click

        Try
            'Declare and create an instance of IEdmVault5 object
            Dim vault As IEdmVault5 = New EdmVault5()
            'Log into the selected vault as the current user
            vault.LoginAuto(VaultsComboBox.Text, _
              Me.Handle.ToInt32())

            'Display the SOLIDWORKS PDM Professional version
            Dim VerMajor As Integer
            Dim VerMinor As Integer
            vault.GetVersion(VerMajor, VerMinor)
            MessageBox.Show("SOLIDWORKS PDM Professional " + _
              "version is " + VerMajor.ToString() + "." + _
              VerMinor.ToString())

            'Display the path of the vault view folder
            MessageBox.Show("The path of the vault view " + _
              "folder is """ + vault.RootFolderPath + """.")

        Catch ex As Runtime.InteropServices.COMException

            Select Case ex.ErrorCode
                Case EdmResultErrorCodes_e.E_EDM_CANT_OPEN_DATABASE
                    MessageBox.Show("Could not open database. Select or type the name of valid database.")
                Case Else
                    MessageBox.Show("HRESULT = 0x" + _
                    ex.ErrorCode.ToString("X") + vbCrLf + _
                    ex.Message)
            End Select

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub
End Class

Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Exercise1
   Inherits System.Windows.Forms.Form

   'Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.LoginButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(42, 9)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 4
        Me.VaultsLabel.Text = "Select vault view:"
        Me.VaultsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(19, 41)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(132, 21)
        Me.VaultsComboBox.TabIndex = 3
        '
        'LoginButton
        '
        Me.LoginButton.Location = New System.Drawing.Point(19, 88)
        Me.LoginButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.LoginButton.Name = "LoginButton"
        Me.LoginButton.Size = New System.Drawing.Size(132, 37)
        Me.LoginButton.TabIndex = 5
        Me.LoginButton.Text = "Log in and display vault information"
        Me.LoginButton.UseVisualStyleBackColor = True
        '
        'Exercise1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(176, 154)
        Me.Controls.Add(Me.LoginButton)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.Name = "Exercise1"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
   Friend WithEvents VaultsLabel As System.Windows.Forms.Label
   Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents LoginButton As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Welcome

SOLIDWORKS PDM Professional is a project-data management application designed to run both natively inside of the SOLIDWORKS environment and as a standalone application.

The SOLIDWORKS PDM Professional Application Programming Interface (API) is an OLE programming interface to SOLIDWORKS PDM Professional, which allows you to automate and customize SOLIDWORKS PDM Professional. The API contains functions that you can call from VB.NET, C#, and C++/CLI. These functions provide direct access to the SOLIDWORKS PDM Professional environment. It is assumed that you are familiar with at least one of these programming languages.

This online reference manual documents the interfaces available in the SOLIDWORKS PDM Professional API, including their structures, methods, properties, and enumerations.

All of the sample code supplied is provided on an as-is basis and is only intended to demonstrate ways of using the SOLIDWORKS PDM Professional API. SOLIDWORKS makes no representations or warranties regarding these samples. Any licensed user of SOLIDWORKS PDM Professional is free to use any or all of these samples in connection with building applications related to SOLIDWORKS PDM Professional and is granted a royalty-free, non-exclusive license for these samples or parts thereof. Intellectual property rights of the samples remain with SOLIDWORKS. Any confidentiality provisions of the SOLIDWORKS PDM Professional license apply to the samples. Some sample code might contain obsolete APIs.


SOLIDWORKS PDM Professional API Help

Notify User When File Changes State Example (C#)

This example shows how to create an add-in that pops up a message box when a file is approved.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Library > Class Library (.NET Framework).
// 3. Select .NET Framework 4.5 or
later in the dropdown.
// 4. Type StateChangeNotificationAddin in Name.
// 5.

For Location, click
... and navigate to the folder where to
create the project.
// 6. Click Create.
// 7. Add
dependencies and safely pass arrays of structures.
// 8. Add System.Windows.Forms as a reference (click Assemblies
> Framework in the
//    left-side panel, click System.Windows.Forms, and click OK).
//
9. Right-click the project name in the Solution Explorer and click
Properties.
//10. In the Properties window:
//    a. On the Application tab, click Assembly Information.
//    b. De-select Make assembly COM-Visible.
//    c. On the Build tab, select Any CPU,
de-select Prefer 32-bit, and select Register for COM interop.
//11. Save the project.
//12. Copy the code below to Class1.cs.
//13. To populate the GUID
    attribute, click Tools > Create GUID in the IDE,
//    select GUID Format 5, click Copy, and click Exit.
Populate [Guid("")...]
with
//    the copied string.
//14. Click
Build > Build Solution.
//
// Postconditions:
// 1. Open the SOLIDWORKS
PDM Professional Administration tool, expand a vault_name node,
//    and log in as Admin.
// 2. Ensure that Default Workflow exists under vault_name > Workflows.
//    a. Ensure that the workflow has an Approved state.
//    b. Ensure that the workflow has a Change Approved
transition.
// 3. Under vault_name, right-click Add-ins and click New Add-in.
//    a. Navigate to the
bin\Debug directory of your built project.
//    b. Click EPDM.Interop.epdm.dll and StateChangeNotificationAddin.dll.
//    c. Click Open.
//    d. Click OK.
// 4. Click OK after
reading the SOLIDWORKS PDM Professional warning dialog.
// 5. Open File Explorer on a view of
vault_name.
//    a. Log in as Admin.
//    b. Create a new file in the root directory of vault_name and check it in.
//    c. Right-click the file and click Change State > transition.
//    d. Click OK in the Do Transition dialog.
//    e. Repeat steps c and
d until the file is in a state that it can be Approved.
//    g. Right-click the file and click Change State > Change Approved.
//    h. Click OK in the Do Transition dialog.
// 6. A message box pops up notifying the user whether the file
changing state is a top
//    node. Click OK.
// 7. A message box pops up notifying the user that the file has been approved.
Click OK.
//---------------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;

[Guid(""),
ComVisible(true)]
public class ChangeStateNotification : IEdmAddIn5
{

public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{

try
{
poInfo.mbsAddInName = "C# Add-In";
poInfo.mbsCompany = "Dassault Systemes";
poInfo.mbsDescription = "Exercise demonstrating responding to a change state event.";
poInfo.mlAddInVersion = 1;

//Minimum SOLIDWORKS PDM Professional version
//needed for C# Add-Ins is 6.4
poInfo.mlRequiredVersionMajor = 6;
poInfo.mlRequiredVersionMinor = 4;

//Register to receive a notification when
//a file has changed state
poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostState);
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
try {

string AffectedFileNames = "";
Boolean topNode;
IEdmCmdNode cmdNode;

            switch (poCmd.meCmdType) {
                //A file has changed state
                case EdmCmdType.EdmCmd_PostState:
                   foreach ( EdmCmdData AffectedFile in ppoData) {

                      if (AffectedFile.mbsStrData2 == "Approved") {
                         AffectedFileNames += AffectedFile.mbsStrData1 + "";
                      }

                      cmdNode = (IEdmCmdNode)AffectedFile.mpoExtra;
                      topNode = (Boolean)cmdNode.GetProperty(EdmCmdNodeProp.EdmCmdNode_IsTopNode);
                      ((EdmVault5)(poCmd.mpoVault)).MsgBox(poCmd.mlParentWnd, "File changing state is a top node? " + topNode);
                   }

                  if (AffectedFileNames.Length > 0) {
                    ((EdmVault5)(poCmd.mpoVault)).MsgBox(poCmd.mlParentWnd, AffectedFileNames + " has been approved.");
                  }

                  break;
               //The event isn't registered
               default:
                  ((EdmVault5)(poCmd.mpoVault)).MsgBox(poCmd.mlParentWnd, "An unknown command type was issued.");
                  break;
            }
        } catch (System.Runtime.InteropServices.COMException ex) {
              MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
        } catch (Exception ex) {
              MessageBox.Show(ex.Message);
        }
     }
  }


SOLIDWORKS PDM Professional API Help

Notify User When File Changes State Example (VB.NET)

This example shows how to create an add-in that pops up a message box when a file is approved.

'--------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Library > Class Library (.NET Framework).
' 3. Select .NET Framework 4.5 in the dropdown.
' 4. Type StateChangeNotificationAddin in Name.
' 5. For Location, click ... and navigate to the folder where to create the project.
' 6. Click Create.
' 7. Add dependencies and safely pass arrays of structures.
' 8. Add System.Windows.Forms as a reference (click Assemblies > Framework in the
'    left-side panel, select System.Windows.Forms, and click OK).
 ' 9. Right-click the project name in the Solution Explorer and click Properties.
'10. In the Properties window:
'    a. On the Application tab, click Assembly Information.
'    b. De-select Make assembly COM-Visible.
'    c. On the Compile tab, select Any CPU, de-select Prefer 32-bit, and select Register for COM interop.
'11. Save the project.
'12. Copy the code below to Class1.vb.
'13. To populate the GUID attribute, click Tools > Create GUID in the IDE,
'    select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with the
'    copied string.
'14. Click Build > Build Solution.
'
' Postconditions:
' 1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
'    and log in as Admin.
' 2. Ensure that Default Workflow exists under vault_name > Workflows.
'    a. Ensure that the workflow has an Approved state.
'    b. Ensure that the workflow has a Change Approved transition.
' 3. Under vault_name, right-click Add-ins and click New Add-in.
'    a. Navigate to the bin\Debug directory of your built project.
'    b. Click EPDM.Interop.epdm.dll and StateChangeNotificationAddin.dll
'    c. Click Open.
'    d. Click OK.
' 4. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
' 5. Open File Explorer on a view of vault_name and:
'    a. Log in as Admin.
'    b. Create a new file in the root directory of vault_name and check it in.
'    c. Right-click the file and click Change State > transition.
'    d. Click OK in the Do Transition dialog.
'    e. Repeat steps c and d until the file is in a state that it can be Approved.
'    g. Right-click the file and click Change State > Change Approved.
'    h. Click OK in the Do Transition dialog.
' 6. A message box pops up notifying the user whether the file changing state is a
'    top node. Click OK.
' 7. A message box pops up notifying the user that the file has been approved.
'    Click OK.
'---------------------------------------------------------------------------------------
Imports System.Windows.Forms
Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("")>
<ComVisible(True)>
Public Class ChangeStateNotification
    Implements IEdmAddIn5

    Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5, ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

        Try
            poInfo.mbsAddInName = "VB.NET Add-In"
            poInfo.mbsCompany = "Dassault Systemes"
            poInfo.mbsDescription = "Exercise demonstrating responding to a change state event."
            poInfo.mlAddInVersion = 1

            'Minimum SOLIDWORKS PDM Professional version
            'needed for VB.Net Add-Ins is 6.4
            poInfo.mlRequiredVersionMajor = 6
            poInfo.mlRequiredVersionMinor = 4

            'Register to receive a notification when
            'a file has changed state
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostState)
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbCrLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

        Try
            Dim AffectedFile As EdmCmdData
            Dim AffectedFileNames As String = ""
            Dim cmdNode As IEdmCmdNode
            Dim topNode As Boolean
            Select Case poCmd.meCmdType
                'A file has changed state
                Case EdmCmdType.EdmCmd_PostState
                    For Each AffectedFile In ppoData
                        If AffectedFile.mbsStrData2 = "Approved" Then
                            AffectedFileNames += AffectedFile.mbsStrData1 + vbCrLf
                        End If

                        cmdNode = AffectedFile.mpoExtra
                        topNode = cmdNode.GetProperty(EdmCmdNodeProp.EdmCmdNode_IsTopNode)
                        MessageBox.Show("File changing state is a top node? " + topNode)

                    Next AffectedFile

                    If AffectedFileNames.Length > 0 Then
                        poCmd.mpoVault.MsgBox(poCmd.mlParentWnd, AffectedFileNames + " has been approved.")
                    End If

                    'The event isn't registered
                Case Else
                    poCmd.mpoVault.MsgBox(poCmd.mlParentWnd, "An unknown command type was issued.")
            End Select
        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbCrLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class


SOLIDWORKS PDM Professional API Help

Prevent Admin from Checking In File Example (C#)

This example shows how to prevent Admin from checking in a file that was not checked out by Admin.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type RefItemContainerCSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. To create the class for the callback:
//        1. Right-click RefItemContainerCSharp in the Solution Explorer.
//        2. Click Add > Class.
//        3. Type Callback.cs in Name and click Add.
//        4. Replace the code in Callback.cs with this code.
//13. Ensure that a file in the targeted vault is checked out by a user
//    other than Admin.
//14. Log into the targeted vault as Admin.
//15. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Access Check-in Flags in Check in Dialog dialog box.
// 2. Select the vault view where you are logged in as Admin.
// 3. Click Select checked-out files to check in.
//    a. Displays the Select files dialog box.
//    b. Select the file verified as checked out by a user other than
//       Admin.
//    c. Click Open.
// 4. Click Create batch check-in.
//    a. Displays message boxes with callback information.
//    b. Click OK to close each message box.
//    c. Displays a message box verifying that the batch check-in
//       was created.
//    d. Click OK to close the message box.
// 5. Click Update check-in flags.
//    a. Displays a message box verifying that check-in flags were updated.
//    b. Click OK to close the message box.
// 6. Click Check in files.
//    a. Displays the Check in dialog box.
//    b. Select the Check in check box.
//    c. Click the Check in button.
//    d. Displays message boxes with callback information.
//    e. Click OK to close each message box.
//    f. Displays an error message informing you that the file is not
//       checked out by Admin.
//    g. Click OK to close the error message.
// 7. Open a File Explorer view of the selected vault and verify that the
//    file that you selected to check in is still checked out.
// 8. Close the Access Check-in Flags in Check in Dialog dialog box.
//--------------------------------------------------------------------------------------

//Form1.cs
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace RefItemContainerCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmVault8 vault = null;
        EdmSelItem[] selFiles = null;
        IEdmBatchUnlock bUnlock = null;

        void Form1_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                vault1 = new EdmVault5();
                vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = { };

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void BrowseButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Display the Select file dialog for user to
                //select the files
                EdmStrLst5 pathList = default(EdmStrLst5);
                pathList = vault.BrowseForFile(this.Handle.ToInt32(),
        (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitMultipleSel +
        (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "SOLIDWORKS files " +
        "(*.sldprt; *.sldasm; *.slddrw)|" + "*.sldprt;*.sldasm;*.slddrw|" + "All Files (*.*)|*.*||", "",
        "", vault.RootFolderPath, "Select files");

                //Exit if the user clicks Cancel
                if (pathList == null)
                    return;

                //Traverse the selected files
                IEdmPos5 pos = default(IEdmPos5);
                pos = pathList.GetHeadPosition();

                //Convert the selected files to an
                //array of EdmSelItem structs
                int nbrFiles = 0;
                nbrFiles = pathList.Count;
                Array.Resize(ref selFiles, nbrFiles);

                int i = 0;
                while (!pos.IsNull)
                {
                    //Get each file path from the selected files list
                    string filePath = null;
                    IEdmFile5 file = default(IEdmFile5);
                    IEdmFolder5 retFolder = default(IEdmFolder5);
                    filePath = pathList.GetNext(pos);
                    file = vault.GetFileFromPath(filePath, out retFolder);
                    selFiles[i].mlDocID = file.ID;
                    selFiles[i].mlProjID = retFolder.ID;
                    i = i + 1;
                }

            }catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void CreateBatchCheckinButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                IEdmVault7 vault2 = (IEdmVault7)vault1;
                bUnlock = (IEdmBatchUnlock)vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock);
                bUnlock.AddSelection((EdmVault5)vault1, ref selFiles);
                bool tree = false;
           Callback myCallback = new Callback();
                tree = bUnlock.CreateTree(this.Handle.ToInt32(), (int)EdmUnlockBuildTreeFlags.Eubtf_MayUnlock, myCallback);
                if (tree == false)
                {
                    MessageBox.Show("No checked-out files selected to check in. Please try again.");
                    return;
                }

                MessageBox.Show("Batch check-in created.");

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void UpdateBatchCheckInButton_Click(object sender, EventArgs e)
        {
             try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                   IEdmRefItemContainer container = null;
                   if (bUnlock == null)
                    {
                        MessageBox.Show("No checked-out files selected to check in. Please try again.");
                        return;
                    }
                    else
                    {
                    container = (IEdmRefItemContainer)bUnlock;
                    object[] items = null;
                    IEdmRefItem theItem = null;
                    container.GetItems(EdmRefItemType.Edmrit_All, out items);
                    int j = 0;
                    while (j < items.Length)
                    {
                        IEdmRefItem aItem = null;
                        theItem = (IEdmRefItem)items[j];
                        aItem = theItem;
                        object value = null;
                        aItem.SetProperty(EdmRefItemProperty.Edmrip_CheckKeepLocked, value);
                        j = j + 1;
                    }
         }
                    MessageBox.Show("Check-in flags updated.");
             }

            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void CheckInButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                if (bUnlock == null)
                {
                    MessageBox.Show("No checked-out files selected to check in. Please try again.");
                    return;
                }
                else
                {
                if (bUnlock.ShowDlg(this.Handle.ToInt32()))
                {
                    Callback myCallback = new Callback();
                    bUnlock.UnlockFiles(this.Handle.ToInt32(), myCallback);
                }
          }
            }

            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

     }
}
Back to top
//Form1.Designer.cs
namespace RefItemContainerCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.CreateBatchCheckinButton = new System.Windows.Forms.Button();
            this.UpdateBatchCheckInButton = new System.Windows.Forms.Button();
            this.CheckInButton = new System.Windows.Forms.Button();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(24, 29);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(27, 45);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(187, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // CreateBatchCheckinButton
            //
            this.CreateBatchCheckinButton.Location = new System.Drawing.Point(27, 122);
            this.CreateBatchCheckinButton.Name = "CreateBatchCheckinButton";
            this.CreateBatchCheckinButton.Size = new System.Drawing.Size(125, 23);
            this.CreateBatchCheckinButton.TabIndex = 4;
            this.CreateBatchCheckinButton.Text = "Create batch check-in";
            this.CreateBatchCheckinButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.CreateBatchCheckinButton.UseVisualStyleBackColor = true;
            this.CreateBatchCheckinButton.Click += new System.EventHandler(this.CreateBatchCheckinButton_Click);
            //
            // UpdateBatchCheckInButton
            //
            this.UpdateBatchCheckInButton.Location = new System.Drawing.Point(27, 164);
            this.UpdateBatchCheckInButton.Name = "UpdateBatchCheckInButton";
            this.UpdateBatchCheckInButton.Size = new System.Drawing.Size(125, 23);
            this.UpdateBatchCheckInButton.TabIndex = 5;
            this.UpdateBatchCheckInButton.Text = "Update check-in flags";
            this.UpdateBatchCheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.UpdateBatchCheckInButton.UseVisualStyleBackColor = true;
            this.UpdateBatchCheckInButton.Click += new System.EventHandler(this.UpdateBatchCheckInButton_Click);
            //
            // CheckInButton
            //
            this.CheckInButton.Location = new System.Drawing.Point(27, 209);
            this.CheckInButton.Name = "CheckInButton";
            this.CheckInButton.Size = new System.Drawing.Size(125, 23);
            this.CheckInButton.TabIndex = 6;
            this.CheckInButton.Text = "Check in files";
            this.CheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.CheckInButton.UseVisualStyleBackColor = true;
            this.CheckInButton.Click += new System.EventHandler(this.CheckInButton_Click);
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(27, 82);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(125, 23);
            this.BrowseButton.TabIndex = 7;
            this.BrowseButton.Text = "Select checked-out files to check in";
            this.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(384, 254);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.CheckInButton);
            this.Controls.Add(this.UpdateBatchCheckInButton);
            this.Controls.Add(this.CreateBatchCheckinButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Access Check-in Flags in Check in Dialog";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button CreateBatchCheckinButton;
        private System.Windows.Forms.Button UpdateBatchCheckInButton;
        private System.Windows.Forms.Button CheckInButton;
        private System.Windows.Forms.Button BrowseButton;
    }
}
Back to top
//Callback.cs
using EPDM.Interop.epdm;
using System.Windows.Forms;

namespace RefItemContainerCSharp
{
    class Callback : IEdmUnlockOpCallback
    {
        #region IEdmUnlockOpCallback Members
        public EdmUnlockOpReply MsgBox(EdmUnlockOpMsg mssge, int docId, int projID, string path, ref EdmUnlockErrInfo err)
        {
            EdmUnlockErrInfo unlockErr;
            unlockErr = err;
            MessageBox.Show("MsgBox callback: " + "\n" + "  Document ID: " + unlockErr.mlDocID.ToString() + "\n" + "  Configuration: " + unlockErr.mbsConfigName + "\n" + "  Unique ID of variable that caused error: " + unlockErr.mlVarID.ToString() + "\n" + "  Name of unique variable that caused error: " + unlockErr.mbsVarName);
            return (EdmUnlockOpReply)EdmUnlockOpMsg.Euom_AdminUnlock;
        }

        public void ProgressBegin(EdmProgressType type, EdmUnlockEvent events, int steps)
        {
            MessageBox.Show("ProgressBegin callback: " + "\n" + "  Type of progress bar: " + type.ToString() + "\n" + "  Type of operation: " + events.ToString() + "\n" + "  Number of steps: " + steps.ToString() + "\n");
            return;
        }

        public void ProgressEnd(EdmProgressType type)
        {
            MessageBox.Show("Type of progress bar: " + type.ToString() + "\n");
            return;
        }

        public bool ProgressStep(EdmProgressType type, string msgText, int progressPos)
        {
            MessageBox.Show("ProgressStep callback: " + "\n" + "  Type of progress bar: " + type.ToString() + "\n" + "  Message: " + msgText + "\n" + "  New position of progress bar: " + progressPos.ToString());
            return true;
        }

        public bool ProgressStepEvent(EdmProgressType type, EdmUnlockEventMsg opText, int progressPos)
        {
            MessageBox.Show("ProgressStepEvent callback: " + "\n" + "  Type of progress bar: " + type.ToString() + "\n" + "  Message: " + opText.ToString() + "\n" + "  New position of progress bar: " + progressPos.ToString());
            return true;
        }

        #endregion

    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Prevent Admin from Checking In File Example (VB.NET)

This example shows how to prevent Admin from checking in a file that was not checked out by Admin.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'--------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type RefItemContainerVBNET in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. To create the class for the callback:
'        1. Right-click RefItemContainerVBNET in the Solution Explorer.
'        2. Click Add > Class.
'        3. Type Callback.vb in Name and click Add.
'        4. Replace the code in Callback.vb with this code.
'13. Ensure that a file in the targeted vault is checked out by a user
'    other than Admin.
'14. Log into the targeted vault as Admin.
'15. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Access Check-in Flags in Check in Dialog dialog box.
' 2. Select the vault view where you are logged in as Admin.
' 3. Click Select checked-out files to check in.
'    a. Displays the Select files dialog box.
'    b. Select the file verified as checked out by a user other than
'       Admin.
'    c. Click Open.
' 4. Click Create batch check-in.
'    a. Displays message boxes with callback information.
'    b. Click OK to close each message box.
'    c. Displays a message box verifying that the batch check-in
'       was created.
'    d. Click OK to close the message box.
' 5. Click Update check-in flags.
'    a. Displays a message box verifying that check-in flags were updated.
'    b. Click OK to close the message box.
' 6. Click Check in files.
'    a. Displays the Check in dialog box.
'    b. Select the Check in check box.
'    c. Click the Check in button.
'    d. Displays message boxes with callback information.
'    e. Click OK to close each message box.
'    f. Displays an error message informing you that the file is not
'       checked out by Admin.
'    g. Click OK to close the error message.
' 7. Open a File Explorer view of the selected vault and verify that the
'    file that you selected to check in is still checked out.
' 8. Close the Access Check-in Flags in Check in Dialog dialog box.
'--------------------------------------------------------------------------------------

'Form1.vb
Imports System.Windows.Forms
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Private vault As IEdmVault8 = Nothing
    Private selFiles As EdmSelItem() = Nothing
    Private bUnlock As IEdmBatchUnlock = Nothing
    Private pathList As EdmStrLst5 = Nothing
    Private pos As IEdmPos5 = Nothing
    Private UnlockCallback As MyCallback

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            vault1 = New EdmVault5()
            vault = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = {}

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub BrowseButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BrowseButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Display the Select file dialog for user to
            'select the files
            pathList = vault.BrowseForFile(Me.Handle.ToInt32(), _
                        CInt(EdmBrowseFlag.EdmBws_ForOpen) + CInt(EdmBrowseFlag.EdmBws_PermitMultipleSel) + _
                        CInt(EdmBrowseFlag.EdmBws_PermitVaultFiles), "SOLIDWORKS files " + _
                        "(*.sldprt; *.sldasm; *.slddrw)|" + "*.sldprt;*.sldasm;*.slddrw|" + _
                        "All Files (*.*)|*.*||", "", "", vault.RootFolderPath, _
                        "Select files")

            'Exit if the user clicks Cancel
            If pathList Is Nothing Then
                Return
            End If

            'Traverse the selected files
            pos = pathList.GetHeadPosition()

            'Convert the selected files to an
            'array of EdmSelItem structs
            Dim nbrFiles As Integer = 0
            nbrFiles = pathList.Count
            Array.Resize(selFiles, nbrFiles)

            Dim i As Integer = 0
            While Not pos.IsNull
                'Get each file path from the selected files list
                Dim filePath As String = Nothing
                Dim file As IEdmFile5 = Nothing
                Dim retFolder As IEdmFolder5 = Nothing
                filePath = pathList.GetNext(pos)
                file = vault.GetFileFromPath(filePath, retFolder)
                selFiles(i).mlDocID = file.ID
                selFiles(i).mlProjID = retFolder.ID
                i = i + 1

            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub CreateBatchCheckinButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CreateBatchCheckinButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim vault2 As IEdmVault7 = DirectCast(vault1, IEdmVault7)
            bUnlock = DirectCast(vault2.CreateUtility(EdmUtility.EdmUtil_BatchUnlock), IEdmBatchUnlock)
            bUnlock.AddSelection(DirectCast(vault1, EdmVault5), selFiles)
            Dim tree As Boolean = False

            Dim UnlockCallback = New MyCallback
            tree = bUnlock.CreateTree(Me.Handle.ToInt32(), CInt(EdmUnlockBuildTreeFlags.Eubtf_MayUnlock), _
                    UnlockCallback)

            If tree = False Then
                MessageBox.Show("No checked-out files selected to check in. Please try again.")
                Return
            End If

            MessageBox.Show("Batch check-in created.")
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub UpdateBatchCheckInButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles UpdateBatchCheckInButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            Dim container As IEdmRefItemContainer = Nothing
            If IsNothing(bUnlock) Then
                MessageBox.Show("No checked-out files selected to check in. Please try again.")
                Exit Sub
            Else
                container = DirectCast(bUnlock, IEdmRefItemContainer)
                Dim items As Object() = Nothing
                Dim theItem As IEdmRefItem = Nothing
                container.GetItems(EdmRefItemType.Edmrit_All, items)
                Dim j As Integer = 0
                While j < items.Length
                    Dim aItem As IEdmRefItem = Nothing
                    theItem = DirectCast(items(j), IEdmRefItem)
                    aItem = theItem
                    Dim value As Object = Nothing
                    aItem.SetProperty(EdmRefItemProperty.Edmrip_CheckKeepLocked, value)
                    j = j + 1
                End While
            End If

            MessageBox.Show("Check-in flags updated.")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub CheckInButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CheckInButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            If IsNothing(bUnlock) Then
                MessageBox.Show("No checked-out files selected to check in. Please try again.")
                Exit Sub
            Else
                Dim UnlockCallback = New MyCallback
                If bUnlock.ShowDlg(Me.Handle.ToInt32()) Then
                    bUnlock.UnlockFiles(Me.Handle.ToInt32(), UnlockCallback)
                End If
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + vbLf + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.CreateBatchCheckinButton = New System.Windows.Forms.Button()
        Me.UpdateBatchCheckInButton = New System.Windows.Forms.Button()
        Me.CheckInButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(22, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select view vault:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(25, 54)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(199, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(25, 81)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(199, 23)
        Me.BrowseButton.TabIndex = 2
        Me.BrowseButton.Text = "Select checked-out files to check in"
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'CreateBatchCheckinButton
        '
        Me.CreateBatchCheckinButton.Location = New System.Drawing.Point(25, 110)
        Me.CreateBatchCheckinButton.Name = "CreateBatchCheckinButton"
        Me.CreateBatchCheckinButton.Size = New System.Drawing.Size(199, 23)
        Me.CreateBatchCheckinButton.TabIndex = 3
        Me.CreateBatchCheckinButton.Text = "Create batch check-in"
        Me.CreateBatchCheckinButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.CreateBatchCheckinButton.UseVisualStyleBackColor = True
        '
        'UpdateBatchCheckInButton
        '
        Me.UpdateBatchCheckInButton.Location = New System.Drawing.Point(25, 139)
        Me.UpdateBatchCheckInButton.Name = "UpdateBatchCheckInButton"
        Me.UpdateBatchCheckInButton.Size = New System.Drawing.Size(199, 23)
        Me.UpdateBatchCheckInButton.TabIndex = 4
        Me.UpdateBatchCheckInButton.Text = "Update check-in flags"
        Me.UpdateBatchCheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.UpdateBatchCheckInButton.UseVisualStyleBackColor = True
        '
        'CheckInButton
        '
        Me.CheckInButton.Location = New System.Drawing.Point(25, 168)
        Me.CheckInButton.Name = "CheckInButton"
        Me.CheckInButton.Size = New System.Drawing.Size(199, 23)
        Me.CheckInButton.TabIndex = 5
        Me.CheckInButton.Text = "Check in files"
        Me.CheckInButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.CheckInButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(355, 222)
        Me.Controls.Add(Me.CheckInButton)
        Me.Controls.Add(Me.UpdateBatchCheckInButton)
        Me.Controls.Add(Me.CreateBatchCheckinButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Access Check-in Flags in Check in Dialog"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents CreateBatchCheckinButton As System.Windows.Forms.Button
    Friend WithEvents UpdateBatchCheckInButton As System.Windows.Forms.Button
    Friend WithEvents CheckInButton As System.Windows.Forms.Button

End Class
Back to top
'Callback.vb
Imports EPDM.Interop.epdm

Public Class MyCallback
    Implements IEdmUnlockOpCallback

    Public Function MsgBox(ByVal eMsg As EPDM.Interop.epdm.EdmUnlockOpMsg, ByVal lDocID As Integer, ByVal lProjID As Integer, ByVal bsPath As String, ByRef poError As EPDM.Interop.epdm.EdmUnlockErrInfo) As EPDM.Interop.epdm.EdmUnlockOpReply Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.MsgBox
        Dim unlockErr As EdmUnlockErrInfo
        unlockErr = poError
        MessageBox.Show("MsgBox callback: " + vbLf + "  Document ID: " + unlockErr.mlDocID.ToString + vbLf + "  Configuration: " + unlockErr.mbsConfigName + vbLf + "  Unique ID of variable that caused error: " + unlockErr.mlVarID.ToString + vbLf + "  Name of unique variable that caused error: " + unlockErr.mbsVarName)
        Return EdmUnlockOpMsg.Euom_AdminUnlock
    End Function

    Public Sub ProgressBegin(ByVal eType As EPDM.Interop.epdm.EdmProgressType, ByVal eEvent As EPDM.Interop.epdm.EdmUnlockEvent, ByVal lSteps As Integer) Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressBegin
        MessageBox.Show("ProgressBegin callback: " + vbLf + "  Type of progress bar: " + eType.ToString + vbLf + "  Type of operation: " + eEvent.ToString + vbLf + "  Number of steps: " + lSteps.ToString + vbLf)
    End Sub

    Public Sub ProgressEnd(ByVal eType As EPDM.Interop.epdm.EdmProgressType) Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressEnd
        MessageBox.Show("Type of progress bar: " + eType.ToString + vbLf)
        Return
    End Sub

    Public Function ProgressStep(ByVal eType As EPDM.Interop.epdm.EdmProgressType, ByVal bsText As String, ByVal lProgressPos As Integer) As Boolean Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressStep

        MessageBox.Show("ProgressStep callback: " + vbLf + "  Type of progress bar: " + eType.ToString + vbLf + "  Message: " + bsText + vbLf + "  New position of progress bar: " + lProgressPos.ToString)
        Return True
    End Function

    Public Function ProgressStepEvent(ByVal eType As EPDM.Interop.epdm.EdmProgressType, ByVal eText As EPDM.Interop.epdm.EdmUnlockEventMsg, ByVal lProgressPos As Integer) As Boolean Implements EPDM.Interop.epdm.IEdmUnlockOpCallback.ProgressStepEvent
        MessageBox.Show("ProgressStepEvent callback: " + vbLf + "  Type of progress bar: " + eType.ToString + vbLf + "  Message: " + eText.ToString + vbLf + "  New position of progress bar: " + lProgressPos.ToString)
        Return True
    End Function
End Class
Back to top


SOLIDWORKS PDM Professional API Help

Return Codes

The SOLIDWORKS PDM Professional API return codes are provided in EPDM.interop.EPDMResultCode.dll which contains these enumerations:

  • EdmResultErrorCodes_e
  • EdmResultSuccessCodes_e

The following examples show how to reference EPDM.interop.EPDMResultCode.dll in your program and access return codes by handling exceptions.

  • Log Into Vault and Display Information Example (C#)
  • Log Into Vault and Display Information Example (VB.NET)

See Also

Getting Started

Using .NET Framework 4.0 in Stand-alone Applications

IEdmVault5::GetErrorString

IEdmVault11::GetErrorMessage

IEDMVault11::GetErrorName


SOLIDWORKS PDM Professional API Help

Roll Back Revisions Example (C#)

This example shows how to roll back a checked-in file to its first revision in the current version.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type RevisionCSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. To find a checked-in file with a revision scheme and at least three
//    revisions in the current version:
//    a. Open a vault view in File Explorer.
//    b. Click a checked-in file.
//    c. Click Display > History.
//    d. Examine the Event column. If Revision is:
//       * listed in the Event column, then the file
//         has a revision scheme. Scroll down and examine the
//         Event and Version columns to verify that at least three
//         revisions exist for the current version of the file.
//       * not listed in the Event column, then
//         repeat steps 4b - 4d until you find a checked-in file
//         with a revision scheme and at least three revisions for
//         the current version.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Get revision names dialog box.
// 2. Select a vault view.
// 3. Click Browse.
// 4. Displays the Select a file dialog box.
//    a. Click the file identified in Preconditions step 4 in the
//       selected vault.
//    b. Click Open to display the selected file's path and file
//       name in the Get revision names dialog box.
// 5. Click Get revisions.
// 6. Displays a message box listing the names of the revisions
//    for the selected file. Click OK to close the message box.
// 7. Displays a message box showing the revision to which the file
//    was rolled back and the current version. Click OK to close the
//    message box.
// 8. Close the Get revision names dialog box.
// 9. Click the file in the vault in File Explorer for which revisions
//    were rolled back.
//    a. Click Display > History.
//    b. Scroll down and examine the Event, Version, and Comment columns.
//----------------------------------------------------------------------------
//Form1.cs

using EPDM.Interop.epdm;
using System.Windows.Forms;
using System;

namespace RevisionCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmVault8 vault = null;
        IEdmFile5 aFile;
        IEdmFolder5 folder;

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                vault1 = new EdmVault5();
                vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = { };

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void RevisionButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Get the local version number
                int version = 0;
                version = aFile.GetLocalVersionNo(folder.ID);
                if (version < 1)
                {
                    MessageBox.Show("A local copy of " + aFile.Name + " does not exist.");
                    return;
                }

                //Get the version interface
                IEdmEnumeratorVersion7 verEnum = default(IEdmEnumeratorVersion7);
                verEnum = (IEdmEnumeratorVersion7)aFile;
                IEdmVersion8 ver = default(IEdmVersion8);
                ver = (IEdmVersion8)verEnum.GetVersion(version);

                //Enumerate the revisions
                string message = null;
                IEdmPos5 pos = default(IEdmPos5);
                pos = ver.GetFirstRevisionPosition();
                IEdmRevision7 rev = default(IEdmRevision7);
                int verNbr = 0;

                if (!pos.IsNull)
                {
                    message = "The following revisions are set on " + aFile.Name + ": " + "\n";
                    while (!pos.IsNull)
                    {
                        rev = (IEdmRevision7)ver.GetNextRevision(pos);
                        message = message + "    " + rev.Name + "\n";
            verNbr = rev.VersionNo;
                    }
                }
                else
                {
                    message = "A revision scheme is not defined for " + aFile.Name + "." + "\n";
                    MessageBox.Show(message);
                    return;
                }

                MessageBox.Show(message);
        //Roll back to first revision
        pos = ver.GetFirstRevisionPosition();
        rev = (IEdmRevision7)ver.GetNextRevision(pos);
        ver = (IEdmVersion8)verEnum.GetVersion(version);
        message = ("Roll back to revision " + rev.Name + " of version " + verNbr);
        rev.Rollback3(message, true);
        MessageBox.Show(message);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //If one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                //Set the initial directory in the Select a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    //Do nothing
                }
                else
                {
                    //Browse for a local file whose revisions you want to see
                    string fileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(fileName);
                    aFile = vault1.GetFileFromPath(fileName, out folder);

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}
Back to top
//Form1.Designer.cs
namespace RevisionCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.RevisionButton = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(23, 13);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(26, 30);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(220, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(26, 90);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(167, 17);
            this.FileListBox.TabIndex = 2;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(199, 84);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(75, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(BrowseButton_Click);
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select a file";

            //
            // RevisionButton
            //
            this.RevisionButton.Location = new System.Drawing.Point(26, 137);
            this.RevisionButton.Name = "RevisionButton";
            this.RevisionButton.Size = new System.Drawing.Size(88, 23);
            this.RevisionButton.TabIndex = 4;
            this.RevisionButton.Text = "Get revisions";
            this.RevisionButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.RevisionButton.UseVisualStyleBackColor = true;
            this.RevisionButton.Click += new System.EventHandler(RevisionButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 187);
            this.Controls.Add(this.RevisionButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Get revision names";
            this.Load += new System.EventHandler(Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.ListBox FileListBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.Button RevisionButton;
        private System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Roll Back Revisions Example (VB.NET)

This example shows how to roll back a checked-in file to its first revision in the current version.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type Revision in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. To find a file with a revision scheme:
'    a. Open a vault view in File Explorer.
'    b. Click a checked-in file.
'    c. Click Display > History.
'    d. Examine the Event column. If Revision is:
'       * listed in the Event column, then the file
'         has a revision scheme. Scroll down and examine the
'         Event and Version columns to verify that at least three
'         revisions exist for the current version of the file.
'       * not listed in the Event column, then
'         repeat steps 4b - 4d until you find a file with
'         a revision scheme.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Get revision names dialog box.
' 2. Select a vault view.
' 3. Click Browse.
' 4. Displays the Select a file dialog box.
'    a. Click the file identified in Preconditions step 4 in the
'       selected vault.
'    b. Click Open to display the selected file's path and file
'       name in the Get revision names dialog box.
' 5. Click Get revisions.
' 6. Displays a message box listing the names of the revisions
'    for the selected file. Click OK to close the message box.
' 7. Displays a message box showing the revision to which the file
'    was rolled back and the current version. Click OK to close the
'    message box.
' 8. Close the Get revision names dialog box.
' 9. Click the file in the vault in File Explorer for which revisions
'    were rolled back.
'    a. Click Display > History.
'    b. Scroll down and examine the Event, Version, and Comment columns.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim folder As IEdmFolder5

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub RevisionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RevisionButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Get the local version number
            Dim version As Integer
            version = aFile.GetLocalVersionNo(folder.ID)
            If version < 1 Then
                MsgBox("A local copy of " + aFile.Name + " does not exist.")
                Exit Sub
            End If

            'Get the version interface
            Dim verEnum As IEdmEnumeratorVersion7
            verEnum = aFile
            Dim ver As IEdmVersion8
            Dim rev As IEdmRevision7
        Dim verNbr As Integer

            ver = verEnum.GetVersion(version)

            'Enumerate the revisions
            Dim message As String
            Dim pos As IEdmPos5
            pos = ver.GetFirstRevisionPosition
            If Not pos.IsNull Then

                message = "The following revisions are set on " + aFile.Name + ": " + vbLf
                While Not pos.IsNull
                    rev = ver.GetNextRevision(pos)
                    message = message + "    " + rev.Name + vbLf
            verNbr = rev.VersionNo
                End While
            Else
                message = "A revision scheme is not defined for " + aFile.Name + "." + vbLf
                MsgBox(message)
                Exit Sub
            End If

            MsgBox(message)

       'Roll back to first revision
           pos = ver.GetFirstRevisionPosition()
       rev = ver.GetNextRevision(pos)
       ver = verEnum.GetVersion(version)
       message = ("Roll back to revision " + rev.Name + " of version " + verNbr.ToString)
           rev.Rollback3(message, True)
           MsgBox(message)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            'If one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            'Set the initial directory in the Select a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select a file dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                'Do nothing
            Else
                'Browse for a local file whose revisions you want to see
                Dim fileName As String = OpenFileDialog1.FileName
                FileListBox.Items.Add(fileName)
                aFile = vault1.GetFileFromPath(fileName, folder)

            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.RevisionButton = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(24, 27)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(27, 44)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(166, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select a file"
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(27, 95)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(206, 17)
        Me.FileListBox.TabIndex = 2
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(239, 89)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(62, 23)
        Me.BrowseButton.TabIndex = 3
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'RevisionButton
        '
        Me.RevisionButton.Location = New System.Drawing.Point(27, 140)
        Me.RevisionButton.Name = "RevisionButton"
        Me.RevisionButton.Size = New System.Drawing.Size(88, 23)
        Me.RevisionButton.TabIndex = 4
        Me.RevisionButton.Text = "Get revisions"
        Me.RevisionButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.RevisionButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(311, 195)
        Me.Controls.Add(Me.RevisionButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Get revision names"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents RevisionButton As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Create a Task that Finds Approved Files Example (C#)

This example shows how to create a task add-in that notifies the logged-in user as to which files in the vault are in the Approved state.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Library > Class Library (.NET Framework), then
Next.
// 3. Select .NET Framework 4.5
or later in the dropdown.
// 4. Type TaskAddinExample in Project
name.
// 5. For
Location, click ... and navigate to the folder where to
create the project.
// 6. Click Create.
// 7. Click
Show All Files in the Solution Explorer
toolbar and expand
//    Class1.cs in the Solution Explorer.
// 8.

Add dependencies and
safely pass arrays of structures.
// 9. Right-click the project name in the Solution Explorer and click
Properties.
//10. In the Properties window:
//    a. On the Application tab, click Assembly Information.
//    b. De-select Make assembly COM-Visible.
//    c. On the Build tab, select Any CPU, de-select
Prefer 32-bit, and select Register for COM interop.
//11. Save the project.
//12. Copy the code below to Class1.cs.
//13. To populate the GUID
    attribute, click Tools > Create GUID in the IDE,
//    select GUID Format 5, click Copy, and click Exit.
Populate [Guid(""),
...] with
//    the copied string.
//14. Click
Build > Build Solution.
//
// Postconditions:
//  1. Open the SOLIDWORKS
PDM Administration tool, expand a vault_name node,
//     and log in as Admin.
//  2. Ensure that Default Workflow with an Approved state exists
//     under vault_name > Workflows.
//  3. Under vault_name,
right-click Add-ins and click New Add-in.
//     a. Navigate to the
bin\Debug directory of your built
project.
//     b. Click EPDM.Interop.epdm.dll and TaskAddinExample.dll.
//     c. Click Open.
//     d. Click OK.
//  4. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
//  5. In the taskbar notification area:
//     a. Click the SOLIDWORKS PDM icon.
//     b. Click Task Host Configuration.
//     c. Select vault_name in the File Vault dropdown.
//     d. Select Permit next to the add-in you installed in step 3.
//     e. Click OK.
//  6. In the Administration tool
under the vault_name, right-click Tasks and click
New Task.
//     a. Type Approved Files Task in the upper-left text box.
//     b. Select the C# Task Add-in from the Add-in dropdown.
//     c. When the attach debugger message box appears:
//        1. In the IDE, click Debug > Attach to Process > ConisioAdmin.exe.
//        2. Click Attach.
//        3. Click OK to close the message box.
//     d. Click Next.
//     e. On the Execution Method properties page, select the local computer.
//     f. Click Next.
//     g. On the Scheduling properties page, select This task is not scheduled.
//     h. Click Next.
//     i. On the Permissions property page, select Admin.
//     j. Click Next.
//     k. On the Success Notification property page:
//        1. Select Notify the user who launched the task.
//        2. In the Subject field, type Success.
//        3. In the Text field, type The task successfully completed at, type
a space,
//           click >, and click Current Time.
//     l. Click OK to close the New Task dialog.
//  7. Expand vault_name > Tasks and double-click Task List.
//  8. Click Add Task.
//  9. In the Add Task dialog:
//     a. Select Approved Files Task from the dropdown.
//     b. Click OK.
// 10. When the attach debugger message box appears:
//     a. In the IDE, click Debug > Attach to Process > TaskExecutor.exe.
//     b. Click Attach.
//     c. Click OK to close the message box.
// 11. The task appears in the Pending tasks list. Observe the task status.
// 12. When the task completes, the task moves to the Completed tasks
//     list. The logged-in user receives a notification with the list of approved files.
//---------------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;

[Guid(""),
ComVisible(true)]
public class TaskAddinExample : IEdmAddIn5
{

public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{
try
{
poInfo.mbsAddInName = "C# Task Add-In";
poInfo.mbsCompany = "Dassault Systemes";
poInfo.mbsDescription = "Exercise demonstrating a task that lists files in the Approved state.";
poInfo.mlAddInVersion = 1;

//Minimum SOLIDWORKS PDM Professional version
//needed for C# Task Add-Ins is 10.0
poInfo.mlRequiredVersionMajor = 10;
poInfo.mlRequiredVersionMinor = 0;

//Register this add-in as a task add-in
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskRun);
//Register this add-in to be called when
//selected as a task in the Administration tool
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetup);
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") +  ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
try
{
PauseToAttachProcess(poCmd.meCmdType.ToString());

switch (poCmd.meCmdType)
{
case EdmCmdType.EdmCmd_TaskRun:
OnTaskRun(ref poCmd, ref ppoData);
break;
case EdmCmdType.EdmCmd_TaskSetup:
OnTaskSetup(ref poCmd, ref ppoData);
break;
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void OnTaskRun(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
//Get the task instance interface
IEdmTaskInstance inst = default(IEdmTaskInstance);
inst = (IEdmTaskInstance)poCmd.mpoExtra;
try
{
//Keep the Task List status up to date
inst.SetStatus(EdmTaskStatus.EdmTaskStat_Running);

//Format a message that will be displayed
//in the task list
inst.SetProgressRange(10, 1, "Task is running.");

List<EdmSelItem2> Items = new List<EdmSelItem2>();
inst.SetProgressPos(4, "Task is searching.");

IEdmSearch6 Search = (IEdmSearch6)((IEdmVault5)(poCmd.mpoVault)).CreateSearch();
if (Search == null)
return;

             Search.SetToken(EdmSearchToken.Edmstok_AllVersions, true);
            Search.SetToken(EdmSearchToken.Edmstok_FindFiles, true);
            Search.SetToken(EdmSearchToken.Edmstok_WorkflowName, "Default Workflow");
            Search.SetToken(EdmSearchToken.Edmstok_StateName, "Approved");

            //Uncomment and modify the following lines to look for files
            //that have a card variable with values in a specific range

//object varName1 = "Card_Variable_ID_or_Name";
//object
varValue1 = "Card_Variable_Value_1";
//int varOp1
= EdmVarOp_NumberGreaterThan;
//object
varValue2 = "Card_Variable_Value_2";
//int varOp2
= EdmVarOp_NumberLessThan;
//Search.BeginAND();
//Search.AddVariable2(ref varName1, ref varValue1, varOp1);
//Search.AddVariable2(ref varName1, ref varValue2, varOp2);
//Search.EndAND();

            IEdmSearchResult5 SearchResult = Search.GetFirstResult();
            while ((SearchResult != null))
            {
                EdmSelItem2 SelItem = new EdmSelItem2();
                SelItem.mlID = SearchResult.ID;
                SelItem.mlParentID = SearchResult.ParentFolderID;
                SelItem.meType = SearchResult.ObjectType;
                SelItem.mlVersion = SearchResult.Version;

                Items.Add(SelItem);
                SearchResult = Search.GetNextResult();
            }
            inst.SetProgressPos(7, "Task finished searching.");

            EdmSelItem2[] NotificationArray = new EdmSelItem2[Items.Count];
            Items.CopyTo(NotificationArray);

            string ProgresssMsg = null;
            if ((Items.Count > 0))
            {
                ProgresssMsg = "Found " + Items.Count.ToString() + " files.";
            }
            else
            {
                ProgresssMsg = ("No files found.");
            }

            inst.SetProgressPos(10, ProgresssMsg);
            inst.SetStatus(EdmTaskStatus.EdmTaskStat_DoneOK, 0, "", NotificationArray, ProgresssMsg);
        }
        catch (System.Runtime.InteropServices.COMException ex)
        {
            inst.SetStatus(EdmTaskStatus.EdmTaskStat_DoneFailed, ex.ErrorCode, "The test task failed!");
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    private void OnTaskSetup(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
    {
        try
        {
            //Get the property interface used to
            //access the framework
            IEdmTaskProperties props = default(IEdmTaskProperties);
            props = (IEdmTaskProperties)poCmd.mpoExtra;

            //Set the property flag that says you want a
            //menu item for the user to launch the task
            //and a flag to support scheduling
            props.TaskFlags = (int)EdmTaskFlag.EdmTask_SupportsInitExec + (int)EdmTaskFlag.EdmTask_SupportsScheduling;

            //Set up the menu commands to launch this task
            EdmTaskMenuCmd[] cmds = new EdmTaskMenuCmd[1];
            cmds[0].mbsMenuString = "List Approved files task";
            cmds[0].mbsStatusBarHelp = "This command runs the task add-in to get the names of the files in the Approved state.";
            cmds[0].mlCmdID = 1;
            cmds[0].mlEdmMenuFlags = (int)EdmMenuFlags.EdmMenu_Nothing;
            props.SetMenuCmds(cmds);
        }
        catch (System.Runtime.InteropServices.COMException ex)
        {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    private void PauseToAttachProcess(string callbackType)
    {
        try
        {
            //If the debugger isn't already attached to a
            //process,
            if (!Debugger.IsAttached)
            {
                //Launch the debug dialog
                //Debugger.Launch()
                //or
                //use a MsgBox dialog to pause execution
                //and allow the user time to attach it
                MessageBox.Show("Attach debugger to process \"" + Process.GetCurrentProcess().ProcessName + "\" for callback \"" + callbackType + "\" before clicking OK.");
            }

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

}


SOLIDWORKS PDM Professional API Help

Create a Task that Finds Approved Files Example (VB.NET)

This example shows how to create a task add-in that notifies the logged-in user as to which files in the vault are in the Approved state.

'--------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Library > Class Library (.NET Framework), then Next.
' 3. Type TaskAddinExample in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Select Framework.
' 6. Click Create.
' 7. Click Show All Files in the Solution Explorer toolbar and expand
'    Class1.vb in the Solution Explorer.
' 8. Add dependencies and safely pass arrays of structures.
' 9. Right-click the project name in the Solution Explorer and click Properties.
'10. In the Properties window:
'    a. On the Application tab, click Assembly Information....
'    b. De-select Make assembly COM-Visible.
'    c. On the Compile tab, select Any CPU, de-select Prefer 32-bit, and select Register for COM interop.
'11. Save the project.
'12. Copy the code below to Class1.vb.
'13. To populate the GUID attribute, click Tools > Create GUID in the IDE,
'    select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with the
'    copied string.
'14. Click Build > Build Solution.
'
' Postconditions:
'  1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
'     and log in as Admin.
'  2. Ensure that Default Workflow with an Approved state exists
'     under vault_name > Workflows.
'  3. Under vault_name, right-click Add-ins and click New Add-in.
'     a. Navigate to the bin\Debug directory of your built project.
'     b. Click EPDM.Interop.epdm.dll and TaskAddinExample.dll.
'     c. Click Open.
'     d. Click OK.
'  4. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
 '  5. In the taskbar notification area:
'     a. Click the SOLIDWORKS PDM icon.
'     b. Click Task Host Configuration.
'     c. Select vault_name in the File Vault dropdown.
'     d. Select Permit next to the add-in you installed in step 3.
'     e. Click OK.
'  6. In the Administration tool under vault_name, right-click Tasks and click New Task.
'     a. Type Approved Files Task in the upper-left text box.
'     b. Select the VB.NET Task Add-in from the Add-in dropdown.
'     c. When the attach debugger message box appears:
'        1. In the IDE, click Debug > Attach to Process > ConisioAdmin.exe.
'        2. Click Attach.
'        3. Click OK to close the message box.
'     d. Click Next.
'     e. On the Execution Method properties page, select the local computer.
'     f. Click Next.
'     g. On the Scheduling properties page, select This task is not scheduled.
'     h. Click Next.
'     i. On the Permissions property page, select Admin.
'     j. Click Next.
'     k. On the Success Notification property page:
'        1. Select Notify the user who launched the task.
'        2. In the Subject field, type Success.
'        3. In the Text field, type The task successfully completed at, type a space,
'           click >, and click Current Time.
'     l. Click OK to close the New Task dialog.
'  7. Expand vault_name > Tasks and double-click Task List.
'  8. Click Add Task.
'  9. In the Add Task dialog:
'     a. Select Approved Files Task from the dropdown.
'     b. Click OK.
' 10. When the attach debugger message box appears:
'     a. In the IDE, click Debug > Attach to Process > TaskExecutor.exe.
'     b. Click Attach.
'     c. Click OK to close the message box.
' 11. The task appears in the Pending tasks list. Observe the task status.
' 12. When the task completes, the task moves to the Completed tasks
'     list. The logged-in user receives a notification with the list of approved files.
'---------------------------------------------------------------------------------------

Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("")>
<ComVisible(True)>
Public Class TaskAddinExample
    Implements IEdmAddIn5

    Public Sub GetAddInInfo( _
      ByRef poInfo As EdmAddInInfo, _
      ByVal poVault As IEdmVault5, _
      ByVal poCmdMgr As IEdmCmdMgr5) _
      Implements IEdmAddIn5.GetAddInInfo

        Try
            poInfo.mbsAddInName = _
              "VB.NET Task Add-In"
            poInfo.mbsCompany = "Dassault Systemes"
            poInfo.mbsDescription = _
              "Exercise demonstrating a task that lists " _
              + "files in the Approved state."
            poInfo.mlAddInVersion = 1

            'Minimum SOLIDWORKS PDM Professional version
            'needed for VB.Net Task Add-Ins is 10.0
            poInfo.mlRequiredVersionMajor = 10
            poInfo.mlRequiredVersionMinor = 0

            'Register this add-in as a task add-in
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskRun)
            'Register this add-in to be called when
            'selected as a task in the Administration tool
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetup)
        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Public Sub OnCmd(ByRef poCmd As EdmCmd, _
      ByRef ppoData As EdmCmdData[]) _
      Implements IEdmAddIn5.OnCmd

        Try
            PauseToAttachProcess(poCmd.meCmdType.ToString())

            Select Case poCmd.meCmdType
                Case EdmCmdType.EdmCmd_TaskRun
                    OnTaskRun(poCmd, ppoData)
                Case EdmCmdType.EdmCmd_TaskSetup
                    OnTaskSetup(poCmd, ppoData)
            End Select
        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub OnTaskRun(ByRef poCmd As EdmCmd, _
      ByRef ppoData As EdmCmdData[])

        'Get the task instance interface
        Dim inst As IEdmTaskInstance
        inst = poCmd.mpoExtra
        Try
            'Keep the task list status up to date
            inst.SetStatus _
              (EdmTaskStatus.EdmTaskStat_Running)

            'Format a message that will be displayed
            'in the task list
            inst.SetProgressRange(10, 1, "Task is running.")

            Dim Items As List(Of EdmSelItem2) = _
              New List(Of EdmSelItem2)
            inst.SetProgressPos(4, "Task is searching.")

            Dim Search As IEdmSearch6 = _
              poCmd.mpoVault.CreateSearch()
            If Search Is Nothing Then Return

             Search.SetToken( _
              EdmSearchToken.Edmstok_FindFiles, True)

             Search.SetToken(EdmSearchToken.Edmstok_AllVersions, True)
            Search.SetToken( _
              EdmSearchToken.Edmstok_WorkflowName, _
              "Default Workflow")
            Search.SetToken( _
              EdmSearchToken.Edmstok_StateName, "Approved")

            'Uncomment and modify the following lines to look for files
            'that have a card variable with values in a specific range

            'Dim varName1 As Object = "Card_Variable_ID_or_Name"
            'Dim varValue1 As Object = "Card_Variable_Value_1"
            'Dim varOp1 as Integer = EdmVarOp_NumberGreaterThan
            'Dim varValue2 As Object = "Card_Variable_Value_2"
            'Dim varOp2 as Integer = EdmVarOp_NumberLessThan
            'Search.BeginAND
               'Search.AddVariable2(varName1, varValue1, varOp1)
               'Search.AddVariable2(varName1, varValue2, varOp2)
            'Search.EndAND

            Dim SearchResult As IEdmSearchResult5 = _
              Search.GetFirstResult()
            While Not SearchResult Is Nothing
                Dim SelItem As EdmSelItem2 = New EdmSelItem2()
                SelItem.mlID = SearchResult.ID
                SelItem.mlParentID = SearchResult.ParentFolderID
                SelItem.meType = SearchResult.ObjectType
                SelItem.mlVersion = SearchResult.Version

                Items.Add(SelItem)
                SearchResult = Search.GetNextResult()
            End While
            inst.SetProgressPos(7, "Task finished searching.")

            Dim NotificationArray(Items.Count - 1) _
              As EdmSelItem2
            Items.CopyTo(NotificationArray)

            Dim ProgresssMsg As String
            If (Items.Count > 0) Then
                ProgresssMsg = "Found " + _
                  Items.Count.ToString() + " files."
            Else
                ProgresssMsg = ("No files found.")
            End If

            inst.SetProgressPos(10, ProgresssMsg)
            inst.SetStatus( _
              EdmTaskStatus.EdmTaskStat_DoneOK, 0, "", _
              NotificationArray, ProgresssMsg)
        Catch ex As Runtime.InteropServices.COMException
            inst.SetStatus _
              (EdmTaskStatus.EdmTaskStat_DoneFailed, _
              ex.ErrorCode, "The test task failed!")
        Catch ex As Exception
            inst.SetStatus _
              (EdmTaskStatus.EdmTaskStat_DoneFailed, _
              0, "Non COM test task failure!")
        End Try
    End Sub

    Private Sub OnTaskSetup(ByRef poCmd As EdmCmd, _
      ByRef ppoData As EdmCmdData[])

        Try
            'Get the property interface used to
            'access the framework
            Dim props As IEdmTaskProperties
            props = poCmd.mpoExtra

            'Set the property flag that says you want a
            'menu item for the user to launch the task
            'and a flag to support scheduling
            props.TaskFlags = _
              EdmTaskFlag.EdmTask_SupportsInitExec + _
              EdmTaskFlag.EdmTask_SupportsScheduling

            'Set up the menu commands to launch this task
            Dim cmds(0) As EdmTaskMenuCmd
            cmds(0).mbsMenuString = "List Approved files task"
            cmds(0).mbsStatusBarHelp = _
              "This command runs the task add-in to get the" + _
              " names of the files in the Approved state."
            cmds(0).mlCmdID = 1
            cmds(0).mlEdmMenuFlags = _
              EdmMenuFlags.EdmMenu_Nothing
            props.SetMenuCmds(cmds)
        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub PauseToAttachProcess( _
      ByVal callbackType As String)

        Try
            'If the debugger isn't already attached to a
            'process,
            If Not Debugger.IsAttached() Then
                'Launch the debug dialog
                'Debugger.Launch()
                'or
                'use a MsgBox dialog to pause execution
                'and allow the user time to attach it
                MsgBox("Attach debugger to process """ + _
                  Process.GetCurrentProcess.ProcessName() + _
                  """ for callback """ + callbackType + _
                  """ before clicking OK.")
            End If

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

End Class


SOLIDWORKS PDM Professional API Help

Create a Task that Finds Files in Workflow States Example (C#)

This example shows how to create a task add-in that finds files that have been in specified workflow states a specified number of days.

//--------------------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > C#, Windows, Library > Class Library (.NET Framework).
//  3. Select .NET Framework 4.5 or later in the dropdown.
//  4. Click Browse and navigate to the folder where to create the project.
//  5. Type StateAgeTask_CSharp in Project name.
//  6. Click Create.
//  7. Right-click the project in the Solution Explorer and click Add > User Control.
//  8. In the Add New Item dialog, keep the default name and click Add.
//  9. Click Show all Files in the Solution Explorer toolbar and expand
UserControl1.vb.
// 10. Replace the code in Class1.cs with this code.
// 11. Replace the code in UserControl1.Designer.cs with this code.
// 12. Replace the code in UserControl1.cs
with this code.
// 13. Add
dependencies and safely pass arrays of structures.
// 14. Add System.Windows.Forms as a reference (click Assemblies
> Framework in the
//     left-side panel, click System.Windows.Forms, and click OK).
// 15. Right-click the project name in the Solution Explorer and click
Properties.
// 16. In the Properties window:
//     a. On the Application tab, click Assembly Information.
//     b. De-select Make assembly COM-Visible.
//     c. On the Build tab,
select Any CPU, de-select
Prefer 32-bit, and select Register for COM interop.
// 17. Save the project.
// 18. To populate the GUID
    attribute, click Tools > Create GUID in the IDE,
//     select GUID Format 5, click Copy, and click Exit.
Replace [Guid(""),
...]
//     with the copied string.
// 19. Click Build > Build Solution.
//
// Postconditions:
//  1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
//     and log in as Admin.
//  2. Under vault_name, right-click Add-ins and click New Add-in.
//     a. Navigate to the bin\Debug

directory of your built project.
//     b. Click EPDM.Interop.epdm.dll and StateAgeTask_CSharp.dll.
//     c. Click Open.
//     d. Click OK.
//  3. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
//  4. In the taskbar notification area:
//     a. Click the SOLIDWORKS PDM icon.
//     b. Click Task Host Configuration.
//     c. Select vault_name in the File Vault dropdown.
//     d. Select Permit next to the add-in you just
installed.
//     e. Click OK.
//  5. In the Administration tool under vault_name, right-click Tasks and click New Task.
//  6. In the New Task dialog:
//     a. Type State Age Task in the upper-left text box.
//     b. Select the C# Workflow State Age
Task Add-in from the Add-in dropdown.
//     c. Click Next.
//     d. On the Execution Method properties page, select the local computer.
//     e. Click Next.
//     f. On the Scheduling properties page, select This task is not scheduled.
//     g. Click Next.
//     h. On the Choose states to check page, select the
file search criteria in:
//        1. Choose Workflow.
//        2. Select States.
//        3. Number of Days in State.
//     i. Click Next.
//     j. On the Permissions property page, select Admin.
//     k. Click Next.
//     l. On the Success Notification property page:
//        1. Select Notify the user who launched the task.
//        2. In the Subject field, type Success.
//        3. In the Text field, type The task successfully completed at, type a space,
//           click >, and click Current Time.
//     m. Click OK to close the New Task dialog.
//  7. Expand vault_name > Tasks and double-click Task List.
//  8. Click Add Task.
//  9. In the Add Task dialog:
//     a. Select State Age Task from the dropdown.
//     b. Click OK.
// 10. The task appears in the Pending tasks list. Observe the task status.
// 11. When the task completes, the task moves to the Completed tasks
//     list. After a minute or so, the logged-in user receives a notification with the
//     list of files that have

been in the specified workflow states a specified
//     number of days.
//---------------------------------------------------------------------------------------

Back to top

//Class1.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using EPDM.Interop.epdm;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace StateAgeTask_CSharp
{
[Guid(""),
ComVisible(true)]
public class Class1 : IEdmAddIn5
{

SetupPage SetupPageObj;
public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
{

try
{
poInfo.mbsAddInName = "C# Workflow State Age Task Add-In";
poInfo.mbsCompany = "Dassault Systemes";
poInfo.mbsDescription = "Example demonstrates a task that finds files that have been in selected workflow states a selected number of days";
poInfo.mlAddInVersion = 1;
//Minimum SOLIDWORKS PDM Professional version
//needed for Tasks is 10.0
poInfo.mlRequiredVersionMajor = 10;
poInfo.mlRequiredVersionMinor = 0;

//Register to call OnCmd on task-related events
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetup);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetupButton);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskRun);
poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskDetails);
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{

try
{
switch (poCmd.meCmdType)
{

//Called from the Administration tool when
//the user selects this task add-in from the
//drop-down list and whenever this task is
//subsequently edited in the Administration tool
case EdmCmdType.EdmCmd_TaskSetup:
OnTaskSetup(ref poCmd, ref ppoData);

break;
//Sent when the user clicks OK or
//Cancel in the task property dialog box
case EdmCmdType.EdmCmd_TaskSetupButton:
OnTaskSetupButton(ref poCmd, ref ppoData);

break;
//Called when an instance of the
//task is run
case EdmCmdType.EdmCmd_TaskRun:
OnTaskRun(ref poCmd, ref ppoData);

break;
//Called from the Task List in the
//Administration tool when the task details
//dialog is displayed
case EdmCmdType.EdmCmd_TaskDetails:
OnTaskDetails(ref poCmd, ref ppoData);
break;
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

private void OnTaskSetup(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
try
{
IEdmTaskProperties props = (IEdmTaskProperties)poCmd.mpoExtra;
if ((props != null))
{
//Set the task properties
props.TaskFlags = (int)EdmTaskFlag.EdmTask_SupportsScheduling + (int)EdmTaskFlag.EdmTask_SupportsDetails;

SetupPageObj = new SetupPage((IEdmVault7)poCmd.mpoVault, props);
//Force immediate creation of the control
//and its handle
SetupPageObj.CreateControl();
SetupPageObj.LoadData(poCmd);

EdmTaskSetupPage[] pages = new EdmTaskSetupPage[1];
//Page name that appears in the
//navigation pane of the Add
Task dialog
//in the Administration tool
pages[0].mbsPageName = "Choose states to check";
pages[0].mlPageHwnd = SetupPageObj.Handle.ToInt32();
pages[0].mpoPageImpl = SetupPageObj;

props.SetSetupPages(pages);

}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "
" + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void OnTaskSetupButton(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
try
{
//Custom setup page, SetupPageObj, is created
//in method Class1::OnTaskSetup; SetupPage::StoreData
//saves the contents of the list box to poCmd.mpoExtra
//in the IEdmTaskProperties interface
if (poCmd.mbsComment == "OK" & (SetupPageObj != null))
{
SetupPageObj.StoreData();
}
SetupPageObj = null;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") +
" " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void OnTaskRun(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
try
{
IEdmTaskInstance TaskInstance = default(IEdmTaskInstance);
TaskInstance = (IEdmTaskInstance)poCmd.mpoExtra;
if ((TaskInstance != null))
{
TaskInstance.SetStatus(EdmTaskStatus.EdmTaskStat_Running);
TaskInstance.SetProgressRange(100, 0, "Task is running.");

string NoDays = null;
NoDays = (string)TaskInstance.GetValEx("NoDaysVar");

string States = "";
States = (string)TaskInstance.GetValEx("SelectedStatesVar");

List<EdmSelItem2> Items = new List<EdmSelItem2>();

DoSearch((IEdmVault11)poCmd.mpoVault, States, NoDays, Items);

EdmSelItem2[] NotificationArray = new EdmSelItem2[Items.Count];

Items.CopyTo(NotificationArray);

string ProgresssMsg = null;
if ((Items.Count > 0))
{
ProgresssMsg = "Found " + Items.Count.ToString() + " files.";
}
else
{
ProgresssMsg = ("No files found.");
}

TaskInstance.SetProgressPos(100, ProgresssMsg);
TaskInstance.SetStatus(EdmTaskStatus.EdmTaskStat_DoneOK, 0, "", NotificationArray, ProgresssMsg);
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") +
" " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void DoSearch(IEdmVault11 Vault, string States, string Days, List<EdmSelItem2> Items)
{
try
{
//Calculate age to use for search
DateTime dt = DateTime.Today;
int DaysInt = Convert.ToInt32(Days) - 1;
TimeSpan ts = new TimeSpan(DaysInt, 0, 0, 0);
dt = dt.Subtract(ts);

//Split States into an array of
//State strings
string[]
StatesObj = States.Split(new string[] { "\\n" }, StringSplitOptions.None);
//Search each selected state for aged files
foreach (string State in StatesObj)
{
//Skip empty strings
if (string.IsNullOrEmpty(State.Trim()))
{
continue;
}

IEdmSearch6 Search = (IEdmSearch6)Vault.CreateSearch();
if (Search == null)
return;

Search.FindFiles = true;
Search.SetToken(EdmSearchToken.Edmstok_AllVersions, true);
Search.SetToken(EdmSearchToken.Edmstok_StateBefore, dt);
Search.SetToken(EdmSearchToken.Edmstok_StateName, State);

IEdmSearchResult5 SearchResult = Search.GetFirstResult();
while ((SearchResult != null))
{
EdmSelItem2 SelItem = new EdmSelItem2();
SelItem.mlID = SearchResult.ID;
SelItem.mlParentID = SearchResult.ParentFolderID;
SelItem.meType = SearchResult.ObjectType;
SelItem.mlVersion = SearchResult.Version;

Items.Add(SelItem);
SearchResult = Search.GetNextResult();
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void OnTaskDetails(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
{
try
{
IEdmTaskInstance TaskInstance = (IEdmTaskInstance)poCmd.mpoExtra;
if ((TaskInstance != null))
{
SetupPageObj = new SetupPage((IEdmVault7)poCmd.mpoVault, TaskInstance);
//Force immediate creation of the control
//and its handle
SetupPageObj.CreateControl();
SetupPageObj.LoadData(poCmd);
SetupPageObj.DisableControls();
poCmd.mbsComment = "State Age Details";
poCmd.mlParentWnd = SetupPageObj.Handle.ToInt32();
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

}
}

Back to top

//UserControl1.cs

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using EPDM.Interop.epdm;
namespace StateAgeTask_CSharp
{
// Setup page used in the task setup and task details dialogs must be a System.Windows.Forms.UserControl
public partial class SetupPage
{

private IEdmVault7 mVault;
private IEdmTaskProperties mTaskProps;
private IEdmTaskInstance mTaskInst;
// Constructor called from task setup
public SetupPage(IEdmVault7 Vault, IEdmTaskProperties Props)
{
try
{
InitializeComponent();
mVault = Vault;
mTaskProps = Props;
mTaskInst = null;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X")  + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
// Constructor called from task details
public SetupPage(IEdmVault7 Vault, IEdmTaskInstance Props)
{
try
{
InitializeComponent();
mVault = Vault;
mTaskProps = null;
mTaskInst = Props;

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void LoadData(EdmCmd poCmd)
{
try
{
//Add the names of the available workflows
//to WorkflowsComboBox
WorkflowsComboBox.Items.Clear();
IEdmWorkflowMgr6 WorkflowMgr = default(IEdmWorkflowMgr6);
WorkflowMgr = (IEdmWorkflowMgr6)mVault.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr);
IEdmPos5 WorkflowPos = WorkflowMgr.GetFirstWorkflowPosition();
while (!WorkflowPos.IsNull)
{
IEdmWorkflow6 Workflow = default(IEdmWorkflow6);
Workflow = WorkflowMgr.GetNextWorkflow(WorkflowPos);
WorkflowsComboBox.Items.Add(Workflow.Name);
}

string SelectedWorkflow = "";
string NoDays = "";
if ((mTaskProps != null))
{
//Retrieve the name of the workflow that was
//selected by the user
SelectedWorkflow = (string)mTaskProps.GetValEx("SelectedWorkflowVar");
//Retrieve the number of days in a state
//before sending a message
NoDays = (string)mTaskProps.GetValEx("NoDaysVar");
}
else if ((mTaskInst != null))
{
//Retrieve the name of the workflow that
//was selected by the user
SelectedWorkflow = (string)mTaskInst.GetValEx("SelectedWorkflowVar");
//Retrieve the number of days in a state
//before sending a message
NoDays = (string)mTaskInst.GetValEx("NoDaysVar");
}

//Select the workflow to display in
//WorkflowsComboBox; setting this also
//causes SetupPage::WorkflowsComboBox_SelectedIndexChanged
//to be called to
fill StatesListBox
//with the available states for this workflow
if (string.IsNullOrEmpty(SelectedWorkflow))
{
WorkflowsComboBox.SelectedIndex = 0;
}
else
{
WorkflowsComboBox.Text = SelectedWorkflow;
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X")  + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void StoreData()
{
try
{
//Add the selected states to StatesList
string StatesList = "";
foreach (int SelectedStateIndex in StatesListBox.SelectedIndices)
{
StatesList += StatesListBox.Items[SelectedStateIndex] + "";
}
//Save the states selected by the user
mTaskProps.SetValEx("SelectedStatesVar", StatesList);
//Save the workflow selected by the user
mTaskProps.SetValEx("SelectedWorkflowVar", WorkflowsComboBox.Text);
//Save the number of days selected by the user
mTaskProps.SetValEx("NoDaysVar", DaysNumericUpDown.Value.ToString());

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void WorkflowsComboBox_SelectedIndexChanged(System.Object sender, System.EventArgs e)
{
try
{
//Find the IEdmWorkflow corresponding to the
//selected workflow name
IEdmWorkflowMgr6 WorkflowMgr = default(IEdmWorkflowMgr6);
WorkflowMgr = (IEdmWorkflowMgr6)mVault.CreateUtility(EdmUtility.EdmUtil_WorkflowMgr);
IEdmPos5 WorkflowPos = WorkflowMgr.GetFirstWorkflowPosition();
IEdmWorkflow6 Workflow = null;
IEdmWorkflow6 SelectedWorkflow = null;
while (!WorkflowPos.IsNull)
{
Workflow = WorkflowMgr.GetNextWorkflow(WorkflowPos);
if (Workflow.Name == WorkflowsComboBox.Text)
{
SelectedWorkflow = Workflow;
break;
}
}

//Add the names of the available states for the
//selected workflow to StatesListBox
StatesListBox.Items.Clear();
if (SelectedWorkflow != null)
{
IEdmPos5 StatePos = SelectedWorkflow.GetFirstStatePosition();
while (!(StatePos.IsNull))
{
IEdmState6 State = default(IEdmState6);
State = SelectedWorkflow.GetNextState(StatePos);
StatesListBox.Items.Add(State.Name);

}

}

string SelectedStates = "";
if ((mTaskProps != null))
{
SelectedStates = (string)mTaskProps.GetValEx("SelectedStatesVar");
}
else if ((mTaskInst != null))
{
SelectedStates = (string)mTaskInst.GetValEx("SelectedStatesVar");
}

string[]
States = SelectedStates.Split(new string[] { "\\n" }, StringSplitOptions.None);
foreach (string State in States)
{
if (!string.IsNullOrEmpty(State.Trim()))
{
StatesListBox.SelectedItems.Add(State);
}
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X")  + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public void DisableControls()
{
try
{
WorkflowsComboBox.Enabled = false;
StatesListBox.Enabled = false;
DaysNumericUpDown.Enabled = false;
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X")  + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

}
}

Back to top

//UserControl1.Designer.cs

namespace StateAgeTask_CSharp
{

    partial class SetupPage : System.Windows.Forms.UserControl
    {

        //UserControl overrides dispose to clean up the component list.
        [System.Diagnostics.DebuggerNonUserCode()]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && components != null)
                {
                    components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

 //Required by the Windows Form Designer

        private System.ComponentModel.IContainer components;
        //NOTE: The following procedure is required by the Windows Form Designer
        //It can be modified using the Windows Form Designer.
        //Do not modify it using the code editor.
        [System.Diagnostics.DebuggerStepThrough()]
        private void InitializeComponent()
        {
            this.StatesListBox = new System.Windows.Forms.ListBox();
            this.WorkflowsComboBox = new System.Windows.Forms.ComboBox();
            this.WorkflowLabel = new System.Windows.Forms.Label();
            this.StatesLabel = new System.Windows.Forms.Label();
            this.DaysLabel = new System.Windows.Forms.Label();
            this.DaysNumericUpDown = new System.Windows.Forms.NumericUpDown();
            ((System.ComponentModel.ISupportInitialize)(this.DaysNumericUpDown)).BeginInit();
            this.SuspendLayout();
            //
            // StatesListBox
            //
            this.StatesListBox.FormattingEnabled = true;
            this.StatesListBox.Location = new System.Drawing.Point(19, 97);
            this.StatesListBox.Margin = new System.Windows.Forms.Padding(2);
            this.StatesListBox.Name = "StatesListBox";
            this.StatesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
            this.StatesListBox.Size = new System.Drawing.Size(124, 108);
            this.StatesListBox.TabIndex = 0;

            //
            // WorkflowsComboBox
            //
            this.WorkflowsComboBox.FormattingEnabled = true;
            this.WorkflowsComboBox.Location = new System.Drawing.Point(19, 35);
            this.WorkflowsComboBox.Margin = new System.Windows.Forms.Padding(2);
            this.WorkflowsComboBox.Name = "WorkflowsComboBox";
            this.WorkflowsComboBox.Size = new System.Drawing.Size(124, 21);
            this.WorkflowsComboBox.TabIndex = 1;
            this.WorkflowsComboBox.SelectedIndexChanged += new System.EventHandler(this.WorkflowsComboBox_SelectedIndexChanged);
            //
            // WorkflowLabel
            //
            this.WorkflowLabel.AutoSize = true;
            this.WorkflowLabel.Location = new System.Drawing.Point(20, 12);
            this.WorkflowLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
            this.WorkflowLabel.Name = "WorkflowLabel";
            this.WorkflowLabel.Size = new System.Drawing.Size(91, 13);
            this.WorkflowLabel.TabIndex = 2;
            this.WorkflowLabel.Text = "Choose Workflow";
            //
            // StatesLabel
            //
            this.StatesLabel.AutoSize = true;
            this.StatesLabel.Location = new System.Drawing.Point(20, 72);
            this.StatesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
            this.StatesLabel.Name = "StatesLabel";
            this.StatesLabel.Size = new System.Drawing.Size(76, 13);
            this.StatesLabel.TabIndex = 3;
            this.StatesLabel.Text = "Select State(s)";
            //
            // DaysLabel
            //
            this.DaysLabel.AutoSize = true;
            this.DaysLabel.Location = new System.Drawing.Point(20, 223);
            this.DaysLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
            this.DaysLabel.Name = "DaysLabel";
            this.DaysLabel.Size = new System.Drawing.Size(122, 13);
            this.DaysLabel.TabIndex = 4;
            this.DaysLabel.Text = "Number of Days in State";
            //
            // DaysNumericUpDown
            //
            this.DaysNumericUpDown.Location = new System.Drawing.Point(22, 247);
            this.DaysNumericUpDown.Margin = new System.Windows.Forms.Padding(2);
            this.DaysNumericUpDown.Name = "DaysNumericUpDown";
            this.DaysNumericUpDown.Size = new System.Drawing.Size(119, 20);
            this.DaysNumericUpDown.TabIndex = 5;
            //
            // SetupPage
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.DaysNumericUpDown);
            this.Controls.Add(this.DaysLabel);
            this.Controls.Add(this.StatesLabel);
            this.Controls.Add(this.WorkflowLabel);
            this.Controls.Add(this.WorkflowsComboBox);
            this.Controls.Add(this.StatesListBox);
            this.Margin = new System.Windows.Forms.Padding(2);
            this.Name = "SetupPage";
            this.Size = new System.Drawing.Size(162, 278);
            ((System.ComponentModel.ISupportInitialize)(this.DaysNumericUpDown)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        private System.Windows.Forms.ListBox StatesListBox;
        private System.Windows.Forms.ComboBox WorkflowsComboBox;
        private System.Windows.Forms.Label WorkflowLabel;
        private System.Windows.Forms.Label StatesLabel;
        private System.Windows.Forms.Label DaysLabel;

        private System.Windows.Forms.NumericUpDown DaysNumericUpDown;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Create a Task that Finds Files in Workflow States Example (VB.NET)

This example shows how to create a task add-in that finds files that have been in specified workflow states a specified number of days.

'--------------------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'  2. Click File > New > Project > Visual Basic, Windows, Library > Class Library (.NET Framework).
'  3. Type StateAgeTask in Project name.
'  3. Select .NET Framework 4.5 or later in the dropdown.
'  4. For Location, click ... and navigate to the folder where to create the project.
'  5. Click Create.
'  6. Right-click the project in the Solution Explorer and click Add > User Control.
'  7. In the Add New Item dialog, keep the default name and click Add.
'  8. Click Show All Files in the Solution Explorer toolbar and expand UserControl1.vb.
'  9. Replace the code in Class1.vb with this code.
' 10. Replace the code in UserControl1.Designer.vb with this code.
' 11. Replace the code in UserControl1.vb with this code.
' 12. Add dependencies and safely pass arrays of structures.
' 13. Right-click the project name in the Solution Explorer and click Properties.
' 14. In the Properties window:
'     a. On the Application tab, click Assembly Information....
'     b. De-select Make assembly COM-Visible.
'     c. On the Compile tab, select Any CPU, de-select Prefer 32-bit, and select Register for COM interop.
' 15. Save the project.
' 16. To populate the GUID attribute, click Tools > Create GUID in the IDE,
'     select GUID Format 6, click Copy, and click Exit. Replace <Guid("")> with
'     the copied string.
' 17. Click Build > Build Solution.
'
' Postconditions:
'  1. Open the SOLIDWORKS PDM Professional Administration tool, expand a vault_name node,
'     and log in as Admin.
'  2. Under vault_name, right-click Add-ins and click New Add-in.
'     a. Navigate to the bin\Debug directory of your built project.
'     b. Click EPDM.Interop.epdm.dll and StateAgeTask.dll.
'     c. Click Open.
'     d. Click OK.
'  3. Click OK after reading the SOLIDWORKS PDM Professional warning dialog.
 '  4. In the taskbar notification area:
'     a. Click the SOLIDWORKS PDM Professional icon.
'     b. Click Task Host Configuration.
'     c. Select vault_name in the File Vault dropdown.
'     d. Select Permit next to the add-in you just installed.
'     e. Click OK.
'  5. In the Administration tool under vault_name, right-click Tasks and click New Task.
'  6. In the New task dialog:
'     a. Type State Age Task in the upper-left text box.
'     b. Select the VB.NET Workflow State Age Task Add-in from the Add-in dropdown.
'     c. Click Next.
'     d. On the Execution Method properties page, select the local computer.
'     e. Click Next.
'     f. On the Scheduling properties page, select This task is not scheduled.
'     g. Click Next.
'     h. On the Choose states to check page, select the file search criteria in:
'        1. Choose Workflow.
'        2. Select States.
'        3. Number of Days in State.
'     i. Click Next.
'     j. On the Permissions property page, select Admin.
'     k. Click Next.
'     l. On the Success Notification property page:
'        1. Select Notify the user who launched the task.
'        2. In the Subject field, type Success.
'        3. In the Text field, type The task successfully completed at, type a space,
'           click >, and click Current Time.
'     m. Click OK to close the New Task dialog.
'  7. Expand vault_name > Tasks and double-click Task List.
'  8. Click Add Task.
'  9. In the Add Task dialog:
'     a. Select State Age Task from the dropdown.
'     b. Click OK.
' 10. The task appears in the Pending tasks list. Observe the task status.
' 11. When the task completes, the task moves to the Completed tasks
'     list. After a minute or so, the logged-in user receives a notification
'     with the list of files that have been in the specified workflow states a
'     specified number of days.
'---------------------------------------------------------------------------------------

Back to top

'UserControl1.vb

Imports EPDM.Interop.epdm

' Setup page used in the task setup and task details dialogs must be a
' System.Windows.Forms.UserControl

Public Class SetupPage

  Private mVault As IEdmVault7
  Private mTaskProps As IEdmTaskProperties
  Private mTaskInst As IEdmTaskInstance
    ' Constructor called from task setup
  Public Sub New(ByVal Vault As IEdmVault7, _
      ByVal Props As IEdmTaskProperties)
    Try
      InitializeComponent()
      mVault = Vault
      mTaskProps = Props
      mTaskInst = Nothing

    Catch ex As Runtime.InteropServices.COMException
      MsgBox("HRESULT = 0x" + _
         ex.ErrorCode.ToString("X") + vbCrLf + _
         ex.Message)
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub

    ' Constructor called from task details
  Public Sub New(ByVal Vault As IEdmVault7, _
      ByVal Props As IEdmTaskInstance)
    Try
      InitializeComponent()
      mVault = Vault
      mTaskProps = Nothing
      mTaskInst = Props

    Catch ex As Runtime.InteropServices.COMException
      MsgBox("HRESULT = 0x" + _
         ex.ErrorCode.ToString("X") + vbCrLf + _
         ex.Message)
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub

  Public Sub LoadData(ByVal poCmd As EdmCmd)
    Try
      'Add the names of the available workflows to WorkflowsComboBox
      WorkflowsComboBox.Items.Clear()
      Dim WorkflowMgr As IEdmWorkflowMgr6
      WorkflowMgr = mVault.CreateUtility( _
        EdmUtility.EdmUtil_WorkflowMgr)
      Dim WorkflowPos As IEdmPos5 = _
        WorkflowMgr.GetFirstWorkflowPosition()
      While Not WorkflowPos.IsNull
        Dim Workflow As IEdmWorkflow6
        Workflow = _
          WorkflowMgr.GetNextWorkflow(WorkflowPos)
        WorkflowsComboBox.Items.Add(Workflow.Name)
      End While

      Dim SelectedWorkflow As String = ""
      Dim NoDays As String = ""
      If Not mTaskProps Is Nothing Then
        'Retrieve the name of the workflow that was
        'selected by the user
        SelectedWorkflow = _
          mTaskProps.GetValEx("SelectedWorkflowVar")
        'Retrieve the number of days in a state
        'before sending a message
        NoDays = mTaskProps.GetValEx("NoDaysVar")
      ElseIf Not mTaskInst Is Nothing Then
        'Retrieve the name of the workflow that
        'was selected by the user
        SelectedWorkflow = _
          mTaskInst.GetValEx("SelectedWorkflowVar")
        'Retrieve the number of days in a state
        'before sending a message
        NoDays = mTaskInst.GetValEx("NoDaysVar")
      End If

      'Select the workflow to display in
      'WorkflowsComboBox; setting this also
      'causes SetupPage::WorkflowsComboBox_SelectedIndexChanged
      'to be called to fill StatesListBox
      'with the available states for this workflow
      If SelectedWorkflow = "" Then
        WorkflowsComboBox.SelectedIndex = 0
      Else
        WorkflowsComboBox.Text = SelectedWorkflow
      End If

      'Retrieve the number of days in a state
      'before sending a message
      If IsNumeric(NoDays) Then
        DaysNumericUpDown.Value = _
          Convert.ToDecimal(NoDays)
      Else
        DaysNumericUpDown.Value = 0
      End If

    Catch ex As Runtime.InteropServices.COMException
      MsgBox("HRESULT = 0x" + _
         ex.ErrorCode.ToString("X") + vbCrLf + _
         ex.Message)
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub

  Public Sub StoreData()
    Try
      'Add the selected states to StatesList
      Dim StatesList As String = ""
      For Each SelectedStateIndex As Integer _
          In StatesListBox.SelectedIndices
        StatesList += _
          StatesListBox.Items(SelectedStateIndex) + _
            vbCrLf
      Next
      'Save the states selected by the user
      mTaskProps.SetValEx("SelectedStatesVar", _
        StatesList)
      'Save the workflow selected by the user
      mTaskProps.SetValEx("SelectedWorkflowVar", _
        WorkflowsComboBox.Text)
      'Save the number of days selected by the user
      mTaskProps.SetValEx("NoDaysVar", _
        DaysNumericUpDown.Value.ToString())

    Catch ex As Runtime.InteropServices.COMException
      MsgBox("HRESULT = 0x" + _
         ex.ErrorCode.ToString("X") + vbCrLf + _
         ex.Message)
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub

  Private Sub WorkflowsComboBox_SelectedIndexChanged( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles WorkflowsComboBox.SelectedIndexChanged
    Try
      'Find the IEdmWorkflow corresponding to the
      'selected workflow name
      Dim WorkflowMgr As IEdmWorkflowMgr6
      WorkflowMgr = mVault.CreateUtility( _
        EdmUtility.EdmUtil_WorkflowMgr)
      Dim WorkflowPos As IEdmPos5 = _
        WorkflowMgr.GetFirstWorkflowPosition()
      Dim Workflow As IEdmWorkflow6 = Nothing
      Dim SelectedWorkflow As IEdmWorkflow6 = Nothing
      While Not WorkflowPos.IsNull
        Workflow = _
          WorkflowMgr.GetNextWorkflow(WorkflowPos)
        If Workflow.Name = WorkflowsComboBox.Text Then
          SelectedWorkflow = Workflow
          Exit While
        End If
      End While

      'Add the names of the available states for the
      'selected workflow to StatesListBox
      StatesListBox.Items.Clear()
      If Not SelectedWorkflow Is Nothing Then
        Dim StatePos As IEdmPos5 = _
          SelectedWorkflow.GetFirstStatePosition()
        While Not StatePos.IsNull
          Dim State As IEdmState6
          State = SelectedWorkflow.GetNextState(StatePos)
          StatesListBox.Items.Add(State.Name)
        End While
      End If

      Dim SelectedStates As String = ""
      If Not mTaskProps Is Nothing Then
        SelectedStates = _
          mTaskProps.GetValEx("SelectedStatesVar")
      ElseIf Not mTaskInst Is Nothing Then
        SelectedStates = _
          mTaskInst.GetValEx("SelectedStatesVar")
      End If

      Dim States As Object = _
        Split(SelectedStates, vbCrLf)
      For Each State As String In States
        If Not Trim(State) = "" Then
          StatesListBox.SelectedItems.Add(State)
        End If
      Next

    Catch ex As Runtime.InteropServices.COMException
      MsgBox("HRESULT = 0x" + _
         ex.ErrorCode.ToString("X") + vbCrLf + _
         ex.Message)
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub

  Public Sub DisableControls()
    Try
      WorkflowsComboBox.Enabled = False
      StatesListBox.Enabled = False
      DaysNumericUpDown.Enabled = False
    Catch ex As Runtime.InteropServices.COMException
      MsgBox("HRESULT = 0x" + _
         ex.ErrorCode.ToString("X") + vbCrLf + _
         ex.Message)
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub

End Class

Back to top

'UserControl1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class SetupPage
    Inherits System.Windows.Forms.UserControl

    'UserControl overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer;
    'It can be modified using the Windows Form Designer;
    'Do not modify it using the code editor
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.StatesListBox = New System.Windows.Forms.ListBox
        Me.WorkflowsComboBox = New System.Windows.Forms.ComboBox
        Me.WorkflowLabel = New System.Windows.Forms.Label
        Me.StatesLabel = New System.Windows.Forms.Label
        Me.DaysLabel = New System.Windows.Forms.Label
        Me.DaysNumericUpDown = New System.Windows.Forms.NumericUpDown
        CType(Me.DaysNumericUpDown, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'StatesListBox
        '
        Me.StatesListBox.FormattingEnabled = True
        Me.StatesListBox.ItemHeight = 16
        Me.StatesListBox.Location = New System.Drawing.Point(25, 119)
        Me.StatesListBox.Name = "StatesListBox"
        Me.StatesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
        Me.StatesListBox.Size = New System.Drawing.Size(164, 132)
        Me.StatesListBox.TabIndex = 0
        '
        'WorkflowsComboBox
        '
        Me.WorkflowsComboBox.FormattingEnabled = True
        Me.WorkflowsComboBox.Location = New System.Drawing.Point(25, 43)
        Me.WorkflowsComboBox.Name = "WorkflowsComboBox"
        Me.WorkflowsComboBox.Size = New System.Drawing.Size(164, 24)
        Me.WorkflowsComboBox.TabIndex = 1
        '
        'WorkflowLabel
        '
        Me.WorkflowLabel.AutoSize = True
        Me.WorkflowLabel.Location = New System.Drawing.Point(27, 15)
        Me.WorkflowLabel.Name = "WorkflowLabel"
        Me.WorkflowLabel.Size = New System.Drawing.Size(117, 17)
        Me.WorkflowLabel.TabIndex = 2
        Me.WorkflowLabel.Text = "Choose Workflow"
        '
        'StatesLabel
        '
        Me.StatesLabel.AutoSize = True
        Me.StatesLabel.Location = New System.Drawing.Point(27, 89)
        Me.StatesLabel.Name = "StatesLabel"
        Me.StatesLabel.Size = New System.Drawing.Size(101, 17)
        Me.StatesLabel.TabIndex = 3
        Me.StatesLabel.Text = "Select State(s)"
        '
        'DaysLabel
        '
        Me.DaysLabel.AutoSize = True
        Me.DaysLabel.Location = New System.Drawing.Point(27, 275)
        Me.DaysLabel.Name = "DaysLabel"
        Me.DaysLabel.Size = New System.Drawing.Size(162, 17)
        Me.DaysLabel.TabIndex = 4
        Me.DaysLabel.Text = "Number of Days in State"
        '
        'DaysNumericUpDown
        '
        Me.DaysNumericUpDown.Location = New System.Drawing.Point(30, 304)
        Me.DaysNumericUpDown.Name = "DaysNumericUpDown"
        Me.DaysNumericUpDown.Size = New System.Drawing.Size(159, 22)
        Me.DaysNumericUpDown.TabIndex = 5
        '
        'SetupPage
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.Controls.Add(Me.DaysNumericUpDown)
        Me.Controls.Add(Me.DaysLabel)
        Me.Controls.Add(Me.StatesLabel)
        Me.Controls.Add(Me.WorkflowLabel)
        Me.Controls.Add(Me.WorkflowsComboBox)
        Me.Controls.Add(Me.StatesListBox)
        Me.Name = "SetupPage"
        Me.Size = New System.Drawing.Size(216, 342)
        CType(Me.DaysNumericUpDown, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents StatesListBox As System.Windows.Forms.ListBox
    Friend WithEvents WorkflowsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents WorkflowLabel As System.Windows.Forms.Label
    Friend WithEvents StatesLabel As System.Windows.Forms.Label
    Friend WithEvents DaysLabel As System.Windows.Forms.Label
    Friend WithEvents DaysNumericUpDown As System.Windows.Forms.NumericUpDown

End Class

Back to top

'Class1.vb

Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("")>
<ComVisible(True)>
Public Class Class1
    Implements IEdmAddIn5

    Dim SetupPageObj As SetupPage

    Public Sub GetAddInInfo( _
          ByRef poInfo As EdmAddInInfo, _
          ByVal poVault As IEdmVault5, _
          ByVal poCmdMgr As IEdmCmdMgr5) _
          Implements IEdmAddIn5.GetAddInInfo
        Try

            poInfo.mbsAddInName = "VB.NET Workflow State Age Task Add-In"
            poInfo.mbsCompany = "Dassault Systemes"
            poInfo.mbsDescription = "Example demonstrates " _
      + "a scheduled task that finds files that have been in selected workflow states a selected number of days"
            poInfo.mlAddInVersion = 1
            'Minimum SOLIDWORKS PDM Professional version
            'needed for tasks is 10.0
            poInfo.mlRequiredVersionMajor = 10
            poInfo.mlRequiredVersionMinor = 0

            'Register to call OnCmd on task-related events
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetup)
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskSetupButton)
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskRun)
            poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskDetails)
        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Public Sub OnCmd(ByRef poCmd As EdmCmd, _
        ByRef ppoData As EdmCmdData[]) _
        Implements IEdmAddIn5.OnCmd
        Try

            Select Case poCmd.meCmdType

                'Called from the Administration tool when
                'the user selects this task add-in from the
                'drop-down list and whenever this task is
                'subsequently edited in the Administration tool
                Case EdmCmdType.EdmCmd_TaskSetup
                    OnTaskSetup(poCmd, ppoData)

                'Sent when the user clicks OK or
                'Cancel in the task property dialog box
                Case EdmCmdType.EdmCmd_TaskSetupButton
                    OnTaskSetupButton(poCmd, ppoData)

                'Called whenever an instance of the
                'task is run
                Case EdmCmdType.EdmCmd_TaskRun
                    OnTaskRun(poCmd, ppoData)

                'Called from the Task List in the
                'Administration tool whenever the task details
                'dialog is displayed
                Case EdmCmdType.EdmCmd_TaskDetails
                    OnTaskDetails(poCmd, ppoData)
            End Select

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

    Private Sub OnTaskSetup(ByRef poCmd As EdmCmd, _
        ByRef ppoData As EdmCmdData[])
        Try
            Dim props As IEdmTaskProperties = poCmd.mpoExtra
            If Not props Is Nothing Then
                'Set the task properties
                props.TaskFlags = _
                  EdmTaskFlag.EdmTask_SupportsScheduling + _
                  EdmTaskFlag.EdmTask_SupportsDetails

                SetupPageObj = New SetupPage( _
                  poCmd.mpoVault, props)
                'Force immediate creation of the control
                'and its handle
                SetupPageObj.CreateControl()
                SetupPageObj.LoadData(poCmd)

                Dim pages(0) As EdmTaskSetupPage
                'Name that appears in the
                'navigation pane of the Add Task dialog
                'in the Administration tool
                pages(0).mbsPageName = "Choose states to check"
                pages(0).mlPageHwnd = SetupPageObj.Handle.ToInt32
                pages(0).mpoPageImpl = SetupPageObj

                props.SetSetupPages(pages)

            End If

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub OnTaskSetupButton(ByRef poCmd As EdmCmd, _
        ByRef ppoData As EdmCmdData[])
        Try
            'Custom setup page, SetupPageObj, is created
            'in method SetupPage::OnTaskSetup; SetupPage::StoreData
            'saves the contents of the list box to poCmd.mpoExtra
            'in the IEdmTaskProperties interface
            If poCmd.mbsComment = "OK" And _
                Not SetupPageObj Is Nothing Then
                SetupPageObj.StoreData()
            End If
            SetupPageObj = Nothing

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub OnTaskRun(ByRef poCmd As EdmCmd, _
        ByRef ppoData As EdmCmdData[])
        Try
            Dim TaskInstance As IEdmTaskInstance
            TaskInstance = poCmd.mpoExtra
            If Not TaskInstance Is Nothing Then
                TaskInstance.SetStatus( _
                  EdmTaskStatus.EdmTaskStat_Running)
                TaskInstance.SetProgressRange(100, 0, _
                  "Task is running.")

                Dim NoDays As String
                NoDays = TaskInstance.GetValEx("NoDaysVar")

                Dim States As String = ""
                States = TaskInstance.GetValEx( _
                  "SelectedStatesVar")

                Dim Items As List(Of EdmSelItem2) = _
                  New List(Of EdmSelItem2)

                DoSearch(poCmd.mpoVault, States, NoDays, Items)

                Dim NotificationArray(Items.Count - 1) _
                  As EdmSelItem2

                Items.CopyTo(NotificationArray)

                Dim ProgresssMsg As String
                If (Items.Count > 0) Then
                    ProgresssMsg = "Found " + _
                      Items.Count.ToString() + " files."
                Else
                    ProgresssMsg = ("No files found.")
                End If

                TaskInstance.SetProgressPos(100, ProgresssMsg)
                TaskInstance.SetStatus( _
                  EdmTaskStatus.EdmTaskStat_DoneOK, 0, "", _
                  NotificationArray, ProgresssMsg)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Public Sub DoSearch(ByVal Vault As IEdmVault11, _
        ByVal States As String, ByVal Days As String, _
        ByVal Items As List(Of EdmSelItem2))
        Try
            'Calculate date to use in file search
            Dim dt As DateTime = DateTime.Today
            Dim DaysInt As Integer = Convert.ToInt32(Days) - 1
            Dim ts As TimeSpan = New TimeSpan(DaysInt, 0, 0, 0)
            dt = dt.Subtract(ts)

            'Split States into an array of strings
            Dim StatesObj As Object = Split(States, vbCrLf)
            'Search for files with the specified state age
            For Each State As String In StatesObj
                'Skip empty strings
                If Trim(State) = "" Then
                    Continue For
                End If

                Dim Search As IEdmSearch6 = Vault.CreateSearch()
                If Search Is Nothing Then Return

                Search.FindFiles = True

                   Search.SetToken(EdmSearchToken.Edmstok_AllVersions, True)
                  Search.SetToken( _
                  EdmSearchToken.Edmstok_StateBefore, dt)
                Search.SetToken( _
                  EdmSearchToken.Edmstok_StateName, State)

                Dim SearchResult As IEdmSearchResult5 = _
                  Search.GetFirstResult()
                While Not SearchResult Is Nothing
                    Dim SelItem As EdmSelItem2 = New EdmSelItem2()
                    SelItem.mlID = SearchResult.ID
                    SelItem.mlParentID = SearchResult.ParentFolderID
                    SelItem.meType = SearchResult.ObjectType
                    SelItem.mlVersion = SearchResult.Version

                    Items.Add(SelItem)
                    SearchResult = Search.GetNextResult()
                End While
            Next State

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub OnTaskDetails(ByRef poCmd As EdmCmd, _
        ByRef ppoData As EdmCmdData[])
        Try
            Dim TaskInstance As IEdmTaskInstance = _
              poCmd.mpoExtra
            If Not TaskInstance Is Nothing Then
                SetupPageObj = New SetupPage( _
                  poCmd.mpoVault, TaskInstance)
                'Force immediate creation of the control
                'and its handle
                SetupPageObj.CreateControl()
                SetupPageObj.LoadData(poCmd)
                SetupPageObj.DisableControls()
                poCmd.mbsComment = "State Age Details"
                poCmd.mlParentWnd = SetupPageObj.Handle.ToInt32()
            End If

        Catch ex As Runtime.InteropServices.COMException
            MsgBox("HRESULT = 0x" + _
               ex.ErrorCode.ToString("X") + vbCrLf + _
               ex.Message)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Send Message to Users Example (C#)

This example shows how to send a message, also called a notification, to logged-in users who have permission to modify Categories.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type SendMessageCSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. Replace the code in Form1.Designer.cs with this code.
//12. Switch back to the Form1.cs code window.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click the Send message to users who can modify Categories button.
//  4. After several minutes, a SOLIDWORKS PDM Professional notification
//     is displayed only to logged-in users who have
//     permission to modify Categories.
//  5. To open the the message, click:
//     * either the notification while it is displayed or
//       the SOLIDWORKS PDM Professional tray icon.
//       - or -
//     * Tools > Inbox in File Explorer.
//  6. Close the dialog.
//----------------------------------------------------------------------------

//Form1.cs
using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;

namespace SendMessageCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        void SendMessageCSharp_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault1 = new EdmVault5();

                //Cast IEdmVault5 to IEdmVault8
                IEdmVault8 vault = (IEdmVault8)vault1;

                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void TraverseUsersButton_Click(System.Object sender, System.EventArgs e)
        {

            try
            {
                //Declare and create an instance of IEdmVault5 object
                IEdmVault5 vault = new EdmVault5();
                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                //Declare an IEdmUserMgr5 object
                IEdmUserMgr5 UserMgr = default(IEdmUserMgr5);
                UserMgr = (IEdmUserMgr5)vault;

                IEdmPos5 UserPos = default(IEdmPos5);
                UserPos = UserMgr.GetFirstUserPosition();
                while (!UserPos.IsNull)
                {
                    IEdmUser5 User = default(IEdmUser5);
                    IEdmUser7 User1 = default(IEdmUser7);
                    User = UserMgr.GetNextUser(UserPos);
                    User1 = (IEdmUser7)User;
                    if (User.IsLoggedIn)
                    {
                        if (User1.HasSysRightEx(EdmSysPerm.EdmSysPerm_ModifyCategories))
                        {
                            User.SendMsg("Category request", "Please stop by my office sometime " + "this morning to discuss adding " + "a new file type to a Category.");
                        }
                    }
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
Back to top
//Form1.Designer.cs
namespace SendMessageCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.TraverseUsersButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(80, 27);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(67, 67);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // TraverseUsersButton
            //
            this.TraverseUsersButton.Location = new System.Drawing.Point(67, 110);
            this.TraverseUsersButton.Name = "TraverseUsersButton";
            this.TraverseUsersButton.Size = new System.Drawing.Size(121, 53);
            this.TraverseUsersButton.TabIndex = 2;
            this.TraverseUsersButton.Text = "Send message to users who can modify Categories";
            this.TraverseUsersButton.UseVisualStyleBackColor = true;
            this.TraverseUsersButton.Click += new System.EventHandler(this.TraverseUsersButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(268, 200);
            this.Controls.Add(this.TraverseUsersButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Send Message to Users";
            this.Load += new System.EventHandler(this.SendMessageCSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button TraverseUsersButton;
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Send Message to Users Example (VB.NET)

This example shows how to send a message, also called a notification, to logged-in users who have permission to modify Categories.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type SendMessage in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. Replace the code in Form1.Designer.vb with this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click the Send message to users who can modify Categories button.
'  4. After several minutes, a SOLIDWORKS PDM Professional notification
'     is displayed only to logged-in users who have permission
'     to modify Categories.
'  5. To open the the message, click:
'     * either the notification while it is displayed or
'       the SOLIDWORKS PDM Professional tray icon.
'       - or -
'     * Tools > Inbox in File Explorer.
'  6. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports EPDM.Interop.epdm

Public Class Exercise3

  Private Sub Exercise3_Load( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load

    Try
      Dim vault As IEdmVault8 = New EdmVault5
      Dim Views() As EdmViewInfo = Nothing

      vault.GetVaultViews(Views, False)
      VaultsComboBox.Items.Clear()
      For Each View As EdmViewInfo In Views
        VaultsComboBox.Items.Add(View.mbsVaultName)
      Next
      If VaultsComboBox.Items.Count > 0 Then
        VaultsComboBox.Text = VaultsComboBox.Items(0)
      End If

    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

  Private Sub TraverseUsersButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles TraverseUsersButton.Click

    Try
      'Declare and create an instance of IEdmVault5 object
      Dim vault As IEdmVault5 = New EdmVault5()
      'Log into selected vault as the current user
      vault.LoginAuto(VaultsComboBox.Text, _
        Me.Handle.ToInt32())

      'Declare an IEdmUserMgr5 object
      Dim UserMgr As IEdmUserMgr5
      'The IEdmUserMgr5 interface is implemented by the
      'same class as the IEdmVault5 interface,
      'so in VB we can simply assign the value of
      'the IEdmVault5 object
      UserMgr = vault

      Dim UserPos As IEdmPos5
      UserPos = UserMgr.GetFirstUserPosition()
      While Not UserPos.IsNull
        Dim User As IEdmUser7
        User = UserMgr.GetNextUser(UserPos)
        If User.IsLoggedIn Then
          If User.HasSysRightEx(EdmSysPerm. _
            EdmSysPerm_ModifyCategories) _
            Then
            User.SendMsg("Category request", _
              "Please stop by my office sometime " + _
              "this morning to discuss adding " + _
              "a new file type to a Category.")
          End If
        End If
      End While

    Catch ex As Runtime.InteropServices.COMException
      MessageBox.Show("HRESULT = 0x" + _
        ex.ErrorCode.ToString("X") + vbCrLf + _
        ex.Message)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
  End Sub

End Class

Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Exercise3
   Inherits System.Windows.Forms.Form

   'Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
        Me.TraverseUsersButton = New System.Windows.Forms.Button()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'TraverseUsersButton
        '
        Me.TraverseUsersButton.Location = New System.Drawing.Point(57, 90)
        Me.TraverseUsersButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.TraverseUsersButton.Name = "TraverseUsersButton"
        Me.TraverseUsersButton.Size = New System.Drawing.Size(136, 67)
        Me.TraverseUsersButton.TabIndex = 18
        Me.TraverseUsersButton.Text = "Send message to users who can modify Categories"
        Me.TraverseUsersButton.UseVisualStyleBackColor = True
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(57, 41)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(136, 21)
        Me.VaultsComboBox.TabIndex = 16
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(71, 9)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 17
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'Exercise3
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(252, 168)
        Me.Controls.Add(Me.TraverseUsersButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.Name = "Exercise3"
        Me.Text = "Send Message to Users"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
   Friend WithEvents TraverseUsersButton As System.Windows.Forms.Button
   Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents VaultsLabel As System.Windows.Forms.Label

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Set Initial Revision Example (C#)

This example shows how to set the initial revision of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//--------------------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type SetRevision_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. Replace the code in Form1.Designer.cs with this code.
//12. Copy a SOLIDWORKS part to a PDM vault view.
//
a. Check in the part.
//
b. Right-click the part and click Change State > No Approval Required.
//
Part is now in the Approved state, and data card Revision is A.
//
c. Check out the part.
//
d. In the part's data card, type G in Revision.
//
e. Save the data card.
//
f. Check in the part.
//13.
Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. The Set Revision dialog opens.
// 2. Select the vault containing the SOLIDWORKS part you just checked in.
// 3. Click Set Initial Revision.
// 4. In the Select files on which to set initial revision dialog, click the
//    SOLIDWORKS part you just checked in and click Open.
// 5. In the File already has a revision dialog, click OK to set the initial
//    revision.
// 6. Refresh the vault view, click the SOLIDWORKS part, and click the Version tab.
//    Observe that the local revision of the file is now G.
// 7. Close the Set Revision dialog.
//--------------------------------------------------------------------------------------

//Form1.cs

using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace SetRevision_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void SetRevision_CSharp_Load(System.Object sender, System.EventArgs e)
{

try {
IEdmVault5 vault = new EdmVault5();
EdmViewInfo[] Views = {};

((IEdmVault8)vault).GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views) {
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0) {
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void SetInitialRevisionButton_Click(System.Object sender, System.EventArgs e)
{

try {
//Declare and create an instance of IEdmVault5
IEdmVault5 vault = new EdmVault5();

//Log into selected vault as the current user
vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

//Display a File Open dialog for user to
//choose the files on which set the initial revision
EdmStrLst5 PathList = default(EdmStrLst5);
PathList = vault.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitMultipleSel + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles, "SOLIDWORKS files " + "(*.sldprt; *.sldasm; *.slddrw)|" + "*.sldprt;*.sldasm;*.slddrw|" + "All Files (*.*)|*.*||", "", "", vault.RootFolderPath, "Select Files to Set Initial Revision on");

//Exit if the user clicks Cancel
if (PathList == null)
return;

//Traverse the selected files
IEdmPos5 pos = default(IEdmPos5);
pos = PathList.GetHeadPosition();
while (!pos.IsNull) {
//Get each file path from the selected files list
string FilePath = null;
FilePath = PathList.GetNext(pos);
//Get the IEdmFile5 object corresponding
//to the path
IEdmFile5 FileObj = default(IEdmFile5);
IEdmFolder5 retfold = default(IEdmFolder5);
FileObj = vault.GetFileFromPath(FilePath, out retfold);

//Skip any files that are checked out
if (FileObj.IsLocked) {
MessageBox.Show    (FilePath + " is checked out." + "\r\n" + "Check it in and try again." + "\r\n" + "Skipping this file.", "File is checked out.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
continue;
}

//Get the value of the file data
//card variable
named Revision
IEdmEnumeratorVariable8 EnumVarObj = default(IEdmEnumeratorVariable8);
//Keeps the file open
EnumVarObj = (IEdmEnumeratorVariable8)FileObj.GetEnumeratorVariable();

bool GetVarSuccess = false;
//GetVar returns a Variant
object RevisionObj = null;
GetVarSuccess = EnumVarObj.GetVar("Revision", "@", out RevisionObj);
EnumVarObj.CloseFile(false);
//Pass True to flush

//Skip any files without a Revision
//card variable value
if (RevisionObj == null) {
MessageBox.Show("The \"Revision\" custom " + "property of " + FilePath + " is not set to a value." + "\r\n" + "Skipping this file.", "Revision custom property empty.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
continue;
}

//Check type
System.Type RevType = default(System.Type);
RevType = RevisionObj.GetType();
if (!(RevType.Name == "String")) {
MessageBox.Show("The \"Revision\" " + "variable type is not \"String\"." + "\r\n" + "Skipping this file.", "Revision custom property empty.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
continue;
}

string RevisionProp = null;
RevisionProp = (string)RevisionObj;

//Skip any files whose Revision value
//is not formatted appropriately
if (!(RevisionProp.Length == 1)) {
MessageBox.Show("The \"Revision\" custom " + "property of " + FilePath + " does not conform to the expected " + "revision number format." + "\r\n" + "Skipping this file.", "Revision custom property in the wrong format.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
continue;
}

//Create an IEdmRevisionMgr2 object
IEdmRevisionMgr2 RevMgr = default(IEdmRevisionMgr2);
RevMgr = (IEdmRevisionMgr2)((IEdmVault7)vault).CreateUtility(EdmUtility.EdmUtil_RevisionMgr);

//Get the revision number ID
bool CanIncrement = false;
int RevisionNumberID = 0;
//Return 0 if there is no revision number
//generator defined for the file's current state
RevisionNumberID = RevMgr.GetRevisionNumberIDFromFile(FileObj.ID, out CanIncrement);

//Skip this file if there is no
//revision number generator for it
if (RevisionNumberID == 0) {
MessageBox.Show("Move " + FilePath + " to a state where a Revision Number " + "is defined." + "\r\n" + "Skipping this file.", "No Revision Number is defined " + "for this state.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
continue;
}

//Get the revision number info for this file
EdmRevNo[] RevNumbers = {

};
RevMgr.GetRevisionNumbers(RevisionNumberID, out RevNumbers);
string RevNoFormatString = null;
RevNoFormatString = RevNumbers[0].mbsData;
string RevNoFormatLiteral = null;
int PercentPos = 0;
PercentPos = RevNoFormatString.IndexOf("%");
RevNoFormatLiteral = RevNoFormatString.Substring(0, PercentPos);
string NewRev = null;
NewRev = RevNoFormatLiteral + RevisionProp;

//Check the file's current revision
string CurRev = null;
CurRev = FileObj.CurrentRevision;

//Give the user the option to skip this file
//if it already has a revision set
if (!(CurRev == string.Empty)) {
System.Windows.Forms.DialogResult MsgBoxResult = default(System.Windows.Forms.DialogResult);
MsgBoxResult = MessageBox.Show("The current revision of " + FilePath + " is \"" + CurRev + "\"." + "\r\n" + "The new revision will be \"" + NewRev + "\"" + "\r\n" + "Would you like to continue?", "File already has a revision", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (MsgBoxResult == System.Windows.Forms.DialogResult.Cancel)
continue;
}

//Get the revision number components for the
//revision number used by this file
EdmRevComponent2[] RevComponents = {

};
RevMgr.GetRevisionNumberComponents2(-RevisionNumberID, out RevComponents);
string RevComponentName = null;
RevComponentName = RevComponents[0].mbsComponentName;

//Declare an array of EdmRevCounter structures,
//even though only one
is used,
//and assign the values to set
EdmRevCounter[] RevCounters = new EdmRevCounter[1];
//Assign the name of the revision counter
//to set
RevCounters[0].mbsComponentName = RevComponentName;
//Assign the new revision counter value to the
//value stored in the Revision card variable
//converted to an integer
int RevInt = 0;
RevInt = Strings.Asc(RevisionProp.ToUpper()) - Strings.Asc("A") + 1;
RevCounters[0].mlCounter = (int)RevInt;

//Set the revision counter to the new values
RevMgr.SetRevisionCounters(FileObj.ID, RevCounters);

//Set the revision of the file to the new values
RevMgr.IncrementRevision(FileObj.ID);

//Save the new values to the database
EdmRevError[] RevErrors = {

};
RevMgr.Commit("Set starting revision for " + "legacy file.", out RevErrors);
}
}
catch (System.Runtime.InteropServices.COMException ex) {
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
}
}

}
}

Back to top
//Form1.Designer.cs

namespace SetRevision_CSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.SetInitialRevisionButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(52, 28);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(136, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select Preferred Vault View";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(55, 58);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // SetInitialRevisionButton
            //
            this.SetInitialRevisionButton.Location = new System.Drawing.Point(55, 97);
            this.SetInitialRevisionButton.Name = "SetInitialRevisionButton";
            this.SetInitialRevisionButton.Size = new System.Drawing.Size(121, 23);
            this.SetInitialRevisionButton.TabIndex = 2;
            this.SetInitialRevisionButton.Text = "Set Initial Revision";
            this.SetInitialRevisionButton.UseVisualStyleBackColor = true;
            this.SetInitialRevisionButton.Click += new System.EventHandler(this.SetInitialRevisionButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Controls.Add(this.SetInitialRevisionButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Set Revision";
            this.Load += new System.EventHandler(this.SetRevision_CSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button SetInitialRevisionButton;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Set Initial Revision Example (VB.NET)

This example shows how to set the initial revision of a file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'---------------------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App
' 3. Type SetRevision in Project name.
 ' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. Replace the code in Form1.Designer.vb with this code.
'12. Copy a SOLIDWORKS part to a PDM vault view.
'     a. Check in the part.
'     b. Right-click the part and click Change State > No Approval Required.
'        Part is now in the Approved state, and data card Revision is A.
'     c. Check out the part.
'     d. In the part's data card, type G in Revision.
'     e. Save the data card.
'     f. Check in the part.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. The Set Revision dialog opens.
' 2. Select the vault containing the SOLIDWORKS part you just checked in.
' 3. Click Set Initial Revision.
' 4. In the Select files on which to set initial revision dialog, click the
'    SOLIDWORKS part you just checked in and click Open.
' 5. In the File already has a revision dialog, click OK to set the initial
'    revision.
' 6. Refresh the vault view, click the SOLIDWORKS part, and click the Version tab.
'    Observe that the local revision of the file is now G.
' 7. Close the Set Revision dialog.
'---------------------------------------------------------------------------------------
'Form1.vb

Imports EPDM.Interop.epdm

Public Class Form1

  Private Sub Form1_Load(ByVal sender As _
    System.Object, ByVal e As System.EventArgs) _
    Handles MyBase.Load

    Dim vault As IEdmVault8 = New EdmVault5
    Dim Views() As EdmViewInfo = {}

    vault.GetVaultViews(Views, False)
    VaultsComboBox.Items.Clear()
    For Each View As EdmViewInfo In Views
      VaultsComboBox.Items.Add(View.mbsVaultName)
    Next
    If VaultsComboBox.Items.Count > 0 Then
      VaultsComboBox.Text = VaultsComboBox.Items(0)
    End If
  End Sub

  Private Sub SetInitialRevisionButton_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles SetInitialRevisionButton.Click

        'Declare and create an instance of IEdmVault5
    Dim vault As IEdmVault5 = New EdmVault5()

    'Log into selected vault as the current user
    vault.LoginAuto(VaultsComboBox.Text, _
       Me.Handle.ToInt32())

        'Display a File Open dialog for user to
        'choose the files on which set the initial revision
    Dim PathList As EdmStrLst5
        PathList = vault.BrowseForFile( _
           Me.Handle.ToInt32(), _
           EdmBrowseFlag.EdmBws_ForOpen + _
           EdmBrowseFlag.EdmBws_PermitMultipleSel + _
           EdmBrowseFlag.EdmBws_PermitVaultFiles, _
           "SOLIDWORKS files " + _
           "(*.sldprt; *.sldasm; *.slddrw)|" + _
           "*.sldprt;*.sldasm;*.slddrw|" + _
           "All Files (*.*)|*.*||", _
           "", "", vault.RootFolderPath, _
           "Select Files to Set Initial Revision on")

        'Exit if the user clicks Cancel
    If PathList Is Nothing Then Exit Sub

    'Traverse the selected files
    Dim pos As IEdmPos5
    pos = PathList.GetHeadPosition
    While Not pos.IsNull
      'Get each file path from the selected files list
      Dim FilePath As String
      FilePath = PathList.GetNext(pos)
      'Get the IEdmFile5 object corresponding
      'to the path
      Dim FileObj As IEdmFile5
      FileObj = vault.GetFileFromPath(FilePath)

      'Skip any files that are checked out
      If FileObj.IsLocked Then
        MessageBox.Show(FilePath + _
           " is checked out." _
           + vbCrLf + "Check it in and try again." _
           + vbCrLf + "Skipping this file.", _
           "File is checked out.", _
           MessageBoxButtons.OK, _
           MessageBoxIcon.Warning)
        Continue While
      End If

      'Get the value of the file data
            'card variable named Revision
      Dim EnumVarObj As IEdmEnumeratorVariable8
      'Keeps the file open
      EnumVarObj = FileObj.GetEnumeratorVariable

      Dim GetVarSuccess As Boolean
      'GetVar returns a Variant
      Dim RevisionObj As Object = Nothing
      GetVarSuccess = EnumVarObj.GetVar("Revision", _
         "@", RevisionObj)
      EnumVarObj.CloseFile(False) 'Pass True to flush

            'Skip any files without a Revision
            'card variable value
      If RevisionObj Is Nothing Then
        MessageBox.Show("The ""Revision"" custom " + _
           "property of " + FilePath + _
           " is not set to a value." _
           + vbCrLf + "Skipping this file.", _
           "Revision custom property empty.", _
           MessageBoxButtons.OK, _
           MessageBoxIcon.Warning)
        Continue While
      End If

            'Check type
      Dim RevType As System.Type
      RevType = RevisionObj.GetType()
      If Not RevType.Name = "String" Then
        MessageBox.Show("The ""Revision"" " + _
           "variable type is not ""String""." _
           + vbCrLf + "Skipping this file.", _
           "Revision custom property empty.", _
           MessageBoxButtons.OK, _
           MessageBoxIcon.Warning)
        Continue While
      End If

      Dim RevisionProp As String
      RevisionProp = RevisionObj

            'Skip any files whose Revision value
            'is not formatted appropriately
      If Not RevisionProp.Length = 1 Then
                MessageBox.Show("The ""Revision"" custom " + _
                   "property of " + FilePath + _
                   " does not conform to the expected " + _
                   "revision number format." + vbCrLf + _
                   "Skipping this file.", _
                   "Revision custom property in the wrong format.", _
                   MessageBoxButtons.OK, _
                   MessageBoxIcon.Warning)
        Continue While
      End If

      'Create an IEdmRevisionMgr2 object
      Dim RevMgr As IEdmRevisionMgr2
      RevMgr = vault.CreateUtility( _
         EdmUtility.EdmUtil_RevisionMgr)

      'Get the revision number ID
      Dim CanIncrement As Boolean
      Dim RevisionNumberID As Long
            'Return 0 if there is no revision number
      'generator defined for the file's current state
      RevisionNumberID = _
         RevMgr.GetRevisionNumberIDFromFile( _
         FileObj.ID, CanIncrement)

      'Skip this file if there is no
      'revision number generator for it
      If RevisionNumberID = 0 Then
                MessageBox.Show("Move " + FilePath + _
                   " to a state where a Revision Number " + _
                   "is defined." + vbCrLf + _
                   "Skipping this file.", _
                   "No Revision Number is defined " + _
                   "for this state.", MessageBoxButtons.OK, _
                   MessageBoxIcon.Warning)
        Continue While
      End If

      'Get the revision number info for this file
      Dim RevNumbers() As EdmRevNo = {}
      RevMgr.GetRevisionNumbers(RevisionNumberID, _
         RevNumbers)
      Dim RevNoFormatString As String
      RevNoFormatString = RevNumbers(0).mbsData
      Dim RevNoFormatLiteral As String
      Dim PercentPos As Integer
      PercentPos = RevNoFormatString.IndexOf("%")
      RevNoFormatLiteral = _
         RevNoFormatString.Substring(0, PercentPos)
      Dim NewRev As String
      NewRev = RevNoFormatLiteral + RevisionProp

      'Check the file's current revision
      Dim CurRev As String
      CurRev = FileObj.CurrentRevision

      'Give the user the option to skip this file
      'if it already has a revision set
      If Not CurRev = String.Empty Then
        Dim MsgBoxResult As _
           System.Windows.Forms.DialogResult
        MsgBoxResult = MessageBox.Show( _
           "The current revision of " _
           + FilePath + " is """ + CurRev + """." + _
           vbCrLf + "The new revision will be """ + _
           NewRev + """" + vbCrLf _
           + "Would you like to continue?", _
           "File already has a revision", _
           MessageBoxButtons.OKCancel, _
           MessageBoxIcon.Question)
        If MsgBoxResult = _
           Windows.Forms.DialogResult.Cancel Then _
           Continue While
      End If

      'Get the revision number components for the
      'revision number used by this file
      Dim RevComponents() As EdmRevComponent2 = {}
      RevMgr.GetRevisionNumberComponents2( _
         -RevisionNumberID, RevComponents)
      Dim RevComponentName As String
      RevComponentName = _
         RevComponents(0).mbsComponentName

            'Declare an array of EdmRevCounter structures,
            'even though only one is used,
      'and assign the values to set
      Dim RevCounters(0) As EdmRevCounter
      'Assign the name of the revision counter
      'to set
      RevCounters(0).mbsComponentName = _
         RevComponentName
      'Assign the new revision counter value to the
      'value stored in the Revision card variable
      'converted to an integer
      Dim RevInt As Long
      RevInt = _
         Asc(RevisionProp.ToUpper()) - Asc("A") + 1
      RevCounters(0).mlCounter = RevInt

      'Set the revision counter to the new values
      RevMgr.SetRevisionCounters(FileObj.ID, _
         RevCounters)

      'Set the revision of the file to the new values
      RevMgr.IncrementRevision(FileObj.ID)

      'Save the new values to the database
      Dim RevErrors() As EdmRevError = {}
      RevMgr.Commit("Set starting revision for " + _
         "legacy file.", RevErrors)
    End While
  End Sub
End Class

Back to top
'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
   Inherits System.Windows.Forms.Form

   'Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.SetInitialRevisionButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(22, 16)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(136, 13)
        Me.VaultsLabel.TabIndex = 10
        Me.VaultsLabel.Text = "Select Preferred Vault View"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(26, 32)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(132, 21)
        Me.VaultsComboBox.TabIndex = 11
        '
        'SetInitialRevisionButton
        '
        Me.SetInitialRevisionButton.Location = New System.Drawing.Point(41, 57)
        Me.SetInitialRevisionButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.SetInitialRevisionButton.Name = "SetInitialRevisionButton"
        Me.SetInitialRevisionButton.Size = New System.Drawing.Size(101, 41)
        Me.SetInitialRevisionButton.TabIndex = 14
        Me.SetInitialRevisionButton.Text = "Set Initial Revision"
        Me.SetInitialRevisionButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(222, 119)
        Me.Controls.Add(Me.SetInitialRevisionButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.Name = "Form1"
        Me.Text = "Set Revision"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
   Friend WithEvents VaultsLabel As System.Windows.Forms.Label
   Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents SetInitialRevisionButton As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

Set Part Numbers Using Default Serial Numbers Example (C#)

This example shows how to set part numbers using default serial numbers.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type SerialNumbersCSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. Ensure that you have:
//     * a vault with at least one serial number generator.
//     * a checked-out file in that vault with its Part Number variable's
//       default set to a serial number.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Serial Numbers dialog box.
//  2. Select a vault view.
//  3. Click Get Vault Serial Number Names.
//  4. Displays a message box containing the names of the serial number
//     generators for the selected vault.
//  5. Click OK to close the message box.
//  6. Click Browse.
//     a. Click a checked-out file in the selected vault whose
//        data card has a Part Number variable.
//     b. Click Open.
//     The selected file's path and file name appear in the Serial
//     Numbers dialog box.
//  7. Click Set New Serial Number.
//  8. Displays a message box verifying that the Part Number was
//     set and shows the value of that Part Number.
//     NOTES:
//     * The value set for the Part Number is the next number in the first
//       serial number generator shown in the message box displayed in
//       step 3.
//     * Make note of the Part Number.
//  9. Click OK to close the message box.
// 10. Check in the file whose Part Number was set in step 7, then check out the
//     file.
// 11. Examine the Part Number on the data card of the checked-out file.
// 12. Close the Serial Numbers dialog box.
//----------------------------------------------------------------------------
//Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace SerialNumbersCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private IEdmVault5 vault1 = null;
        string aSerialNbrName;
        string aFileName;
        IEdmFile5 aFile;
        string aFolder;
        IEdmSerNoGen7 serialNbrs;

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {

        try {
            vault1 = new EdmVault5();
                    IEdmVault8 vault = (IEdmVault8)vault1;
            EdmViewInfo[] Views = null;

            vault.GetVaultViews(out Views, false);
            VaultsComboBox.Items.Clear();
            foreach (EdmViewInfo View in Views) {
                VaultsComboBox.Items.Add(View.mbsVaultName);
            }
            if (VaultsComboBox.Items.Count > 0) {
                VaultsComboBox.Text = (string) VaultsComboBox.Items[0];
            }

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " "  + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
    }

    public void Button1_Click(System.Object sender, System.EventArgs e)
    {
        try {
            //Only create a new vault object
            //if one hasn't been created yet
            IEdmVault11 vault2 = null;
            if (vault1 == null) {
                vault1 = new EdmVault5();
            }
            vault2 = (IEdmVault11)vault1;
            if (!vault1.IsLoggedIn) {
                //Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
            }

            serialNbrs = (IEdmSerNoGen7)vault2.CreateUtility(EdmUtility.EdmUtil_SerNoGen);
            string[] names = {	};
            serialNbrs.GetSerialNumberNames(out names);
            string myMessage = "";
            myMessage = "Serial number names in selected vault: " + "\n ";
            int idx = 0;
            idx = (names.GetLowerBound(0));
            while (idx <= (names.GetUpperBound(0))) {
                myMessage = myMessage + names[idx] + "\n";
                idx = idx + 1;
            }

            // Use this serial number generator
            aSerialNbrName = names[0];

            MessageBox.Show(myMessage);

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
    }

    public void BrowseButton_Click(System.Object sender, System.EventArgs e)
    {
        try {

            //Set the initial directory in the Select a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
            //Show the Select a file dialog
            System.Windows.Forms.DialogResult DialogResult;
            DialogResult = OpenFileDialog1.ShowDialog();

            if (!(DialogResult == System.Windows.Forms.DialogResult.OK)) {
                // Do nothing
            } else {
                // Browse for a file whose serial number to set
                // File's data card must have a Part Number associated
                // with a serial number generator and must be checked out
                string fileName = OpenFileDialog1.FileName;
                FileListBox.Items.Add(fileName);
                            IEdmFolder5 retFolder = default(IEdmFolder5);
                aFile = vault1.GetFileFromPath(fileName, out retFolder);

            }

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
    }

    public void NewButton_Click(System.Object sender, System.EventArgs e)
    {
        try {

            IEdmSerNoValue serialNbrValue = default(IEdmSerNoValue);
            serialNbrValue = serialNbrs.AllocSerNoValue(aSerialNbrName, this.Handle.ToInt32(), " ", 0, 0, 0, 0);
            dynamic serialNbrValueValue = serialNbrValue.Value;
            IEdmEnumeratorVariable5 enumVariable = default(IEdmEnumeratorVariable5);
            enumVariable = aFile.GetEnumeratorVariable(aFileName);
            // Set the Part Number of the selected file
            enumVariable.SetVar("Part Number", "@", serialNbrValueValue);
                    IEdmEnumeratorVariable8 enumVariable8 = (IEdmEnumeratorVariable8)enumVariable;
            enumVariable8.CloseFile(true);

            MessageBox.Show("Part Number set to " + serialNbrValueValue.ToString() + "." + " ");

        } catch (System.Runtime.InteropServices.COMException ex) {
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
        } catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
    }
    }

}
Back to top
//Form1.Designer.cs

namespace SerialNumbersCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.Button1 = new System.Windows.Forms.Button();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.NewButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            //VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.VaultsLabel.Location = new System.Drawing.Point(25, 28);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            //VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(28, 44);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(190, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            //Button1
            //
            this.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.Button1.Location = new System.Drawing.Point(28, 84);
            this.Button1.Name = "Button1";
            this.Button1.Size = new System.Drawing.Size(190, 23);
            this.Button1.TabIndex = 2;
            this.Button1.Text = "Get Vault Serial Number Names";
            this.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.Button1.UseVisualStyleBackColor = true;
                    this.Button1.Click += new System.EventHandler(this.Button1_Click);
            //
            //FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(28, 141);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(190, 17);
            this.FileListBox.TabIndex = 3;
            //
            //OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select a file";
            //
            //BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(239, 135);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(56, 23);
            this.BrowseButton.TabIndex = 4;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.BrowseButton.UseVisualStyleBackColor = true;
                    this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            //NewButton
            //
            this.NewButton.Location = new System.Drawing.Point(28, 182);
            this.NewButton.Name = "NewButton";
            this.NewButton.Size = new System.Drawing.Size(190, 23);
            this.NewButton.TabIndex = 5;
            this.NewButton.Text = "Set New Serial Number";
            this.NewButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.NewButton.UseVisualStyleBackColor = true;
                    this.NewButton.Click += new System.EventHandler(this.NewButton_Click);
            //
            //Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(326, 262);
            this.Controls.Add(this.NewButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.Button1);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Serial Numbers";
                    this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

    }

    #endregion

    internal System.Windows.Forms.Label VaultsLabel;
    internal System.Windows.Forms.ComboBox VaultsComboBox;
    internal System.Windows.Forms.Button Button1;
    internal System.Windows.Forms.ListBox FileListBox;
    internal System.Windows.Forms.Button BrowseButton;
    internal System.Windows.Forms.Button NewButton;
    internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;

   }

}
Back to top


SOLIDWORKS PDM Professional API Help

Set Part Numbers Using Default Serial Numbers Example (VB.NET)

This example shows how to set part numbers using default serial numbers.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type SerialNumbers in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Ensure that you have:
'     * a vault with at least one serial number generator.
'     * a checked-out file in that vault with its Part Number variable's
'       default set to a serial number.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Serial Numbers dialog box.
'  2. Select a vault view.
'  3. Click Get Vault Serial Number Names.
'  4. Displays a message box containing the names of the serial number
'     generators for the selected vault.
'  5. Click OK to close the message box.
'  6. Click Browse.
'     a. Click a checked-out file in the selected vault whose
'        data card has a Part Number variable.
'     b. Click Open.
'     The selected file's path and file name appear in the Serial
'     Numbers dialog box.
'  7. Click Set New Serial Number.
'  8. Displays a message box verifying that the Part Number was
'     set and shows the value of that Part Number.
'     NOTES:
'     * The value set for the Part Number is the next number in the first
'       serial number generator shown in the message box displayed in
'       step 3.
'     * Make note of the Part Number.
'  9. Click OK to close the message box.
' 10. Check in the file whose Part Number was set in step 7, then check out
'     file.
' 11. Examine the Part Number on the data card of the checked-out file.
' 12. Close the Serial Numbers dialog box.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aSerialNbrName As String
    Dim aFileName As String
    Dim aFile As IEdmFile5
    Dim aFolder As String
    Dim serialNbrs As IEdmSerNoGen7

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            serialNbrs = vault2.CreateUtility(EdmUtility.EdmUtil_SerNoGen)
            Dim names() As String = {}
            serialNbrs.GetSerialNumberNames(names)
            Dim myMessage As String = ""
            myMessage = "Serial number names in selected vault: " + vbLf + vbLf
            Dim idx As Integer
            idx = LBound(names)
            While (idx <= UBound(names))
                myMessage = myMessage + names(idx) + vbLf
                idx = idx + 1
            End While

            ' Use this serial number generator
            aSerialNbrName = names(0)

            MessageBox.Show(myMessage)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try

            'Set the initial directory in the Select a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select a file dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                ' Do nothing
            Else
                ' Browse for a file whose serial number to set
                ' File's data card must have a Part Number associated
                ' with a serial number generator and must be checked out
                Dim fileName As String = OpenFileDialog1.FileName
                FileListBox.Items.Add(fileName)
                aFile = vault1.GetFileFromPath(fileName)

            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub NewButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewButton.Click
        Try

            Dim serialNbrValue As IEdmSerNoValue
            serialNbrValue = serialNbrs.AllocSerNoValue(aSerialNbrName, Me.Handle.ToInt32)
            Dim serialNbrValueValue = serialNbrValue.Value
            Dim enumVariable As IEdmEnumeratorVariable5
            enumVariable = aFile.GetEnumeratorVariable(aFileName)
            Dim serialNbrValueObj As Object = Nothing
            ' Set the Part Number of the selected file
            enumVariable.SetVar("Part Number", "@", serialNbrValueValue)
            enumVariable.CloseFile(True)

            MessageBox.Show("Part Number set to " + serialNbrValueValue.ToString + "." + vbLf)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.NewButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.VaultsLabel.Location = New System.Drawing.Point(25, 28)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(28, 44)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(190, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Button1
        '
        Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Button1.Location = New System.Drawing.Point(28, 84)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(190, 23)
        Me.Button1.TabIndex = 2
        Me.Button1.Text = "Get Vault Serial Number Names"
        Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Button1.UseVisualStyleBackColor = True
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(28, 141)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(190, 17)
        Me.FileListBox.TabIndex = 3
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select a file"
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(239, 135)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(56, 23)
        Me.BrowseButton.TabIndex = 4
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'NewButton
        '
        Me.NewButton.Location = New System.Drawing.Point(28, 182)
        Me.NewButton.Name = "NewButton"
        Me.NewButton.Size = New System.Drawing.Size(190, 23)
        Me.NewButton.TabIndex = 5
        Me.NewButton.Text = "Set New Serial Number"
        Me.NewButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.NewButton.UseVisualStyleBackColor = True
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(326, 262)
        Me.Controls.Add(Me.NewButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Serial Numbers"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents NewButton As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Standard Task Add-in

You can write your own task add-in using SOLIDWORKS PDM Professional API's methods and interfaces. Doing so gives you full control over what the task should do.

However, if you simply want a task to open files in SOLIDWORKS and run VBScripts on them, then you can reuse the standard task add-in shipped with SOLIDWORKS PDM Professional.

The standard task add-in provides two tasks:

  • Printing files using SOLIDWORKS.
  • Converting SOLIDWORKS files to other file formats.

Additionally you can modify the standard task add-in to execute any script.

  1. Make sure that the add-in, SWTaskAddIn, is installed in the vault.
  2. Start the Administration tool, right-click Tasks in the tree, and select New Task.
  3. Select the SWTaskAddIn add-in in the first page of the dialog box.
  4. Go to the Script page and edit the code in the main function.
    The Insert Macro button makes it possible to insert macros that will be replaced with data from SOLIDWORKS PDM Professional when the script is executed.     Read more about macros in the following section.
  5. Set all other tasks settings, such as computer on which to execute, notifications, etc.

Macros

The macros in the Insert Macro menu work inconsistently. Keep in mind:

Menu Option | Macro | Note
Source File Name | <Filename> | This option is added as the literal string "<Filename>" to the script. The script has to scan for the string and replace it with the real file name.
Source File Extension | <Extension> | This option works like <Filename> in the sense that the macro is not resolved.
Configuration Name | <Configuration> | This option works like <Filename> in the sense that the macro is not resolved.
Source Folder Path | <Path> | This macro will be replaced with the file system path to the parent folder of the source file. Add double quotes around "<Path>" to use it as a string. Example: C:\MyVault\Drawings\
Vault Root Folder Path | <VaultPath> | Resolves to the root folder of the vault. For instance: C:\MyVault\
Task Instance GUID | <TaskInstanceGuid> | A GUID (Globally Unique Identifier) that identifies the task instance.
Source File Path | <Filepath> | Resolves to the full path to the source file. Example: C:\MyVault\Drawings\Part.sldprt

You can create an input card using the card editor to provide a user interface when the task is launched. The data entered in the card can then be used in the script. Refer to a card variable value in the script by enclosing it with { }, for example {Description}, to insert a value from variable, Description.

It is a good idea to have a look at the scripts for printing and converting, which are shipped with SOLIDWORKS PDM Professional, for hints on how to write scripts. The SOLIDWORKS PDM Professional Help contains additional information about the Administration tool and using the standard task add-in.

See Also

Task Add-in Sample

Task Add-in Sample (C#)


SOLIDWORKS PDM Professional API Help

Traverse Folders and Files in Vault Example (C#)

This example shows how to recursively traverse all of the folders and files in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
//  1. Start Microsoft Visual Studio.
//  2. Click File > New > Project > Dropdowns:
C#, Windows, Desktop > Windows Forms App. Click
Next.
//  3. Type TraverseFilesFoldersCSharp in Project
name.
//  4. In
Location click ... and navigate to the folder where to create the project.
Click Next.
//  5. Select a
supported .NET Framework installed on your computer. Click Create.
//  6. Replace the code in Form1.cs with this code.
//  7. Replace the code in Form1.Designer.cs with
this code.
//  8. Add "using
TraverseFilesAndFoldersCSharp;" to the top of Program.cs.
//  9. Add EPDM.Interop.epdm.dll as a reference (right-click the project
//     name in the Solution Explorer, click Add >
Project Reference, click
Browse,
//     navigate to the top folder of your SOLIDWORKS PDM Professional installation,
//     locate and select EPDM.Interop.epdm.dll).
Click OK.
// 10. Click
Show All Files in the tool bar. Right-click Dependencies
> Assemblies >
//     EPDM.Interop.epdm, click Properties, and set
//     Embed Interop Types to No to handle methods that pass arrays of
//     structures.
// 11. Ensure
that the vault contains one or more checked-out files.
// 12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays a Traverse
Folders and Files dialog.
// 2. Select a vault.
// 3. Click Log
in, get client log, get checked-out files in vault.
// 4. Displays a message box with the vault type.
// 5. Click OK.
// 6. Populates Client log and Checked-out files.
// 7. Close the dialog.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using EPDM.Interop.epdm;

namespace TraverseFilesAndFoldersCSharp
{
    public partial class Form1 : Form
    {
        IEdmVault20 vault;
        public Form1()
        {
            InitializeComponent();
        }

        void TraverseFilesAndFolders_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Declare and create an instance of IEdmVault5
                IEdmVault5 vault1 = new EdmVault5();

                vault = (IEdmVault20)vault1;

                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void TraverseFoldersButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {

                //Log into selected vault as the current user
                vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                MessageBox.Show(vault.GetVaultType().ToString(), "Vault type");

                String log;
                vault.GetClientLog(out log);
                textBox1.Text = log;

                TraverseFolder(vault.RootFolder);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void TraverseFolder(IEdmFolder5 CurFolder)
        {
            try
            {
                //Enumerate the files in the folder
                IEdmPos5 FilePos = default(IEdmPos5);
                FilePos = CurFolder.GetFirstFilePosition();
                IEdmFile5 file = default(IEdmFile5);
                while (!FilePos.IsNull)
                {
                    file = CurFolder.GetNextFile(FilePos);
                    //Get its checked out status
                    if (file.IsLocked)
                    {
                        listBox1.Items.Add(file.LockPath);
                    }
                }

                //Enumerate the sub-folders in the folder
                IEdmPos5 FolderPos = default(IEdmPos5);
                FolderPos = CurFolder.GetFirstSubFolderPosition();
                while (!FolderPos.IsNull)
                {
                    IEdmFolder5 SubFolder = default(IEdmFolder5);
                    SubFolder = CurFolder.GetNextSubFolder(FolderPos);
                    TraverseFolder(SubFolder);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

Back to top

//Form1.Designer.cs

namespace TraverseFilesAndFoldersCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.TraverseFoldersButton = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(25, 30);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(28, 46);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // TraverseFoldersButton
            //
            this.TraverseFoldersButton.Location = new System.Drawing.Point(28, 84);
            this.TraverseFoldersButton.Name = "TraverseFoldersButton";
            this.TraverseFoldersButton.Size = new System.Drawing.Size(238, 44);
            this.TraverseFoldersButton.TabIndex = 2;
            this.TraverseFoldersButton.Text = "Log in, get client log, get checked-out files in vault";
            this.TraverseFoldersButton.UseVisualStyleBackColor = true;
            this.TraverseFoldersButton.Click += new System.EventHandler(this.TraverseFoldersButton_Click);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(25, 158);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(53, 13);
            this.label1.TabIndex = 3;
            this.label1.Text = "Client log:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(29, 349);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(92, 13);
            this.label2.TabIndex = 4;
            this.label2.Text = "Checked-out files:";
            //
            // listBox1
            //
            this.listBox1.FormattingEnabled = true;
            this.listBox1.HorizontalScrollbar = true;
            this.listBox1.Location = new System.Drawing.Point(32, 365);
            this.listBox1.Name = "listBox1";
            this.listBox1.ScrollAlwaysVisible = true;
            this.listBox1.Size = new System.Drawing.Size(234, 147);
            this.listBox1.TabIndex = 5;
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(28, 174);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.textBox1.Size = new System.Drawing.Size(238, 153);
            this.textBox1.TabIndex = 6;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(293, 531);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.listBox1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.TraverseFoldersButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Traverse Folders and Files";
            this.Load += new System.EventHandler(this.TraverseFilesAndFolders_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button TraverseFoldersButton;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.ListBox listBox1;
        private System.Windows.Forms.TextBox textBox1;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Traverse Folders and Files in Vault Example (VB.NET)

This example shows how to recursively traverse all of the folders and files in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
'  1. Start Microsoft Visual Studio.
'  2. Click File > New > Project > Dropdowns: Visual Basic, Windows, Desktop > Windows Forms App. Click Next.
'  3. Type TraverseFilesFolders in Project name.
'  4. In Location click ... and navigate to the folder where to create the project. Click Next.
'  5. Select a supported .NET Framework installed on your computer. Click Create.
'  6. Replace the code in Form1.vb with this code.
'  7. Replace the code in Form1.Designer.vb with this code.
'  8. Add EPDM.Interop.epdm.dll as a reference (right-click the project
'     name in the Solution Explorer, click Add > Project Reference, click Browse,
'     navigate to the top folder of your SOLIDWORKS PDM Professional installation,
'     locate and select EPDM.Interop.epdm.dll). Click OK.
'  9. Click Show All Files in the tool bar. Right-click Dependencies > Assemblies >
'     EPDM.Interop.epdm, click Properties, and set
'     Embed Interop Types to No to handle methods that pass arrays of
'     structures.
' 10. Ensure that the vault contains one or more checked-out files.
' 11. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays a Traverse Folders and Files dialog.
' 2. Select a vault.
' 3. Click Log in, get client log, get checked-out files in vault.
' 4. Displays a message box with the vault type.
' 5. Click OK.
' 6. Populates Client log and Checked-out files.
' 7. Close the dialog.
'----------------------------------------------------------------------------

'Form1.vb

Imports EPDM.Interop.epdm

Public Class TraverseFilesFolders

    Dim vault As IEdmVault20
    Public Sub TraverseFilesFolders_Load(
ByVal sender As System.Object,
ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try

            Dim Views() As EdmViewInfo = Nothing
            Dim vault5 As IEdmVault5 = New EdmVault5()
            vault = DirectCast(vault5, IEdmVault20)

            vault.GetVaultViews(Views, False)

            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" +
ex.ErrorCode.ToString("X") + vbCrLf +
ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub TraverseFoldersButton_Click(
ByVal sender As System.Object,
ByVal e As System.EventArgs) _
      Handles TraverseFoldersButton.Click

        Try

            'Log into selected vault as the current user
            vault.LoginAuto(VaultsComboBox.Text,
Me.Handle.ToInt32())

            MessageBox.Show(vault.GetVaultType().ToString(), "Vault type")

            Dim log As String = Nothing
            vault.GetClientLog(log)
            TextBox1.Text = log

            TraverseFolder(vault.RootFolder)

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" +
ex.ErrorCode.ToString("X") + vbCrLf +
ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub TraverseFolder(
ByVal CurFolder As IEdmFolder5)

        Try

            'Enumerate the files in the folder
            Dim FilePos As IEdmPos5
            FilePos = CurFolder.GetFirstFilePosition
            Dim file As IEdmFile5
            While Not FilePos.IsNull
                file = CurFolder.GetNextFile(FilePos)
                'Get its checked out status
                If file.IsLocked Then
                    ListBox2.Items.Add(file.LockPath)
                End If
            End While

            'Enumerate the subfolders in the folder
            Dim FolderPos As IEdmPos5
            FolderPos = CurFolder.GetFirstSubFolderPosition
            While Not FolderPos.IsNull
                Dim SubFolder As IEdmFolder5
                SubFolder = CurFolder.GetNextSubFolder _
                  (FolderPos)
                TraverseFolder(SubFolder)
            End While

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" +
ex.ErrorCode.ToString("X") + vbCrLf +
ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class TraverseFilesFolders
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.TraverseFoldersButton = New System.Windows.Forms.Button()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.ListBox2 = New System.Windows.Forms.ListBox()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(22, 34)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(25, 50)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'TraverseFoldersButton
        '
        Me.TraverseFoldersButton.Location = New System.Drawing.Point(25, 89)
        Me.TraverseFoldersButton.Name = "TraverseFoldersButton"
        Me.TraverseFoldersButton.Size = New System.Drawing.Size(212, 34)
        Me.TraverseFoldersButton.TabIndex = 2
        Me.TraverseFoldersButton.Text = "Log in, get client log, get checked-out files in vault"
        Me.TraverseFoldersButton.UseVisualStyleBackColor = True
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(22, 144)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(53, 13)
        Me.Label2.TabIndex = 4
        Me.Label2.Text = "Client log:"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(24, 310)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(89, 13)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "Checked-out files:"
        '
        'ListBox2
        '
        Me.ListBox2.FormattingEnabled = True
        Me.ListBox2.HorizontalScrollbar = True
        Me.ListBox2.Location = New System.Drawing.Point(27, 326)
        Me.ListBox2.Name = "ListBox2"
        Me.ListBox2.ScrollAlwaysVisible = True
        Me.ListBox2.SelectionMode = System.Windows.Forms.SelectionMode.None
        Me.ListBox2.Size = New System.Drawing.Size(210, 160)
        Me.ListBox2.TabIndex = 6
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(25, 160)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both
        Me.TextBox1.Size = New System.Drawing.Size(212, 147)
        Me.TextBox1.TabIndex = 7
        '
        'TraverseFilesFolders
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(258, 509)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.ListBox2)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.TraverseFoldersButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.Label1)
        Me.Name = "TraverseFilesFolders"
        Me.Text = "Traverse Folders and Files"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents TraverseFoldersButton As System.Windows.Forms.Button
    Friend WithEvents Label2 As Label
    Friend WithEvents Label3 As Label
    Friend WithEvents ListBox2 As ListBox
    Friend WithEvents TextBox1 As TextBox
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Traverse Users and Groups in Vault Example (C#)

This example shows how to traverse the users and groups in a vault and send a message, also called a notification, to all logged-in users of the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type UsersAndGroupsCSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. Replace the code in Form1.Designer.cs with this code.
//12. Ensure that the vault contains one or more users and one or more
//    workflows.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays a dialog.
//  2. Select a vault.
//  3. Click Traverse users.
//     Three message boxes report:
//     * users
in the vault,
//     * state permissions for a user in the vault,
//       - and -
//     * transition permissions for a user in the vault.
//  4. Click OK to close each message box.
//  5. Click Traverse groups.
//     A message box reports
the groups in the vault.
//  6. Click OK to close the message box.
//  7. Click Traverse group members.
//     A message box reports
the users of each group in the vault.
//  8. Click OK to close the message box.
//  9. Click Send consultation request.
//     After several minutes, a SOLIDWORKS PDM Professional notification
//     appears only to logged-in users.
// 10. To open the the message, click:
//     * the notification while it is displayed,
//     * the SOLIDWORKS PDM Professional tray icon,
//       - or -
//     * Tools > Inbox in the
vault view.
// 11. Close the dialog.
//----------------------------------------------------------------------------
//Form1.cs
using System.IO;
using System.Xml.Serialization;
using EPDM.Interop.epdm;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace UsersAndGroupsCSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

void UsersAndGroupsCSharp_Load(System.Object sender, System.EventArgs e)
{

IEdmVault8 vault = (IEdmVault8)new EdmVault5();
EdmViewInfo[] Views = { };

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}

        private void TraverseUsersButton_Click(System.Object sender, System.EventArgs e)

        {
                IEdmVault5 vault = new EdmVault5();
                IEdmVault7 vault1 = null;

                if (vault == null)
                {
                    vault = new EdmVault5();
                }

                vault1 = (IEdmVault7)vault;

                //Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

                //Declare an IEdmUserMgr9 object
                IEdmUserMgr9 UserMgr = default(IEdmUserMgr9);
                UserMgr = vault1.CreateUtility(EdmUtility.EdmUtil_UserMgr);

                EdmStatePermission[] ppoPermissions = {

    };
                EdmTransitionPermission[] ppoTransitionPermissions = {

    };

                string Users = null;
                IEdmPos5 UserPos = default(IEdmPos5);
                IEdmUser5 User = default(IEdmUser5);
                UserPos = UserMgr.GetFirstUserPosition();
                while (!UserPos.IsNull)
                {
                    User = UserMgr.GetNextUser(UserPos);
                    Users = Users + User.Name + " ID: " + User.ID + "\n";
                }

                MessageBox.Show(Users, vault1.Name + " Vault Users", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Get permissions for all states for a user
                UserMgr.GetStatePermissions(User.ID, EdmObjectType.EdmObject_User, 0, out ppoPermissions);
                string str = null;
                str = "EdmStatePermissions for a user in the vault" + "\n";
                str = str + "\n";
                foreach (EdmStatePermission item in ppoPermissions)
                {

                   str = str + "mlOwnerID: " + item.mlOwnerID + "\n";
                    str = str + "meOwnerType (EdmObjectType.EdmObject_User (7) or EdmObjectType.EdmObject_UserGroup (8)): " + item.meOwnerType + "\n";
                    str = str + "mlStateID: " + item.mlStateID + "\n";
                    str = str + "mlEdmRightFlag as defined in EdmRightFlags: " + item.mlEdmRightFlag + "\n";
                    str = str + "\n";

                }
                MessageBox.Show(str);

                //Get permissions for all transitions for a user
                UserMgr.GetTransitionPermissions(User.ID, EdmObjectType.EdmObject_User, 0, out ppoTransitionPermissions);
                str = "EdmTransitionPermissions for a user in the vault" + "\n";
                str = str + "\n";
                foreach (EdmTransitionPermission item in ppoTransitionPermissions)
                {

                    str = str + "mlOwnerID: " + item.mlOwnerID + "\n";
                    str = str + "meOwnerType (EdmObjectType.EdmObject_User (7) or EdmObjectType.EdmObject_UserGroup (8)): " + item.meOwnerType + "\n";
                    str = str + "mlTransitionID: " + item.mlTransitionID + "\n";
                    str = str + "mlEdmRightFlag as defined in EdmTransitionRightFlags: " + item.mlEdmRightFlag + "\n";
                    str = str + "\n";

                }
                MessageBox.Show(str);
        }

        private void TraverseGroupsButton_Click(System.Object sender, System.EventArgs e)
        {

            //Declare and create an instance of IEdmVault5 object
            IEdmVault5 vault = new EdmVault5();
            //Log into selected vault as the current user
            vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

            //Declare an IEdmUserMgr5 object
            IEdmUserMgr5 UserMgr = default(IEdmUserMgr5);
            //The IEdmUserMgr5 interface is implemented by the
            //same class as the IEdmVault5 interface,
            //so assign the value of the IEdmVault5 object
            UserMgr = (IEdmUserMgr5)vault;

            string Groups = "";
            IEdmPos5 UserGroupPos = default(IEdmPos5);
            UserGroupPos = UserMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull)
            {
                IEdmUserGroup5 UserGroup = default(IEdmUserGroup5);
                UserGroup = UserMgr.GetNextUserGroup(UserGroupPos);
                Groups = Groups + UserGroup.Name + "\n";
            }
            MessageBox.Show(Groups, vault.Name + " Vault Groups", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void TraverseGroupMembersButton_Click(System.Object sender, System.EventArgs e)
        {

            //Declare and create an instance of IEdmVault5 object
            IEdmVault5 vault = new EdmVault5();
            //Log into selected vault as the current user
            vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

            //Declare an IEdmUserMgr5 object
            IEdmUserMgr5 UserMgr = default(IEdmUserMgr5);
            //The IEdmUserMgr5 interface is implemented by the
            //same class as the IEdmVault5 interface,
            //so assign the value of the IEdmVault5 object
            UserMgr = (IEdmUserMgr5)vault;

            string Groups = "";
            IEdmPos5 UserGroupPos = default(IEdmPos5);
            UserGroupPos = UserMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull) {
                IEdmUserGroup5 UserGroup = default(IEdmUserGroup5);
                UserGroup = UserMgr.GetNextUserGroup(UserGroupPos);
                Groups = Groups + UserGroup.Name + ":\n";
                Groups = Groups + GetMembers(UserGroup);
            }
            MessageBox.Show(Groups, vault.Name + " Vault Group and Users", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        private string GetMembers(IEdmUserGroup5 UserGroup)
        {
            string functionReturnValue = null;

            functionReturnValue = "";
            string Users = "";
            IEdmPos5 UserPos = default(IEdmPos5);
            UserPos = UserGroup.GetFirstUserPosition();
            while (!UserPos.IsNull)
            {
                IEdmUser5 User = default(IEdmUser5);
                User = UserGroup.GetNextUser(UserPos);
                Users = Users + " " + User.Name + "\n";
            }
            functionReturnValue = Users;
            return functionReturnValue;
        }

        private void SendConsultationRequestButton_Click(System.Object sender, System.EventArgs e)
        {

            //Declare and create an instance of IEdmVault5 object
            IEdmVault5 vault = new EdmVault5();
            //Log into selected vault as the current user
            vault.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());

            //Declare an IEdmUserMgr5 object
            IEdmUserMgr5 UserMgr = default(IEdmUserMgr5);
            //The IEdmUserMgr5 interface is implemented by the
            //same class as the IEdmVault5 interface,
            //so assign the value of the IEdmVault5 object
            UserMgr = (IEdmUserMgr5)vault;

            IEdmUserGroup5 UserGroup = default(IEdmUserGroup5);
            UserGroup = UserMgr.GetUserGroup("All Users");
            if ((UserGroup != null))
            {
                IEdmPos5 UserPos = default(IEdmPos5);
                UserPos = UserGroup.GetFirstUserPosition();
                while (!UserPos.IsNull)
                {
                    IEdmUser5 User = default(IEdmUser5);
                    User = UserGroup.GetNextUser(UserPos);
                    if (User.IsLoggedIn)
                    {
                        User.SendMsg("Informal review request", "Please stop by my office sometime " + "this morning for a quick informal " + "review of my design changes before " + "I submit them for approval.");
                    }
                }
            }
        }
    }
}

Back to top
\\Form1.Designer.cs
namespace UsersAndGroupsCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">True if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.VaultsLabel = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.TraverseUsersButton = new System.Windows.Forms.Button();
            this.TraverseGroupsButton = new System.Windows.Forms.Button();
            this.TraverseGroupMembersButton = new System.Windows.Forms.Button();
            this.SendConsultationRequestButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // VaultsLabel
            //
            this.VaultsLabel.AutoSize = true;
            this.VaultsLabel.Location = new System.Drawing.Point(26, 24);
            this.VaultsLabel.Name = "VaultsLabel";
            this.VaultsLabel.Size = new System.Drawing.Size(91, 13);
            this.VaultsLabel.TabIndex = 0;
            this.VaultsLabel.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(29, 51);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(168, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // TraverseUsersButton
            //
            this.TraverseUsersButton.Location = new System.Drawing.Point(29, 92);
            this.TraverseUsersButton.Name = "TraverseUsersButton";
            this.TraverseUsersButton.Size = new System.Drawing.Size(168, 36);
            this.TraverseUsersButton.TabIndex = 2;
            this.TraverseUsersButton.Text = "Traverse users";
            this.TraverseUsersButton.UseVisualStyleBackColor = true;
            this.TraverseUsersButton.Click += new System.EventHandler(this.TraverseUsersButton_Click);
            //
            // TraverseGroupsButton
            //
            this.TraverseGroupsButton.Location = new System.Drawing.Point(29, 151);
            this.TraverseGroupsButton.Name = "TraverseGroupsButton";
            this.TraverseGroupsButton.Size = new System.Drawing.Size(168, 39);
            this.TraverseGroupsButton.TabIndex = 3;
            this.TraverseGroupsButton.Text = "Traverse groups";
            this.TraverseGroupsButton.UseVisualStyleBackColor = true;
            this.TraverseGroupsButton.Click += new System.EventHandler(this.TraverseGroupsButton_Click);
            //
            // TraverseGroupMembersButton
            //
            this.TraverseGroupMembersButton.Location = new System.Drawing.Point(29, 210);
            this.TraverseGroupMembersButton.Name = "TraverseGroupMembersButton";
            this.TraverseGroupMembersButton.Size = new System.Drawing.Size(168, 41);
            this.TraverseGroupMembersButton.TabIndex = 4;
            this.TraverseGroupMembersButton.Text = "Traverse group members";
            this.TraverseGroupMembersButton.UseVisualStyleBackColor = true;
            this.TraverseGroupMembersButton.Click += new System.EventHandler(this.TraverseGroupMembersButton_Click);
            //
            // SendConsultationRequestButton
            //
            this.SendConsultationRequestButton.Location = new System.Drawing.Point(29, 279);
            this.SendConsultationRequestButton.Name = "SendConsultationRequestButton";
            this.SendConsultationRequestButton.Size = new System.Drawing.Size(168, 35);
            this.SendConsultationRequestButton.TabIndex = 5;
            this.SendConsultationRequestButton.Text = "Send consultation request";
            this.SendConsultationRequestButton.UseVisualStyleBackColor = true;
            this.SendConsultationRequestButton.Click += new System.EventHandler(this.SendConsultationRequestButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 342);
            this.Controls.Add(this.SendConsultationRequestButton);
            this.Controls.Add(this.TraverseGroupMembersButton);
            this.Controls.Add(this.TraverseGroupsButton);
            this.Controls.Add(this.TraverseUsersButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.VaultsLabel);
            this.Name = "Form1";
            this.Text = "Traverse users and groups";
            this.Load += new System.EventHandler(this.UsersAndGroupsCSharp_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label VaultsLabel;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button TraverseUsersButton;
        private System.Windows.Forms.Button TraverseGroupsButton;
        private System.Windows.Forms.Button TraverseGroupMembersButton;
        private System.Windows.Forms.Button SendConsultationRequestButton;
    }
}

Back to top


SOLIDWORKS PDM Professional API Help

Traverse Users and Groups in Vault Example (VB.NET)

This example shows how to traverse the users and groups in a vault and send a message, also called a notification, to all logged-in users of the vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type UsersAndGroups in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. Replace the code in Form1.Designer.vb with this code.
'12. Ensure that the vault contains one or more users and one or more
'    workflows.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays a dialog.
'  2. Select a vault.
'  3. Click Traverse users.
'     Three message boxes report:
'     * users in the vault,
'     * state permissions for a user in the vault,
'       - and -
'     * transition permissions for a user in the vault.
'  4. Click OK to close each message box.
'  5. Click Traverse groups.
'     A message box reports the groups in the vault.
'  6. Click OK to close the message box.
'  7. Click Traverse group members.
'     A message box reports the users of each group in the vault.
'  8. Click OK to close the message box.
'  9. Click Send consultation request.
'     After several minutes, a SOLIDWORKS PDM Professional notification
'     appears only to logged-in users.
' 10. To open the message, click:
'     * the notification while it is displayed,
'     * the SOLIDWORKS PDM Professional tray icon,
'       - or -
'     * Tools > Inbox in the vault view.
' 11. Close the dialog.
'----------------------------------------------------------------------------
'Form1.vb
Imports System.IO
Imports System.Xml.Serialization
Imports EPDM.Interop.epdm

Public Class UsersAndGroups

   Private Sub UsersAndGroups_Load(ByVal sender As _
         System.Object, ByVal e As System.EventArgs) _
         Handles MyBase.Load

      Dim vault As IEdmVault8 = New EdmVault5
      Dim Views() As EdmViewInfo = {}

      vault.GetVaultViews(Views, False)
      VaultsComboBox.Items.Clear()
      For Each View As EdmViewInfo In Views
         VaultsComboBox.Items.Add(View.mbsVaultName)
      Next
      If VaultsComboBox.Items.Count > 0 Then
         VaultsComboBox.Text = VaultsComboBox.Items(0)
      End If
   End Sub

    Private Sub TraverseUsersButton_Click(ByVal sender As _
             System.Object, ByVal e As System.EventArgs) _
             Handles TraverseUsersButton.Click

        Dim vault As IEdmVault5 = New EdmVault5()
        Dim vault1 As IEdmVault7 = Nothing

        If vault Is Nothing Then
            vault = New EdmVault5()
        End If

        vault1 = DirectCast(vault, IEdmVault7)

        'Log into selected vault as the current user
        vault1.LoginAuto(VaultsComboBox.Text,
  Me.Handle.ToInt32())

        'Declare an IEdmUserMgr9 object
        Dim UserMgr As IEdmUserMgr9
        UserMgr = vault1.CreateUtility(EdmUtility.EdmUtil_UserMgr)

        Dim ppoPermissions() As EdmStatePermission = {}
        Dim ppoTransitionPermissions() As EdmTransitionPermission = {}

        Dim Users As String = vbNullString
        Dim UserPos As IEdmPos5
        Dim User As IEdmUser5
        UserPos = UserMgr.GetFirstUserPosition()
        While Not UserPos.IsNull

            User = UserMgr.GetNextUser(UserPos)
            Users = Users & User.Name & " ID: " & User.ID & vbCrLf
        End While

        MessageBox.Show(Users, vault1.Name +
        " Vault Users", MessageBoxButtons.OK,
        MessageBoxIcon.Information)

        'Get permissions for all states for a user
        UserMgr.GetStatePermissions(User.ID, EdmObjectType.EdmObject_User, 0, ppoPermissions)
        Dim str As String
        str = "EdmStatePermissions for a user in the vault" & vbLf
        str = str & vbLf
        For Each item As EdmStatePermission In ppoPermissions

            str = str & "mlOwnerID: " & item.mlOwnerID & vbLf
            str = str & "meOwnerType (EdmObjectType.EdmObject_User (7) or EdmObjectType.EdmObject_UserGroup (8)): " & item.meOwnerType & vbLf
            str = str & "mlStateID: " & item.mlStateID & vbLf
            str = str & "mlEdmRightFlag as defined in EdmRightFlags: " & item.mlEdmRightFlag & vbLf
            str = str & vbLf

        Next
        MessageBox.Show(str)

        'Get permissions for all transitions for a user
        UserMgr.GetTransitionPermissions(User.ID, EdmObjectType.EdmObject_User, 0, ppoTransitionPermissions)
        str = "EdmTransitionPermissions for a user in the vault" & vbLf
        str = str & vbLf
        For Each item As EdmTransitionPermission In ppoTransitionPermissions

            str = str & "mlOwnerID: " & item.mlOwnerID & vbLf
            str = str & "meOwnerType (EdmObjectType.EdmObject_User (7) or EdmObjectType.EdmObject_UserGroup (8)): " & item.meOwnerType & vbLf
            str = str & "mlTransitionID: " & item.mlTransitionID & vbLf
            str = str & "mlEdmRightFlag as defined in EdmTransitionRightFlags: " & item.mlEdmRightFlag & vbLf
            str = str & vbLf

        Next
        MessageBox.Show(str)

    End Sub

   Private Sub TraverseGroupsButton_Click(ByVal sender _
         As System.Object, ByVal e As System.EventArgs) _
         Handles TraverseGroupsButton.Click

      'Declare and create an instance of IEdmVault5 object
      Dim vault As IEdmVault5 = New EdmVault5()
      'Log into selected vault as the current user
      vault.LoginAuto(VaultsComboBox.Text, _
         Me.Handle.ToInt32())

      'Declare an IEdmUserMgr5 object
      Dim UserMgr As IEdmUserMgr5
      'The IEdmUserMgr5 interface is implemented by the
      'same class as the IEdmVault5 interface,
      'so assign the value of the IEdmVault5 object
      UserMgr = vault

      Dim Groups As String = vbNullString
      Dim UserGroupPos As IEdmPos5
      UserGroupPos = UserMgr.GetFirstUserGroupPosition()
      While Not UserGroupPos.IsNull
         Dim UserGroup As IEdmUserGroup5
         UserGroup = UserMgr.GetNextUserGroup _
            (UserGroupPos)
         Groups = Groups + UserGroup.Name + vbCrLf
      End While
      MessageBox.Show(Groups, vault.Name + _
         " Vault Groups", MessageBoxButtons.OK, _
         MessageBoxIcon.Information)
   End Sub

   Private Sub TraverseGroupMembersButton_Click( _
         ByVal sender As System.Object, _
         ByVal e As System.EventArgs) _
         Handles TraverseGroupMembersButton.Click

      'Declare and create an instance of IEdmVault5 object
      Dim vault As IEdmVault5 = New EdmVault5()
      'Log into selected vault as the current user
      vault.LoginAuto(VaultsComboBox.Text, _
         Me.Handle.ToInt32())

      'Declare an IEdmUserMgr5 object
      Dim UserMgr As IEdmUserMgr5
        'The IEdmUserMgr5 interface is implemented by the
        'same class as the IEdmVault5 interface,
        'so assign the value of the IEdmVault5 object
      UserMgr = vault

      Dim Groups As String = vbNullString
      Dim UserGroupPos As IEdmPos5
      UserGroupPos = UserMgr.GetFirstUserGroupPosition()
      While Not UserGroupPos.IsNull
         Dim UserGroup As IEdmUserGroup5
         UserGroup = UserMgr.GetNextUserGroup _
            (UserGroupPos)
         Groups = Groups + UserGroup.Name + " Members:" _
            + vbCrLf
         Groups = Groups + GetMembers(UserGroup)
      End While
      MessageBox.Show(Groups, vault.Name + _
         " Vault Group Users", _
      MessageBoxButtons.OK, MessageBoxIcon.Information)
   End Sub

   Private Function GetMembers(ByVal UserGroup _
         As IEdmUserGroup5) As String

      GetMembers = vbNullString
      Dim Users As String = vbNullString
      Dim UserPos As IEdmPos5
      UserPos = UserGroup.GetFirstUserPosition()
      While Not UserPos.IsNull
         Dim User As IEdmUser5
         User = UserGroup.GetNextUser(UserPos)
         Users = Users + " " + User.Name + vbCrLf
      End While
      GetMembers = Users
   End Function

   Private Sub SendConsultationRequestButton_Click( _
         ByVal sender As System.Object, _
         ByVal e As System.EventArgs) _
         Handles SendConsultationRequestButton.Click

      'Declare and create an instance of IEdmVault5 object
      Dim vault As IEdmVault5 = New EdmVault5()
      'Log into selected vault as the current user
      vault.LoginAuto(VaultsComboBox.Text, _
         Me.Handle.ToInt32())

      'Declare an IEdmUserMgr5 object
      Dim UserMgr As IEdmUserMgr5
        'The IEdmUserMgr5 interface is implemented by the
        'same class as the IEdmVault5 interface,
        'so assign the value of the IEdmVault5 object
      UserMgr = vault

      Dim UserGroup As IEdmUserGroup5
        UserGroup = UserMgr.GetUserGroup("All Users")
      If Not UserGroup Is Nothing Then
         Dim UserPos As IEdmPos5
         UserPos = UserGroup.GetFirstUserPosition()
         While Not UserPos.IsNull
            Dim User As IEdmUser5
            User = UserGroup.GetNextUser(UserPos)
            If User.IsLoggedIn Then
                    User.SendMsg("Informal review request", _
                    "Please stop by my office sometime " + _
                    "this morning for a quick informal " + _
                    "review of my design changes before " + _
                    "I submit them for approval.")
            End If
         End While
      End If
   End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class UsersAndGroups
   Inherits System.Windows.Forms.Form

   'Form overrides dispose to clean up the component list.
   <System.Diagnostics.DebuggerNonUserCode()> _
   Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      Try
         If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
         End If
      Finally
         MyBase.Dispose(disposing)
      End Try
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.TraverseUsersButton = New System.Windows.Forms.Button()
        Me.TraverseGroupsButton = New System.Windows.Forms.Button()
        Me.TraverseGroupMembersButton = New System.Windows.Forms.Button()
        Me.SendConsultationRequestButton = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(49, 34)
        Me.VaultsComboBox.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(146, 21)
        Me.VaultsComboBox.TabIndex = 10
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(46, 9)
        Me.VaultsLabel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(91, 13)
        Me.VaultsLabel.TabIndex = 11
        Me.VaultsLabel.Text = "Select vault view:"
        '
        'TraverseUsersButton
        '
        Me.TraverseUsersButton.Location = New System.Drawing.Point(49, 69)
        Me.TraverseUsersButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.TraverseUsersButton.Name = "TraverseUsersButton"
        Me.TraverseUsersButton.Size = New System.Drawing.Size(146, 41)
        Me.TraverseUsersButton.TabIndex = 15
        Me.TraverseUsersButton.Text = "Traverse users"
        Me.TraverseUsersButton.UseVisualStyleBackColor = True
        '
        'TraverseGroupsButton
        '
        Me.TraverseGroupsButton.Location = New System.Drawing.Point(49, 126)
        Me.TraverseGroupsButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.TraverseGroupsButton.Name = "TraverseGroupsButton"
        Me.TraverseGroupsButton.Size = New System.Drawing.Size(146, 41)
        Me.TraverseGroupsButton.TabIndex = 16
        Me.TraverseGroupsButton.Text = "Traverse groups"
        Me.TraverseGroupsButton.UseVisualStyleBackColor = True
        '
        'TraverseGroupMembersButton
        '
        Me.TraverseGroupMembersButton.Location = New System.Drawing.Point(49, 183)
        Me.TraverseGroupMembersButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.TraverseGroupMembersButton.Name = "TraverseGroupMembersButton"
        Me.TraverseGroupMembersButton.Size = New System.Drawing.Size(146, 41)
        Me.TraverseGroupMembersButton.TabIndex = 17
        Me.TraverseGroupMembersButton.Text = "Traverse group members"
        Me.TraverseGroupMembersButton.UseVisualStyleBackColor = True
        '
        'SendConsultationRequestButton
        '
        Me.SendConsultationRequestButton.Location = New System.Drawing.Point(49, 240)
        Me.SendConsultationRequestButton.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.SendConsultationRequestButton.Name = "SendConsultationRequestButton"
        Me.SendConsultationRequestButton.Size = New System.Drawing.Size(146, 41)
        Me.SendConsultationRequestButton.TabIndex = 18
        Me.SendConsultationRequestButton.Text = "Send consultation request"
        Me.SendConsultationRequestButton.UseVisualStyleBackColor = True
        '
        'UsersAndGroups
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(291, 317)
        Me.Controls.Add(Me.SendConsultationRequestButton)
        Me.Controls.Add(Me.TraverseGroupMembersButton)
        Me.Controls.Add(Me.TraverseGroupsButton)
        Me.Controls.Add(Me.TraverseUsersButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
        Me.Name = "UsersAndGroups"
        Me.Text = "Traverse users and groups"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
   Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
   Friend WithEvents VaultsLabel As System.Windows.Forms.Label
   Friend WithEvents TraverseUsersButton As System.Windows.Forms.Button
   Friend WithEvents TraverseGroupsButton As System.Windows.Forms.Button
   Friend WithEvents TraverseGroupMembersButton As System.Windows.Forms.Button
   Friend WithEvents SendConsultationRequestButton As System.Windows.Forms.Button

End Class

Back to top


SOLIDWORKS PDM Professional API Help

PDM Professional API Troubleshooting Guide

The examples provided with the PDM APIs are thorough and extensive. You should use them carefully when you develop your own PDM applications and add-ins. This topic discusses several important steps in the PDM API examples that are often overlooked by PDM developers. It also answers some questions that have been frequently asked of API Support.

Why am I getting "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)" when my PDM API application
calls a method that passes an array of structures?

Why does adding my add-in to the Admin tool fail with the message "Please select at least one DLL implementing the IEdmAddin5
interface."?

When I add an add-in to the Admin tool, why does it throw "An older version of the add-in is already loaded in memory..."?

Why aren't I hitting breakpoints when I debug my PDM API application?

Why are my add-in's commands not working?

How do you debug a task add-in?

Why doesn't my PDM add-in appear in the Debug Add-ins window after I've selected to debug the add-in in the Admin tool?

How do I specify the lParentWnd parameter in methods?

Why am I seeing Failed to extract add-in and Error loading add-ins messages while my add-in is running?

My add-in works when compiled for .NET Framework 2.0, 3.0, and 3.5. But with .NET Framework 4.0, I get a runtime error,
"Call to method 'OnCmd' in add-in failed. Error code = 0x080131522 (Unknown error 0x080131522)."

======================================================================================

Why am I getting "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)" when my PDM API application
calls a method that passes an array of structures?

If you are using .NET 4.0, you must right-click EPDM.Interop.epdm in References, click Properties, and set Embed Interop Types
to False.

The reason is that all of the structures defined in the PDM Pro API (nothing but COM API’s) are not embedded by the .Net
Framework if this property is set to true. This is a Microsoft issue with COM, and there is no solution for it at the moment.

*KEEP IN MIND THAT YOU SHOULD ONLY SET THIS PROPERTY TO FALSE FOR EPDM.Interop.epdm.dll. FOR ALL OTHER EXTERNAL REFERENCES IN
YOUR PROJECT THIS PROPERTY SHOULD BE SET TO TRUE.

Back

Why does adding my .NET or C++ add-in to the Admin tool fail with the message "Please select at least one DLL implementing the IEdmAddin5
interface."?

The Admin tool did not find the ISwAddin interface for some reason, usually because multiple classes were made COM-visible in
your add-in, and the Admin tool randomly chose the wrong class with which to start the add-in. To correct this problem:

1. In project properties deselect Application > Assembly Information> Make Assembly COM-visible.
2. Make only the class that implements IEdmAddin5 COM-Visible as follows:

'VB.NET
Imports EPDM.Interop.epdm
Imports System.Runtime.InteropServices

<Guid("07a33492-234f-4e8a-8c4f-6b66d8cf16c2")> _
<ComVisible(True)> _
Public Class SWEPDMAddin
Implements IEdmAddIn5
Public Sub GetAddInInfo
Public Sub OnCmd
…

The Guid above is created in Visual Studio's Tools > Create GUID. Copy and paste the GUID to one class that implements the
IEDMAddin5 interface.

3. If you are on Windows 8 or above, make sure that .Net CLR 2.0 is enabled on your machine, because your add-in is using .Net Framework 3.5. Also, ensure that the UAC is off on this machine.
4. In project properties select Build > Register for COM interop.
5. Re-compile the add-in.
6. Open the task manager and kill edmserver.exe, viewserver.exe and explorer.exe.
7. Restart the Admin tool as administrator.
8. Add the add-in dlls in the Admin tool.

If this happens with your C++ add-in, try re-compiling the add-in DLL under Administrator privileges in Visual Studio so the add-in is registered. Also, make sure to open the Admin Tool with Administrator privileges, or you won't be able to successfully add the add-in.

Back

When I add an add-in to the Admin tool, why does it throw "An older version of the add-in is already loaded in memory..."?

There is already an add-in with the same version in the vault.
To add the add-in you must create your own GUID using Visual Studio’s Tools > Create GUID. Copy the new GUID to the class
implementing the IEdmAddin5 interface, setting the COMVisible attribute to true. This uniquely identifies each add-in and
also prevents the loading of duplicate add-ins in your vault.

//C#
using System.Runtime.InteropServices;

namespace test
{
[Guid("E9B24B05-A4CA-401B-A644-AB59175D758E"),ComVisible(true)]
public class Class1 : IEdmAddIn5
...
}

Back

Why aren't I hitting breakpoints when I debug my PDM API application?

If your project targets a .NET Framework older than 4.0, you must add an application configuration file to the debug
application in order for breakpoints to work. If you are using Notepad for debugging, then add the notepad config file to the
notepad exe’s location i.e. C:\Windows\Notepad.exe. Add notepad.exe.config for .Net CLR 2 or CLR 4, depending on your .NET
framework.

<!-- sample notepad.exe.config -->
<?xml version ="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.[version on your machine]" />
</startup>
</configuration>

To determine the correct [version on your machine] look in the “C:\Windows\Microsoft.NET\Framework” directory for the most recent
“v2.0.xxxxx” folder.

Back

Why are my add-in's commands not working?

Are you passing arguments to OnCmd() by value or by reference? PDM Pro add-ins require that you implement IEdmAddIn5::OnCmd, passing arguments using ByRef:

C#:

public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData) {}

VB.NET:

Public Sub OnCmd(ByRef poCmd As EdmCmd, ByRef ppoData As EdmCmdData[]) Implements IEdmAddIn5.OnCmd

Back

How do you debug a task add-in?

The task add-in needs to be fully installed in the vault before you can install it as a task or debug it. Therefore in order to debug a task
add-in, you must attach the add-in’s running process to the debugger.

Since add-ins are loaded and unloaded at unpredictable times, you can pop up a message box to force the add-in to pause
while you attach the debugger to the add-in's process.

Back

Why doesn't my PDM add-in appear in the Debug Add-ins window after I've configured the Admin tool to debug the add-in?

1. In the project's properties, select Application > Register for COM interop.
2. Compile the add-in.
3. Kill edmserver.exe, viewserver.exe, and explorer.exe from the task manager.
4. Restart the Admin tool as an administrator.
5. Add the add-in for debugging in the Admin tool.
6. Debug the add-in.

Back

How do I specify the lParentWnd parameter in method calls?

The lParentWnd parameter ensures that your application’s dialog remains visible. When your application displays a dialog box, you need to make sure that it is not possible to switch between the dialog box and the Explorer window behind it (or whatever application it is launched from). Failure to ensure this may cause your application's dialog box to be hidden behind an inactive Explorer window or application, leaving the impression that your program has hung.

For methods called in Windows Forms, you can specify lParentWnd as follows:

VB.NET:

Me.Handle.ToInt32()

C#:

this.Handle.ToInt32()

For non-windows-forms applications, you can specify lParentWnd with 0 (zero).

Back

Why am I seeing Failed to extract add-in and Error loading add-ins messages when my add-in is running?

1. In Visual Studio, select Compile or Build tab > Register for COM interop.
2. If you are on Windows 10, verify that the UAC is OFF.
3. The host application needs an elevation (i.e. it must be run with administrator privileges).
4. Start the Admin Tool as Administrator and then add the add-in.

Back

My add-in works when compiled for .NET Framework 2.0, 3.0, and 3.5. But with .NET Framework 4.0, I get a runtime error,
"Call to method 'OnCmd' in add-in failed. Error code = 0x080131522 (Unknown error 0x080131522)."

As of PDM Pro 2013 we distribute the primary interop assembly, EPDM.Interop.epdm.dll.
Add this interop assembly to your add-in's references when compiling for .NET Framework 4.0 and later.

Back


SOLIDWORKS PDM Professional API Help

Update File Raw References Example (C#)

This example shows how to get file references directly from a file and update file references directly in that file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type RawReferencesCSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. Check out a SOLIDWORKS assembly or drawing document whose file
//    references you want to update and check out all of the document's
//    referenced files.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays the Update Raw References in File dialog box.
//  2. Select the vault view where the SOLIDWORKS assembly or
//     drawing document that you checked out in
//     Preconditions step 4 resides.
//  3. Click Open file.
//  4. Displays the Open a file dialog box.
//     a. Click the assembly or drawing document you checked out
//        in Preconditions step 4.
//     b. Click Open.
//     The opened file's path and file name appear
//     in the Update Raw References in File dialog box.
//  5. Click Get references.
//     a. Displays a message box for each referenced file.
//        The referenced file's ID, path and file name, file name,
//        type, and number of times referenced appear in the
//        message box.
//     b. Click OK to close each message box.
//  6. Rename one of the referenced files in the selected vault
//     in File Explorer.
//  7. Click Update references.
//     a. Displays a message box confirming that references were updated.
//     b. Click OK to close the message box.
//  8. Click Get references.
//     a. Displays a message box for each referenced file.
//        The referenced file's ID, path and file name, file name,
//        type, and number of times referenced appear in the
//        message box. Note that the renamed file is now a referenced
//        file of the open document.
//     b. Click OK to close each message box.
//  9. Click Close file.
// 10. Click OK to close the message box confirming that the open
//     document was closed.
// 11. Close the Update Raw References in File dialog box.
// 12. Check in the SOLIDWORKS assembly or drawing document and
//     its file references.
//----------------------------------------------------------------------------

//Form1.cs
using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace RawReferencesCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        IEdmVault5 vault1 = null;
        IEdmFile5 aFile;
        string fileName;
        IEdmRawReferenceMgr rawRefs;
        EdmRawReference[] refs = null;

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void UpdateButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Update the file references directly in the file
                rawRefs.UpdateReferences(refs);
                MessageBox.Show("File references updated.");

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void OpenButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //If one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                //Set the initial directory in the Open a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Open a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    //Do nothing
                }
                else
                {
                    //Click a file
                    IEdmFolder5 retPath = default(IEdmFolder5);
                    fileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(fileName);
                    aFile = vault1.GetFileFromPath(fileName, out retPath);

                }

                //Get IEdmRawReferences interface
                IEdmVault7 vault2 = null;
                vault2 = (IEdmVault7)vault1;
                rawRefs = (IEdmRawReferenceMgr)vault2.CreateUtility(EdmUtility.EdmUtil_RawReferenceMgr);
                bool fileRefsSupported = false;
                fileRefsSupported = rawRefs.Open(fileName);
                if (!fileRefsSupported)
                {
                    MessageBox.Show("File's format does not support file references.");
                    return;
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void GetButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                int arrSize = 0;
                int i = 0;
                string message = null;
                //Get the file references directly from the file
                rawRefs.GetReferences(ref refs);
                arrSize = refs.Length;
                if (arrSize == 0)
                {
                    MessageBox.Show("No file references for opened file.");
                    return;
                }
                while (i < arrSize)
                {
                    message = "File reference information: " + "\n" + "\n";
                    message = message + "  Internal ID: " + refs[i].mbsRefID + "\n";
                    message = message + "  Referenced how: " + refs[i].mbsIncludePath + "\n";
                    message = message + "  Reference name: " + refs[i].mbsRefName + "\n";
                    message = message + "  Number of times file referenced = " + refs[i].mlCount.ToString() + "\n";
                    switch (refs[i].mlFlags)
                    {
                        case (int)EdmRawRefFlags.Edmrrf_Ghost:
                            message = message + "  Type = DWG files can store grandchildren as references" + "\n";
                            break;
                        case (int)EdmRawRefFlags.Edmrrf_InternalComponent:
                            message = message + "  Type = Not used" + "\n";
                            break;
                        case (int)EdmRawRefFlags.Edmrrf_Nothing:
                            message = message + "  Type = Normal file reference" + "\n";
                            break;
                    }
                    i = i + 1;
                    MessageBox.Show(message);
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void CloseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Close the file
                rawRefs.Close();
                MessageBox.Show("File closed.");

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}
Back to top
//Form1.Designer.cs
namespace RawReferencesCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.OpenButton = new System.Windows.Forms.Button();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.UpdateButton = new System.Windows.Forms.Button();
            this.GetButton = new System.Windows.Forms.Button();
            this.CloseButton = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(82, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(91, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(41, 40);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(196, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // OpenButton
            //
            this.OpenButton.Location = new System.Drawing.Point(74, 67);
            this.OpenButton.Name = "OpenButton";
            this.OpenButton.Size = new System.Drawing.Size(108, 23);
            this.OpenButton.TabIndex = 2;
            this.OpenButton.Text = "Open file";
            this.OpenButton.UseVisualStyleBackColor = true;
            this.OpenButton.Click += new System.EventHandler(OpenButton_Click);
            //
            // FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(12, 96);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(235, 30);
            this.FileListBox.TabIndex = 3;
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Open a file";
            //
            // UpdateButton
            //
            this.UpdateButton.Location = new System.Drawing.Point(139, 144);
            this.UpdateButton.Name = "UpdateButton";
            this.UpdateButton.Size = new System.Drawing.Size(108, 23);
            this.UpdateButton.TabIndex = 4;
            this.UpdateButton.Text = "Update references";
            this.UpdateButton.UseVisualStyleBackColor = true;
            this.UpdateButton.Click += new System.EventHandler(UpdateButton_Click);
            //
            // GetButton
            //
            this.GetButton.Location = new System.Drawing.Point(12, 144);
            this.GetButton.Name = "GetButton";
            this.GetButton.Size = new System.Drawing.Size(108, 23);
            this.GetButton.TabIndex = 5;
            this.GetButton.Text = "Get references";
            this.GetButton.UseVisualStyleBackColor = true;
            this.GetButton.Click += new System.EventHandler(GetButton_Click);
            //
            // CloseButton
            //
            this.CloseButton.Location = new System.Drawing.Point(74, 192);
            this.CloseButton.Name = "CloseButton";
            this.CloseButton.Size = new System.Drawing.Size(99, 23);
            this.CloseButton.TabIndex = 6;
            this.CloseButton.Text = "Close file";
            this.CloseButton.UseVisualStyleBackColor = true;
            this.CloseButton.Click += new System.EventHandler(CloseButton_Click);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(266, 233);
            this.Controls.Add(this.CloseButton);
            this.Controls.Add(this.GetButton);
            this.Controls.Add(this.UpdateButton);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.OpenButton);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.label1);
            this.Name = "Form1";
            this.Text = "Update Raw References in File";
            this.Load += new System.EventHandler(Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.Button OpenButton;
        private System.Windows.Forms.ListBox FileListBox;
        private System.Windows.Forms.Button UpdateButton;
        private System.Windows.Forms.Button GetButton;
        private System.Windows.Forms.Button CloseButton;
        private System.Windows.Forms.OpenFileDialog OpenFileDialog1;

    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Update File Raw References Example (VB.NET)

This example shows how to get file references directly from a file and update file references directly in that file.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type RawReferences in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Check out a SOLIDWORKS assembly or drawing document whose file
'    references you want to update and check out all of the document's
'    referenced files.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays the Update Raw References in File dialog box.
'  2. Select the vault view where the SOLIDWORKS assembly or
'     drawing document that you checked out in
'     Preconditions step 4 resides.
'  3. Click Open file.
'  4. Displays the Open a file dialog box.
'     a. Click the assembly or drawing document you checked
'        out in Preconditions step 4.
'     b. Click Open.
'     The opened file's path and file name appear
'     in the Update Raw References in File dialog box.
'  5. Click Get references.
'     a. Displays a message box for each referenced file.
'        The referenced file's ID, path and file name, file name,
'        type, and number of times referenced appear in the
'        message box.
'     b. Click OK to close each message box.
'  6. Rename one of the referenced files in the selected vault
'     in File Explorer.
'  7. Click Update references.
'     a. Displays a message box confirming that references were updated.
'     b. Click OK to close the message box.
'  8. Click Get references.
'     a. Displays a message box for each referenced file.
'        The referenced file's ID, path and file name, file name,
'        type, and number of times referenced appear in the
'        message box. Note that the renamed file is now a referenced
'        file of the open document.
'     b. Click OK to close each message box.
'  9. Click Close file.
' 10. Click OK to close the message box confirming that the
'     open document was closed.
' 11. Close the Update Raw References in File dialog box.
' 12. Check in the SOLIDWORKS assembly or drawing and its
'     file references.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim fileName As String
    Dim rawRefs As IEdmRawReferenceMgr
    Dim refs() As EdmRawReference = Nothing

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub UpdateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Update the file references directly in the file
            rawRefs.UpdateReferences(refs)
            MessageBox.Show("File references updated.")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub OpenButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenButton.Click
        Try
            'If one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            'Set the initial directory in the Open a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Open a file dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                'Do nothing
            Else
                'Open a file
                fileName = OpenFileDialog1.FileName
                FileListBox.Items.Add(fileName)
                aFile = vault1.GetFileFromPath(fileName)

            End If

            'Get IEdmRawReferences interface
            rawRefs = vault1.CreateUtility(EdmUtility.EdmUtil_RawReferenceMgr)
            Dim fileRefsSupported As Boolean
            fileRefsSupported = rawRefs.Open(fileName)
            If Not fileRefsSupported Then
                MessageBox.Show("File's format does not support file references.")
                Exit Sub
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub GetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim arrSize As Integer
            Dim i As Integer = 0
            Dim message As String
            'Get the file references directly from the file
            rawRefs.GetReferences(refs)
            arrSize = refs.Length
            If arrSize = 0 Then
                MessageBox.Show("No file references for opened file.")
                Exit Sub
            End If
            While i < arrSize
                message = "File reference information: " + vbLf + vbLf
                message = message + "  Internal ID: " + refs(i).mbsRefID + vbLf
                message = message + "  Referenced how: " + refs(i).mbsIncludePath + vbLf
                message = message + "  Reference name: " + refs(i).mbsRefName + vbLf
                message = message + "  Number of times file referenced = " + refs(i).mlCount.ToString + vbLf
                Select Case refs(i).mlFlags
                    Case EdmRawRefFlags.Edmrrf_Ghost
                        message = message + "  Type = DWG files can store grandchildren as references" + vbLf
                    Case EdmRawRefFlags.Edmrrf_InternalComponent
                        message = message + "  Type = Not used" + vbLf
                    Case EdmRawRefFlags.Edmrrf_Nothing
                        message = message + "  Type = Normal file reference" + vbLf
                End Select
                i = i + 1
                MessageBox.Show(message)
            End While

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub CloseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Close the file
            rawRefs.Close()
            MessageBox.Show("File closed.")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class
Back to top
'Form.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.OpenButton = New System.Windows.Forms.Button()
        Me.GetButton = New System.Windows.Forms.Button()
        Me.UpdateButton = New System.Windows.Forms.Button()
        Me.CloseButton = New System.Windows.Forms.Button()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(88, 26)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(55, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(154, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'OpenButton
        '
        Me.OpenButton.Location = New System.Drawing.Point(55, 88)
        Me.OpenButton.Name = "OpenButton"
        Me.OpenButton.Size = New System.Drawing.Size(154, 23)
        Me.OpenButton.TabIndex = 2
        Me.OpenButton.Text = "Open file"
        Me.OpenButton.UseVisualStyleBackColor = True
        '
        'GetButton
        '
        Me.GetButton.Location = New System.Drawing.Point(12, 165)
        Me.GetButton.Name = "GetButton"
        Me.GetButton.Size = New System.Drawing.Size(108, 23)
        Me.GetButton.TabIndex = 3
        Me.GetButton.Text = "Get references"
        Me.GetButton.UseVisualStyleBackColor = True
        '
        'UpdateButton
        '
        Me.UpdateButton.Location = New System.Drawing.Point(164, 165)
        Me.UpdateButton.Name = "UpdateButton"
        Me.UpdateButton.Size = New System.Drawing.Size(108, 23)
        Me.UpdateButton.TabIndex = 4
        Me.UpdateButton.Text = "Update references"
        Me.UpdateButton.UseVisualStyleBackColor = True
        '
        'CloseButton
        '
        Me.CloseButton.Location = New System.Drawing.Point(55, 222)
        Me.CloseButton.Name = "CloseButton"
        Me.CloseButton.Size = New System.Drawing.Size(154, 23)
        Me.CloseButton.TabIndex = 5
        Me.CloseButton.Text = "Close file"
        Me.CloseButton.UseVisualStyleBackColor = True
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(12, 118)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(260, 30)
        Me.FileListBox.TabIndex = 6
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Open a file"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(284, 264)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.CloseButton)
        Me.Controls.Add(Me.UpdateButton)
        Me.Controls.Add(Me.GetButton)
        Me.Controls.Add(Me.OpenButton)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Form1"
        Me.Text = "Update References in File"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents OpenButton As System.Windows.Forms.Button
    Friend WithEvents GetButton As System.Windows.Forms.Button
    Friend WithEvents UpdateButton As System.Windows.Forms.Button
    Friend WithEvents CloseButton As System.Windows.Forms.Button
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Update References Example (C#)

This example shows how to update the references of a file in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.

// 3. Type UpdateReferencesCSharp in Project
name.

// 4. For Location, click ... and navigate to the folder where to
create the project.

// 5. Click Next.

// 6. Select Framework.

// 7. Click Create.

// 8. Click Show All Files in the Solution Explorer toolbar and expand

//    Form1.cs in the Solution Explorer.

// 9. Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form, replace the code in Form1.Designer.cs with
//    this code.
//12. Click Debug > Start Debugging or press F5.
//
// Postconditions:
//  1. Displays your Update References dialog box.
//  2. Select a vault view.
//  3. Click Browse.
//  4. Displays the Select a file dialog box.
//     a. Click a file in the selected vault.
//     b. Click Open.
//     The selected file's path and file name appear
//     in the Select a file dialog box.
//  5. Click Update references.
//  6. Initializes and displays SOLIDWORKS PDM Professional's Update References
//     dialog box, which shows the name of the selected file whose file references
//     to update and the names of the file references, if any.
//  7. Click Close.
//  8. Close your Update References dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace UpdateReferencesCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        IEdmVault5 vault1 = null;
        IEdmFile5 aFile;
        string fileName;

        private void Form1_Load(System.Object sender, System.EventArgs e)
        {

            try
            {
                IEdmVault5 vault1 = new EdmVault5();
                IEdmVault8 vault = (IEdmVault8)vault1;
                EdmViewInfo[] Views = null;

                vault.GetVaultViews(out Views, false);
                VaultsComboBox.Items.Clear();
                foreach (EdmViewInfo View in Views)
                {
                    VaultsComboBox.Items.Add(View.mbsVaultName);
                }
                if (VaultsComboBox.Items.Count > 0)
                {
                    VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + "\n" + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void UpdateReferencesButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Only create a new vault object
                //if one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }

                //Update the references for the selected document
                //and show SOLIDWORKS PDM Professional Update References dialog
                IEdmUpdateReferences updateRefs = default(IEdmUpdateReferences);
                IEdmVault7 vault2 = (IEdmVault7)vault1;
                updateRefs = (IEdmUpdateReferences)vault2.CreateUtility(EdmUtility.EdmUtil_UpdateReferences);
                updateRefs.AddFile(fileName);
                updateRefs.ShowDlg(this.Handle.ToInt32(), 0, 0);

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //If one hasn't been created yet
                if (vault1 == null)
                {
                    vault1 = new EdmVault5();
                }

                if (!vault1.IsLoggedIn)
                {
                    //Log into selected vault as the current user
                    vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
                }
                //Set the initial directory in the Select a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    //Do nothing
                }
                else
                {
                    //Browse for a file whose next possible state
                    //transitions to get
                    fileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(fileName);
                    IEdmFolder5 retFolder = default(IEdmFolder5);
                    aFile = vault1.GetFileFromPath(fileName, out retFolder);

                }

            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
    }
}
Back to top
//Form1.Designer.cs
namespace UpdateReferencesCSharp
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Label1 = new System.Windows.Forms.Label();
            this.VaultsComboBox = new System.Windows.Forms.ComboBox();
            this.FileListBox = new System.Windows.Forms.ListBox();
            this.BrowseButton = new System.Windows.Forms.Button();
            this.UpdateReferencesButton = new System.Windows.Forms.Button();
            this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.SuspendLayout();
            //
            // Label1
            //
            this.Label1.AutoSize = true;
            this.Label1.Location = new System.Drawing.Point(13, 9);
            this.Label1.Name = "Label1";
            this.Label1.Size = new System.Drawing.Size(91, 13);
            this.Label1.TabIndex = 0;
            this.Label1.Text = "Select vault view:";
            //
            // VaultsComboBox
            //
            this.VaultsComboBox.FormattingEnabled = true;
            this.VaultsComboBox.Location = new System.Drawing.Point(16, 26);
            this.VaultsComboBox.Name = "VaultsComboBox";
            this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
            this.VaultsComboBox.TabIndex = 1;
            //
            // FileListBox
            //
            this.FileListBox.FormattingEnabled = true;
            this.FileListBox.Location = new System.Drawing.Point(16, 66);
            this.FileListBox.Name = "FileListBox";
            this.FileListBox.Size = new System.Drawing.Size(165, 17);
            this.FileListBox.TabIndex = 2;
            //
            // BrowseButton
            //
            this.BrowseButton.Location = new System.Drawing.Point(206, 66);
            this.BrowseButton.Name = "BrowseButton";
            this.BrowseButton.Size = new System.Drawing.Size(66, 23);
            this.BrowseButton.TabIndex = 3;
            this.BrowseButton.Text = "Browse...";
            this.BrowseButton.UseVisualStyleBackColor = true;
            this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
            //
            // UpdateReferencesButton
            //
            this.UpdateReferencesButton.Location = new System.Drawing.Point(16, 113);
            this.UpdateReferencesButton.Name = "UpdateReferencesButton";
            this.UpdateReferencesButton.Size = new System.Drawing.Size(121, 23);
            this.UpdateReferencesButton.TabIndex = 4;
            this.UpdateReferencesButton.Text = "Update references";
            this.UpdateReferencesButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.UpdateReferencesButton.UseVisualStyleBackColor = true;
            this.UpdateReferencesButton.Click += new System.EventHandler(this.UpdateReferencesButton_Click);
            //
            // OpenFileDialog1
            //
            this.OpenFileDialog1.FileName = "OpenFileDialog1";
            this.OpenFileDialog1.Multiselect = true;
            this.OpenFileDialog1.Title = "Select a file";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 161);
            this.Controls.Add(this.UpdateReferencesButton);
            this.Controls.Add(this.BrowseButton);
            this.Controls.Add(this.FileListBox);
            this.Controls.Add(this.VaultsComboBox);
            this.Controls.Add(this.Label1);
            this.Name = "Form1";
            this.Text = "Update References";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label Label1;
        private System.Windows.Forms.ComboBox VaultsComboBox;
        private System.Windows.Forms.ListBox FileListBox;
        private System.Windows.Forms.Button BrowseButton;
        private System.Windows.Forms.Button UpdateReferencesButton;
        private System.Windows.Forms.OpenFileDialog OpenFileDialog1;
    }
}
Back to top


SOLIDWORKS PDM Professional API Help

Update References Example (VB.NET)

This example shows how to update the references of a file in a vault.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic,
Windows, Desktop > Windows Forms App

' 3. Type UpdateReferences in Project
name.
' 4. For Location, click ... and navigate to the folder where to
create the project.

' 5. Click Next.

' 6. Select Framework.

' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand

'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and
safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with
'    this code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions:
'  1. Displays your Update References dialog box.
'  2. Select a vault view.
'  3. Click Browse.
'  4. Displays the Select a file dialog box.
'     a. Click a file in the selected vault.
'     b. Click Open.
'     The selected file's path and file name appear
'     in the Select a file dialog box.
'  5. Click Update references.
'  6. Initializes and displays SOLIDWORKS PDM Professional's Update References
'     dialog box, which shows the name of the selected file whose file references
'     to update and the names of the file references, if any.
'  7. Click Close.
'  8. Close your Update References dialog box.
'----------------------------------------------------------------------------
'Form1.vb
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing
    Dim aFile As IEdmFile5
    Dim fileName As String

    Private Sub Form1_Load( _
      ByVal sender As System.Object, _
      ByVal e As System.EventArgs) _
      Handles MyBase.Load

        Try
            Dim vault As IEdmVault8 = New EdmVault5
            Dim Views() As EdmViewInfo = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = VaultsComboBox.Items(0)
            End If

        Catch ex As Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + _
              ex.ErrorCode.ToString("X") + vbCrLf + _
              ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub UpdateReferencesButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateReferencesButton.Click
        Try
            'Only create a new vault object
            'if one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            'Update the references for the selected document
            'and show SOLIDWORKS PDM Professional Update References dialog
            Dim updateRefs As IEdmUpdateReferences
            updateRefs = vault1.CreateUtility(EdmUtility.EdmUtil_UpdateReferences)
            updateRefs.AddFile(fileName)
            updateRefs.ShowDlg(Me.Handle.ToInt32(), 0, 0)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Public Sub BrowseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseButton.Click
        Try
            'If one hasn't been created yet
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If

            If Not vault1.IsLoggedIn Then
                'Log into selected vault as the current user
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If
            'Set the initial directory in the Select a file dialog
            OpenFileDialog1.InitialDirectory = vault1.RootFolderPath
            'Show the Select a file dialog
            Dim DialogResult As System.Windows.Forms.DialogResult = Nothing
            DialogResult = OpenFileDialog1.ShowDialog()

            If Not (DialogResult = System.Windows.Forms.DialogResult.OK) Then
                'Do nothing
            Else
                'Browse for a file whose next possible state
                'transitions to get
                fileName = OpenFileDialog1.FileName
                FileListBox.Items.Add(fileName)
                aFile = vault1.GetFileFromPath(fileName)

            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class
Back to top
'Form1.Designer.vb
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.FileListBox = New System.Windows.Forms.ListBox()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.BrowseButton = New System.Windows.Forms.Button()
        Me.UpdateReferencesButton = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(28, 44)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(190, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'FileListBox
        '
        Me.FileListBox.FormattingEnabled = True
        Me.FileListBox.Location = New System.Drawing.Point(28, 97)
        Me.FileListBox.Name = "FileListBox"
        Me.FileListBox.Size = New System.Drawing.Size(190, 17)
        Me.FileListBox.TabIndex = 3
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        Me.OpenFileDialog1.Multiselect = True
        Me.OpenFileDialog1.Title = "Select a file"
        '
        'BrowseButton
        '
        Me.BrowseButton.Location = New System.Drawing.Point(236, 97)
        Me.BrowseButton.Name = "BrowseButton"
        Me.BrowseButton.Size = New System.Drawing.Size(56, 23)
        Me.BrowseButton.TabIndex = 4
        Me.BrowseButton.Text = "Browse..."
        Me.BrowseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.BrowseButton.UseVisualStyleBackColor = True
        '
        'UpdateReferencesButton
        '
        Me.UpdateReferencesButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.UpdateReferencesButton.Location = New System.Drawing.Point(28, 152)
        Me.UpdateReferencesButton.Name = "UpdateReferencesButton"
        Me.UpdateReferencesButton.Size = New System.Drawing.Size(109, 23)
        Me.UpdateReferencesButton.TabIndex = 5
        Me.UpdateReferencesButton.Text = "Update references"
        Me.UpdateReferencesButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.UpdateReferencesButton.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(28, 25)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 13)
        Me.Label1.TabIndex = 6
        Me.Label1.Text = "Select vault view:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(323, 184)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.UpdateReferencesButton)
        Me.Controls.Add(Me.BrowseButton)
        Me.Controls.Add(Me.FileListBox)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Name = "Form1"
        Me.Text = "Update File References"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents FileListBox As System.Windows.Forms.ListBox
    Friend WithEvents BrowseButton As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents UpdateReferencesButton As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label

End Class
Back to top


SOLIDWORKS PDM Professional API Help

Using Basic Search Syntax Example (C#)

This example shows how to search the vault for file and folder card variables using CreateSearch2 search syntax.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Console > Console App.
// 3. Type Search in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Add dependencies and
safely pass arrays of structures.
// 9. Click Show All Files in the Solution Explorer
toolbar and expand
//    Program.cs in the Solution Explorer.
//10. Replace the code in Program.cs
with this code.
//11. Change the vault name and the vault view path
in the code.
//12.
 Make sure
your vault contains a text file data card with a Document Number data card variable,
//    and checked-in files with data card values exactly as described in the code.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions: Press a key when prompted in the console.
//----------------------------------------------------------------------------

//Program.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using EPDM.Interop.epdm;

namespace ConsoleApp1

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("Press a key...");

            Console.ReadKey();

            IEdmVault21 CurrentVault = new EdmVault5() as IEdmVault21;

            CurrentVault.LoginAuto("JEB5", 0);

            // The vault contains these files:             The file data cards contain these variables and values:

            // DocNum=five-six-seven Comnt=ijk.txt         @Document Number=567 & @Comment=ijk

            // DocNum=five-six-seven Comnt=xyz.txt         @Document Number=567 & @Comment=xyz

            // DocNum=one-two-three Comnt=abc.txt          @Document Number=123 & @Comment=abc

            IEdmSearchResult5 _searchResult;

            IEdmSearch9 _search = (IEdmSearch9)CurrentVault.CreateSearch2();

            // Let's see whether the IEdmSearch9 object _search works - just as an example; not needed in common practice

            string[] VarNames0 = { };

            _search.AddMultiVariableCondition(VarNames0, "@:"); // poVariableNames can be null

            _search.GetFirstResult();

            bool OriginatedFromCreateSearch2 = _search.GetSyntaxErrors() != null;

            Console.WriteLine("OriginatedFromCreateSearch2 = " + OriginatedFromCreateSearch2);

            Console.WriteLine("Press a key...");

            Console.ReadKey();

            for (int i = 0; i < 7; i++)

            {

                bool ExceptionEncountered = false;

                _search.Clear();

                _search.StartFolderID = CurrentVault.GetFolderFromPath("C:\\Users\\J4M\\Desktop\\JEB5").ID;

                switch (i)

                {

                    case 0:     // Single variable search conditions

                                // Expressions for special criteria and variables

                                // Finds DocNum=five-six-seven Comnt=xyz.txt

                        Console.WriteLine("");

                        Console.WriteLine("Expressions for special criteria and variables:");

                          _search.FileName = "(limit | cam) !wheel OR DocNum";

                          _search.AddVariable2("Document Number", "56 & 7");

                          _search.AddVariable2("Comment", "xy | z NOT a");

                        break;

                    case 1:     // Multi-variable condition with extended possibilities for variable names

                        Console.WriteLine("");

                        Console.WriteLine("A multi-variable condition with extended possibilities for names:");

                        {

                            string[] VarNames = { "\"Document Number\"",  // Variable name contains a space so it must be quoted; quotes must be escaped with backslashes

                                                  "Comment",              // Extra quotes are not required for simple names

                                                  "51",                   // Database ID of Project name is a numeric constant

                                                  "_Name"                 // _Name represents file/folder name

                                                };

                            // xy and z should be in one and the same variable value - owing to {}

                            // Text 567 can be present in a different variable of a searched document

                            // Because 567 and {z xy} can be in different variable values of the same document (and here we want to find such cases),

                            //   apply : at the beginning of the condition to turn on multi-value search logic

                            // Finds DocNum=five-six-seven Comnt=xyz.txt

                            _search.AddMultiVariableCondition(VarNames, ":567 {z xy}");

                        }

                        break;

                    case 2:     // Multi-variable condition for all vault variables plus file/folder name

                        Console.WriteLine("");

                        Console.WriteLine("A multi-variable condition for all vault variables:");

                        {

                            string[] VarNames = { "\"\"",   // "" represents any vault variable (and so does numeric constant 0)

                                                  "_Name"   // Unquoted _Name represents file/folder name

                                                };

                            // Finds DocNum=five-six-seven Comnt=xyz.txt

                            _search.AddMultiVariableCondition(VarNames, ":567 xyz | five xy");

                        }

                        break;

                    case 3:     // Multi-variable condition with mistakenly unquoted names

                        Console.WriteLine("");

                        Console.WriteLine("A multi-variable condition with mistakenly unquoted names:");

                        try

                        {

                            string[] VarNames = { "Document Number", "Comment", "Project Name" };

                            // Causes an exception because there are unquoted names with spaces

                            _search.AddMultiVariableCondition(VarNames, ":567 xyz | five xy");

                        }

                        catch (System.ArgumentException ex)

                        {

                            Console.WriteLine("Wrong variable name syntax... HRESULT = 0x" + ex.HResult.ToString("X") + ex.Message);

                            ExceptionEncountered = true;

                        }

                        break;

                    case 4:     // Syntax errors are not displayed and no documents are returned

                        Console.WriteLine("");

                        Console.WriteLine("Non-displayed syntax errors:");

                        _search.FileName = "(limit = | cam) !wheel OR AND DocNum";

                        _search.AddVariable2("Document Number", "56 && 7");

                        _search.AddVariable2("Comment", "xy | z() NOT a");

                        break;

                    case 5:     // Syntax errors are displayed (because @: is at the beginning of the conditions) and no documents are returned

                        Console.WriteLine("");

                        Console.WriteLine("Messages about syntax errors:");

                        _search.FileName = "@:(limit = | cam) !wheel OR AND DocNum";

                        _search.AddVariable2("Document Number", "56 && 7");

                        _search.AddVariable2("Comment", "@:xy | z() NOT a");

                        break;

                    case 6:     // Multi-value syntax with error reporting (because @: is at the beginning of the condition)

                        Console.WriteLine("");

                        Console.WriteLine("Advanced syntax features:");

                        // The first argument, VarNames0, can be null because all the variables used are defined directly inside the second argument (condition)

                        // The second argument specifies to look for files that have (Comment = abc and any card variable containing xyz) OR (file name or "Document Number" containing 123 or ab, but not five)

                        // @: turns on multi-value logic at the top level of a condition (as does just a colon)

                        // @: allows variable bindings

                        // Finds DocNum=one-two-three Comnt=abc.txt

                        _search.AddMultiVariableCondition(VarNames0, "@: @Comment=abc & @\"\"(xyz) | @(\"Document Number\" | _Name)(123 | ab & !five)");

                        break;

                }

                if (ExceptionEncountered)

                    _searchResult = null;

                else

                    _searchResult = _search.GetFirstResult();

                if (_searchResult == null)

                    Console.WriteLine("Returned null...");

                else

                    Console.WriteLine("Returned a file list...");

                Console.WriteLine("Press a key...");

                Console.ReadKey();

                if (_searchResult != null)

                {

                    while (_searchResult != null)

                    {

                        Console.WriteLine("NAME = " + _searchResult.Name + ", PATH = " + _searchResult.Path);

                        Console.WriteLine("Press a key...");

                        Console.ReadKey();

                        _searchResult = _search.GetNextResult();

                    }

                }

                else

                {

                    string[] SyntaxErrors = _search.GetSyntaxErrors();

                    if (SyntaxErrors != null)

                        foreach (string s in SyntaxErrors)

                        {

                            Console.WriteLine(s);

                            Console.WriteLine("Press a key...");

                            Console.ReadKey();

                        }

                }

            }

        }

    }

}

Back to top


SOLIDWORKS PDM Professional API Help

Using Basic Search Syntax Example (VB.NET)

This example shows how to search the vault for file and folder card variables using CreateSearch2 search syntax.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Console > Console App.
' 3. Type Search in Project name.
' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Add dependencies and safely pass arrays of structures.
' 9. Replace all the code for Module1.vb with this code.
'10. Change the vault name and the vault view path in the code.
'11. Make sure your vault contains a text file data card with a Document Number data card variable,
'    and checked-in files with data card values exactly as described in the code.
'12. Click Debug > Start Debugging or press F5.
'
' Postconditions: Press a key when prompted in the console.
'---------------------------------------------------------------------------

'Module1.vb

Imports System

Imports System.Collections.Generic

Imports System.Linq

Imports System.Text

Imports System.Threading.Tasks

Imports EPDM.Interop.epdm

Module Module1

    Sub Main(ByVal args As String())

        Console.WriteLine("Press a key...")

        Console.ReadKey()

        Dim CurrentVault As IEdmVault21 = TryCast(New EdmVault5(), IEdmVault21)

        CurrentVault.LoginAuto("JEB5", 0)

        ' The vault contains these files       The file data cards contain these variables And values:

' DocNum=five-six-seven
Comnt=ijk.txt   @Document
Number=567 & @Comment=ijk

' DocNum=five-six-seven
Comnt=xyz.txt   @Document
Number=567 & @Comment=xyz

' DocNum=one-two-three
Comnt=abc.txt    @Document
Number=123 & @Comment=abc

        Dim _searchResult As IEdmSearchResult5

        Dim _search As IEdmSearch9 = CType(CurrentVault.CreateSearch2(), IEdmSearch9)

        Dim VarNames0 As String() = {}

        _search.AddMultiVariableCondition(VarNames0, "@:") ' poVariableNames can be Nothing

        _search.GetFirstResult()

        Dim OriginatedFromCreateSearch2 As Boolean = _search.GetSyntaxErrors() IsNot Nothing

        Console.WriteLine("OriginatedFromCreateSearch2  = " & OriginatedFromCreateSearch2)

        Console.WriteLine("Press a key...")

        Console.ReadKey()

        For i As Integer = 0 To 7 - 1

            Dim ExceptionEncountered As Boolean = False

            _search.Clear()

            _search.StartFolderID = CurrentVault.GetFolderFromPath("C:\Users\J4M\Desktop\JEB5").ID

            Select Case i

                Case 0 ' Single variable search conditions with special criteria and variables

                    Console.WriteLine("")

                    Console.WriteLine("Single variable search conditions with special criteria and variables:")

                    _search.FileName = "(limit | cam) !wheel OR DocNum"

                    _search.AddVariable2("Document Number", "56 & 7")

                    _search.AddVariable2("Comment", "xy | z NOT a")

                    ' Finds DocNum=five-six-seven Comnt=xyz.txt

                Case 1 ' Multi-variable condition with extended search name syntax

                    Console.WriteLine("")

                    Console.WriteLine("Multi-variable condition with extended search name syntax:")

                    ' VarNames array declares that all elements are strings

                    Dim VarNames As String() = {"""Document Number""", "Comment", "51", "_Name"}

                    ' Both xy And z must be in the same card variable - owing to {}

                    ' Text 567 can be in a different card variable

                    ' : turns on multi-value search logic

                    _search.AddMultiVariableCondition(VarNames, ":567 {z xy}")

                    ' Finds DocNum=five-six-seven Comnt=xyz.txt

                Case 2 ' Multi-variable condition searches all the card variables in file/folder name

                    Console.WriteLine("")

                    Console.WriteLine("Multi-variable condition for all the vault variables:")

                    ' Unquoted _Name represents file/folder name

                    ' "" or 0 represents any card variable

                    Dim VarNames As String() = {"""""", "_Name"}

                    _search.AddMultiVariableCondition(VarNames, ":567 xyz | five xy")

                    ' Finds DocNum=five-six-seven Comnt=xyz.txt

                Case 3 ' Extended multi-variable condition with erroneously unquoted card variable names

                    Console.WriteLine("")

                    Console.WriteLine("Multi-variable condition with erroneously unquoted names:")

                    Try

                        Dim VarNames As String() = {"Document Number", "Comment", "Project Name"}

                        _search.AddMultiVariableCondition(VarNames, ":567 xyz | five xy")

                        ' Causes an exception because there are card variable names with spaces that need extra quotation marks

                    Catch ex As System.ArgumentException

                        Console.WriteLine("Wrong variable syntax... HRESULT = 0x" & ex.HResult.ToString("X") & ex.Message)

                        ExceptionEncountered = True

                    End Try

                Case 4  ' Syntax errors are not displayed; no documents returned

                    Console.WriteLine("")

                    Console.WriteLine("Syntax errors, but not displayed:")

                    _search.FileName = "(limit = | cam) !wheel OR AND DocNum"

                    _search.AddVariable2("Document Number", "56 && 7")

                    _search.AddVariable2("Comment", "xy | z() NOT a")

                Case 5 ' Syntax errors displayed (because @: is at the beginning of a condition); no documents returned

                    Console.WriteLine("")

                    Console.WriteLine("Syntax errors:")

                    _search.FileName = "@:(limit = | cam) !wheel OR AND DocNum"

                    _search.AddVariable2("Document Number", "56 && 7")

                    _search.AddVariable2("Comment", "@:xy | z() NOT a")

                Case 6  ' Multi-value syntax with error reporting (because @: is at the beginning of a condition)

                    Console.WriteLine("")

                    Console.WriteLine("Advanced search syntax:")

                    ' The first argument can be Nothing because all the card variables are defined with variable binding specifiers (@) inside the second argument which is the condition

                    ' The second argument uses the advanced specifier which allows variable bindings

                    ' The second argument specifies to look for files that have (Comment = abc and any card variables with xyz) OR (a file name or "Document Number" that contains 123 or ab, but not five)

                    '

                    ' Finds DocNum=one-two-three Comnt=abc.txt

                    _search.AddMultiVariableCondition(VarNames0, "@: @Comment=abc & @""""(xyz) | @(""Document Number"" | _Name)(123 ab & !five)")

            End Select

            If ExceptionEncountered Then

                _searchResult = Nothing

            Else

                _searchResult = _search.GetFirstResult()

            End If

            If _searchResult Is Nothing Then

                Console.WriteLine("Returned null...")

            Else

                Console.WriteLine("Returned a file list...")

            End If

            Console.WriteLine("Press a key...")

            Console.ReadKey()

            If _searchResult IsNot Nothing Then

                While _searchResult IsNot Nothing

                    Console.WriteLine("NAME = " & _searchResult.Name & ", PATH = " + _searchResult.Path)

                    Console.WriteLine("Press a key...")

                    Console.ReadKey()

                    _searchResult = _search.GetNextResult()

                End While

            Else

                Dim SyntaxErrors As String() = _search.GetSyntaxErrors()

                If SyntaxErrors IsNot Nothing Then

                    For Each s As String In SyntaxErrors

                        Console.WriteLine(s)

                        Console.WriteLine("Press a key...")

                        Console.ReadKey()

                    Next

                End If

            End If

        Next

    End Sub

End Module

Back to top


SOLIDWORKS PDM Professional API Help

Vault Utilities Example (C#)

This example shows how to:

  • Verify installed SOLIDWORKS PDM Professional version is at least 5.3.
  • Get installed SOLIDWORKS PDM Professional licenses.
  • Add a group.
  • Remove a group.
  • Add a user.
  • Remove a user.
  • Copy a file.
  • Delete a file.
  • Get check-out permission for a file.
  • Delete a folder.
  • Restore deleted items to the vault view.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

//----------------------------------------------------------------------------
// Preconditions:
// 1. Start Microsoft Visual Studio.
// 2. Click File > New > Project > C#,
Windows, Desktop > Windows Forms App.
// 3. Type VaultUtilities_CSharp in Project
name.
// 4. For
Location, click ... and navigate to the folder where to
create the project.
// 5. Click Next.
// 6. Select Framework.
// 7. Click Create.
// 8. Click Show All Files in the Solution Explorer toolbar and expand
//    Form1.cs in the Solution Explorer.
// 9.

Add dependencies and
safely pass arrays of structures.
//10. Replace the code in Form1.cs with this code.
//11. To create the form,
replace the code in Form1.Designer.cs with this code.
//12. Ensure that an empty folder exists in the vault.
//13. Click Debug > Start Debugging or press F5.
//
// Postconditions:
// 1. Displays the Vault
utilities dialog box.
//    a. Select a vault view.
//    b. Click Verify
SOLIDWORKS PDM Professional 5.3.
//
1. Displays message about the installed version.
//       2. Click OK.
//    c. Click Get
SOLIDWORKS PDM Professional licenses.
//       1. Displays a
message with the installed licenses.
//
2. Click OK.
//    d. Click Add group.
//       1. Displays a message that group, My
Group, is created.
//       2. Click OK.
//    e. Click Add user.
//       1. Displays a message that user, Temp, is
created.
//       2. Click OK.
//    f. Click Remove group.
//       1. Displays a message with the removal
status.
//       2. Click OK.
//    g. Click Remove user.
//       1. Displays a message with the removal
status.
//       2. Click OK.
//    h. Click Copy file.
//       1. In the Open dialog, click a vault
file.
//       2. Click Open.
//       3. In the Select Folder dialog, click a
folder to which to copy
//          the selected file.
//       4. Click OK.
//       5. Displays a message with the file copy
status.
//       6. Click OK.
//    i. Click Delete file.
//       1. In the Select Files to Delete dialog
box, click a vault file
//          to delete.
//       2. Click Open.
//       3. Displays a message with the file
deletion status.
//       4. Click OK.
//    j. Click Check-out permission.
//       1. In the Open dialog, click a file for
which to get the check-out
//          permission.
//       2. Click Open.
//       3. Displays a message with the user's
permission.
//       4. Click OK.
//    k. Click Delete folder.
//       1. In the Select Folder dialog, click an
empty vault folder to delete.
//       2. Click OK.
//       3. Displays a message with the status of
the folder deletion.
//       4. Click OK.
//
l. Click Restore deleted items.
//       1. In the Select Folder dialog, click the
folder from which you deleted
//          a file in step 1i.
//       2. Click OK.
//       3. Displays a message with the status of
the folder restoration.
//       4. Click OK.
// 2. Close the Vault
utilities dialog box.
//----------------------------------------------------------------------------

//Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EPDM.Interop.epdm;

namespace VaultUtilities_CSharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private IEdmVault5 vault1 = null;

public void Form1_Load(System.Object sender, System.EventArgs e)
{
try
{
IEdmVault5 vault1 = new EdmVault5();
IEdmVault8 vault = (IEdmVault8)vault1;
EdmViewInfo[] Views = null;

vault.GetVaultViews(out Views, false);
VaultsComboBox.Items.Clear();
foreach (EdmViewInfo View in Views)
{
VaultsComboBox.Items.Add(View.mbsVaultName);
}
if (VaultsComboBox.Items.Count > 0)
{
VaultsComboBox.Text = (string)VaultsComboBox.Items[0];
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button5_Click(System.Object sender, System.EventArgs e)
{
//Verify SOLIDWORKS PDM Professional version is 5.3 or higher
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

vault2.VerifyVersion(5, 3);

MessageBox.Show("SOLIDWORKS PDM Professional version is at least 5.3");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button6_Click(System.Object sender, System.EventArgs e)
{
//Get licenses
try
{
IEdmVault11 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault11)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

string msg = null;
msg = "Installed licenses:" + "\n";
EdmLicense[] lics = null;
lics = null;
vault2.GetLicense(out lics);
int idx = 0;
idx = Information.LBound(lics);
while ((idx <= Information.UBound(lics)))
{
msg = msg + "Type=";
switch (lics[idx].meType)
{
case EdmLicenseType.EdmLic_Editor:
msg = msg + "Editor";
break;
case EdmLicenseType.EdmLic_Contributor:
msg = msg + "Contributor";
break;
case EdmLicenseType.EdmLic_Viewer:
msg = msg + "Viewer";
break;
case EdmLicenseType.EdmLic_Processor:
msg = msg + "Processor";
break;
default:
msg = msg + Convert.ToString(lics[idx].meType);
break;
}

msg = msg + " Users=" + Convert.ToString(lics[idx].mlUserCount) + "\n";
idx = idx + 1;
}

vault2.MsgBox(this.Handle.ToInt32(), msg);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button7_Click(System.Object sender, System.EventArgs e)
{
//Add group, My Group
try
{
IEdmVault11 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault11)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmUserMgr7 userMgr = default(IEdmUserMgr7);
userMgr = (IEdmUserMgr7)vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr);

IEdmUser7 admin = default(IEdmUser7);
admin = (IEdmUser7)userMgr.GetUser("Admin");

EdmGroupData2[] groups = new EdmGroupData2[1];
groups[0].mbAutoAdd = 0;
groups[0].mbsDescription = "A group created by the API";
groups[0].mbsName = "My Group";
groups[0].mlFlags = (int)EdmGroupDataFlags.Edmgdf_GetInterface;
int[] members = new int[1];
members[0] = admin.ID;
groups[0].moMembers = members;
EdmSysPerm[] perms = new EdmSysPerm[1];
perms[0] = EdmSysPerm.EdmSysPerm_ModifyToolbox;
groups[0].moSysPerms = perms;

userMgr.AddGroups2(ref groups);

string msg = null;
msg = "";
int idx = 0;
idx = Information.LBound(groups);
while ((idx <= Information.UBound(groups)))
{
if (groups[idx].mhStatus != 0)
{
msg = msg + "Error creating group, '" + groups[idx].mbsName + "' - " + vault2.GetErrorMessage(groups[idx].mhStatus) + "\n";
}
else
{
msg = msg + "Created group, '" + groups[idx].mbsName + "', successfully with ID, " + groups[idx].mlGroupID.ToString() + "\n";
}
idx = idx + 1;
}

vault2.MsgBox(this.Handle.ToInt32(), msg);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button8_Click(System.Object sender, System.EventArgs e)
{
//Remove group, My Group
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmUserMgr7 userMgr = default(IEdmUserMgr7);
userMgr = (IEdmUserMgr7)vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr);
IEdmUserGroup6 @group = default(IEdmUserGroup6);
@group = (IEdmUserGroup6)userMgr.GetUserGroup("My Group");
if (@group == null)
return;

int[] groups = new int[1];
groups[0] = @group.ID;
userMgr.RemoveGroups(groups);

MessageBox.Show("Group, My Group, removed");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button9_Click(System.Object sender, System.EventArgs e)
{
//Add user, Temp
try
{
IEdmVault11 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault11)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmUserMgr7 UsrMgr = (IEdmUserMgr7)vault2;
EdmUserData2[] UserData = new EdmUserData2[1];

UserData[0].mbsCompleteName = "Temp";
UserData[0].mbsEmail = "Temp";
UserData[0].mbsInitials = "TJ";
UserData[0].mbsUserName = "Temp";
UserData[0].mlFlags = (int)EdmUserDataFlags.Edmudf_GetInterface;
UserData[0].mlFlags += (int)EdmUserDataFlags.Edmudf_ForceAdd;

EdmSysPerm[] perms = new EdmSysPerm[3];
perms[0] = EdmSysPerm.EdmSysPerm_EditUserMgr;
perms[1] = EdmSysPerm.EdmSysPerm_EditReportQuery;
perms[2] = EdmSysPerm.EdmSysPerm_MandatoryVersionComments;
UserData[0].moSysPerms = perms;

UsrMgr.AddUsers2(UserData);

string msg = "";
foreach (EdmUserData2 usr in UserData)
{
if (usr.mhStatus == 0)
{
msg += "Created user, \"" + usr.mbsUserName + "\", successfully with ID, " + usr.mlUserID.ToString() + "\n";
}
else
{
msg += "Error creating user, \"" + usr.mbsUserName + "\" - " + vault2.GetErrorMessage(usr.mhStatus) + "\n";
}
}
MessageBox.Show(msg);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button10_Click(System.Object sender, System.EventArgs e)
{
//Remove user, Temp
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmUserMgr7 userMgr = default(IEdmUserMgr7);
userMgr = (IEdmUserMgr7)vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr);
IEdmUser7 user = default(IEdmUser7);
user = (IEdmUser7)userMgr.GetUser("Temp");
if (user == null)
return;

int[] users = new int[1];
users[0] = user.ID;
userMgr.RemoveUsers(users);

MessageBox.Show("User, Temp, removed");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button4_Click(System.Object sender, System.EventArgs e)
{
//Get user's check-out permission for a file
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

EdmStrLst5 pathList = default(EdmStrLst5);
pathList = vault2.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles);
if (pathList == null)
return;

IEdmFile5 file = default(IEdmFile5);
IEdmFolder5 srcFolder = null;
file = vault2.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out srcFolder);

if (srcFolder.HasRightsEx((int)EdmRightFlags.EdmRight_Lock, file.ID))
{
MessageBox.Show("User can check out this file");
}
else
{
MessageBox.Show("User does not have check-out permission");
}

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Copy file
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

EdmStrLst5 pathList = default(EdmStrLst5);
pathList = vault2.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles);
if (pathList == null)
return;

IEdmFile5 file = default(IEdmFile5);
IEdmFolder5 srcFolder = null;
file = vault2.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition()), out srcFolder);

IEdmFolder5 destFolder = default(IEdmFolder5);
destFolder = vault2.BrowseForFolder(this.Handle.ToInt32(), "Select destination folder:");
if (destFolder == null)
return;

int fileID = 0;
fileID = destFolder.CopyFile(file.ID, srcFolder.ID, this.Handle.ToInt32(), "", (int)EdmCopyFlag.EdmCpy_Simple);
MessageBox.Show("Copied file successfully to new file with ID, " + fileID);

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button2_Click(System.Object sender, System.EventArgs e)
{
//Delete file
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

EdmStrLst5 pathList = default(EdmStrLst5);
pathList = vault2.BrowseForFile(this.Handle.ToInt32(), (int)EdmBrowseFlag.EdmBws_ForOpen + (int)EdmBrowseFlag.EdmBws_PermitVaultFiles + (int)EdmBrowseFlag.EdmBws_PermitMultipleSel, "", "", "", "", "Select Files to Delete");
if (pathList == null)
return;

IEdmPos5 pos = default(IEdmPos5);
pos = pathList.GetHeadPosition();
while (!pos.IsNull)
{
IEdmFile5 file = default(IEdmFile5);
IEdmFolder5 folder = null;
file = vault2.GetFileFromPath(pathList.GetNext(pos), out folder);
folder.DeleteFile(this.Handle.ToInt32(), file.ID);
}

string strCount = null;
strCount = pathList.Count.ToString();
MessageBox.Show("Deleted " + strCount + " file");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void Button3_Click(System.Object sender, System.EventArgs e)
{
//Delete folder
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmFolder5 folder = default(IEdmFolder5);
folder = vault2.BrowseForFolder(this.Handle.ToInt32(), "Select folder to delete:");
if (folder == null)
return;

IEdmFolder5 parentFolder = default(IEdmFolder5);
parentFolder = folder.ParentFolder;

if (parentFolder == null)
{
MessageBox.Show("You cannot delete the vault root folder");
return;
}

parentFolder.DeleteFolder(this.Handle.ToInt32(), folder.ID);

MessageBox.Show(folder.Name + " deleted");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Button11_Click(System.Object sender, System.EventArgs e)
{
//Restore
folder
try
{
IEdmVault7 vault2 = null;
if (vault1 == null)
{
vault1 = new EdmVault5();
}
vault2 = (IEdmVault7)vault1;
if (!vault1.IsLoggedIn)
{
vault1.LoginAuto(VaultsComboBox.Text, this.Handle.ToInt32());
}

IEdmFolder11 folder = default(IEdmFolder11);
folder = vault2.BrowseForFolder(this.Handle.ToInt32(), "Select folder to delete:");
if (folder == null)
return;

EdmDeletedItems[] arrayEdmDeletedItems;

folder.GetDeletedItems(out
arrayEdmDeletedItems, true);
folder.RecoverDeletedItems(arrayEdmDeletedItems);

MessageBox.Show(folder.Name + " restored");

}
catch (System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Back to top

//Form1.Designer.cs

namespace VaultUtilities_CSharp
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.VaultsLabel = new System.Windows.Forms.Label();
this.VaultsComboBox = new System.Windows.Forms.ComboBox();
this.Button1 = new System.Windows.Forms.Button();
this.Button2 = new System.Windows.Forms.Button();
this.Button3 = new System.Windows.Forms.Button();
this.Button4 = new System.Windows.Forms.Button();
this.Button5 = new System.Windows.Forms.Button();
this.Button6 = new System.Windows.Forms.Button();
this.Button7 = new System.Windows.Forms.Button();
this.Button8 = new System.Windows.Forms.Button();
this.Button9 = new System.Windows.Forms.Button();
this.Button10 = new System.Windows.Forms.Button();
this.Button11 = new System.Windows.Forms.Button();
this.OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout();
//
//VaultsLabel
//
this.VaultsLabel.AutoSize = true;
this.VaultsLabel.Location = new System.Drawing.Point(13, 26);
this.VaultsLabel.Name = "VaultsLabel";
this.VaultsLabel.Size = new System.Drawing.Size(94, 13);
this.VaultsLabel.TabIndex = 0;
this.VaultsLabel.Text = " Select vault view:";
//
//VaultsComboBox
//
this.VaultsComboBox.FormattingEnabled = true;
this.VaultsComboBox.Location = new System.Drawing.Point(16, 42);
this.VaultsComboBox.Name = "VaultsComboBox";
this.VaultsComboBox.Size = new System.Drawing.Size(121, 21);
this.VaultsComboBox.TabIndex = 1;
//
//Button1
//
this.Button1.Location = new System.Drawing.Point(16, 223);
this.Button1.Name = "Button1";
this.Button1.Size = new System.Drawing.Size(91, 23);
this.Button1.TabIndex = 6;
this.Button1.Text = "Copy file...";
this.Button1.UseVisualStyleBackColor = true;
this.Button1.Click +=new System.EventHandler(Button1_Click);
//
//Button2
//
this.Button2.Location = new System.Drawing.Point(113, 223);
this.Button2.Name = "Button2";
this.Button2.Size = new System.Drawing.Size(96, 23);
this.Button2.TabIndex = 7;
this.Button2.Text = "Delete file...";
this.Button2.UseVisualStyleBackColor = true;
this.Button2.Click +=new System.EventHandler(Button2_Click);
//
//Button3
//
this.Button3.Location = new System.Drawing.Point(69, 281);
this.Button3.Name = "Button3";
this.Button3.Size = new System.Drawing.Size(96, 23);
this.Button3.TabIndex = 8;
this.Button3.Text = "Delete folder...";
this.Button3.UseVisualStyleBackColor = true;
this.Button3.Click +=new System.EventHandler(Button3_Click);
//
//Button4
//
this.Button4.Location = new System.Drawing.Point(43, 252);
this.Button4.Name = "Button4";
this.Button4.Size = new System.Drawing.Size(156, 23);
this.Button4.TabIndex = 9;
this.Button4.Text = "Check-out permission...";
this.Button4.UseVisualStyleBackColor = true;
this.Button4.Click +=new System.EventHandler(Button4_Click);
//
//Button5
//
this.Button5.Location = new System.Drawing.Point(16, 83);
this.Button5.Name = "Button5";
this.Button5.Size = new System.Drawing.Size(233, 23);
this.Button5.TabIndex = 10;
this.Button5.Text = "Verify SOLIDWORKS PDM Professional 5.3";
this.Button5.UseVisualStyleBackColor = true;
this.Button5.Click +=new System.EventHandler(Button5_Click);
//
//Button6
//
this.Button6.Location = new System.Drawing.Point(16, 121);
this.Button6.Name = "Button6";
this.Button6.Size = new System.Drawing.Size(233, 23);
this.Button6.TabIndex = 11;
this.Button6.Text = "Get SOLIDWORKS PDM Professional licenses";
this.Button6.UseVisualStyleBackColor = true;
this.Button6.Click +=new System.EventHandler(Button6_Click);
//
//Button7
//
this.Button7.Location = new System.Drawing.Point(16, 165);
this.Button7.Name = "Button7";
this.Button7.Size = new System.Drawing.Size(91, 23);
this.Button7.TabIndex = 12;
this.Button7.Text = "Add group";
this.Button7.UseVisualStyleBackColor = true;
this.Button7.Click +=new System.EventHandler(Button7_Click);
//
//Button8
//
this.Button8.Location = new System.Drawing.Point(16, 194);
this.Button8.Name = "Button8";
this.Button8.Size = new System.Drawing.Size(91, 23);
this.Button8.TabIndex = 13;
this.Button8.Text = "Remove group";
this.Button8.UseVisualStyleBackColor = true;
this.Button8.Click +=new System.EventHandler(Button8_Click);
//
//Button9
//
this.Button9.Location = new System.Drawing.Point(113, 165);
this.Button9.Name = "Button9";
this.Button9.Size = new System.Drawing.Size(96, 23);
this.Button9.TabIndex = 14;
this.Button9.Text = "Add user";
this.Button9.UseVisualStyleBackColor = true;
this.Button9.Click +=new System.EventHandler(Button9_Click);
//
//Button10
//
this.Button10.Location = new System.Drawing.Point(113, 194);
this.Button10.Name = "Button10";
this.Button10.Size = new System.Drawing.Size(96, 23);
this.Button10.TabIndex = 15;
this.Button10.Text = "Remove user";
this.Button10.UseVisualStyleBackColor = true;
this.Button10.Click +=new System.EventHandler(Button10_Click);
//
//Button11
//
this.Button11.Location = new System.Drawing.Point(43, 310);
this.Button11.Name = "Button11";
this.Button11.Size = new System.Drawing.Size(156, 29);
this.Button11.TabIndex = 16;
this.Button11.Text = "Restore
deleted items";
this.Button11.UseVisualStyleBackColor = true;
this.Button11.Click +=new System.EventHandler(Button11_Click);
//
//OpenFileDialog1
//
this.OpenFileDialog1.FileName = "OpenFileDialog1";
//
//Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(276, 330);
this.Controls.Add(this.Button11);
this.Controls.Add(this.Button10);
this.Controls.Add(this.Button9);
this.Controls.Add(this.Button8);
this.Controls.Add(this.Button7);
this.Controls.Add(this.Button6);
this.Controls.Add(this.Button5);
this.Controls.Add(this.Button4);
this.Controls.Add(this.Button3);
this.Controls.Add(this.Button2);
this.Controls.Add(this.Button1);
this.Controls.Add(this.VaultsComboBox);
this.Controls.Add(this.VaultsLabel);
this.Name = "Form1";
this.Text = "Vault utilities";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

internal System.Windows.Forms.Label VaultsLabel;
internal System.Windows.Forms.ComboBox VaultsComboBox;
internal System.Windows.Forms.Button Button1;
internal System.Windows.Forms.Button Button2;
internal System.Windows.Forms.Button Button3;
internal System.Windows.Forms.Button Button4;
internal System.Windows.Forms.Button Button5;
internal System.Windows.Forms.Button Button6;
internal System.Windows.Forms.Button Button7;
internal System.Windows.Forms.Button Button8;
internal System.Windows.Forms.Button Button9;
internal System.Windows.Forms.Button Button10;
internal System.Windows.Forms.Button Button11;
internal System.Windows.Forms.OpenFileDialog OpenFileDialog1;
}
}

Back to top


SOLIDWORKS PDM Professional API Help

Vault Utilities Example (VB.NET)

This example shows how to:

  • Verify installed SOLIDWORKS PDM Professional version is at least 5.3.
  • Get installed SOLIDWORKS PDM Professional licenses.
  • Add a group.
  • Remove a group.
  • Add a user.
  • Remove a user.
  • Copy a file.
  • Delete a file.
  • Get check-out permission for a file.
  • Delete a folder.
  • Restore deleted items to the vault view.

NOTE: If using the primary interop assembly provided with SOLIDWORKS PDM Professional, see Using .NET Framework 4.0 in Stand-alone Applications.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Start Microsoft Visual Studio.
' 2. Click File > New > Project > Visual Basic, Windows, Desktop > Windows Forms App
' 3. Type VaultUtilities in Project name.
 ' 4. For Location, click ... and navigate to the folder where to create the project.
' 5. Click Next.
' 6. Select Framework.
' 7. Click Create.
' 8. Click Show All Files in the Solution Explorer toolbar and expand
'    Form1.vb in the Solution Explorer.
' 9. Add dependencies and safely pass arrays of structures.
'10. Replace the code in Form1.vb with this code.
'11. To create the form, replace the code in Form1.Designer.vb with this code.
'12. Ensure that an empty folder exists in the vault.
'13. Click Debug > Start Debugging or press F5.
'
' Postconditions:
' 1. Displays the Vault utilities dialog box.
'    a. Select a vault view.
'    b. Click Verify SOLIDWORKS PDM Professional 5.3.
'       1. Displays message about the installed version.
'       2. Click OK.
'    c. Click Get SOLIDWORKS Professional PDM licenses.
'       1. Displays a message with the installed licenses.
'       2. Click OK.
'    d. Click Add group.
'       1. Displays a message that group, My Group, is created.
'       2. Click OK.
'    e. Click Add user.
'       1. Displays a message that user, Temp, is created.
'       2. Click OK.
'    f. Click Remove group.
'       1. Displays a message with the removal status.
'       2. Click OK.
'    g. Click Remove user.
'       1. Displays a message with the removal status.
'       2. Click OK.
'    h. Click Copy file.
'       1. In the Open dialog, click a vault file.
'       2. Click Open.
'       3. In the Select Folder dialog, click a folder to which to copy
'          the selected file.
'       4. Click OK.
'       5. Displays a message with the file copy status.
'       6. Click OK.
'    i. Click Delete file.
'       1. In the Select Files to Delete dialog box, click a vault file
'          to delete.
'       2. Click Open.
'       3. Displays a message with the file deletion status.
'       4. Click OK.
'    j. Click Check-out permission.
'       1. In the Open dialog, click a file for which to get the check-out
'          permission.
'       2. Click Open.
'       3. Displays a message with the user's permission.
'       4. Click OK.
'    k. Click Delete folder.
'       1. In the Select Folder dialog, click an empty vault folder to delete.
'       2. Click OK.
'       3. Displays a message with the status of the folder deletion.
'       4. Click OK.
'    l. Click Restore deleted items.
'       1. In the Select Folder dialog, click the folder from which you deleted
'          a file in step 1i.
'       2. Click OK.
'       3. Displays a message with the status of the folder restoration.
'       4. Click OK.
' 2. Close the Vault utilities dialog box.
'----------------------------------------------------------------------------

'Form1.vb

Imports System.IO
Imports System.Xml.Serialization
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports EPDM.Interop.epdm

Public Class Form1

    Private vault1 As IEdmVault5 = Nothing

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Dim vault1 As IEdmVault5 = New EdmVault5()
            Dim vault As IEdmVault8 = DirectCast(vault1, IEdmVault8)
            Dim Views As EdmViewInfo() = Nothing

            vault.GetVaultViews(Views, False)
            VaultsComboBox.Items.Clear()
            For Each View As EdmViewInfo In Views
                VaultsComboBox.Items.Add(View.mbsVaultName)
            Next
            If VaultsComboBox.Items.Count > 0 Then
                VaultsComboBox.Text = DirectCast(VaultsComboBox.Items(0), String)
            End If
        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        'Verify SOLIDWORKS PDM Professional version is 5.3 or higher
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            vault2.VerifyVersion(5, 3)

            MessageBox.Show("SOLIDWORKS PDM Professional version is at least 5.3")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        'Get licenses
        Try

            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim msg As String
            msg = "Installed licenses:" + vbLf
            Dim lics() As EdmLicense
            lics = Nothing
            vault2.GetLicense(lics)
            Dim idx As Integer
            idx = LBound(lics)
            While (idx <= UBound(lics))
                msg = msg + "Type="
                Select Case lics(idx).meType
                    Case EdmLicenseType.EdmLic_Editor
                        msg = msg + "Editor"
                    Case EdmLicenseType.EdmLic_Contributor
                        msg = msg + "Contributor"
                    Case EdmLicenseType.EdmLic_Viewer
                        msg = msg + "Viewer"
                    Case EdmLicenseType.EdmLic_Processor
                        msg = msg + "Processor"
                    Case Else
                        msg = msg + CStr(lics(idx).meType)
                End Select

                msg = msg + " Users=" + CStr(lics(idx).mlUserCount) + vbLf
                idx = idx + 1
            End While

            vault2.MsgBox(Me.Handle.ToInt32, msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        'Add group, My Group
        Try

            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim userMgr As IEdmUserMgr7
            userMgr = vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr)

            Dim admin As IEdmUser7
            admin = userMgr.GetUser("Admin")

            Dim groups(0) As EdmGroupData2
            groups(0).mbAutoAdd = 0
            groups(0).mbsDescription = "A group created by the API"
            groups(0).mbsName = "My Group"
            groups(0).mlFlags = EdmGroupDataFlags.Edmgdf_GetInterface
            Dim members(0) As Integer
            members(0) = admin.ID
            groups(0).moMembers = members
            Dim perms(0) As EdmSysPerm
            perms(0) = EdmSysPerm.EdmSysPerm_ModifyToolbox
            groups(0).moSysPerms = perms

            userMgr.AddGroups2(groups)

            Dim msg As String
            msg = ""
            Dim idx As Integer
            idx = LBound(groups)
            While (idx <= UBound(groups))
                If groups(idx).mhStatus <> 0 Then
                    msg = msg & "Error creating group, '" & groups(idx).mbsName & "' - " & vault2.GetErrorMessage(groups(idx).mhStatus) & vbLf
                Else
                    msg = msg & "Created group, '" & groups(idx).mpoGroup.Name & "', successfully with ID, " & CStr(groups(idx).mpoGroup.ID) & vbLf
                End If
                idx = idx + 1
            End While

            vault2.MsgBox(Me.Handle.ToInt32, msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        'Remove group, My Group
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim userMgr As IEdmUserMgr7
            userMgr = vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr)
            Dim group As IEdmUserGroup6
            group = userMgr.GetUserGroup("My Group")
            If group Is Nothing Then Exit Sub

            Dim groups(0) As Integer
            groups(0) = group.ID
            userMgr.RemoveGroups(groups)

            MessageBox.Show("Group, My Group, removed")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        'Add user, Temp
        Try

            Dim vault2 As IEdmVault11 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault11)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim UsrMgr As IEdmUserMgr7 = vault2
            Dim UserData(0) As EdmUserData2

            UserData(0).mbsCompleteName = "Temp"
            UserData(0).mbsEmail = "Temp"
            UserData(0).mbsInitials = "TJ"
            UserData(0).mbsUserName = "Temp"
            UserData(0).mlFlags = _
                EdmUserDataFlags.Edmudf_GetInterface
            UserData(0).mlFlags += _
                EdmUserDataFlags.Edmudf_ForceAdd
            Dim perms(2) As EdmSysPerm
            perms(0) = EdmSysPerm.EdmSysPerm_EditUserMgr
            perms(1) = EdmSysPerm.EdmSysPerm_EditReportQuery
            perms(2) = EdmSysPerm.EdmSysPerm_MandatoryVersionComments
            UserData(0).moSysPerms = perms

            UsrMgr.AddUsers2(UserData)

            Dim msg As String = ""
            For Each usr As EdmUserData2 In UserData
                If usr.mhStatus = 0 Then
                    msg += "Created user, """ + usr.mpoUser.Name _
                        + """, successfully with ID, " _
                        + usr.mpoUser.ID.ToString() + vbCrLf
                Else
                    msg &= "Error creating user, """ _
                        & usr.mbsUserName & """ - " _
                        & vault2.GetErrorMessage(usr.mhStatus) & vbCrLf
                End If
            Next
            MessageBox.Show(msg)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        'Remove user, Temp
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim userMgr As IEdmUserMgr7
            userMgr = vault2.CreateUtility(EdmUtility.EdmUtil_UserMgr)
            Dim user As IEdmUser7
            user = userMgr.GetUser("Temp")
            If user Is Nothing Then Exit Sub

            Dim users(0) As Integer
            users(0) = user.ID
            userMgr.RemoveUsers(users)

            MessageBox.Show("User, Temp, removed")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        'Get user's check-out permission for a file
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim pathList As EdmStrLst5
            pathList = vault2.BrowseForFile(Me.Handle.ToInt32(), EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles)
            If pathList Is Nothing Then Exit Sub

            Dim file As IEdmFile5
            Dim srcFolder As IEdmFolder5 = Nothing
            file = vault2.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition), srcFolder)

            If srcFolder.HasRightsEx(EdmRightFlags.EdmRight_Lock, file.ID) Then
                MsgBox("User can check out this file")
            Else
                MsgBox("User does not have check-out permission")
            End If

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Copy file
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim pathList As EdmStrLst5
            pathList = vault2.BrowseForFile(Me.Handle.ToInt32(), EdmBrowseFlag.EdmBws_ForOpen + EdmBrowseFlag.EdmBws_PermitVaultFiles)
            If pathList Is Nothing Then Exit Sub

            Dim file As IEdmFile5
            Dim srcFolder As IEdmFolder5 = Nothing
            file = vault2.GetFileFromPath(pathList.GetNext(pathList.GetHeadPosition), srcFolder)

            Dim destFolder As IEdmFolder5
            destFolder = vault2.BrowseForFolder(Me.Handle.ToInt32(), "Select destination folder:")
            If destFolder Is Nothing Then Exit Sub

            Dim fileID As Integer
            fileID = destFolder.CopyFile(file.ID, srcFolder.ID, Me.Handle.ToInt32(), "", EdmCopyFlag.EdmCpy_Simple)
            MsgBox("Copied file successfully to new file with ID, " & fileID)

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Delete file
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim pathList As EdmStrLst5
            pathList = vault2.BrowseForFile(Me.Handle.ToInt32(), _
                                     EdmBrowseFlag.EdmBws_ForOpen + _
                                     EdmBrowseFlag.EdmBws_PermitVaultFiles + _
                                     EdmBrowseFlag.EdmBws_PermitMultipleSel, _
                                     "", "", "", "", _
                                     "Select Files to Delete")
            If pathList Is Nothing Then Exit Sub

            Dim pos As IEdmPos5
            pos = pathList.GetHeadPosition
            While Not pos.IsNull
                Dim file As IEdmFile5
                Dim folder As IEdmFolder5 = Nothing
                file = vault2.GetFileFromPath(pathList.GetNext(pos), folder)
                folder.DeleteFile(Me.Handle.ToInt32(), file.ID)
            End While

            Dim strCount As String
            strCount = pathList.Count.ToString
            MessageBox.Show("Deleted " + strCount + " file")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'Delete folder
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim folder As IEdmFolder5
            folder = vault2.BrowseForFolder(Me.Handle.ToInt32(), "Select folder to delete:")
            If folder Is Nothing Then Exit Sub

            Dim parentFolder As IEdmFolder5
            parentFolder = folder.ParentFolder

            If parentFolder Is Nothing Then
                MsgBox("You cannot delete the vault root folder")
                Exit Sub
            End If

            parentFolder.DeleteFolder(Me.Handle.ToInt32(), folder.ID)

            MessageBox.Show(folder.Name & " deleted")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        'Restore folder
        Try

            Dim vault2 As IEdmVault7 = Nothing
            If vault1 Is Nothing Then
                vault1 = New EdmVault5()
            End If
            vault2 = DirectCast(vault1, IEdmVault7)
            If Not vault1.IsLoggedIn Then
                vault1.LoginAuto(VaultsComboBox.Text, Me.Handle.ToInt32())
            End If

            Dim folder As IEdmFolder11
            folder = vault2.BrowseForFolder(Me.Handle.ToInt32(), "Select folder to restore:")
            If folder Is Nothing Then Exit Sub

            Dim arrayEdmDeletedItems() As EdmDeletedItems = Nothing

            folder.GetDeletedItems(arrayEdmDeletedItems, True)
            folder.RecoverDeletedItems(arrayEdmDeletedItems)

            MessageBox.Show(folder.Name & " restored")

        Catch ex As System.Runtime.InteropServices.COMException
            MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Back to top

'Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.VaultsLabel = New System.Windows.Forms.Label()
        Me.VaultsComboBox = New System.Windows.Forms.ComboBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.Button3 = New System.Windows.Forms.Button()
        Me.Button4 = New System.Windows.Forms.Button()
        Me.Button5 = New System.Windows.Forms.Button()
        Me.Button6 = New System.Windows.Forms.Button()
        Me.Button7 = New System.Windows.Forms.Button()
        Me.Button8 = New System.Windows.Forms.Button()
        Me.Button9 = New System.Windows.Forms.Button()
        Me.Button10 = New System.Windows.Forms.Button()

        Me.Button11 = New System.Windows.Forms.Button()

        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'VaultsLabel
        '
        Me.VaultsLabel.AutoSize = True
        Me.VaultsLabel.Location = New System.Drawing.Point(13, 26)
        Me.VaultsLabel.Name = "VaultsLabel"
        Me.VaultsLabel.Size = New System.Drawing.Size(94, 13)
        Me.VaultsLabel.TabIndex = 0
        Me.VaultsLabel.Text = " Select vault view:"
        '
        'VaultsComboBox
        '
        Me.VaultsComboBox.FormattingEnabled = True
        Me.VaultsComboBox.Location = New System.Drawing.Point(16, 42)
        Me.VaultsComboBox.Name = "VaultsComboBox"
        Me.VaultsComboBox.Size = New System.Drawing.Size(121, 21)
        Me.VaultsComboBox.TabIndex = 1
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(16, 223)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(91, 23)
        Me.Button1.TabIndex = 6
        Me.Button1.Text = "Copy file..."
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(113, 223)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(96, 23)
        Me.Button2.TabIndex = 7
        Me.Button2.Text = "Delete file..."
        Me.Button2.UseVisualStyleBackColor = True
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(69, 281)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(96, 23)
        Me.Button3.TabIndex = 8
        Me.Button3.Text = "Delete folder..."
        Me.Button3.UseVisualStyleBackColor = True
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(43, 252)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(156, 23)
        Me.Button4.TabIndex = 9
        Me.Button4.Text = "Check-out permission..."
        Me.Button4.UseVisualStyleBackColor = True
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(16, 83)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(233, 23)
        Me.Button5.TabIndex = 10
        Me.Button5.Text = "Verify SOLIDWORKS PDM Professional 5.3"
        Me.Button5.UseVisualStyleBackColor = True
        '
        'Button6
        '
        Me.Button6.Location = New System.Drawing.Point(16, 121)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(233, 23)
        Me.Button6.TabIndex = 11
        Me.Button6.Text = "Get SOLIDWORKS PDM Professional licenses"
        Me.Button6.UseVisualStyleBackColor = True
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(16, 165)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(91, 23)
        Me.Button7.TabIndex = 12
        Me.Button7.Text = "Add group"
        Me.Button7.UseVisualStyleBackColor = True
        '
        'Button8
        '
        Me.Button8.Location = New System.Drawing.Point(16, 194)
        Me.Button8.Name = "Button8"
        Me.Button8.Size = New System.Drawing.Size(91, 23)
        Me.Button8.TabIndex = 13
        Me.Button8.Text = "Remove group"
        Me.Button8.UseVisualStyleBackColor = True
        '
        'Button9
        '
        Me.Button9.Location = New System.Drawing.Point(113, 165)
        Me.Button9.Name = "Button9"
        Me.Button9.Size = New System.Drawing.Size(96, 23)
        Me.Button9.TabIndex = 14
        Me.Button9.Text = "Add user"
        Me.Button9.UseVisualStyleBackColor = True
        '
        'Button10
        '
        Me.Button10.Location = New System.Drawing.Point(113, 194)
        Me.Button10.Name = "Button10"
        Me.Button10.Size = New System.Drawing.Size(96, 23)
        Me.Button10.TabIndex = 15
        Me.Button10.Text = "Remove user"
        Me.Button10.UseVisualStyleBackColor = True

        'Button11
        '
        Me.Button11.Location = New System.Drawing.Point(43, 310)
        Me.Button11.Name = "Button11"
        Me.Button11.Size = New System.Drawing.Size(156, 29)
        Me.Button11.TabIndex = 16
        Me.Button11.Text = "Restore deleted items"
        Me.Button11.UseVisualStyleBackColor = True

        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.FileName = "OpenFileDialog1"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(276, 330)

        Me.Controls.Add(Me.Button11)
        Me.Controls.Add(Me.Button10)
        Me.Controls.Add(Me.Button9)
        Me.Controls.Add(Me.Button8)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.VaultsComboBox)
        Me.Controls.Add(Me.VaultsLabel)
        Me.Name = "Form1"
        Me.Text = "Vault utilities"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Friend WithEvents VaultsLabel As System.Windows.Forms.Label
    Friend WithEvents VaultsComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button6 As System.Windows.Forms.Button
    Friend WithEvents Button7 As System.Windows.Forms.Button
    Friend WithEvents Button8 As System.Windows.Forms.Button
    Friend WithEvents Button9 As System.Windows.Forms.Button
    Friend WithEvents Button10 As System.Windows.Forms.Button

    Friend WithEvents Button11 As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
End Class

Back to top


SOLIDWORKS PDM Professional API Help

Creating an Add-in with Visual Basic 6

Obsolete. Visual Basic 6 is no longer supported. See Creating Add-ins (VB.NET).