While Removing conenctor in MSTeams, "registerOnRemoveHandler" method is called twice.

Brass Contributor

I am trying to remove a connector from MSTeams, i have  noticed that  "registerOnRemoveHandler" method is  executing twice, and in this  method  i have  written AJAX calls for  removing  dependencies of  connector, but as method is called twice, AJAX  call also called twice.

i am not able to find why this is  happening in this method.

Can someone help me with it??

3 Replies

@sunnykalola -Could you please check did you write two instance for the method? Also could you please conform are you implemented the method as documented here ?If no could you please share repro steps?

Thank You @Nikitha-MSFT . I haven't write  2 instance for the method. Also i have referred a link which you had  shared there is   one variable  "removeCalled" which  value is  set as true and  below  that i have  implement my AJAX call.but  then also it's called twice.
below is a sample code :

microsoftTeams.settings.registerOnRemoveHandler(function (removeEvent) {
  var removeCalled = true;  
  // AJAX Call
  $.ajax({
    url: "https://example.com",
    type: "DELETE",
    data: "string",
    contentType: "application/json",
    success: function () {
      removeEvent.notifySuccess();
    },
    error: function () {
      removeEvent.notifyFailure("Failed");
    }
  });
})

@sunnykalola - Could you please try the code mentioned in sample?