Hide Table of Contents
SetSettingsVar Method (IEdmUserGroup9)

Sets the specified user group setting.

Syntax

Visual Basic (Declaration) 
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

//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

Availability

SOLIDWORKS PDM Professional 2022


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   SetSettingsVar Method (IEdmUserGroup9)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2023 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.