RobotStudio event

Change user password through PC-SDK

Hello.

I would like to change user password though pc-sdk. I checked at reference, but I didn't succeced ... class userinfo has a password property, but I got a exception when I try to change its value. Besides the method DemandWriteAccess cannot be called. I'm using PC-SDK 5.15

Any clue? 

Comments

  • Hi MrRogerf,<div><br></div><div>I think you should to do a <span style="font-family: 'Segoe UI', Verdana, Arial; font-size: 17px; line-height: 23.7999992370605px; background-color: rgb(255, 255, 255);">Request Mastership from controller to modify the password.</span></div><ol style="line-height: 23.7999992370605px; margin-bottom: 15px; font-family: 'Segoe UI', Verdana, Arial; font-size: 17px; background-color: rgb(255, 255, 255);"><li style="margin-bottom: 3px; margin-left: 0px;"><div id="ID0EABAEAAAAA" class="OH_CodeSnippetContainer" style="clear: both; margin-top: 10px; line-height: normal;"><div class="OH_CodeSnippetContainerTabs" id="ID0EABAEAAAAA_tabs" style="position: relative; top: 5px; float: left; vertical-align: middle; cursor: default; margin: 0px; padding: 0px; z-index: 2; background-color: transparent;"><div class="OH_CodeSnippetContainerTabLeftActive" id="ID0EABAEAAAAA_tabimgleft" style="float: left; font-size: 0.8em; margin: 0px; padding: 0px; height: 20px; font-weight: bold; width: 5px; background-repeat: no-repeat;"></div><div id="ID0EABAEAAAAA_tab1" class="OH_CodeSnippetContainerTabActive" enablecopycode="true" style="float: left; font-size: 0.8em; margin: 0px; padding: 0px; height: 20px; border-top-style: solid; border-top-width: 1px; border-top-color: rgb(187, 187, 187); font-weight: bold;"><a href="http://developercenter.robotstudio.com/BlobProxy/devcenter/RobotStudio/html/28540cbf-22f1-4c3c-acc7-733b806c82f7.htm#&quot; style="color: rgb(37, 12, 88); text-decoration: none; padding: 0px 5px; cursor: pointer;">C#</a></div><div id="ID0EABAEAAAAA_tab2" class="OH_CodeSnippetContainerTabDisabledNotFirst" enablecopycode="true" disabled="true" style="float: left; font-size: 0.8em; margin: 0px; padding: 0px; height: 20px; border-top-style: solid; border-top-width: 1px; border-top-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: rgb(208, 210, 210); border-left-style: solid; border-left-width: 1px; border-left-color: rgb(187, 187, 187); background-color: rgb(245, 245, 245);"><a style="color: rgb(168, 168, 168); padding: 0px 5px;">VB</a></div><div id="ID0EABAEAAAAA_tab3" class="OH_CodeSnippetContainerTabDisabledNotFirst" enablecopycode="true" disabled="true" style="float: left; font-size: 0.8em; margin: 0px; padding: 0px; height: 20px; border-top-style: solid; border-top-width: 1px; border-top-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: rgb(208, 210, 210); border-left-style: solid; border-left-width: 1px; border-left-color: rgb(187, 187, 187); background-color: rgb(245, 245, 245);"><a style="color: rgb(168, 168, 168); padding: 0px 5px;">C++</a></div><div id="ID0EABAEAAAAA_tab4" class="OH_CodeSnippetContainerTabDisabledNotFirst" enablecopycode="true" disabled="true" style="float: left; font-size: 0.8em; margin: 0px; padding: 0px; height: 20px; border-top-style: solid; border-top-width: 1px; border-top-color: rgb(187, 187, 187); border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: rgb(208, 210, 210); border-left-style: solid; border-left-width: 1px; border-left-color: rgb(187, 187, 187); background-color: rgb(245, 245, 245);"><a style="color: rgb(168, 168, 168); padding: 0px 5px;">F#</a></div><div class="OH_CodeSnippetContainerTabRight" id="ID0EABAEAAAAA_tabimgright" style="float: left; font-size: 0.8em; margin: 0px; padding: 0px; height: 20px; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: rgb(208, 210, 210); width: 5px; background-color: rgb(239, 245, 255); background-repeat: no-repeat;"></div></div><div id="ID0EABAEAAAAA_codecollection" class="OH_CodeSnippetContainerCodeCollection" style="border-left-style: solid; border-left-width: 1px; border-left-color: rgb(229, 229, 229); border-right-style: solid; border-right-width: 1px; border-right-color: rgb(229, 229, 229); border-bottom-style: solid; border-bottom-width: 3px; border-bottom-color: rgb(229, 229, 229); clear: both; margin: 0px 0px 5px; width: 1814.65625px;"><div class="OH_CodeSnippetToolBar" style="width: 1814.65625px; height: 1em; border-top-style: solid; border-top-width: 3px; border-top-color: rgb(229, 229, 229);"><div class="OH_CodeSnippetToolBarText" style="float: right; position: relative; z-index: 100; width: auto; margin-right: 13px; top: -13px;"><a id="ID0EABAEAAAAA_copycode" href="http://developercenter.robotstudio.com/BlobProxy/devcenter/RobotStudio/html/28540cbf-22f1-4c3c-acc7-733b806c82f7.htm#&quot; title="Copy to Clipboard" style="color: rgb(19, 100, 196); text-decoration: none; font-size: 0.8em; padding-left: 3px; padding-right: 3px;">Copy to Clipboard</a><a id="ID0EABAEAAAAA_PrintText" class="OH_PrintText" href="http://developercenter.robotstudio.com/BlobProxy/devcenter/RobotStudio/html/28540cbf-22f1-4c3c-acc7-733b806c82f7.htm#&quot; title="Print" style="color: rgb(19, 100, 196); text-decoration: none; font-size: 0.8em; padding-left: 3px; padding-right: 3px;">Print</a></div></div><div id="ID0EABAEAAAAA_code_Div1" class="OH_CodeSnippetContainerCode" style="width: 1814.65625px; border-right-width: 0px; margin: 0px; padding: 0px 0px 0px 19px;"><pre style="overflow: hidden;"><span class="highlight-keyword" style="color: rgb(0, 0, 255);">using</span> (ABB.Robotics.Controllers.Mastership m =
    ABB.Robotics.Controllers.Mastership.Request(controller.Rapid))</pre></div></div></div></li></ol>
  • Thanks, ArmanDb, but I haven't success so far . I still got an Exception when I try to set user.password.  I also tried controller.Configuration instead of controller.Rapid. Part of my code is bellow:

    ...
    if (controllerInfo.Availability == Availability.Available)
    {   Controller controller = ControllerFactory.CreateFrom(controllerInfo);
                              
        UserInfo user = new UserInfo("MyFullAccessUser","MyPassword");

        controller.Logon(user);

        if (controller.CurrentUser.Name == "MyFullAccessUser")
        {  
              using (ABB.Robotics.Controllers.Mastership m = ABB.Robotics.Controllers.Mastership.Request(controller.Rapid))
               {
                   if (m.IsMaster)
                   {   System.Console.WriteLine("I'm the master");

                       controller.CurrentUser.Password ="teste";  //unhandled exception
                   }
                   else
                       System.Console.WriteLine("Ops ... failed mastership");
              }
     
    ...