ISLetter.RemoveCCRecipient

Description

This function removes a CC recipient from the letter.

Syntax

object.RemoveCCRecipient aIndex

Part Attribute Type Description
object Required
The object always implements the ISLetter interface
aIndex In, Required
int
The index of the CC recipient

Example

Remove a CC recipient from the letter.

sub main
  Dim aPatient
  Dim aLetters, aLetter
  Dim aMainRecipient
  Dim aAlreadyExists
  Dim aCCRecipients, aCCRecipient
  Dim i
  Dim aMessage

  Set aPatient = Profile.SelectPatient
  set aLetters = aPatient.GetLetters (1) ' slcfWordRTF

  aMessage =_
    "The number of the letters of the selected format is " & aLetters.Count

  'remove the specified provider from CC
  set aExcludedCCProvider = Profile.LoadProvider("ADMIN")
  for i = 0 to aLetters.Count - 1
    set aLetter = aLetters.Item(i)
    set aCCRecipients = aLetter.CCRecipients
    for j = aCCRecipients.Count - 1 to 0 step -1
      set aCCRecipient = aCCRecipients.Item(j)
     if aCCRecipient.ProviderId = aExcludedCCProvider.Id then aLetter.RemoveCCRecipient(j)
    next 'j
  next 'i      
    
  'Display the information about all letters
  for i = 0 to aLetters.Count - 1
    set aLetter = aLetters.Item(i) 
    aMessage = aMessage & vbNewLine & "---------------" & vbNewLine &_
      "Letter Date: " & aLetter.Date & vbNewLine &_
      "Letter Subject: " & aLetter.Subject2 & vbNewLine  

    set aMainRecipient = aLetter.MainRecipient  
    if not aMainRecipient is nothing then                              
       aMessage = aMessage & vbNewLine &_
          "Main Recipient: " & vbNewLine & GetLetterRecipientInfo(aMainRecipient)      
    end if 
    
    aMessage = aMessage & vbNewLine & "CC Recipients: "   
    set aCCRecipients = aLetter.CCRecipients
    for each aCCRecipient in aCCRecipients
      aMessage = aMessage & vbNewLine & GetLetterRecipientInfo(aCCRecipient) 
    next  
  next

  Profile.MsgBox(aMessage)
end sub

function GetLetterRecipientInfo(aRecipient)
  Dim aProvider
  Dim aExtProvider
  Dim aPatient
  Dim aPOS
  Dim aInfo
  Dim aLetter

  aInfo = vbNewLine &_
    "  Recipient Type: " & aRecipient.RecipientType & vbNewLine &_
    "  Is Main: " & aRecipient.IsMainRecipient & vbNewLine
    
  if aRecipient.ProviderId > 0 then
    set aProvider = Profile.LoadProviderById(aRecipient.ProviderId) 
    aInfo = aInfo & "  Provider: " & aProvider.FullName & vbNewLine 
  end if
    
  if aRecipient.ExternalProviderID > 0 then 
    set aExtProvider = Profile.LoadExternalProviderById(aRecipient.ExternalProviderID)
    aInfo = aInfo & "  External Provider: " & aExtProvider.FullName & vbNewLine 
  end if 
    
  if aRecipient.PatientId > 0 then
    set aPatient = Profile.LoadPatient(aRecipient.PatientId)
    aInfo = aInfo & "  Patient: " & aPatient.SurnameFirstName & vbNewLine  
  end if
    
  if aRecipient.PosID > 0 then
    set aPOS = Profile.LoadProviderById(aRecipient.PosID) 
    aInfo = aInfo & "  Pos: " & aPOS.FullName & vbNewLine 
  end if

  GetLetterRecipientInfo = aInfo
end function 
Note:

In Profile Client v8 on User Interface CC Recipients can be found and removed in Clinical > Medical Record > Documents > Open saved document > Information and Recipients > Copies to or in Organisation > Work Centre > Communication > Letters > Open saved document > Information and Recipients > Copies to.

Version information

Added in v7.8.0