protected override IConfigurable ResolveDataObject() { ADRecipient adrecipient = (ADRecipient)base.ResolveDataObject(); if (MailboxTaskHelper.ExcludeArbitrationMailbox(adrecipient, base.Arbitration) || MailboxTaskHelper.ExcludePublicFolderMailbox(adrecipient, base.PublicFolder) || MailboxTaskHelper.ExcludeGroupMailbox(adrecipient, false) || MailboxTaskHelper.ExcludeMailboxPlan(adrecipient, false) || MailboxTaskHelper.ExcludeAuditLogMailbox(adrecipient, base.AuditLog)) { base.WriteError(new ManagementObjectNotFoundException(base.GetErrorMessageObjectNotFound(this.Identity.ToString(), typeof(ADUser).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)), ExchangeErrorCategory.Client, this.Identity); } if (adrecipient != null && adrecipient.RecipientTypeDetails == RecipientTypeDetails.TeamMailbox) { TeamMailbox teamMailbox = TeamMailbox.FromDataObject((ADUser)adrecipient); teamMailbox.ClosedTime = new DateTime?(DateTime.UtcNow); this.removeTeamMailboxFromResolverCache = true; if (teamMailbox.SharePointUrl != null && base.ExchangeRunspaceConfig != null) { TeamMailboxHelper teamMailboxHelper = new TeamMailboxHelper(teamMailbox, base.ExchangeRunspaceConfig.ExecutingUser, base.ExchangeRunspaceConfig.ExecutingUserOrganizationId, (IRecipientSession)base.DataSession, new TeamMailboxGetDataObject <ADUser>(base.GetDataObject <ADUser>)); try { teamMailboxHelper.LinkSharePointSite(null, false, false); } catch (RecipientTaskException ex) { this.WriteWarning(Strings.ErrorTeamMailFailedUnlinkSharePointSite(this.Identity.ToString(), teamMailbox.SharePointUrl.ToString(), ex.Message)); } } } return(adrecipient); }